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
|
|---|---|---|---|---|---|---|---|
7597f3b692124a762c3b212b604938be2d64175a
|
2024-01-31 13:01:15
|
Kartikeya Hegde
|
feat: add deep health check for analytics (#3438)
| false
|
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index 00ae3b6e310..27d42350509 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -7,6 +7,7 @@ use router_env::logger;
use time::PrimitiveDateTime;
use super::{
+ health_check::HealthCheck,
payments::{
distribution::PaymentDistributionRow, filters::FilterRow, metrics::PaymentMetricRow,
},
@@ -93,6 +94,18 @@ impl ClickhouseClient {
}
}
+#[async_trait::async_trait]
+impl HealthCheck for ClickhouseClient {
+ async fn deep_health_check(
+ &self,
+ ) -> common_utils::errors::CustomResult<(), QueryExecutionError> {
+ self.execute_query("SELECT 1")
+ .await
+ .map(|_| ())
+ .change_context(QueryExecutionError::DatabaseError)
+ }
+}
+
#[async_trait::async_trait]
impl AnalyticsDataSource for ClickhouseClient {
type Row = serde_json::Value;
diff --git a/crates/analytics/src/health_check.rs b/crates/analytics/src/health_check.rs
new file mode 100644
index 00000000000..f566aecf10b
--- /dev/null
+++ b/crates/analytics/src/health_check.rs
@@ -0,0 +1,8 @@
+use common_utils::errors::CustomResult;
+
+use crate::types::QueryExecutionError;
+
+#[async_trait::async_trait]
+pub trait HealthCheck {
+ async fn deep_health_check(&self) -> CustomResult<(), QueryExecutionError>;
+}
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index 501bd58527c..a4e925519ce 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -8,6 +8,7 @@ pub mod refunds;
pub mod api_event;
pub mod connector_events;
+pub mod health_check;
pub mod outgoing_webhook_event;
pub mod sdk_events;
mod sqlx;
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 7ab8a2aa4bc..562a3a1f64d 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -17,6 +17,7 @@ use storage_impl::config::Database;
use time::PrimitiveDateTime;
use super::{
+ health_check::HealthCheck,
query::{Aggregate, ToSql, Window},
types::{
AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, QueryExecutionError,
@@ -164,6 +165,17 @@ impl AnalyticsDataSource for SqlxClient {
.change_context(QueryExecutionError::RowExtractionFailure)
}
}
+#[async_trait::async_trait]
+impl HealthCheck for SqlxClient {
+ async fn deep_health_check(&self) -> CustomResult<(), QueryExecutionError> {
+ sqlx::query("SELECT 1")
+ .fetch_all(&self.pool)
+ .await
+ .map(|_| ())
+ .into_report()
+ .change_context(QueryExecutionError::DatabaseError)
+ }
+}
impl<'a> FromRow<'a, PgRow> for super::refunds::metrics::RefundMetricRow {
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index 8cd3ee53f21..1e8e0f47eb9 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -18,6 +18,7 @@ dummy_connector = ["euclid/dummy_connector", "common_enums/dummy_connector"]
detailed_errors = []
payouts = []
frm = []
+olap = []
openapi = ["common_enums/openapi"]
recon = []
diff --git a/crates/api_models/src/health_check.rs b/crates/api_models/src/health_check.rs
index d7bb120d017..8323f135134 100644
--- a/crates/api_models/src/health_check.rs
+++ b/crates/api_models/src/health_check.rs
@@ -1,6 +1,10 @@
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RouterHealthCheckResponse {
- pub database: String,
- pub redis: String,
- pub locker: String,
+ pub database: bool,
+ pub redis: bool,
+ pub locker: bool,
+ #[cfg(feature = "olap")]
+ pub analytics: bool,
}
+
+impl common_utils::events::ApiEventMetric for RouterHealthCheckResponse {}
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 3d129edfe3f..f60b0c25e93 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -17,7 +17,7 @@ email = ["external_services/email", "olap"]
frm = []
stripe = ["dep:serde_qs"]
release = ["kms", "stripe", "aws_s3", "email", "backwards_compatibility", "business_profile_routing", "accounts_cache", "kv_store", "connector_choice_mca_id", "profile_specific_fallback_routing", "vergen", "recon"]
-olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap", "dep:analytics"]
+olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap","api_models/olap","dep:analytics"]
oltp = ["storage_impl/oltp"]
kv_store = ["scheduler/kv_store"]
accounts_cache = []
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index 63205ea68ca..759e968125f 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -468,7 +468,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
errors::ApiErrorResponse::MandateUpdateFailed
| errors::ApiErrorResponse::MandateSerializationFailed
| errors::ApiErrorResponse::MandateDeserializationFailed
- | errors::ApiErrorResponse::InternalServerError => Self::InternalServerError, // not a stripe code
+ | errors::ApiErrorResponse::InternalServerError
+ | errors::ApiErrorResponse::HealthCheckError { .. } => Self::InternalServerError, // not a stripe code
errors::ApiErrorResponse::ExternalConnectorError {
code,
message,
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 5ae4b0be33d..9bdc493e078 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -17,6 +17,7 @@ pub mod files;
#[cfg(feature = "frm")]
pub mod fraud_check;
pub mod gsm;
+pub mod health_check;
pub mod locker_migration;
pub mod mandate;
pub mod metrics;
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index 54ec4ec1e29..023e1f4b7fb 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -238,6 +238,11 @@ pub enum ApiErrorResponse {
WebhookInvalidMerchantSecret,
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_19", message = "{message}")]
CurrencyNotSupported { message: String },
+ #[error(error_type = ErrorType::ServerNotAvailable, code= "HE_00", message = "{component} health check is failiing with error: {message}")]
+ HealthCheckError {
+ component: &'static str,
+ message: String,
+ },
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_24", message = "Merchant connector account is configured with invalid {config}")]
InvalidConnectorConfiguration { config: String },
#[error(error_type = ErrorType::ValidationError, code = "HE_01", message = "Failed to convert currency to minor unit")]
diff --git a/crates/router/src/core/errors/transformers.rs b/crates/router/src/core/errors/transformers.rs
index ff764cafed6..0119335b7c4 100644
--- a/crates/router/src/core/errors/transformers.rs
+++ b/crates/router/src/core/errors/transformers.rs
@@ -123,7 +123,10 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
},
Self::MandateUpdateFailed | Self::MandateSerializationFailed | Self::MandateDeserializationFailed | Self::InternalServerError => {
AER::InternalServerError(ApiError::new("HE", 0, "Something went wrong", None))
- }
+ },
+ Self::HealthCheckError { message,component } => {
+ AER::InternalServerError(ApiError::new("HE",0,format!("{} health check failed with error: {}",component,message),None))
+ },
Self::PayoutFailed { data } => {
AER::BadRequest(ApiError::new("CE", 4, "Payout failed while processing with connector.", Some(Extra { data: data.clone(), ..Default::default()})))
},
diff --git a/crates/router/src/core/health_check.rs b/crates/router/src/core/health_check.rs
new file mode 100644
index 00000000000..6fc038b82e9
--- /dev/null
+++ b/crates/router/src/core/health_check.rs
@@ -0,0 +1,111 @@
+#[cfg(feature = "olap")]
+use analytics::health_check::HealthCheck;
+use error_stack::ResultExt;
+use router_env::logger;
+
+use crate::{
+ consts::LOCKER_HEALTH_CALL_PATH,
+ core::errors::{self, CustomResult},
+ routes::app,
+ services::api as services,
+};
+
+#[async_trait::async_trait]
+pub trait HealthCheckInterface {
+ async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError>;
+ async fn health_check_redis(&self) -> CustomResult<(), errors::HealthCheckRedisError>;
+ async fn health_check_locker(&self) -> CustomResult<(), errors::HealthCheckLockerError>;
+ #[cfg(feature = "olap")]
+ async fn health_check_analytics(&self) -> CustomResult<(), errors::HealthCheckDBError>;
+}
+
+#[async_trait::async_trait]
+impl HealthCheckInterface for app::AppState {
+ async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError> {
+ let db = &*self.store;
+ db.health_check_db().await?;
+ Ok(())
+ }
+
+ async fn health_check_redis(&self) -> CustomResult<(), errors::HealthCheckRedisError> {
+ let db = &*self.store;
+ let redis_conn = db
+ .get_redis_conn()
+ .change_context(errors::HealthCheckRedisError::RedisConnectionError)?;
+
+ redis_conn
+ .serialize_and_set_key_with_expiry("test_key", "test_value", 30)
+ .await
+ .change_context(errors::HealthCheckRedisError::SetFailed)?;
+
+ logger::debug!("Redis set_key was successful");
+
+ redis_conn
+ .get_key("test_key")
+ .await
+ .change_context(errors::HealthCheckRedisError::GetFailed)?;
+
+ logger::debug!("Redis get_key was successful");
+
+ redis_conn
+ .delete_key("test_key")
+ .await
+ .change_context(errors::HealthCheckRedisError::DeleteFailed)?;
+
+ logger::debug!("Redis delete_key was successful");
+
+ Ok(())
+ }
+
+ async fn health_check_locker(&self) -> CustomResult<(), errors::HealthCheckLockerError> {
+ let locker = &self.conf.locker;
+ if !locker.mock_locker {
+ let mut url = locker.host_rs.to_owned();
+ url.push_str(LOCKER_HEALTH_CALL_PATH);
+ let request = services::Request::new(services::Method::Get, &url);
+ services::call_connector_api(self, request)
+ .await
+ .change_context(errors::HealthCheckLockerError::FailedToCallLocker)?
+ .ok();
+ }
+
+ logger::debug!("Locker call was successful");
+
+ Ok(())
+ }
+
+ #[cfg(feature = "olap")]
+ async fn health_check_analytics(&self) -> CustomResult<(), errors::HealthCheckDBError> {
+ let analytics = &self.pool;
+ match analytics {
+ analytics::AnalyticsProvider::Sqlx(client) => client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::SqlxAnalyticsError),
+ analytics::AnalyticsProvider::Clickhouse(client) => client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::ClickhouseAnalyticsError),
+ analytics::AnalyticsProvider::CombinedCkh(sqlx_client, ckh_client) => {
+ sqlx_client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::SqlxAnalyticsError)?;
+ ckh_client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::ClickhouseAnalyticsError)
+ }
+ analytics::AnalyticsProvider::CombinedSqlx(sqlx_client, ckh_client) => {
+ sqlx_client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::SqlxAnalyticsError)?;
+ ckh_client
+ .deep_health_check()
+ .await
+ .change_context(errors::HealthCheckDBError::ClickhouseAnalyticsError)
+ }
+ }
+ }
+}
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index d805925f318..9f70cc6baee 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -375,9 +375,6 @@ async fn store_bank_details_in_payment_methods(
.await
.change_context(ApiErrorResponse::InternalServerError)?;
- #[cfg(not(feature = "kms"))]
- let pm_auth_key = pm_auth_key;
-
let mut update_entries: Vec<(storage::PaymentMethod, storage::PaymentMethodUpdate)> =
Vec::new();
let mut new_entries: Vec<storage::PaymentMethodNew> = Vec::new();
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index b9d346b7a71..54900177246 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -110,7 +110,7 @@ pub trait StorageInterface:
+ user_role::UserRoleInterface
+ authorization::AuthorizationInterface
+ user::sample_data::BatchSampleDataInterface
- + health_check::HealthCheckInterface
+ + health_check::HealthCheckDbInterface
+ 'static
{
fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>;
diff --git a/crates/router/src/db/health_check.rs b/crates/router/src/db/health_check.rs
index 73bc2a4321d..6ebc9dfff5a 100644
--- a/crates/router/src/db/health_check.rs
+++ b/crates/router/src/db/health_check.rs
@@ -3,145 +3,66 @@ use diesel_models::ConfigNew;
use error_stack::ResultExt;
use router_env::logger;
-use super::{MockDb, StorageInterface, Store};
+use super::{MockDb, Store};
use crate::{
connection,
- consts::LOCKER_HEALTH_CALL_PATH,
core::errors::{self, CustomResult},
- routes,
- services::api as services,
types::storage,
};
#[async_trait::async_trait]
-pub trait HealthCheckInterface {
+pub trait HealthCheckDbInterface {
async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError>;
- async fn health_check_redis(
- &self,
- db: &dyn StorageInterface,
- ) -> CustomResult<(), errors::HealthCheckRedisError>;
- async fn health_check_locker(
- &self,
- state: &routes::AppState,
- ) -> CustomResult<(), errors::HealthCheckLockerError>;
}
#[async_trait::async_trait]
-impl HealthCheckInterface for Store {
+impl HealthCheckDbInterface for Store {
async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError> {
let conn = connection::pg_connection_write(self)
.await
.change_context(errors::HealthCheckDBError::DBError)?;
- let _data = conn
- .transaction_async(|conn| {
- Box::pin(async move {
- let query =
- diesel::select(diesel::dsl::sql::<diesel::sql_types::Integer>("1 + 1"));
- let _x: i32 = query.get_result_async(&conn).await.map_err(|err| {
- logger::error!(read_err=?err,"Error while reading element in the database");
- errors::HealthCheckDBError::DBReadError
- })?;
+ conn.transaction_async(|conn| async move {
+ let query = diesel::select(diesel::dsl::sql::<diesel::sql_types::Integer>("1 + 1"));
+ let _x: i32 = query.get_result_async(&conn).await.map_err(|err| {
+ logger::error!(read_err=?err,"Error while reading element in the database");
+ errors::HealthCheckDBError::DBReadError
+ })?;
- logger::debug!("Database read was successful");
+ logger::debug!("Database read was successful");
- let config = ConfigNew {
- key: "test_key".to_string(),
- config: "test_value".to_string(),
- };
+ let config = ConfigNew {
+ key: "test_key".to_string(),
+ config: "test_value".to_string(),
+ };
- config.insert(&conn).await.map_err(|err| {
- logger::error!(write_err=?err,"Error while writing to database");
- errors::HealthCheckDBError::DBWriteError
- })?;
+ config.insert(&conn).await.map_err(|err| {
+ logger::error!(write_err=?err,"Error while writing to database");
+ errors::HealthCheckDBError::DBWriteError
+ })?;
- logger::debug!("Database write was successful");
+ logger::debug!("Database write was successful");
- storage::Config::delete_by_key(&conn, "test_key").await.map_err(|err| {
- logger::error!(delete_err=?err,"Error while deleting element in the database");
- errors::HealthCheckDBError::DBDeleteError
- })?;
-
- logger::debug!("Database delete was successful");
-
- Ok::<_, errors::HealthCheckDBError>(())
- })
- })
- .await?;
-
- Ok(())
- }
-
- async fn health_check_redis(
- &self,
- db: &dyn StorageInterface,
- ) -> CustomResult<(), errors::HealthCheckRedisError> {
- let redis_conn = db
- .get_redis_conn()
- .change_context(errors::HealthCheckRedisError::RedisConnectionError)?;
-
- redis_conn
- .serialize_and_set_key_with_expiry("test_key", "test_value", 30)
- .await
- .change_context(errors::HealthCheckRedisError::SetFailed)?;
-
- logger::debug!("Redis set_key was successful");
-
- redis_conn
- .get_key("test_key")
- .await
- .change_context(errors::HealthCheckRedisError::GetFailed)?;
-
- logger::debug!("Redis get_key was successful");
-
- redis_conn
- .delete_key("test_key")
- .await
- .change_context(errors::HealthCheckRedisError::DeleteFailed)?;
-
- logger::debug!("Redis delete_key was successful");
-
- Ok(())
- }
-
- async fn health_check_locker(
- &self,
- state: &routes::AppState,
- ) -> CustomResult<(), errors::HealthCheckLockerError> {
- let locker = &state.conf.locker;
- if !locker.mock_locker {
- let mut url = locker.host_rs.to_owned();
- url.push_str(LOCKER_HEALTH_CALL_PATH);
- let request = services::Request::new(services::Method::Get, &url);
- services::call_connector_api(state, request)
+ storage::Config::delete_by_key(&conn, "test_key")
.await
- .change_context(errors::HealthCheckLockerError::FailedToCallLocker)?
- .ok();
- }
+ .map_err(|err| {
+ logger::error!(delete_err=?err,"Error while deleting element in the database");
+ errors::HealthCheckDBError::DBDeleteError
+ })?;
+
+ logger::debug!("Database delete was successful");
- logger::debug!("Locker call was successful");
+ Ok::<_, errors::HealthCheckDBError>(())
+ })
+ .await?;
Ok(())
}
}
#[async_trait::async_trait]
-impl HealthCheckInterface for MockDb {
+impl HealthCheckDbInterface for MockDb {
async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError> {
Ok(())
}
-
- async fn health_check_redis(
- &self,
- _: &dyn StorageInterface,
- ) -> CustomResult<(), errors::HealthCheckRedisError> {
- Ok(())
- }
-
- async fn health_check_locker(
- &self,
- _: &routes::AppState,
- ) -> CustomResult<(), errors::HealthCheckLockerError> {
- Ok(())
- }
}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index e88d59ea9f3..665a920bcad 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -43,7 +43,7 @@ use crate::{
events::EventInterface,
file::FileMetadataInterface,
gsm::GsmInterface,
- health_check::HealthCheckInterface,
+ health_check::HealthCheckDbInterface,
locker_mock_up::LockerMockUpInterface,
mandate::MandateInterface,
merchant_account::MerchantAccountInterface,
@@ -58,7 +58,6 @@ use crate::{
routing_algorithm::RoutingAlgorithmInterface,
MasterKeyInterface, StorageInterface,
},
- routes,
services::{authentication, kafka::KafkaProducer, Store},
types::{
domain,
@@ -2185,22 +2184,8 @@ impl AuthorizationInterface for KafkaStore {
}
#[async_trait::async_trait]
-impl HealthCheckInterface for KafkaStore {
+impl HealthCheckDbInterface for KafkaStore {
async fn health_check_db(&self) -> CustomResult<(), errors::HealthCheckDBError> {
self.diesel_store.health_check_db().await
}
-
- async fn health_check_redis(
- &self,
- db: &dyn StorageInterface,
- ) -> CustomResult<(), errors::HealthCheckRedisError> {
- self.diesel_store.health_check_redis(db).await
- }
-
- async fn health_check_locker(
- &self,
- state: &routes::AppState,
- ) -> CustomResult<(), errors::HealthCheckLockerError> {
- self.diesel_store.health_check_locker(state).await
- }
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index a69220231f5..9e8bee73c28 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -311,7 +311,7 @@ impl Health {
web::scope("health")
.app_data(web::Data::new(state))
.service(web::resource("").route(web::get().to(health)))
- .service(web::resource("/deep_check").route(web::post().to(deep_health_check)))
+ .service(web::resource("/ready").route(web::get().to(deep_health_check)))
}
}
diff --git a/crates/router/src/routes/health.rs b/crates/router/src/routes/health.rs
index f07b744f7f5..89132c3319b 100644
--- a/crates/router/src/routes/health.rs
+++ b/crates/router/src/routes/health.rs
@@ -1,9 +1,14 @@
-use actix_web::web;
+use actix_web::{web, HttpRequest};
use api_models::health_check::RouterHealthCheckResponse;
-use router_env::{instrument, logger, tracing};
+use router_env::{instrument, logger, tracing, Flow};
use super::app;
-use crate::{routes::metrics, services};
+use crate::{
+ core::{api_locking, health_check::HealthCheckInterface},
+ errors::{self, RouterResponse},
+ routes::metrics,
+ services::{api, authentication as auth},
+};
/// .
// #[logger::instrument(skip_all, name = "name1", level = "warn", fields( key1 = "val1" ))]
#[instrument(skip_all)]
@@ -14,58 +19,90 @@ pub async fn health() -> impl actix_web::Responder {
actix_web::HttpResponse::Ok().body("health is good")
}
-#[instrument(skip_all)]
-pub async fn deep_health_check(state: web::Data<app::AppState>) -> impl actix_web::Responder {
+#[instrument(skip_all, fields(flow = ?Flow::DeepHealthCheck))]
+pub async fn deep_health_check(
+ state: web::Data<app::AppState>,
+ request: HttpRequest,
+) -> impl actix_web::Responder {
metrics::HEALTH_METRIC.add(&metrics::CONTEXT, 1, &[]);
- let db = &*state.store;
- let mut status_code = 200;
+
+ let flow = Flow::DeepHealthCheck;
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &request,
+ (),
+ |state, _, _| deep_health_check_func(state),
+ &auth::NoAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+async fn deep_health_check_func(state: app::AppState) -> RouterResponse<RouterHealthCheckResponse> {
logger::info!("Deep health check was called");
logger::debug!("Database health check begin");
- let db_status = match db.health_check_db().await {
- Ok(_) => "Health is good".to_string(),
- Err(err) => {
- status_code = 500;
- err.to_string()
- }
- };
+ let db_status = state.health_check_db().await.map(|_| true).map_err(|err| {
+ error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
+ component: "Database",
+ message: err.to_string()
+ })
+ })?;
+
logger::debug!("Database health check end");
logger::debug!("Redis health check begin");
- let redis_status = match db.health_check_redis(db).await {
- Ok(_) => "Health is good".to_string(),
- Err(err) => {
- status_code = 500;
- err.to_string()
- }
- };
+ let redis_status = state
+ .health_check_redis()
+ .await
+ .map(|_| true)
+ .map_err(|err| {
+ error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
+ component: "Redis",
+ message: err.to_string()
+ })
+ })?;
logger::debug!("Redis health check end");
logger::debug!("Locker health check begin");
- let locker_status = match db.health_check_locker(&state).await {
- Ok(_) => "Health is good".to_string(),
- Err(err) => {
- status_code = 500;
- err.to_string()
- }
- };
+ let locker_status = state
+ .health_check_locker()
+ .await
+ .map(|_| true)
+ .map_err(|err| {
+ error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
+ component: "Locker",
+ message: err.to_string()
+ })
+ })?;
+
+ #[cfg(feature = "olap")]
+ let analytics_status = state
+ .health_check_analytics()
+ .await
+ .map(|_| true)
+ .map_err(|err| {
+ error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
+ component: "Analytics",
+ message: err.to_string()
+ })
+ })?;
logger::debug!("Locker health check end");
- let response = serde_json::to_string(&RouterHealthCheckResponse {
+ let response = RouterHealthCheckResponse {
database: db_status,
redis: redis_status,
locker: locker_status,
- })
- .unwrap_or_default();
-
- if status_code == 200 {
- services::http_response_json(response)
- } else {
- services::http_server_error_json_response(response)
- }
+ #[cfg(feature = "olap")]
+ analytics: analytics_status,
+ };
+
+ Ok(api::ApplicationResponse::Json(response))
}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index b726c64f0ed..0dfc3b1b339 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -11,6 +11,7 @@ pub enum ApiIdentifier {
Configs,
Customers,
Ephemeral,
+ Health,
Mandates,
PaymentMethods,
PaymentMethodAuth,
@@ -83,6 +84,7 @@ impl From<Flow> for ApiIdentifier {
Flow::EphemeralKeyCreate | Flow::EphemeralKeyDelete => Self::Ephemeral,
+ Flow::DeepHealthCheck => Self::Health,
Flow::MandatesRetrieve | Flow::MandatesRevoke | Flow::MandatesList => Self::Mandates,
Flow::PaymentMethodsCreate
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index a395235ca8a..55e7bafd8e0 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -54,6 +54,8 @@ pub enum Tag {
/// API Flow
#[derive(Debug, Display, Clone, PartialEq, Eq)]
pub enum Flow {
+ /// Deep health Check
+ DeepHealthCheck,
/// Merchants account create flow.
MerchantsAccountCreate,
/// Merchants account retrieve flow.
diff --git a/crates/storage_impl/src/errors.rs b/crates/storage_impl/src/errors.rs
index ac3a04e85b2..2adcdcf8d2e 100644
--- a/crates/storage_impl/src/errors.rs
+++ b/crates/storage_impl/src/errors.rs
@@ -394,6 +394,10 @@ pub enum HealthCheckDBError {
UnknownError,
#[error("Error in database transaction")]
TransactionError,
+ #[error("Error while executing query in Sqlx Analytics")]
+ SqlxAnalyticsError,
+ #[error("Error while executing query in Clickhouse Analytics")]
+ ClickhouseAnalyticsError,
}
impl From<diesel::result::Error> for HealthCheckDBError {
|
feat
|
add deep health check for analytics (#3438)
|
c9dbb567ab1a633aef6d4fd8bace7250ed638747
|
2024-06-06 17:33:28
|
Sampras Lopes
|
feat(events): add metadata info to events (#4875)
| false
|
diff --git a/crates/events/src/lib.rs b/crates/events/src/lib.rs
index 0136b64a0f6..cef0c8894de 100644
--- a/crates/events/src/lib.rs
+++ b/crates/events/src/lib.rs
@@ -49,6 +49,11 @@ pub trait Event: EventInfo {
/// The class/type of the event. This is used to group/categorize events together.
fn class(&self) -> Self::EventType;
+
+ /// Metadata associated with the event
+ fn metadata(&self) -> HashMap<String, String> {
+ HashMap::new()
+ }
}
/// Hold the context information for any events
@@ -73,7 +78,8 @@ where
event: E,
}
-struct RawEvent<T, A: Event<EventType = T>>(HashMap<String, Value>, A);
+/// A flattened event that flattens the context provided to it along with the actual event.
+struct FlatMapEvent<T, A: Event<EventType = T>>(HashMap<String, Value>, A);
impl<T, A, E, D> EventBuilder<T, A, E, D>
where
@@ -109,12 +115,13 @@ where
/// Emit the event.
pub fn try_emit(self) -> Result<(), EventsError> {
let ts = self.event.timestamp();
+ let metadata = self.event.metadata();
self.message_sink
- .send_message(RawEvent(self.metadata, self.event), ts)
+ .send_message(FlatMapEvent(self.metadata, self.event), metadata, ts)
}
}
-impl<T, A> Serialize for RawEvent<T, A>
+impl<T, A> Serialize for FlatMapEvent<T, A>
where
A: Event<EventType = T>,
{
@@ -236,7 +243,12 @@ pub trait MessagingInterface {
/// The type of the event used for categorization by the event publisher.
type MessageClass;
/// Send a message that follows the defined message class.
- fn send_message<T>(&self, data: T, timestamp: PrimitiveDateTime) -> Result<(), EventsError>
+ fn send_message<T>(
+ &self,
+ data: T,
+ metadata: HashMap<String, String>,
+ timestamp: PrimitiveDateTime,
+ ) -> Result<(), EventsError>
where
T: Message<Class = Self::MessageClass> + ErasedMaskSerialize;
}
@@ -252,7 +264,7 @@ pub trait Message {
fn identifier(&self) -> String;
}
-impl<T, A> Message for RawEvent<T, A>
+impl<T, A> Message for FlatMapEvent<T, A>
where
A: Event<EventType = T>,
{
diff --git a/crates/router/src/events.rs b/crates/router/src/events.rs
index e1ecd09804c..1af515b8c22 100644
--- a/crates/router/src/events.rs
+++ b/crates/router/src/events.rs
@@ -1,3 +1,5 @@
+use std::collections::HashMap;
+
use error_stack::ResultExt;
use events::{EventsError, Message, MessagingInterface};
use hyperswitch_domain_models::errors::{StorageError, StorageResult};
@@ -94,14 +96,15 @@ impl MessagingInterface for EventsHandler {
fn send_message<T>(
&self,
data: T,
+ metadata: HashMap<String, String>,
timestamp: PrimitiveDateTime,
) -> error_stack::Result<(), EventsError>
where
T: Message<Class = Self::MessageClass> + ErasedMaskSerialize,
{
match self {
- Self::Kafka(a) => a.send_message(data, timestamp),
- Self::Logs(a) => a.send_message(data, timestamp),
+ Self::Kafka(a) => a.send_message(data, metadata, timestamp),
+ Self::Logs(a) => a.send_message(data, metadata, timestamp),
}
}
}
diff --git a/crates/router/src/events/event_logger.rs b/crates/router/src/events/event_logger.rs
index 235ee4a3e3c..004f94942d2 100644
--- a/crates/router/src/events/event_logger.rs
+++ b/crates/router/src/events/event_logger.rs
@@ -1,3 +1,5 @@
+use std::collections::HashMap;
+
use events::{EventsError, Message, MessagingInterface};
use masking::ErasedMaskSerialize;
use time::PrimitiveDateTime;
@@ -21,12 +23,13 @@ impl MessagingInterface for EventLogger {
fn send_message<T>(
&self,
data: T,
+ metadata: HashMap<String, String>,
_timestamp: PrimitiveDateTime,
) -> error_stack::Result<(), EventsError>
where
T: Message<Class = Self::MessageClass> + ErasedMaskSerialize,
{
- logger::info!(event =? data.masked_serialize().unwrap_or_else(|e| serde_json::json!({"error": e.to_string()})), event_type =? data.get_message_class(), event_id =? data.identifier(), log_type =? "event");
+ logger::info!(event =? data.masked_serialize().unwrap_or_else(|e| serde_json::json!({"error": e.to_string()})), event_type =? data.get_message_class(), event_id =? data.identifier(), log_type =? "event", metadata = ?metadata);
Ok(())
}
}
diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs
index e0a4f80908d..e1601f8bbbe 100644
--- a/crates/router/src/middleware.rs
+++ b/crates/router/src/middleware.rs
@@ -157,7 +157,8 @@ where
payment_method = Empty,
status_code = Empty,
flow = "UNKNOWN",
- golden_log_line = Empty
+ golden_log_line = Empty,
+ tenant_id = "ta"
)
.or_current(),
),
diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs
index 3523ab9261f..9c38917424e 100644
--- a/crates/router/src/services/kafka.rs
+++ b/crates/router/src/services/kafka.rs
@@ -1,4 +1,4 @@
-use std::sync::Arc;
+use std::{collections::HashMap, sync::Arc};
use bigdecimal::ToPrimitive;
use common_utils::errors::CustomResult;
@@ -6,6 +6,7 @@ use error_stack::{report, ResultExt};
use events::{EventsError, Message, MessagingInterface};
use rdkafka::{
config::FromClientConfig,
+ message::{Header, OwnedHeaders},
producer::{BaseRecord, DefaultProducerContext, Producer, ThreadedProducer},
};
#[cfg(feature = "payouts")]
@@ -528,6 +529,7 @@ impl MessagingInterface for KafkaProducer {
fn send_message<T>(
&self,
data: T,
+ metadata: HashMap<String, String>,
timestamp: PrimitiveDateTime,
) -> error_stack::Result<(), EventsError>
where
@@ -538,12 +540,20 @@ impl MessagingInterface for KafkaProducer {
.masked_serialize()
.and_then(|i| serde_json::to_vec(&i))
.change_context(EventsError::SerializationError)?;
+ let mut headers = OwnedHeaders::new();
+ for (k, v) in metadata.iter() {
+ headers = headers.insert(Header {
+ key: k.as_str(),
+ value: Some(v),
+ });
+ }
self.producer
.0
.send(
BaseRecord::to(topic)
.key(&data.identifier())
.payload(&json_data)
+ .headers(headers)
.timestamp(
(timestamp.assume_utc().unix_timestamp_nanos() / 1_000_000)
.to_i64()
|
feat
|
add metadata info to events (#4875)
|
9b508a838d68d14517477d41f2fc60168703d001
|
2024-09-10 16:03:50
|
Suman Maji
|
feat(connector): [THUNES] Add template code (#5775)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 052b10d0b90..afdbdc954b6 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -253,6 +253,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
+thunes.base_url = "https://api.limonetikqualif.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
@@ -318,6 +319,7 @@ cards = [
"stax",
"stripe",
"threedsecureio",
+ "thunes",
"worldpay",
"zen",
"zsl",
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 16803295896..142eaaa6c09 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -93,6 +93,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
+thunes.base_url = "https://api.limonetikqualif.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index cc16d88c169..e1b4f0a36f6 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -97,6 +97,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
taxjar.base_url = "https://api.taxjar.com/v2/"
+thunes.base_url = "https://api.limonetik.com/"
trustpay.base_url = "https://tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://gateway.transit-pass.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 8a8030db052..3b7993b4b1c 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -97,6 +97,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
+thunes.base_url = "https://api.limonetikqualif.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
diff --git a/config/development.toml b/config/development.toml
index 27ac5bb3f5f..687f0dc1ec8 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -155,6 +155,7 @@ cards = [
"stripe",
"taxjar",
"threedsecureio",
+ "thunes",
"trustpay",
"tsys",
"volt",
@@ -261,6 +262,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
+thunes.base_url = "https://api.limonetikqualif.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 98da1c30986..e3587986ee1 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -182,6 +182,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
+thunes.base_url = "https://api.limonetikqualif.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
@@ -264,6 +265,7 @@ cards = [
"stripe",
"taxjar",
"threedsecureio",
+ "thunes",
"trustpay",
"tsys",
"volt",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 5db816305bd..5bee91843bd 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -137,6 +137,7 @@ pub enum Connector {
Stripe,
Taxjar,
Threedsecureio,
+ //Thunes,
Trustpay,
Tsys,
Volt,
@@ -265,6 +266,7 @@ impl Connector {
| Self::Square
| Self::Stax
| Self::Taxjar
+ //| Self::Thunes
| Self::Trustpay
| Self::Tsys
| Self::Volt
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index eef23ff5b89..61acfa23304 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -251,6 +251,7 @@ pub enum RoutableConnectors {
Stripe,
// Taxjar,
Trustpay,
+ // Thunes
// Tsys,
Tsys,
Volt,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 79024411320..037f91e90ca 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -11,12 +11,13 @@ pub mod novalnet;
pub mod powertranz;
pub mod stax;
pub mod taxjar;
+pub mod thunes;
pub mod tsys;
pub mod worldline;
pub use self::{
bambora::Bambora, bitpay::Bitpay, deutschebank::Deutschebank, fiserv::Fiserv,
fiservemea::Fiservemea, fiuu::Fiuu, globepay::Globepay, helcim::Helcim, nexixpay::Nexixpay,
- novalnet::Novalnet, powertranz::Powertranz, stax::Stax, taxjar::Taxjar, tsys::Tsys,
- worldline::Worldline,
+ novalnet::Novalnet, powertranz::Powertranz, stax::Stax, taxjar::Taxjar, thunes::Thunes,
+ tsys::Tsys, worldline::Worldline,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs
new file mode 100644
index 00000000000..972ba0d7dd3
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/thunes.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 thunes;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Thunes {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Thunes {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Thunes {}
+impl api::PaymentSession for Thunes {}
+impl api::ConnectorAccessToken for Thunes {}
+impl api::MandateSetup for Thunes {}
+impl api::PaymentAuthorize for Thunes {}
+impl api::PaymentSync for Thunes {}
+impl api::PaymentCapture for Thunes {}
+impl api::PaymentVoid for Thunes {}
+impl api::Refund for Thunes {}
+impl api::RefundExecute for Thunes {}
+impl api::RefundSync for Thunes {}
+impl api::PaymentToken for Thunes {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Thunes
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Thunes
+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 Thunes {
+ fn id(&self) -> &'static str {
+ "thunes"
+ }
+
+ 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.thunes.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = thunes::ThunesAuthType::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: thunes::ThunesErrorResponse = res
+ .response
+ .parse_struct("ThunesErrorResponse")
+ .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 Thunes {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Thunes {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Thunes {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Thunes {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Thunes {
+ 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 = thunes::ThunesRouterData::from((amount, req));
+ let connector_req = thunes::ThunesPaymentsRequest::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: thunes::ThunesPaymentsResponse = res
+ .response
+ .parse_struct("Thunes 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 Thunes {
+ 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: thunes::ThunesPaymentsResponse = res
+ .response
+ .parse_struct("thunes 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 Thunes {
+ 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: thunes::ThunesPaymentsResponse = res
+ .response
+ .parse_struct("Thunes 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 Thunes {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Thunes {
+ 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 = thunes::ThunesRouterData::from((refund_amount, req));
+ let connector_req = thunes::ThunesRefundRequest::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: thunes::RefundResponse =
+ res.response
+ .parse_struct("thunes 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 Thunes {
+ 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: thunes::RefundResponse = res
+ .response
+ .parse_struct("thunes 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 Thunes {
+ 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/thunes/transformers.rs b/crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs
new file mode 100644
index 00000000000..c0ee0fdae94
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/thunes/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 ThunesRouterData<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 ThunesRouterData<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 ThunesPaymentsRequest {
+ amount: StringMinorUnit,
+ card: ThunesCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct ThunesCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&ThunesRouterData<&PaymentsAuthorizeRouterData>> for ThunesPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &ThunesRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = ThunesCard {
+ 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 ThunesAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for ThunesAuthType {
+ 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 ThunesPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<ThunesPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: ThunesPaymentStatus) -> Self {
+ match item {
+ ThunesPaymentStatus::Succeeded => Self::Charged,
+ ThunesPaymentStatus::Failed => Self::Failure,
+ ThunesPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct ThunesPaymentsResponse {
+ status: ThunesPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, ThunesPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, ThunesPaymentsResponse, 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: None,
+ mandate_reference: 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 ThunesRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&ThunesRouterData<&RefundsRouterData<F>>> for ThunesRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &ThunesRouterData<&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 ThunesErrorResponse {
+ 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 0210bfa551a..40aa36cc8ba 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -102,6 +102,7 @@ default_imp_for_authorize_session_token!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -133,6 +134,7 @@ default_imp_for_calculate_tax!(
connectors::Globepay,
connectors::Worldline,
connectors::Powertranz,
+ connectors::Thunes,
connectors::Tsys,
connectors::Deutschebank
);
@@ -165,6 +167,7 @@ default_imp_for_session_update!(
connectors::Globepay,
connectors::Worldline,
connectors::Powertranz,
+ connectors::Thunes,
connectors::Tsys,
connectors::Deutschebank
);
@@ -197,6 +200,7 @@ default_imp_for_complete_authorize!(
connectors::Nexixpay,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -230,6 +234,7 @@ default_imp_for_incremental_authorization!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -262,6 +267,7 @@ default_imp_for_create_customer!(
connectors::Nexixpay,
connectors::Powertranz,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -296,6 +302,7 @@ default_imp_for_connector_redirect_response!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -329,6 +336,7 @@ default_imp_for_pre_processing_steps!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -362,6 +370,7 @@ default_imp_for_post_processing_steps!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -395,6 +404,7 @@ default_imp_for_approve!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -428,6 +438,7 @@ default_imp_for_reject!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -461,6 +472,7 @@ default_imp_for_webhook_source_verification!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -495,6 +507,7 @@ default_imp_for_accept_dispute!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -528,6 +541,7 @@ default_imp_for_submit_evidence!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -561,6 +575,7 @@ default_imp_for_defend_dispute!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -603,6 +618,7 @@ default_imp_for_file_upload!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -638,6 +654,7 @@ default_imp_for_payouts_create!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -673,6 +690,7 @@ default_imp_for_payouts_retrieve!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -708,6 +726,7 @@ default_imp_for_payouts_eligibility!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -743,6 +762,7 @@ default_imp_for_payouts_fulfill!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -778,6 +798,7 @@ default_imp_for_payouts_cancel!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -813,6 +834,7 @@ default_imp_for_payouts_quote!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -848,6 +870,7 @@ default_imp_for_payouts_recipient!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -883,6 +906,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -918,6 +942,7 @@ default_imp_for_frm_sale!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -953,6 +978,7 @@ default_imp_for_frm_checkout!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -988,6 +1014,7 @@ default_imp_for_frm_transaction!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -1023,6 +1050,7 @@ default_imp_for_frm_fulfillment!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -1058,6 +1086,7 @@ default_imp_for_frm_record_return!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -1090,6 +1119,7 @@ default_imp_for_revoking_mandates!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index e23f8fdb290..95c7ffec007 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -209,6 +209,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -243,6 +244,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -272,6 +274,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -307,6 +310,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -341,6 +345,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -375,6 +380,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -419,6 +425,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -455,6 +462,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -491,6 +499,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -527,6 +536,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -563,6 +573,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -599,6 +610,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -635,6 +647,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -671,6 +684,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -707,6 +721,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -741,6 +756,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -777,6 +793,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -813,6 +830,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -849,6 +867,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -885,6 +904,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -921,6 +941,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
@@ -954,6 +975,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Powertranz,
connectors::Stax,
connectors::Taxjar,
+ connectors::Thunes,
connectors::Tsys,
connectors::Worldline
);
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 37e5eecea6a..eae30eeb67b 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -78,6 +78,7 @@ pub struct Connectors {
pub stripe: ConnectorParamsWithFileUploadUrl,
pub taxjar: ConnectorParams,
pub threedsecureio: ConnectorParams,
+ pub thunes: ConnectorParams,
pub trustpay: ConnectorParamsWithMoreUrls,
pub tsys: ConnectorParams,
pub volt: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 1fea8015def..caa5b13b51c 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -68,7 +68,7 @@ pub use hyperswitch_connectors::connectors::{
fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, globepay,
globepay::Globepay, helcim, helcim::Helcim, nexixpay, nexixpay::Nexixpay, novalnet,
novalnet::Novalnet, powertranz, powertranz::Powertranz, stax, stax::Stax, taxjar,
- taxjar::Taxjar, tsys, tsys::Tsys, worldline, worldline::Worldline,
+ taxjar::Taxjar, thunes, thunes::Thunes, tsys, tsys::Tsys, worldline, worldline::Worldline,
};
#[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 0a4aa8348d4..a1a3cecd8fc 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1287,6 +1287,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Taxjar,
connector::Trustpay,
connector::Threedsecureio,
+ connector::Thunes,
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
@@ -2100,6 +2101,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Taxjar,
connector::Trustpay,
connector::Threedsecureio,
+ connector::Thunes,
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
@@ -2704,6 +2706,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Taxjar,
connector::Trustpay,
connector::Threedsecureio,
+ connector::Thunes,
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 1c5e6eb5e95..598db0bdcc1 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -482,14 +482,17 @@ impl ConnectorData {
enums::Connector::Paypal => {
Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new())))
}
+ // enums::Connector::Thunes => Ok(ConnectorEnum::Old(Box::new(connector::Thunes))),
enums::Connector::Trustpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new())))
}
enums::Connector::Tsys => Ok(ConnectorEnum::Old(Box::new(&connector::Tsys))),
+
enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
enums::Connector::Wellsfargo => {
Ok(ConnectorEnum::Old(Box::new(&connector::Wellsfargo)))
}
+
// enums::Connector::Wellsfargopayout => {
// Ok(Box::new(connector::Wellsfargopayout::new()))
// }
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index de897c816dd..f302cb00956 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -333,6 +333,8 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Square => Self::Square,
api_enums::Connector::Stax => Self::Stax,
api_enums::Connector::Stripe => Self::Stripe,
+ // api_enums::Connector::Taxjar => Self::Taxjar,
+ // api_enums::Connector::Thunes => Self::Thunes,
api_enums::Connector::Trustpay => Self::Trustpay,
api_enums::Connector::Tsys => Self::Tsys,
api_enums::Connector::Volt => Self::Volt,
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index fe5820d34e5..6ed9bd7103d 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -276,4 +276,7 @@ api_key = "API Key"
api_key="API Key"
[deutschebank]
+api_key="API Key"
+
+[thunes]
api_key="API Key"
\ No newline at end of file
diff --git a/crates/router/tests/connectors/thunes.rs b/crates/router/tests/connectors/thunes.rs
new file mode 100644
index 00000000000..379e102a53c
--- /dev/null
+++ b/crates/router/tests/connectors/thunes.rs
@@ -0,0 +1,402 @@
+use masking::Secret;
+// use router::{
+// types::{self, api, storage::enums,
+// }};
+
+use crate::utils::{self, ConnectorActions};
+use test_utils::connector_auth;
+
+#[derive(Clone, Copy)]
+struct ThunesTest;
+impl ConnectorActions for ThunesTest {}
+impl utils::Connector for ThunesTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Thunes;
+ api::ConnectorData {
+ connector: Box::new(Thunes::new()),
+ connector_name: types::Connector::Thunes,
+ 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()
+ .thunes
+ .expect("Missing connector authentication configuration").into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "thunes".to_string()
+ }
+}
+
+static CONNECTOR: ThunesTest = ThunesTest {};
+
+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: types::api::PaymentMethodData::Card(api::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: api::PaymentMethodData::Card(api::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: api::PaymentMethodData::Card(api::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/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index a1261e6edb1..68895e5876e 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -77,6 +77,7 @@ pub struct ConnectorAuthentication {
pub stripe: Option<HeaderKey>,
pub taxjar: Option<HeaderKey>,
pub threedsecureio: Option<HeaderKey>,
+ pub thunes: Option<HeaderKey>,
pub stripe_au: Option<HeaderKey>,
pub stripe_uk: Option<HeaderKey>,
pub trustpay: Option<SignatureKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 11a404e7c27..f352644ea7f 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -148,6 +148,7 @@ stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
taxjar.base_url = "https://api.sandbox.taxjar.com/v2/"
threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
+thunes.base_url = "https://api.limonetikqualif.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
@@ -230,6 +231,7 @@ cards = [
"stripe",
"taxjar",
"threedsecureio",
+ "thunes",
"trustpay",
"tsys",
"volt",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 0dd3b6434c8..fb7252833d5 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 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 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 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")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res=`echo ${sorted[@]}`
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
[THUNES] Add template code (#5775)
|
3fea00c43ee597c9b786da6636e245cb848cdb97
|
2024-08-05 15:28:19
|
Amisha Prabhat
|
refactor(routing): Refactor api v2 routes for deactivating and retrieving the routing config (#5478)
| false
|
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 265d0451117..aca7bfaebe3 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -30,7 +30,16 @@ impl ConnectorSelection {
}
}
}
+#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct RoutingConfigRequest {
+ pub name: String,
+ pub description: String,
+ pub algorithm: RoutingAlgorithm,
+ pub profile_id: String,
+}
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct RoutingConfigRequest {
pub name: Option<String>,
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 2451156e874..cb7cf344e89 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -1,15 +1,12 @@
pub mod helpers;
pub mod transformers;
+#[cfg(all(feature = "v2", feature = "routing_v2"))]
+use api_models::routing::RoutingConfigRequest;
use api_models::{
enums,
- routing::{
- self as routing_types, RoutingAlgorithmId, RoutingRetrieveLinkQuery, RoutingRetrieveQuery,
- },
+ routing::{self as routing_types, RoutingRetrieveLinkQuery, RoutingRetrieveQuery},
};
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
-use diesel_models::routing_algorithm::RoutingAlgorithm;
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
use diesel_models::routing_algorithm::RoutingAlgorithm;
use error_stack::ResultExt;
#[cfg(all(feature = "v2", feature = "routing_v2"))]
@@ -19,11 +16,8 @@ use rustc_hash::FxHashSet;
use super::payments;
#[cfg(feature = "payouts")]
use super::payouts;
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
-use crate::consts;
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
-use crate::{consts, core::errors::RouterResult, db::StorageInterface};
use crate::{
+ consts,
core::{
errors::{self, RouterResponse, StorageErrorExt},
metrics, utils as core_utils,
@@ -36,6 +30,8 @@ use crate::{
},
utils::{self, OptionExt, ValueExt},
};
+#[cfg(all(feature = "v2", feature = "routing_v2"))]
+use crate::{core::errors::RouterResult, db::StorageInterface};
pub enum TransactionData<'a, F>
where
F: Clone,
@@ -51,10 +47,8 @@ struct RoutingAlgorithmUpdate(RoutingAlgorithm);
#[cfg(all(feature = "v2", feature = "routing_v2"))]
impl RoutingAlgorithmUpdate {
pub fn create_new_routing_algorithm(
- algorithm: routing_types::RoutingAlgorithm,
+ request: &RoutingConfigRequest,
merchant_id: &common_utils::id_type::MerchantId,
- name: String,
- description: String,
profile_id: String,
transaction_type: &enums::TransactionType,
) -> Self {
@@ -67,10 +61,10 @@ impl RoutingAlgorithmUpdate {
algorithm_id,
profile_id,
merchant_id: merchant_id.clone(),
- name,
- description: Some(description),
- kind: algorithm.get_kind().foreign_into(),
- algorithm_data: serde_json::json!(algorithm),
+ name: request.name.clone(),
+ description: Some(request.description.clone()),
+ kind: request.algorithm.get_kind().foreign_into(),
+ algorithm_data: serde_json::json!(request.algorithm),
created_at: timestamp,
modified_at: timestamp,
algorithm_for: transaction_type.to_owned(),
@@ -150,36 +144,15 @@ pub async fn create_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- request: routing_types::RoutingConfigRequest,
+ request: RoutingConfigRequest,
transaction_type: &enums::TransactionType,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
metrics::ROUTING_CREATE_REQUEST_RECEIVED.add(&metrics::CONTEXT, 1, &[]);
let db = &*state.store;
- let name = request
- .name
- .get_required_value("name")
- .change_context(errors::ApiErrorResponse::MissingRequiredField { field_name: "name" })
- .attach_printable("Name of config not given")?;
-
- let description = request
- .description
- .get_required_value("description")
- .change_context(errors::ApiErrorResponse::MissingRequiredField {
- field_name: "description",
- })
- .attach_printable("Description of config not given")?;
-
- let algorithm = request
- .algorithm
- .get_required_value("algorithm")
- .change_context(errors::ApiErrorResponse::MissingRequiredField {
- field_name: "algorithm",
- })
- .attach_printable("Algorithm of config not given")?;
let business_profile = core_utils::validate_and_get_business_profile(
db,
- request.profile_id.as_ref(),
+ Some(&request.profile_id),
merchant_account.get_id(),
)
.await?
@@ -205,16 +178,14 @@ pub async fn create_routing_config(
let algorithm_helper = helpers::RoutingAlgorithmHelpers {
name_mca_id_set,
name_set,
- routing_algorithm: &algorithm,
+ routing_algorithm: &request.algorithm,
};
algorithm_helper.validate_connectors_in_routing_config()?;
let algo = RoutingAlgorithmUpdate::create_new_routing_algorithm(
- algorithm,
+ &request,
merchant_account.get_id(),
- name,
- description,
business_profile.profile_id,
transaction_type,
);
@@ -327,11 +298,13 @@ pub async fn link_routing_config(
let routing_algorithm =
RoutingAlgorithmUpdate::fetch_routing_algo(merchant_account.get_id(), &algorithm_id, db)
.await?;
+
utils::when(routing_algorithm.0.profile_id != profile_id, || {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: "Profile Id is invalid for the routing config".to_string(),
})
})?;
+
let business_profile = core_utils::validate_and_get_business_profile(
db,
Some(&profile_id),
@@ -348,6 +321,7 @@ pub async fn link_routing_config(
.unwrap_or_default();
routing_algorithm.update_routing_ref_with_algorithm_id(transaction_type, &mut routing_ref)?;
+
// TODO move to business profile
helpers::update_business_profile_active_algorithm_ref(
db,
@@ -432,10 +406,41 @@ pub async fn link_routing_config(
))
}
+#[cfg(all(feature = "v2", feature = "routing_v2"))]
+pub async fn retrieve_routing_config(
+ state: SessionState,
+ merchant_account: domain::MerchantAccount,
+ algorithm_id: routing_types::RoutingAlgorithmId,
+) -> RouterResponse<routing_types::MerchantRoutingAlgorithm> {
+ metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]);
+ let db = state.store.as_ref();
+
+ let routing_algorithm =
+ RoutingAlgorithmUpdate::fetch_routing_algo(merchant_account.get_id(), &algorithm_id.0, db)
+ .await?;
+ // TODO: Move to domain types of Business Profile
+ core_utils::validate_and_get_business_profile(
+ db,
+ Some(&routing_algorithm.0.profile_id),
+ merchant_account.get_id(),
+ )
+ .await?
+ .get_required_value("BusinessProfile")
+ .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?;
+
+ let response = routing_types::MerchantRoutingAlgorithm::foreign_try_from(routing_algorithm.0)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to parse routing algorithm")?;
+
+ metrics::ROUTING_RETRIEVE_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]);
+ Ok(service_api::ApplicationResponse::Json(response))
+}
+
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
pub async fn retrieve_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
- algorithm_id: RoutingAlgorithmId,
+ algorithm_id: routing_types::RoutingAlgorithmId,
) -> RouterResponse<routing_types::MerchantRoutingAlgorithm> {
metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]);
let db = state.store.as_ref();
@@ -465,6 +470,70 @@ pub async fn retrieve_routing_config(
Ok(service_api::ApplicationResponse::Json(response))
}
+#[cfg(all(feature = "v2", feature = "routing_v2"))]
+pub async fn unlink_routing_config(
+ state: SessionState,
+ merchant_account: domain::MerchantAccount,
+ profile_id: String,
+ transaction_type: &enums::TransactionType,
+) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
+ metrics::ROUTING_UNLINK_CONFIG.add(&metrics::CONTEXT, 1, &[]);
+ let db = state.store.as_ref();
+
+ let business_profile = core_utils::validate_and_get_business_profile(
+ db,
+ Some(&profile_id),
+ merchant_account.get_id(),
+ )
+ .await?
+ .get_required_value("BusinessProfile")?;
+
+ let routing_algo_ref = routing_types::RoutingAlgorithmRef::parse_routing_algorithm(
+ match transaction_type {
+ enums::TransactionType::Payment => business_profile.routing_algorithm.clone(),
+ #[cfg(feature = "payouts")]
+ enums::TransactionType::Payout => business_profile.payout_routing_algorithm.clone(),
+ }
+ .map(Secret::new),
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to deserialize routing algorithm ref from merchant account")?
+ .unwrap_or_default();
+
+ if let Some(algorithm_id) = routing_algo_ref.algorithm_id {
+ let timestamp = common_utils::date_time::now_unix_timestamp();
+ let routing_algorithm: routing_types::RoutingAlgorithmRef =
+ routing_types::RoutingAlgorithmRef {
+ algorithm_id: None,
+ timestamp,
+ config_algo_id: routing_algo_ref.config_algo_id.clone(),
+ surcharge_config_algo_id: routing_algo_ref.surcharge_config_algo_id,
+ };
+ let record = RoutingAlgorithmUpdate::fetch_routing_algo(
+ merchant_account.get_id(),
+ &algorithm_id,
+ db,
+ )
+ .await?;
+ let response = record.0.foreign_into();
+ helpers::update_business_profile_active_algorithm_ref(
+ db,
+ business_profile,
+ routing_algorithm,
+ transaction_type,
+ )
+ .await?;
+
+ metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]);
+ Ok(service_api::ApplicationResponse::Json(response))
+ } else {
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Algorithm is already inactive".to_string(),
+ })?
+ }
+}
+
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
pub async fn unlink_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0a40d5b6a15..0b42c71944e 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1455,18 +1455,16 @@ impl BusinessProfile {
},
)),
)
- .service(
- web::resource("/deactivate_routing_algorithm").route(web::post().to(
- |state, req, path| {
- routing::routing_unlink_config(
- state,
- req,
- path,
- &TransactionType::Payment,
- )
- },
- )),
- ),
+ .service(web::resource("/deactivate_routing_algorithm").route(
+ web::patch().to(|state, req, path| {
+ routing::routing_unlink_config(
+ state,
+ req,
+ path,
+ &TransactionType::Payment,
+ )
+ }),
+ )),
)
}
}
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index b4e180cf718..8e375898377 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -200,7 +200,41 @@ pub async fn list_routing_configs(
.await
}
-#[cfg(feature = "olap")]
+#[cfg(all(feature = "olap", feature = "v2", feature = "routing_v2"))]
+#[instrument(skip_all)]
+pub async fn routing_unlink_config(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ path: web::Path<String>,
+ transaction_type: &enums::TransactionType,
+) -> impl Responder {
+ let flow = Flow::RoutingUnlinkConfig;
+ Box::pin(oss_api::server_wrap(
+ flow,
+ state,
+ &req,
+ path.into_inner(),
+ |state, auth: auth::AuthenticationData, path, _| {
+ routing::unlink_routing_config(state, auth.merchant_account, path, transaction_type)
+ },
+ #[cfg(not(feature = "release"))]
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::RoutingWrite),
+ req.headers(),
+ ),
+ #[cfg(feature = "release")]
+ &auth::JWTAuth(Permission::RoutingWrite),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+#[cfg(all(
+ feature = "olap",
+ any(feature = "v1", feature = "v2"),
+ not(feature = "routing_v2")
+))]
#[instrument(skip_all)]
pub async fn routing_unlink_config(
state: web::Data<AppState>,
|
refactor
|
Refactor api v2 routes for deactivating and retrieving the routing config (#5478)
|
77e60c82fa123ef780485a8507ce779f2f41e166
|
2023-05-30 13:13:15
|
chikke srujan
|
refactor(core): Add 'redirect_response' field to CompleteAuthorizeData (#1222)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 74d627d5f60..eeaceec2112 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1575,15 +1575,21 @@ pub struct Metadata {
#[serde(flatten)]
pub data: pii::SecretSerdeValue,
- /// Payload coming in request as a metadata field
- #[schema(value_type = Option<Object>)]
- pub payload: Option<pii::SecretSerdeValue>,
+ /// Redirection response coming in request as metadata field only for redirection scenarios
+ pub redirect_response: Option<RedirectResponse>,
/// Allowed payment method types for a payment intent
#[schema(value_type = Option<Vec<PaymentMethodType>>)]
pub allowed_payment_method_types: Option<Vec<api_enums::PaymentMethodType>>,
}
+#[derive(Default, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
+pub struct RedirectResponse {
+ pub param: Option<Secret<String>>,
+ #[schema(value_type = Option<Object>)]
+ pub json_payload: Option<pii::SecretSerdeValue>,
+}
+
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsSessionRequest {
/// The identifier for the payment
diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs
index 5d4c2ec71d9..1cb3bc6076c 100644
--- a/crates/router/src/connector/airwallex/transformers.rs
+++ b/crates/router/src/connector/airwallex/transformers.rs
@@ -1,3 +1,5 @@
+use error_stack::{IntoReport, ResultExt};
+use masking::PeekInterface;
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use url::Url;
@@ -166,9 +168,18 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for AirwallexCompleteR
three_ds: AirwallexThreeDsData {
acs_response: item
.request
- .payload
+ .redirect_response
.as_ref()
- .map(|data| Secret::new(serde_json::Value::to_string(data))),
+ .map(|f| f.payload.to_owned())
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "redirect_response.payload",
+ })?
+ .as_ref()
+ .map(|data| serde_json::to_string(data.peek()))
+ .transpose()
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?
+ .map(Secret::new),
},
three_ds_type: AirwallexThreeDsType::ThreeDSContinue,
})
diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs
index 14ce731627e..e3b02b995b2 100644
--- a/crates/router/src/connector/bambora/transformers.rs
+++ b/crates/router/src/connector/bambora/transformers.rs
@@ -80,10 +80,11 @@ impl TryFrom<&types::CompleteAuthorizeData> for BamboraThreedsContinueRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(value: &types::CompleteAuthorizeData) -> Result<Self, Self::Error> {
let card_response: CardResponse = value
- .payload
- .clone()
+ .redirect_response
+ .as_ref()
+ .and_then(|f| f.payload.to_owned())
.ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "payload",
+ field_name: "redirect_response.payload",
})?
.parse_value("CardResponse")
.change_context(errors::ConnectorError::ParsingFailed)?;
diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs
index 7626d1f3ee6..909cab27ccb 100644
--- a/crates/router/src/connector/bluesnap/transformers.rs
+++ b/crates/router/src/connector/bluesnap/transformers.rs
@@ -339,10 +339,11 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for BluesnapPaymentsRe
fn try_from(item: &types::PaymentsCompleteAuthorizeRouterData) -> Result<Self, Self::Error> {
let redirection_response: BluesnapRedirectionResponse = item
.request
- .payload
- .clone()
+ .redirect_response
+ .as_ref()
+ .and_then(|res| res.payload.to_owned())
.ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {
- field_name: "request.payload",
+ field_name: "request.redirect_response.payload",
})?
.parse_value("BluesnapRedirectionResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index c2faae18a82..0ad80cbf19d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -361,7 +361,10 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
routing_parameters: None,
order_details: None,
data: masking::Secret::new("{}".into()),
- payload: Some(req.json_payload.unwrap_or(serde_json::json!({})).into()),
+ redirect_response: Some(api_models::payments::RedirectResponse {
+ param: req.param.map(Secret::new),
+ json_payload: Some(req.json_payload.unwrap_or(serde_json::json!({})).into()),
+ }),
allowed_payment_method_types: None,
}),
..Default::default()
@@ -950,6 +953,7 @@ where
pub pm_token: Option<String>,
pub connector_customer_id: Option<String>,
pub ephemeral_key: Option<ephemeral_key::EphemeralKey>,
+ pub redirect_response: Option<api_models::payments::RedirectResponse>,
}
#[derive(Debug, Default)]
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 573ec4d2e58..e5468b31398 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -152,6 +152,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
None,
))
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 368e51fd79e..3903c989f54 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -158,6 +158,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
None,
))
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 7e7f6989118..065f3a14679 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -2,7 +2,6 @@ use std::marker::PhantomData;
use async_trait::async_trait;
use error_stack::ResultExt;
-use masking::ExposeOptionInterface;
use router_derive::PaymentOperation;
use router_env::{instrument, tracing};
@@ -146,7 +145,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
)
.await?;
- let mut connector_response = db
+ let connector_response = db
.find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_attempt.payment_id,
&payment_attempt.merchant_id,
@@ -156,12 +155,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- connector_response.encoded_data = request.metadata.clone().and_then(|secret_metadata| {
- secret_metadata
- .payload
- .expose_option()
- .map(|exposed_payload| exposed_payload.to_string())
- });
+ let redirect_response = request
+ .metadata
+ .as_ref()
+ .and_then(|secret_metadata| secret_metadata.redirect_response.to_owned());
payment_intent.shipping_address_id = shipping_address.clone().map(|i| i.address_id);
payment_intent.billing_address_id = billing_address.clone().map(|i| i.address_id);
@@ -205,6 +202,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response,
},
Some(CustomerDetails {
customer_id: request.customer_id.clone(),
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index c32a57a88b4..9d413d6903e 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -245,6 +245,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
Some(CustomerDetails {
customer_id: request.customer_id.clone(),
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index edaa922df53..82bb8047754 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -250,6 +250,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
pm_token: None,
connector_customer_id: None,
ephemeral_key,
+ redirect_response: None,
},
Some(CustomerDetails {
customer_id: request.customer_id.clone(),
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 9a4cf69f40b..9b3375aa331 100644
--- a/crates/router/src/core/payments/operations/payment_method_validate.rs
+++ b/crates/router/src/core/payments/operations/payment_method_validate.rs
@@ -179,6 +179,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::VerifyRequest> for Paym
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
Some(payments::CustomerDetails {
customer_id: request.customer_id.clone(),
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index f12d60aff64..409818125c4 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -171,6 +171,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
Some(customer_details),
))
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index e69c576e53f..b8f657b5695 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -143,6 +143,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
Some(customer_details),
))
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 8117a87f179..780ec27c83f 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -291,6 +291,7 @@ async fn get_tracker_for_sync<
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
None,
))
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 6830cebb7ea..853df5630b6 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -304,6 +304,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
pm_token: None,
connector_customer_id: None,
ephemeral_key: None,
+ redirect_response: None,
},
Some(CustomerDetails {
customer_id: request.customer_id.clone(),
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 8d44d2ec303..0a8edf9a2a0 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1,7 +1,7 @@
use std::{fmt::Debug, marker::PhantomData};
use common_utils::fp_utils;
-use error_stack::{IntoReport, ResultExt};
+use error_stack::ResultExt;
use router_env::{instrument, tracing};
use storage_models::ephemeral_key;
@@ -836,13 +836,13 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
field_name: "browser_info",
})?;
- let json_payload = payment_data
- .connector_response
- .encoded_data
- .map(|s| serde_json::from_str::<serde_json::Value>(&s))
- .transpose()
- .into_report()
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
+ let redirect_response = payment_data.redirect_response.map(|redirect| {
+ types::CompleteAuthorizeRedirectResponse {
+ params: redirect.param,
+ payload: redirect.json_payload,
+ }
+ });
+
Ok(Self {
setup_future_usage: payment_data.payment_intent.setup_future_usage,
mandate_id: payment_data.mandate_id.clone(),
@@ -857,7 +857,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
email: payment_data.email,
payment_method_data: payment_data.payment_method_data,
connector_transaction_id: payment_data.connector_response.connector_transaction_id,
- payload: json_payload,
+ redirect_response,
connector_meta: payment_data.payment_attempt.connector_metadata,
})
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 803f987f0a4..347adcc92f4 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -284,12 +284,18 @@ pub struct CompleteAuthorizeData {
pub mandate_id: Option<api_models::payments::MandateIds>,
pub off_session: Option<bool>,
pub setup_mandate_details: Option<payments::MandateData>,
- pub payload: Option<serde_json::Value>,
+ pub redirect_response: Option<CompleteAuthorizeRedirectResponse>,
pub browser_info: Option<BrowserInformation>,
pub connector_transaction_id: Option<String>,
pub connector_meta: Option<serde_json::Value>,
}
+#[derive(Debug, Clone)]
+pub struct CompleteAuthorizeRedirectResponse {
+ pub params: Option<Secret<String>>,
+ pub payload: Option<pii::SecretSerdeValue>,
+}
+
#[derive(Debug, Default, Clone)]
pub struct PaymentsSyncData {
//TODO : add fields based on the connector requirements
|
refactor
|
Add 'redirect_response' field to CompleteAuthorizeData (#1222)
|
acb09b022ccc10ddcd373d5fd6cf38ccaae67f2a
|
2023-01-04 17:24:32
|
Narayan Bhat
|
refactor(helpers): rename order_id to payment_intent_client_secret (#285)
| false
|
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 02bc6961266..37fa06a427f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1080,7 +1080,7 @@ pub fn make_merchant_url_with_response(
url,
&[
("status", status_check.to_string()),
- ("order_id", payment_intent_id),
+ ("payment_intent_client_secret", payment_intent_id),
],
)
.into_report()
@@ -1092,7 +1092,7 @@ pub fn make_merchant_url_with_response(
url,
&[
("status", status_check.to_string()),
- ("order_id", payment_intent_id),
+ ("payment_intent_client_secret", payment_intent_id),
("amount", amount.to_string()),
],
)
|
refactor
|
rename order_id to payment_intent_client_secret (#285)
|
751f16eaee254ab8f0068e2e9e81e3e4b7fe133f
|
2023-10-12 17:17:58
|
SamraatBansal
|
refactor(connector): [noon] update and add recommended fields (#2381)
| false
|
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index 749c8c8dea7..21a6501bb50 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -1,3 +1,4 @@
+use common_utils::pii;
use error_stack::ResultExt;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -36,6 +37,23 @@ pub struct NoonSubscriptionData {
name: String,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonBillingAddress {
+ street: Option<Secret<String>>,
+ street2: Option<Secret<String>>,
+ city: Option<String>,
+ state_province: Option<Secret<String>>,
+ country: Option<api_models::enums::CountryAlpha2>,
+ postal_code: Option<Secret<String>>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonBilling {
+ address: NoonBillingAddress,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct NoonOrder {
@@ -46,6 +64,7 @@ pub struct NoonOrder {
reference: String,
//Short description of the order.
name: String,
+ ip_address: Option<Secret<String, pii::IpAddress>>,
}
#[derive(Debug, Serialize)]
@@ -164,6 +183,7 @@ pub struct NoonPaymentsRequest {
configuration: NoonConfiguration,
payment_data: NoonPaymentData,
subscription: Option<NoonSubscriptionData>,
+ billing: Option<NoonBilling>,
}
impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
@@ -247,6 +267,27 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
.take(50)
.collect();
+ let ip_address = item.request.get_ip_address_as_optional();
+
+ let channel = NoonChannels::Web;
+
+ let billing = item
+ .address
+ .billing
+ .clone()
+ .and_then(|billing_address| billing_address.address)
+ .map(|address| NoonBilling {
+ address: NoonBillingAddress {
+ street: address.line1,
+ street2: address.line2,
+ city: address.city,
+ // If state is passed in request, country becomes mandatory, keep a check while debugging failed payments
+ state_province: address.state,
+ country: address.country,
+ postal_code: address.zip,
+ },
+ });
+
let (subscription, tokenize_c_c) =
match item.request.setup_future_usage.is_some().then_some((
NoonSubscriptionData {
@@ -261,10 +302,11 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
let order = NoonOrder {
amount: conn_utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
currency,
- channel: NoonChannels::Web,
+ channel,
category,
reference: item.connector_request_reference_id.clone(),
name,
+ ip_address,
};
let payment_action = if item.request.is_auto_capture()? {
NoonPaymentActions::Sale
@@ -274,6 +316,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
Ok(Self {
api_operation: NoonApiOperations::Initiate,
order,
+ billing,
configuration: NoonConfiguration {
payment_action,
return_url: item.request.router_return_url.clone(),
@@ -333,7 +376,8 @@ impl From<NoonPaymentStatus> for enums::AttemptStatus {
fn from(item: NoonPaymentStatus) -> Self {
match item {
NoonPaymentStatus::Authorized => Self::Authorized,
- NoonPaymentStatus::Captured | NoonPaymentStatus::PartiallyCaptured => Self::Charged,
+ NoonPaymentStatus::Captured => Self::Charged,
+ NoonPaymentStatus::PartiallyCaptured => Self::PartialCharged,
NoonPaymentStatus::Reversed => Self::Voided,
NoonPaymentStatus::Cancelled | NoonPaymentStatus::Expired => Self::AuthenticationFailed,
NoonPaymentStatus::ThreeDsEnrollInitiated | NoonPaymentStatus::ThreeDsEnrollChecked => {
@@ -444,6 +488,7 @@ pub struct NoonActionTransaction {
#[serde(rename_all = "camelCase")]
pub struct NoonActionOrder {
id: String,
+ cancellation_reason: Option<String>,
}
#[derive(Debug, Serialize)]
@@ -459,6 +504,7 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for NoonPaymentsActionRequest {
fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
let order = NoonActionOrder {
id: item.request.connector_transaction_id.clone(),
+ cancellation_reason: None,
};
let transaction = NoonActionTransaction {
amount: conn_utils::to_currency_base_unit(
@@ -488,6 +534,11 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NoonPaymentsCancelRequest {
fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
let order = NoonActionOrder {
id: item.request.connector_transaction_id.clone(),
+ cancellation_reason: item
+ .request
+ .cancellation_reason
+ .clone()
+ .map(|reason| reason.chars().take(100).collect()), // Max 100 chars
};
Ok(Self {
api_operation: NoonApiOperations::Reverse,
@@ -501,6 +552,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for NoonPaymentsActionRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
let order = NoonActionOrder {
id: item.request.connector_transaction_id.clone(),
+ cancellation_reason: None,
};
let transaction = NoonActionTransaction {
amount: conn_utils::to_currency_base_unit(
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 4f59c38ea7c..455646f619e 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -283,6 +283,7 @@ pub trait PaymentsAuthorizeRequestData {
fn get_payment_method_type(&self) -> Result<diesel_models::enums::PaymentMethodType, Error>;
fn get_connector_mandate_id(&self) -> Result<String, Error>;
fn get_complete_authorize_url(&self) -> Result<String, Error>;
+ fn get_ip_address_as_optional(&self) -> Option<Secret<String, IpAddress>>;
}
impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
@@ -370,6 +371,13 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
self.connector_mandate_id()
.ok_or_else(missing_field_err("connector_mandate_id"))
}
+ fn get_ip_address_as_optional(&self) -> Option<Secret<String, IpAddress>> {
+ self.browser_info.clone().and_then(|browser_info| {
+ browser_info
+ .ip_address
+ .map(|ip| Secret::new(ip.to_string()))
+ })
+ }
}
pub trait ConnectorCustomerData {
|
refactor
|
[noon] update and add recommended fields (#2381)
|
30dd7ceb5f38849faacee5409112a8857df71972
|
2024-09-19 18:55:23
|
Kashif
|
refactor(recon): use AuthDataWithUser and use JWTAuth for token verif… (#5829)
| false
|
diff --git a/crates/router/src/core/recon.rs b/crates/router/src/core/recon.rs
index fa9944ee8ee..2c2dfc9c9f0 100644
--- a/crates/router/src/core/recon.rs
+++ b/crates/router/src/core/recon.rs
@@ -17,11 +17,10 @@ use crate::{
pub async fn send_recon_request(
state: SessionState,
- user_with_auth_data: authentication::UserFromTokenWithAuthData,
+ auth_data: authentication::AuthenticationDataWithUser,
) -> RouterResponse<recon_api::ReconStatusResponse> {
- let user = user_with_auth_data.0;
- let user_in_db = &user_with_auth_data.1.user;
- let merchant_id = user.merchant_id;
+ let user_in_db = &auth_data.user;
+ let merchant_id = auth_data.merchant_account.get_id().clone();
let user_email = user_in_db.email.clone();
let email_contents = email_types::ProFeatureRequest {
@@ -55,7 +54,6 @@ pub async fn send_recon_request(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to compose and send email for ProFeatureRequest [Recon]")
.async_and_then(|_| async {
- let auth = user_with_auth_data.1;
let updated_merchant_account = storage::MerchantAccountUpdate::ReconUpdate {
recon_status: enums::ReconStatus::Requested,
};
@@ -65,9 +63,9 @@ pub async fn send_recon_request(
let response = db
.update_merchant(
key_manager_state,
- auth.merchant_account,
+ auth_data.merchant_account,
updated_merchant_account,
- &auth.key_store,
+ &auth_data.key_store,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 9d0f168827e..89f44aa1524 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -1853,11 +1853,9 @@ pub async fn verify_token(
state: SessionState,
user: auth::UserFromToken,
) -> UserResponse<user_api::VerifyTokenResponse> {
- let user_in_db = state
- .global_store
- .find_user_by_id(&user.user_id)
+ let user_in_db = user
+ .get_user_from_db(&state)
.await
- .change_context(UserErrors::InternalServerError)
.attach_printable_lazy(|| {
format!(
"Failed to fetch the user from DB for user_id - {}",
@@ -1867,7 +1865,7 @@ pub async fn verify_token(
Ok(ApplicationResponse::Json(user_api::VerifyTokenResponse {
merchant_id: user.merchant_id.to_owned(),
- user_email: user_in_db.email,
+ user_email: user_in_db.0.email,
}))
}
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index a6c8659617f..b1fbd2bb6df 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -575,7 +575,10 @@ pub async fn verify_recon_token(state: web::Data<AppState>, http_req: HttpReques
&http_req,
(),
|state, user, _req, _| user_core::verify_token(state, user),
- &auth::DashboardNoPermissionAuth,
+ &auth::JWTAuth {
+ permission: Permission::ReconAdmin,
+ minimum_entity_level: EntityType::Merchant,
+ },
api_locking::LockAction::NotApplicable,
))
.await
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 5f9fc798d89..d8318ce9517 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -1984,13 +1984,9 @@ where
default_auth
}
-#[derive(Clone)]
-#[cfg(feature = "recon")]
-pub struct UserFromTokenWithAuthData(pub UserFromToken, pub AuthenticationDataWithUser);
-
#[cfg(feature = "recon")]
#[async_trait]
-impl<A> AuthenticateAndFetch<UserFromTokenWithAuthData, A> for JWTAuth
+impl<A> AuthenticateAndFetch<AuthenticationDataWithUser, A> for JWTAuth
where
A: SessionStateInfo + Sync,
{
@@ -1998,7 +1994,7 @@ where
&self,
request_headers: &HeaderMap,
state: &A,
- ) -> RouterResult<(UserFromTokenWithAuthData, AuthenticationType)> {
+ ) -> RouterResult<(AuthenticationDataWithUser, AuthenticationType)> {
let payload = parse_jwt_payload::<A, AuthToken>(request_headers, state).await?;
if payload.check_in_blacklist(state).await? {
return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
@@ -2049,17 +2045,9 @@ where
let auth_type = AuthenticationType::MerchantJwt {
merchant_id: auth.merchant_account.get_id().clone(),
- user_id: Some(user_id.clone()),
- };
-
- let user = UserFromToken {
- user_id,
- merchant_id: payload.merchant_id.clone(),
- org_id: payload.org_id,
- role_id: payload.role_id,
- profile_id: payload.profile_id,
+ user_id: Some(user_id),
};
- Ok((UserFromTokenWithAuthData(user, auth), auth_type))
+ Ok((auth, auth_type))
}
}
|
refactor
|
use AuthDataWithUser and use JWTAuth for token verif… (#5829)
|
5a1a3da7502ce9e13546b896477d82719162d5b6
|
2024-01-11 12:57:36
|
Hrithikesh
|
fix(core): surcharge with saved card failure (#3318)
| false
|
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 67328e35612..a07c88ea667 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -509,8 +509,7 @@ where
let raw_card_key = payment_data
.payment_method_data
.as_ref()
- .map(get_key_params_for_surcharge_details)
- .transpose()?
+ .and_then(get_key_params_for_surcharge_details)
.map(|(payment_method, payment_method_type, card_network)| {
types::SurchargeKey::PaymentMethodData(
payment_method,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d864cacc52f..fed8357bc38 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3610,93 +3610,74 @@ impl ApplePayData {
pub fn get_key_params_for_surcharge_details(
payment_method_data: &api_models::payments::PaymentMethodData,
-) -> RouterResult<(
+) -> Option<(
common_enums::PaymentMethod,
common_enums::PaymentMethodType,
Option<common_enums::CardNetwork>,
)> {
match payment_method_data {
api_models::payments::PaymentMethodData::Card(card) => {
- let card_network = card
- .card_network
- .clone()
- .get_required_value("payment_method_data.card.card_network")?;
// surcharge generated will always be same for credit as well as debit
// since surcharge conditions cannot be defined on card_type
- Ok((
+ Some((
common_enums::PaymentMethod::Card,
common_enums::PaymentMethodType::Credit,
- Some(card_network),
+ card.card_network.clone(),
))
}
- api_models::payments::PaymentMethodData::CardRedirect(card_redirect_data) => Ok((
+ api_models::payments::PaymentMethodData::CardRedirect(card_redirect_data) => Some((
common_enums::PaymentMethod::CardRedirect,
card_redirect_data.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::Wallet(wallet) => Ok((
+ api_models::payments::PaymentMethodData::Wallet(wallet) => Some((
common_enums::PaymentMethod::Wallet,
wallet.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::PayLater(pay_later) => Ok((
+ api_models::payments::PaymentMethodData::PayLater(pay_later) => Some((
common_enums::PaymentMethod::PayLater,
pay_later.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::BankRedirect(bank_redirect) => Ok((
+ api_models::payments::PaymentMethodData::BankRedirect(bank_redirect) => Some((
common_enums::PaymentMethod::BankRedirect,
bank_redirect.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::BankDebit(bank_debit) => Ok((
+ api_models::payments::PaymentMethodData::BankDebit(bank_debit) => Some((
common_enums::PaymentMethod::BankDebit,
bank_debit.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::BankTransfer(bank_transfer) => Ok((
+ api_models::payments::PaymentMethodData::BankTransfer(bank_transfer) => Some((
common_enums::PaymentMethod::BankTransfer,
bank_transfer.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::Crypto(crypto) => Ok((
+ api_models::payments::PaymentMethodData::Crypto(crypto) => Some((
common_enums::PaymentMethod::Crypto,
crypto.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::MandatePayment => {
- Err(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "payment_method_data",
- }
- .into())
- }
- api_models::payments::PaymentMethodData::Reward => {
- Err(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "payment_method_data",
- }
- .into())
- }
- api_models::payments::PaymentMethodData::Upi(_) => Ok((
+ api_models::payments::PaymentMethodData::MandatePayment => None,
+ api_models::payments::PaymentMethodData::Reward => None,
+ api_models::payments::PaymentMethodData::Upi(_) => Some((
common_enums::PaymentMethod::Upi,
common_enums::PaymentMethodType::UpiCollect,
None,
)),
- api_models::payments::PaymentMethodData::Voucher(voucher) => Ok((
+ api_models::payments::PaymentMethodData::Voucher(voucher) => Some((
common_enums::PaymentMethod::Voucher,
voucher.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::GiftCard(gift_card) => Ok((
+ api_models::payments::PaymentMethodData::GiftCard(gift_card) => Some((
common_enums::PaymentMethod::GiftCard,
gift_card.get_payment_method_type(),
None,
)),
- api_models::payments::PaymentMethodData::CardToken(_) => {
- Err(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "payment_method_data",
- }
- .into())
- }
+ api_models::payments::PaymentMethodData::CardToken(_) => None,
}
}
|
fix
|
surcharge with saved card failure (#3318)
|
7c639bf878a96212c6e5c03e86a3787c2bc1e151
|
2024-06-25 18:42:47
|
Shankar Singh C
|
feat(router): updated `last_used_at` field for apple pay and google pay for CITs (#5087)
| false
|
diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs
index 7fb0cfa28af..2bb981d03e8 100644
--- a/crates/router/src/core/mandate/helpers.rs
+++ b/crates/router/src/core/mandate/helpers.rs
@@ -70,9 +70,11 @@ pub fn get_mandate_type(
Ok(Some(api::MandateTransactionType::NewMandateTransaction))
}
- (_, _, Some(enums::FutureUsage::OffSession), _, Some(_)) | (_, Some(_), _, _, _) => Ok(
- Some(api::MandateTransactionType::RecurringMandateTransaction),
- ),
+ (_, _, Some(enums::FutureUsage::OffSession), _, Some(_))
+ | (_, Some(_), _, _, _)
+ | (_, _, Some(enums::FutureUsage::OffSession), _, _) => Ok(Some(
+ api::MandateTransactionType::RecurringMandateTransaction,
+ )),
_ => Ok(None),
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 9802860ef95..e9df375ab6e 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -533,6 +533,63 @@ pub async fn get_token_pm_type_mandate_details(
mandate_generic_data.mandate_connector,
mandate_generic_data.payment_method_info,
)
+ } else if request.payment_method_type
+ == Some(api_models::enums::PaymentMethodType::ApplePay)
+ || request.payment_method_type
+ == Some(api_models::enums::PaymentMethodType::GooglePay)
+ {
+ if let Some(customer_id) = &request.customer_id {
+ let customer_saved_pm_option = match state
+ .store
+ .find_payment_method_by_customer_id_merchant_id_list(
+ customer_id,
+ merchant_account.merchant_id.as_str(),
+ None,
+ )
+ .await
+ {
+ Ok(customer_payment_methods) => Ok(customer_payment_methods
+ .iter()
+ .find(|payment_method| {
+ payment_method.payment_method_type
+ == request.payment_method_type
+ })
+ .cloned()),
+ Err(error) => {
+ if error.current_context().is_db_not_found() {
+ Ok(None)
+ } else {
+ Err(error)
+ .change_context(
+ errors::ApiErrorResponse::InternalServerError,
+ )
+ .attach_printable(
+ "failed to find payment methods for a customer",
+ )
+ }
+ }
+ }?;
+
+ (
+ None,
+ request.payment_method,
+ request.payment_method_type,
+ None,
+ None,
+ None,
+ customer_saved_pm_option,
+ )
+ } else {
+ (
+ None,
+ request.payment_method,
+ request.payment_method_type,
+ None,
+ None,
+ None,
+ None,
+ )
+ }
} else {
(
request.payment_token.to_owned(),
|
feat
|
updated `last_used_at` field for apple pay and google pay for CITs (#5087)
|
8bcda2cea480083179bd071e8ff466103e61efc1
|
2024-08-14 14:56:18
|
Sanchith Hegde
|
refactor(webhook_events): allow listing unique webhook events based on profile ID (#5598)
| false
|
diff --git a/api-reference/api-reference/event/events--delivery-attempt-list.mdx b/api-reference/api-reference/event/events--delivery-attempt-list.mdx
index 04cad3e5e17..52ed085f9d3 100644
--- a/api-reference/api-reference/event/events--delivery-attempt-list.mdx
+++ b/api-reference/api-reference/event/events--delivery-attempt-list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /events/{merchant_id_or_profile_id}/{event_id}/attempts
+openapi: get /events/{merchant_id}/{event_id}/attempts
---
\ No newline at end of file
diff --git a/api-reference/api-reference/event/events--list.mdx b/api-reference/api-reference/event/events--list.mdx
index 580b705052c..0b02af87e61 100644
--- a/api-reference/api-reference/event/events--list.mdx
+++ b/api-reference/api-reference/event/events--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /events/{merchant_id_or_profile_id}
+openapi: get /events/{merchant_id}
---
\ No newline at end of file
diff --git a/api-reference/api-reference/event/events--manual-retry.mdx b/api-reference/api-reference/event/events--manual-retry.mdx
index 2bc2fce304a..d52cb414bbf 100644
--- a/api-reference/api-reference/event/events--manual-retry.mdx
+++ b/api-reference/api-reference/event/events--manual-retry.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /events/{merchant_id_or_profile_id}/{event_id}/retry
+openapi: post /events/{merchant_id}/{event_id}/retry
---
\ No newline at end of file
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index e1634359565..b2383e2cb81 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -4658,7 +4658,7 @@
]
}
},
- "/events/{merchant_id_or_profile_id}": {
+ "/events/{merchant_id}": {
"get": {
"tags": [
"Event"
@@ -4668,9 +4668,9 @@
"operationId": "List all Events associated with a Merchant Account or Business Profile",
"parameters": [
{
- "name": "merchant_id_or_profile_id",
+ "name": "merchant_id",
"in": "path",
- "description": "The unique identifier for the Merchant Account or Business Profile",
+ "description": "The unique identifier for the Merchant Account.",
"required": true,
"schema": {
"type": "string"
@@ -4729,6 +4729,16 @@
"type": "string",
"nullable": true
}
+ },
+ {
+ "name": "profile_id",
+ "in": "query",
+ "description": "Only include Events associated with the Business Profile identified by the specified Business Profile ID.",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
}
],
"responses": {
@@ -4753,7 +4763,7 @@
]
}
},
- "/events/{merchant_id_or_profile_id}/{event_id}/attempts": {
+ "/events/{merchant_id}/{event_id}/attempts": {
"get": {
"tags": [
"Event"
@@ -4763,9 +4773,9 @@
"operationId": "List all delivery attempts for an Event",
"parameters": [
{
- "name": "merchant_id_or_profile_id",
+ "name": "merchant_id",
"in": "path",
- "description": "The unique identifier for the Merchant Account or Business Profile",
+ "description": "The unique identifier for the Merchant Account.",
"required": true,
"schema": {
"type": "string"
@@ -4803,7 +4813,7 @@
]
}
},
- "/events/{merchant_id_or_profile_id}/{event_id}/retry": {
+ "/events/{merchant_id}/{event_id}/retry": {
"post": {
"tags": [
"Event"
@@ -4813,9 +4823,9 @@
"operationId": "Manually retry the delivery of an Event",
"parameters": [
{
- "name": "merchant_id_or_profile_id",
+ "name": "merchant_id",
"in": "path",
- "description": "The unique identifier for the Merchant Account or Business Profile",
+ "description": "The unique identifier for the Merchant Account.",
"required": true,
"schema": {
"type": "string"
diff --git a/crates/api_models/src/webhook_events.rs b/crates/api_models/src/webhook_events.rs
index 2dcc6d64323..fa61cc0f253 100644
--- a/crates/api_models/src/webhook_events.rs
+++ b/crates/api_models/src/webhook_events.rs
@@ -24,6 +24,9 @@ pub struct EventListConstraints {
/// Filter all events associated with the specified object identifier (Payment Intent ID,
/// Refund ID, etc.)
pub object_id: Option<String>,
+
+ /// Filter all events associated with the specified business profile ID.
+ pub profile_id: Option<String>,
}
#[derive(Debug)]
@@ -97,11 +100,7 @@ pub struct EventRetrieveResponse {
impl common_utils::events::ApiEventMetric for EventRetrieveResponse {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Events {
- merchant_id_or_profile_id: self
- .event_information
- .merchant_id
- .get_string_repr()
- .to_owned(),
+ merchant_id: self.event_information.merchant_id.clone(),
})
}
}
@@ -148,42 +147,42 @@ pub struct OutgoingWebhookResponseContent {
#[derive(Debug, serde::Serialize)]
pub struct EventListRequestInternal {
- pub merchant_id_or_profile_id: String,
+ pub merchant_id: common_utils::id_type::MerchantId,
pub constraints: EventListConstraints,
}
impl common_utils::events::ApiEventMetric for EventListRequestInternal {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Events {
- merchant_id_or_profile_id: self.merchant_id_or_profile_id.clone(),
+ merchant_id: self.merchant_id.clone(),
})
}
}
#[derive(Debug, serde::Serialize)]
pub struct WebhookDeliveryAttemptListRequestInternal {
- pub merchant_id_or_profile_id: String,
+ pub merchant_id: common_utils::id_type::MerchantId,
pub initial_attempt_id: String,
}
impl common_utils::events::ApiEventMetric for WebhookDeliveryAttemptListRequestInternal {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Events {
- merchant_id_or_profile_id: self.merchant_id_or_profile_id.clone(),
+ merchant_id: self.merchant_id.clone(),
})
}
}
#[derive(Debug, serde::Serialize)]
pub struct WebhookDeliveryRetryRequestInternal {
- pub merchant_id_or_profile_id: String,
+ pub merchant_id: common_utils::id_type::MerchantId,
pub event_id: String,
}
impl common_utils::events::ApiEventMetric for WebhookDeliveryRetryRequestInternal {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Events {
- merchant_id_or_profile_id: self.merchant_id_or_profile_id.clone(),
+ merchant_id: self.merchant_id.clone(),
})
}
}
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index c2294f865ae..ac4b9c42a41 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -58,7 +58,7 @@ pub enum ApiEventsType {
dispute_id: String,
},
Events {
- merchant_id_or_profile_id: String,
+ merchant_id: id_type::MerchantId,
},
PaymentMethodCollectLink {
link_id: String,
diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs
index 09fa700dae6..fb80449cdc6 100644
--- a/crates/diesel_models/src/query/business_profile.rs
+++ b/crates/diesel_models/src/query/business_profile.rs
@@ -48,6 +48,20 @@ impl BusinessProfile {
.await
}
+ pub async fn find_by_merchant_id_profile_id(
+ conn: &PgPooledConn,
+ merchant_id: &common_utils::id_type::MerchantId,
+ profile_id: &str,
+ ) -> StorageResult<Self> {
+ generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+ conn,
+ dsl::merchant_id
+ .eq(merchant_id.to_owned())
+ .and(dsl::profile_id.eq(profile_id.to_owned())),
+ )
+ .await
+ }
+
pub async fn find_by_profile_name_merchant_id(
conn: &PgPooledConn,
profile_name: &str,
diff --git a/crates/openapi/src/routes/webhook_events.rs b/crates/openapi/src/routes/webhook_events.rs
index fc06ffee580..c754f59e517 100644
--- a/crates/openapi/src/routes/webhook_events.rs
+++ b/crates/openapi/src/routes/webhook_events.rs
@@ -3,12 +3,12 @@
/// List all Events associated with a Merchant Account or Business Profile.
#[utoipa::path(
get,
- path = "/events/{merchant_id_or_profile_id}",
+ path = "/events/{merchant_id}",
params(
(
- "merchant_id_or_profile_id" = String,
+ "merchant_id" = String,
Path,
- description = "The unique identifier for the Merchant Account or Business Profile"
+ description = "The unique identifier for the Merchant Account."
),
(
"created_after" = Option<PrimitiveDateTime>,
@@ -40,6 +40,11 @@
description = "Only include Events associated with the specified object (Payment Intent ID, Refund ID, etc.). \
Either only `object_id` must be specified, or one or more of `created_after`, `created_before`, `limit` and `offset` must be specified."
),
+ (
+ "profile_id" = Option<String>,
+ Query,
+ description = "Only include Events associated with the Business Profile identified by the specified Business Profile ID."
+ ),
),
responses(
(status = 200, description = "List of Events retrieved successfully", body = Vec<EventListItemResponse>),
@@ -55,9 +60,9 @@ pub fn list_initial_webhook_delivery_attempts() {}
/// List all delivery attempts for the specified Event.
#[utoipa::path(
get,
- path = "/events/{merchant_id_or_profile_id}/{event_id}/attempts",
+ path = "/events/{merchant_id}/{event_id}/attempts",
params(
- ("merchant_id_or_profile_id" = String, Path, description = "The unique identifier for the Merchant Account or Business Profile"),
+ ("merchant_id" = String, Path, description = "The unique identifier for the Merchant Account."),
("event_id" = String, Path, description = "The unique identifier for the Event"),
),
responses(
@@ -74,9 +79,9 @@ pub fn list_webhook_delivery_attempts() {}
/// Manually retry the delivery of the specified Event.
#[utoipa::path(
post,
- path = "/events/{merchant_id_or_profile_id}/{event_id}/retry",
+ path = "/events/{merchant_id}/{event_id}/retry",
params(
- ("merchant_id_or_profile_id" = String, Path, description = "The unique identifier for the Merchant Account or Business Profile"),
+ ("merchant_id" = String, Path, description = "The unique identifier for the Merchant Account."),
("event_id" = String, Path, description = "The unique identifier for the Event"),
),
responses(
diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs
index e7d0483a76b..cf4a8d87263 100644
--- a/crates/router/src/core/webhooks/webhook_events.rs
+++ b/crates/router/src/core/webhooks/webhook_events.rs
@@ -15,23 +15,23 @@ const INITIAL_DELIVERY_ATTEMPTS_LIST_MAX_LIMIT: i64 = 100;
#[derive(Debug)]
enum MerchantAccountOrBusinessProfile {
MerchantAccount(domain::MerchantAccount),
- #[allow(dead_code)]
BusinessProfile(domain::BusinessProfile),
}
#[instrument(skip(state))]
pub async fn list_initial_delivery_attempts(
state: SessionState,
- merchant_id_or_profile_id: String,
+ merchant_id: common_utils::id_type::MerchantId,
constraints: api::webhook_events::EventListConstraints,
) -> RouterResponse<Vec<api::webhook_events::EventListItemResponse>> {
+ let profile_id = constraints.profile_id.clone();
let constraints =
api::webhook_events::EventListConstraintsInternal::foreign_try_from(constraints)?;
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
let (account, key_store) =
- determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?;
+ get_account_and_key_store(state.clone(), merchant_id, profile_id).await?;
let events = match constraints {
api_models::webhook_events::EventListConstraintsInternal::ObjectIdFilter { object_id } => {
@@ -110,38 +110,31 @@ pub async fn list_initial_delivery_attempts(
#[instrument(skip(state))]
pub async fn list_delivery_attempts(
state: SessionState,
- merchant_id_or_profile_id: String,
+ merchant_id: common_utils::id_type::MerchantId,
initial_attempt_id: String,
) -> RouterResponse<Vec<api::webhook_events::EventRetrieveResponse>> {
let store = state.store.as_ref();
-
- let (account, key_store) =
- determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?;
let key_manager_state = &(&state).into();
- let events = match account {
- MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => {
- store
- .list_events_by_merchant_id_initial_attempt_id(
- key_manager_state,
- merchant_account.get_id(),
- &initial_attempt_id,
- &key_store,
- )
- .await
- }
- MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => {
- store
- .list_events_by_profile_id_initial_attempt_id(
- key_manager_state,
- &business_profile.profile_id,
- &initial_attempt_id,
- &key_store,
- )
- .await
- }
- }
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to list delivery attempts for initial event")?;
+
+ let key_store = store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &merchant_id,
+ &store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+
+ let events = store
+ .list_events_by_merchant_id_initial_attempt_id(
+ key_manager_state,
+ &merchant_id,
+ &initial_attempt_id,
+ &key_store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to list delivery attempts for initial event")?;
if events.is_empty() {
Err(error_stack::report!(
@@ -161,13 +154,20 @@ pub async fn list_delivery_attempts(
#[instrument(skip(state))]
pub async fn retry_delivery_attempt(
state: SessionState,
- merchant_id_or_profile_id: String,
+ merchant_id: common_utils::id_type::MerchantId,
event_id: String,
) -> RouterResponse<api::webhook_events::EventRetrieveResponse> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
- let (account, key_store) =
- determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?;
+
+ let key_store = store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &merchant_id,
+ &store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
let event_to_retry = store
.find_event_by_merchant_id_event_id(
@@ -179,25 +179,16 @@ pub async fn retry_delivery_attempt(
.await
.to_not_found_response(errors::ApiErrorResponse::EventNotFound)?;
- let business_profile = match account {
- MerchantAccountOrBusinessProfile::MerchantAccount(_) => {
- let business_profile_id = event_to_retry
- .business_profile_id
- .get_required_value("business_profile_id")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to read business profile ID from event to retry")?;
- store
- .find_business_profile_by_profile_id(
- key_manager_state,
- &key_store,
- &business_profile_id,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to find business profile")
- }
- MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => Ok(business_profile),
- }?;
+ let business_profile_id = event_to_retry
+ .business_profile_id
+ .get_required_value("business_profile_id")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to read business profile ID from event to retry")?;
+ let business_profile = store
+ .find_business_profile_by_profile_id(key_manager_state, &key_store, &business_profile_id)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to find business profile")?;
let delivery_attempt = storage::enums::WebhookDeliveryAttempt::ManualRetry;
let new_event_id = super::utils::generate_event_id();
@@ -271,77 +262,65 @@ pub async fn retry_delivery_attempt(
))
}
-async fn determine_identifier_and_get_key_store(
+async fn get_account_and_key_store(
state: SessionState,
- merchant_id_or_profile_id: String,
+ merchant_id: common_utils::id_type::MerchantId,
+ profile_id: Option<String>,
) -> errors::RouterResult<(MerchantAccountOrBusinessProfile, domain::MerchantKeyStore)> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
- let merchant_id = common_utils::id_type::MerchantId::try_from(std::borrow::Cow::from(
- merchant_id_or_profile_id.clone(),
- ))
- .change_context(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "merchant_id",
- })?;
- match store
+ let merchant_key_store = store
.get_merchant_key_store_by_merchant_id(
key_manager_state,
&merchant_id,
&store.get_master_key().to_vec().into(),
)
.await
- {
- // Since a merchant key store was found with `merchant_id` = `merchant_id_or_profile_id`,
- // `merchant_id_or_profile_id` is a valid merchant ID.
- // Find a merchant account having `merchant_id` = `merchant_id_or_profile_id`.
- Ok(key_store) => {
- let merchant_account = store
- .find_merchant_account_by_merchant_id(key_manager_state, &merchant_id, &key_store)
- .await
- .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
-
- Ok((
- MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account),
- key_store,
- ))
- }
-
- /*
- // Since no merchant key store was found with `merchant_id` = `merchant_id_or_profile_id`,
- // `merchant_id_or_profile_id` is not a valid merchant ID.
- // Assuming that `merchant_id_or_profile_id` is a business profile ID, try to find a
- // business profile having `profile_id` = `merchant_id_or_profile_id`.
- Err(error) if error.current_context().is_db_not_found() => {
- router_env::logger::debug!(
- ?error,
- %merchant_id_or_profile_id,
- "Failed to find merchant key store for the specified merchant ID or business profile ID"
- );
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ match profile_id {
+ // If profile ID is specified, return business profile, since a business profile is more
+ // specific than a merchant account.
+ Some(profile_id) => {
let business_profile = store
- .find_business_profile_by_profile_id(&merchant_id_or_profile_id)
+ .find_business_profile_by_merchant_id_profile_id(
+ key_manager_state,
+ &merchant_key_store,
+ &merchant_id,
+ &profile_id,
+ )
.await
+ .attach_printable_lazy(|| {
+ format!(
+ "Failed to find business profile by merchant_id `{merchant_id:?}` and profile_id `{profile_id}`. \
+ The merchant_id associated with the business profile `{profile_id}` may be \
+ different than the merchant_id specified (`{merchant_id:?}`)."
+ )
+ })
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: merchant_id_or_profile_id,
+ id: profile_id,
})?;
- let key_store = store
- .get_merchant_key_store_by_merchant_id(
+ Ok((
+ MerchantAccountOrBusinessProfile::BusinessProfile(business_profile),
+ merchant_key_store,
+ ))
+ }
+
+ None => {
+ let merchant_account = store
+ .find_merchant_account_by_merchant_id(
key_manager_state,
- &business_profile.merchant_id,
- &store.get_master_key().to_vec().into(),
+ &merchant_id,
+ &merchant_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
Ok((
- MerchantAccountOrBusinessProfile::BusinessProfile(business_profile),
- key_store,
+ MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account),
+ merchant_key_store,
))
}
- */
- Err(error) => Err(error)
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to find merchant key store by merchant ID"),
}
}
diff --git a/crates/router/src/db/business_profile.rs b/crates/router/src/db/business_profile.rs
index 7b7de43d60e..ed178f275fd 100644
--- a/crates/router/src/db/business_profile.rs
+++ b/crates/router/src/db/business_profile.rs
@@ -36,6 +36,14 @@ where
profile_id: &str,
) -> CustomResult<domain::BusinessProfile, errors::StorageError>;
+ async fn find_business_profile_by_merchant_id_profile_id(
+ &self,
+ key_manager_state: &KeyManagerState,
+ merchant_key_store: &domain::MerchantKeyStore,
+ merchant_id: &common_utils::id_type::MerchantId,
+ profile_id: &str,
+ ) -> CustomResult<domain::BusinessProfile, errors::StorageError>;
+
async fn find_business_profile_by_profile_name_merchant_id(
&self,
key_manager_state: &KeyManagerState,
@@ -112,6 +120,26 @@ impl BusinessProfileInterface for Store {
.change_context(errors::StorageError::DecryptionError)
}
+ async fn find_business_profile_by_merchant_id_profile_id(
+ &self,
+ key_manager_state: &KeyManagerState,
+ merchant_key_store: &domain::MerchantKeyStore,
+ merchant_id: &common_utils::id_type::MerchantId,
+ profile_id: &str,
+ ) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ storage::BusinessProfile::find_by_merchant_id_profile_id(&conn, merchant_id, profile_id)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))?
+ .convert(
+ key_manager_state,
+ merchant_key_store.key.get_inner(),
+ merchant_key_store.merchant_id.clone().into(),
+ )
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ }
+
#[instrument(skip_all)]
async fn find_business_profile_by_profile_name_merchant_id(
&self,
@@ -262,6 +290,42 @@ impl BusinessProfileInterface for MockDb {
)
}
+ async fn find_business_profile_by_merchant_id_profile_id(
+ &self,
+ key_manager_state: &KeyManagerState,
+ merchant_key_store: &domain::MerchantKeyStore,
+ merchant_id: &common_utils::id_type::MerchantId,
+ profile_id: &str,
+ ) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
+ self.business_profiles
+ .lock()
+ .await
+ .iter()
+ .find(|business_profile| {
+ business_profile.merchant_id == *merchant_id
+ && business_profile.profile_id == profile_id
+ })
+ .cloned()
+ .async_map(|business_profile| async {
+ business_profile
+ .convert(
+ key_manager_state,
+ merchant_key_store.key.get_inner(),
+ merchant_key_store.merchant_id.clone().into(),
+ )
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await
+ .transpose()?
+ .ok_or(
+ errors::StorageError::ValueNotFound(format!(
+ "No business profile found for merchant_id = {merchant_id:?} and profile_id = {profile_id}"
+ ))
+ .into(),
+ )
+ }
+
async fn update_business_profile_by_profile_id(
&self,
key_manager_state: &KeyManagerState,
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 3b0f789cf04..edd1eecff95 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -84,14 +84,6 @@ where
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Event>, errors::StorageError>;
- async fn list_events_by_profile_id_initial_attempt_id(
- &self,
- state: &KeyManagerState,
- profile_id: &str,
- initial_attempt_id: &str,
- merchant_key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Vec<domain::Event>, errors::StorageError>;
-
async fn update_event_by_merchant_id_event_id(
&self,
state: &KeyManagerState,
@@ -338,37 +330,6 @@ impl EventInterface for Store {
.await
}
- #[instrument(skip_all)]
- async fn list_events_by_profile_id_initial_attempt_id(
- &self,
- state: &KeyManagerState,
- profile_id: &str,
- initial_attempt_id: &str,
- merchant_key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
- let conn = connection::pg_connection_read(self).await?;
- storage::Event::list_by_profile_id_initial_attempt_id(&conn, profile_id, initial_attempt_id)
- .await
- .map_err(|error| report!(errors::StorageError::from(error)))
- .async_and_then(|events| async {
- let mut domain_events = Vec::with_capacity(events.len());
- for event in events.into_iter() {
- domain_events.push(
- event
- .convert(
- state,
- merchant_key_store.key.get_inner(),
- merchant_key_store.merchant_id.clone().into(),
- )
- .await
- .change_context(errors::StorageError::DecryptionError)?,
- );
- }
- Ok(domain_events)
- })
- .await
- }
-
#[instrument(skip_all)]
async fn update_event_by_merchant_id_event_id(
&self,
@@ -695,39 +656,6 @@ impl EventInterface for MockDb {
Ok(domain_events)
}
- async fn list_events_by_profile_id_initial_attempt_id(
- &self,
- state: &KeyManagerState,
- profile_id: &str,
- initial_attempt_id: &str,
- merchant_key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
- let locked_events = self.events.lock().await;
- let events = locked_events
- .iter()
- .filter(|event| {
- event.business_profile_id == Some(profile_id.to_owned())
- && event.initial_attempt_id == Some(initial_attempt_id.to_owned())
- })
- .cloned()
- .collect::<Vec<_>>();
- let mut domain_events = Vec::with_capacity(events.len());
-
- for event in events {
- let domain_event = event
- .convert(
- state,
- merchant_key_store.key.get_inner(),
- merchant_key_store.merchant_id.clone().into(),
- )
- .await
- .change_context(errors::StorageError::DecryptionError)?;
- domain_events.push(domain_event);
- }
-
- Ok(domain_events)
- }
-
async fn update_event_by_merchant_id_event_id(
&self,
state: &KeyManagerState,
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 31b9ffcd7f8..ddae52c243b 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -668,23 +668,6 @@ impl EventInterface for KafkaStore {
.await
}
- async fn list_events_by_profile_id_initial_attempt_id(
- &self,
- state: &KeyManagerState,
- profile_id: &str,
- initial_attempt_id: &str,
- merchant_key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
- self.diesel_store
- .list_events_by_profile_id_initial_attempt_id(
- state,
- profile_id,
- initial_attempt_id,
- merchant_key_store,
- )
- .await
- }
-
async fn update_event_by_merchant_id_event_id(
&self,
state: &KeyManagerState,
@@ -2270,6 +2253,23 @@ impl BusinessProfileInterface for KafkaStore {
.await
}
+ async fn find_business_profile_by_merchant_id_profile_id(
+ &self,
+ key_manager_state: &KeyManagerState,
+ merchant_key_store: &domain::MerchantKeyStore,
+ merchant_id: &id_type::MerchantId,
+ profile_id: &str,
+ ) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
+ self.diesel_store
+ .find_business_profile_by_merchant_id_profile_id(
+ key_manager_state,
+ merchant_key_store,
+ merchant_id,
+ profile_id,
+ )
+ .await
+ }
+
async fn update_business_profile_by_profile_id(
&self,
key_manager_state: &KeyManagerState,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 614774ebb04..a705c603003 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1762,7 +1762,7 @@ pub struct WebhookEvents;
#[cfg(feature = "olap")]
impl WebhookEvents {
pub fn server(config: AppState) -> Scope {
- web::scope("/events/{merchant_id_or_profile_id}")
+ web::scope("/events/{merchant_id}")
.app_data(web::Data::new(config))
.service(web::resource("").route(web::get().to(list_initial_webhook_delivery_attempts)))
.service(
diff --git a/crates/router/src/routes/webhook_events.rs b/crates/router/src/routes/webhook_events.rs
index 548ee652599..d5150ad1fef 100644
--- a/crates/router/src/routes/webhook_events.rs
+++ b/crates/router/src/routes/webhook_events.rs
@@ -19,11 +19,11 @@ pub async fn list_initial_webhook_delivery_attempts(
query: web::Query<EventListConstraints>,
) -> impl Responder {
let flow = Flow::WebhookEventInitialDeliveryAttemptList;
- let merchant_id_or_profile_id = path.into_inner();
+ let merchant_id = path.into_inner();
let constraints = query.into_inner();
let request_internal = EventListRequestInternal {
- merchant_id_or_profile_id: merchant_id_or_profile_id.get_string_repr().to_string(),
+ merchant_id: merchant_id.clone(),
constraints,
};
@@ -35,14 +35,14 @@ pub async fn list_initial_webhook_delivery_attempts(
|state, _, request_internal, _| {
webhook_events::list_initial_delivery_attempts(
state,
- request_internal.merchant_id_or_profile_id,
+ request_internal.merchant_id,
request_internal.constraints,
)
},
auth::auth_type(
&auth::AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
- merchant_id: merchant_id_or_profile_id,
+ merchant_id,
required_permission: Permission::WebhookEventRead,
},
req.headers(),
@@ -59,10 +59,10 @@ pub async fn list_webhook_delivery_attempts(
path: web::Path<(common_utils::id_type::MerchantId, String)>,
) -> impl Responder {
let flow = Flow::WebhookEventDeliveryAttemptList;
- let (merchant_id_or_profile_id, initial_attempt_id) = path.into_inner();
+ let (merchant_id, initial_attempt_id) = path.into_inner();
let request_internal = WebhookDeliveryAttemptListRequestInternal {
- merchant_id_or_profile_id: merchant_id_or_profile_id.get_string_repr().to_string(),
+ merchant_id: merchant_id.clone(),
initial_attempt_id,
};
@@ -74,14 +74,14 @@ pub async fn list_webhook_delivery_attempts(
|state, _, request_internal, _| {
webhook_events::list_delivery_attempts(
state,
- request_internal.merchant_id_or_profile_id,
+ request_internal.merchant_id,
request_internal.initial_attempt_id,
)
},
auth::auth_type(
&auth::AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
- merchant_id: merchant_id_or_profile_id,
+ merchant_id,
required_permission: Permission::WebhookEventRead,
},
req.headers(),
@@ -98,10 +98,10 @@ pub async fn retry_webhook_delivery_attempt(
path: web::Path<(common_utils::id_type::MerchantId, String)>,
) -> impl Responder {
let flow = Flow::WebhookEventDeliveryRetry;
- let (merchant_id_or_profile_id, event_id) = path.into_inner();
+ let (merchant_id, event_id) = path.into_inner();
let request_internal = WebhookDeliveryRetryRequestInternal {
- merchant_id_or_profile_id: merchant_id_or_profile_id.get_string_repr().to_string(),
+ merchant_id: merchant_id.clone(),
event_id,
};
@@ -113,14 +113,14 @@ pub async fn retry_webhook_delivery_attempt(
|state, _, request_internal, _| {
webhook_events::retry_delivery_attempt(
state,
- request_internal.merchant_id_or_profile_id,
+ request_internal.merchant_id,
request_internal.event_id,
)
},
auth::auth_type(
&auth::AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
- merchant_id: merchant_id_or_profile_id,
+ merchant_id,
required_permission: Permission::WebhookEventWrite,
},
req.headers(),
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 7e7e7b8b40f..30857f797fb 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -1033,70 +1033,6 @@ where
}
}
-/*
-pub struct JWTAuthMerchantOrProfileFromRoute {
- pub merchant_id_or_profile_id: String,
- pub required_permission: Permission,
-}
-
-#[async_trait]
-impl<A> AuthenticateAndFetch<(), A> for JWTAuthMerchantOrProfileFromRoute
-where
- A: SessionStateInfo + Sync,
-{
- async fn authenticate_and_fetch(
- &self,
- request_headers: &HeaderMap,
- state: &A,
- ) -> RouterResult<((), AuthenticationType)> {
- let payload = parse_jwt_payload::<A, AuthToken>(request_headers, state).await?;
- if payload.check_in_blacklist(state).await? {
- return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
- }
-
- let permissions = authorization::get_permissions(state, &payload).await?;
- authorization::check_authorization(&self.required_permission, &permissions)?;
-
- // Check if token has access to MerchantId that has been requested through path or query param
- if payload.merchant_id.get_string_repr() == self.merchant_id_or_profile_id {
- return Ok((
- (),
- AuthenticationType::MerchantJwt {
- merchant_id: payload.merchant_id,
- user_id: Some(payload.user_id),
- },
- ));
- }
-
- // Route did not contain the merchant ID in present JWT, check if it corresponds to a
- // business profile
- let business_profile = state
- .store()
- .find_business_profile_by_profile_id(&self.merchant_id_or_profile_id)
- .await
- // Return access forbidden if business profile not found
- .to_not_found_response(errors::ApiErrorResponse::AccessForbidden {
- resource: self.merchant_id_or_profile_id.clone(),
- })
- .attach_printable("Could not find business profile specified in route")?;
-
- // Check if merchant (from JWT) has access to business profile that has been requested
- // through path or query param
- if payload.merchant_id == business_profile.merchant_id {
- Ok((
- (),
- AuthenticationType::MerchantJwt {
- merchant_id: payload.merchant_id,
- user_id: Some(payload.user_id),
- },
- ))
- } else {
- Err(report!(errors::ApiErrorResponse::InvalidJwtToken))
- }
- }
-}
-*/
-
pub async fn parse_jwt_payload<A, T>(headers: &HeaderMap, state: &A) -> RouterResult<T>
where
T: serde::de::DeserializeOwned,
|
refactor
|
allow listing unique webhook events based on profile ID (#5598)
|
982c27fce72074d2644c0a9f229b201b927c55da
|
2023-05-08 14:31:49
|
Nishant Joshi
|
fix(redis): fix recreation on redis connection pool (#1063)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 46c98b30cc9..82cc4015a53 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2950,7 +2950,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",
@@ -2959,7 +2959,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",
@@ -2976,7 +2976,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",
@@ -2988,7 +2988,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",
@@ -3003,7 +3003,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/redis_interface/src/lib.rs b/crates/redis_interface/src/lib.rs
index 3a4ffdebc5a..5a4789385b5 100644
--- a/crates/redis_interface/src/lib.rs
+++ b/crates/redis_interface/src/lib.rs
@@ -156,6 +156,7 @@ impl RedisConnectionPool {
}
impl Drop for RedisConnectionPool {
+ // safety: panics when invoked without a current tokio runtime
fn drop(&mut self) {
let rt = tokio::runtime::Handle::current();
rt.block_on(self.close_connections())
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 835f076fb9e..a662145b47a 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -23,7 +23,6 @@ use storage_models::{enums as storage_enums, payment_method};
use crate::scheduler::metrics as scheduler_metrics;
use crate::{
configs::settings,
- connection,
core::{
errors::{self, StorageErrorExt},
payment_methods::{
@@ -1531,7 +1530,7 @@ pub async fn list_customer_payment_method(
};
customer_pms.push(pma.to_owned());
- let redis_conn = connection::redis_connection(&state.conf).await;
+ let redis_conn = state.store.get_redis_conn();
let key_for_hyperswitch_token = format!(
"pm_token_{}_{}_hyperswitch",
parent_payment_method_token, pma.payment_method
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index db71a3cca16..6c41f0ce104 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -24,7 +24,6 @@ use self::{
operations::{payment_complete_authorize, BoxedOperation, Operation},
};
use crate::{
- connection,
core::{
errors::{self, CustomResult, RouterResponse, RouterResult},
payment_methods::vault,
@@ -672,7 +671,7 @@ async fn decide_payment_method_tokenize_action(
}
}
Some(token) => {
- let redis_conn = connection::redis_connection(&state.conf).await;
+ let redis_conn = state.store.get_redis_conn();
let key = format!(
"pm_token_{}_{}_{}",
token.to_owned(),
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 365c804f07f..536b29387af 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -19,7 +19,7 @@ use super::{
};
use crate::{
configs::settings::Server,
- connection, consts,
+ consts,
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payment_methods::{cards, vault},
@@ -691,7 +691,7 @@ pub async fn make_pm_data<'a, F: Clone, R>(
let request = &payment_data.payment_method_data;
let token = payment_data.token.clone();
let hyperswitch_token = if let Some(token) = token {
- let redis_conn = connection::redis_connection(&state.conf).await;
+ let redis_conn = state.store.get_redis_conn();
let key = format!(
"pm_token_{}_{}_hyperswitch",
token,
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index a8dadd2ab84..6b017b99ebb 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -25,7 +25,10 @@ use std::sync::Arc;
use futures::lock::Mutex;
-use crate::{services::Store, types::storage};
+use crate::{
+ services::{self, Store},
+ types::storage,
+};
#[derive(PartialEq, Eq)]
pub enum StorageImpl {
@@ -61,10 +64,10 @@ pub trait StorageInterface:
+ refund::RefundInterface
+ reverse_lookup::ReverseLookupInterface
+ cards_info::CardsInfoInterface
+ + services::RedisConnInterface
+ 'static
{
}
-
#[async_trait::async_trait]
impl StorageInterface for Store {}
@@ -117,4 +120,10 @@ where
.change_context(redis_interface::errors::RedisError::JsonDeserializationFailed)
}
+impl services::RedisConnInterface for MockDb {
+ fn get_redis_conn(&self) -> Arc<redis_interface::RedisConnectionPool> {
+ self.redis.clone()
+ }
+}
+
dyn_clone::clone_trait_object!(StorageInterface);
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index 55401156591..8fec99a18fd 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -78,6 +78,10 @@ impl PubSubInterface for redis_interface::RedisConnectionPool {
}
}
+pub trait RedisConnInterface {
+ fn get_redis_conn(&self) -> Arc<redis_interface::RedisConnectionPool>;
+}
+
#[derive(Clone)]
pub struct Store {
pub master_pool: PgPool,
@@ -185,3 +189,9 @@ impl Store {
.change_context(crate::core::errors::StorageError::KVError)
}
}
+
+impl RedisConnInterface for Store {
+ fn get_redis_conn(&self) -> Arc<redis_interface::RedisConnectionPool> {
+ self.redis_conn.clone()
+ }
+}
|
fix
|
fix recreation on redis connection pool (#1063)
|
10a43370e8b6f2f14850a505f89796e7accffcec
|
2024-12-26 16:19:20
|
Shankar Singh C
|
fix(router): populate `profile_id` in for the HeaderAuth of v1 (#6936)
| false
|
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index dd4938d8d6f..6283382258a 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -419,7 +419,7 @@ outgoing_enabled = true
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[saved_payment_methods]
sdk_eligible_payment_methods = "card"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 9ad4f90b71f..3537834fd07 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -435,7 +435,7 @@ outgoing_enabled = true
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[saved_payment_methods]
sdk_eligible_payment_methods = "card"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index d2132cd1e40..fcfadb339d9 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -437,7 +437,7 @@ outgoing_enabled = true
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[saved_payment_methods]
sdk_eligible_payment_methods = "card"
diff --git a/config/development.toml b/config/development.toml
index d157894ac76..4c9b8516b5a 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -768,7 +768,7 @@ enabled = true
file_storage_backend = "file_system"
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[opensearch]
host = "https://localhost:9200"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 3bbb1106350..75699d0a967 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -609,7 +609,7 @@ source = "logs"
file_storage_backend = "file_system"
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[opensearch]
host = "https://opensearch:9200"
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index d35e321a7be..99800b55512 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -666,6 +666,13 @@ where
metrics::PARTIAL_AUTH_FAILURE.add(1, &[]);
};
+ let profile_id = HeaderMapStruct::new(request_headers)
+ .get_id_type_from_header_if_present::<id_type::ProfileId>(headers::X_PROFILE_ID)
+ .change_context(errors::ValidationError::IncorrectValueProvided {
+ field_name: "X-Profile-Id",
+ })
+ .change_context(errors::ApiErrorResponse::Unauthorized)?;
+
let payload = ExtractedPayload::from_headers(request_headers)
.and_then(|value| {
let (algo, secret) = state.get_detached_auth()?;
@@ -687,8 +694,13 @@ where
merchant_id: Some(merchant_id),
key_id: Some(key_id),
} => {
- let auth =
- construct_authentication_data(state, &merchant_id, request_headers).await?;
+ let auth = construct_authentication_data(
+ state,
+ &merchant_id,
+ request_headers,
+ profile_id,
+ )
+ .await?;
Ok((
auth.clone(),
AuthenticationType::ApiKey {
@@ -702,8 +714,13 @@ where
merchant_id: Some(merchant_id),
key_id: None,
} => {
- let auth =
- construct_authentication_data(state, &merchant_id, request_headers).await?;
+ let auth = construct_authentication_data(
+ state,
+ &merchant_id,
+ request_headers,
+ profile_id,
+ )
+ .await?;
Ok((
auth.clone(),
AuthenticationType::PublishableKey {
@@ -779,6 +796,7 @@ async fn construct_authentication_data<A>(
state: &A,
merchant_id: &id_type::MerchantId,
request_headers: &HeaderMap,
+ profile_id: Option<id_type::ProfileId>,
) -> RouterResult<AuthenticationData>
where
A: SessionStateInfo + Sync,
@@ -830,7 +848,7 @@ where
merchant_account: merchant,
platform_merchant_account,
key_store,
- profile_id: None,
+ profile_id,
};
Ok(auth)
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 64d0526d147..ec58ab08b87 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -396,7 +396,7 @@ client_secret = ""
partner_id = ""
[unmasked_headers]
-keys = "accept-language,user-agent"
+keys = "accept-language,user-agent,x-profile-id"
[multitenancy]
enabled = false
|
fix
|
populate `profile_id` in for the HeaderAuth of v1 (#6936)
|
7c0c3b6b35f2654bbb64c9631c308925bbf5226d
|
2023-08-28 09:29:57
|
BallaNitesh
|
feat(connector): [CashToCode] perform currency based connector credentials mapping (#2025)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index c65f30150a0..33e9579d7b7 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -776,7 +776,7 @@ pub enum PaymentMethodData {
BankTransfer(Box<BankTransferData>),
Crypto(CryptoData),
MandatePayment,
- Reward(RewardData),
+ Reward,
Upi(UpiData),
Voucher(VoucherData),
GiftCard(Box<GiftCardData>),
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index e22122138eb..9be092a6720 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -225,6 +225,8 @@ pub enum StripeErrorCode {
PaymentMethodUnactivated,
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "{entity} expired or invalid")]
HyperswitchUnprocessableEntity { entity: String },
+ #[error(error_type = StripeErrorType::InvalidRequestError, code = "", message = "{message}")]
+ CurrencyNotSupported { message: String },
// [#216]: https://github.com/juspay/hyperswitch/issues/216
// Implement the remaining stripe error codes
@@ -553,6 +555,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
Self::MerchantConnectorAccountDisabled
}
errors::ApiErrorResponse::NotSupported { .. } => Self::InternalServerError,
+ errors::ApiErrorResponse::CurrencyNotSupported { message } => {
+ Self::CurrencyNotSupported { message }
+ }
errors::ApiErrorResponse::FileProviderNotSupported { .. } => {
Self::FileProviderNotSupported
}
@@ -628,6 +633,7 @@ impl actix_web::ResponseError for StripeErrorCode {
| Self::FileNotFound
| Self::FileNotAvailable
| Self::FileProviderNotSupported
+ | Self::CurrencyNotSupported { .. }
| Self::PaymentMethodUnactivated => StatusCode::BAD_REQUEST,
Self::RefundFailed
| Self::PayoutFailed
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index a1685d5c19a..30ed9f5d8db 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -369,7 +369,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
api::PaymentMethodData::Crypto(_)
| api::PaymentMethodData::BankDebit(_)
| api::PaymentMethodData::BankTransfer(_)
- | api::PaymentMethodData::Reward(_)
+ | api::PaymentMethodData::Reward
| api::PaymentMethodData::GiftCard(_)
| api::PaymentMethodData::CardRedirect(_)
| api::PaymentMethodData::Upi(_)
diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs
index e50e7a64704..a1e494d4b5e 100644
--- a/crates/router/src/connector/bluesnap/transformers.rs
+++ b/crates/router/src/connector/bluesnap/transformers.rs
@@ -299,7 +299,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BluesnapPaymentsRequest {
| payments::PaymentMethodData::BankTransfer(_)
| payments::PaymentMethodData::Crypto(_)
| payments::PaymentMethodData::MandatePayment
- | payments::PaymentMethodData::Reward(_)
+ | payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_)
| payments::PaymentMethodData::CardRedirect(_)
| payments::PaymentMethodData::Voucher(_)
diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
index b1730fe1b50..2783f948a70 100644
--- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
+++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
@@ -88,7 +88,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
| api_models::payments::PaymentMethodData::BankTransfer(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::GiftCard(_) => {
@@ -149,9 +149,7 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::from(transaction_data.status.clone()),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- transaction_data.id.clone(),
- ),
+ resource_id: types::ResponseId::ConnectorTransactionId(transaction_data.id),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
@@ -616,7 +614,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {
| api_models::payments::PaymentMethodData::BankTransfer(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::GiftCard(_) => {
diff --git a/crates/router/src/connector/cashtocode.rs b/crates/router/src/connector/cashtocode.rs
index cdba0ca6c40..cf417fafe37 100644
--- a/crates/router/src/connector/cashtocode.rs
+++ b/crates/router/src/connector/cashtocode.rs
@@ -2,13 +2,14 @@ pub mod transformers;
use std::fmt::Debug;
+use base64::Engine;
use diesel_models::enums;
use error_stack::{IntoReport, ResultExt};
-use masking::PeekInterface;
+use masking::{PeekInterface, Secret};
use transformers as cashtocode;
use crate::{
- configs::settings,
+ configs::settings::{self},
connector::{utils as connector_utils, utils as conn_utils},
core::errors::{self, CustomResult},
db::StorageInterface,
@@ -42,33 +43,40 @@ impl api::Refund for Cashtocode {}
impl api::RefundExecute for Cashtocode {}
impl api::RefundSync for Cashtocode {}
-fn get_auth_cashtocode(
+fn get_b64_auth_cashtocode(
payment_method_type: &Option<storage::enums::PaymentMethodType>,
- auth_type: &types::ConnectorAuthType,
+ auth_type: &transformers::CashtocodeAuth,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- match (*payment_method_type).ok_or_else(conn_utils::missing_field_err("payment_method_type")) {
- Ok(reward_type) => match reward_type {
- storage::enums::PaymentMethodType::ClassicReward => match auth_type {
- types::ConnectorAuthType::BodyKey { api_key, .. } => Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- format!("Basic {}", api_key.peek()).into_masked(),
- )]),
- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
- },
- storage::enums::PaymentMethodType::Evoucher => match auth_type {
- types::ConnectorAuthType::BodyKey { key1, .. } => Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- format!("Basic {}", key1.peek()).into_masked(),
- )]),
- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
- },
- _ => Err(error_stack::report!(errors::ConnectorError::NotSupported {
- message: reward_type.to_string(),
- connector: "cashtocode",
- })),
- },
- Err(_) => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ fn construct_basic_auth(
+ username: Option<Secret<String>>,
+ password: Option<Secret<String>>,
+ ) -> Result<request::Maskable<String>, errors::ConnectorError> {
+ let username = username.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
+ let password = password.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(format!(
+ "Basic {}",
+ base64::engine::general_purpose::STANDARD.encode(format!(
+ "{}:{}",
+ username.peek(),
+ password.peek()
+ ))
+ )
+ .into_masked())
}
+
+ let auth_header = match payment_method_type {
+ Some(storage::enums::PaymentMethodType::ClassicReward) => construct_basic_auth(
+ auth_type.username_classic.to_owned(),
+ auth_type.password_classic.to_owned(),
+ ),
+ Some(storage::enums::PaymentMethodType::Evoucher) => construct_basic_auth(
+ auth_type.username_evoucher.to_owned(),
+ auth_type.password_evoucher.to_owned(),
+ ),
+ _ => return Err(errors::ConnectorError::MissingPaymentMethodType)?,
+ }?;
+
+ Ok(vec![(headers::AUTHORIZATION.to_string(), auth_header)])
}
impl
@@ -99,18 +107,6 @@ impl ConnectorCommon for Cashtocode {
connectors.cashtocode.base_url.as_ref()
}
- fn get_auth_header(
- &self,
- auth_type: &types::ConnectorAuthType,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let auth = cashtocode::CashtocodeAuthType::try_from(auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- auth.api_key.into_masked(),
- )])
- }
-
fn build_error_response(
&self,
res: Response,
@@ -173,13 +169,14 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
.to_owned()
.into(),
)];
- let auth_differentiator =
- get_auth_cashtocode(&req.request.payment_method_type, &req.connector_auth_type);
- let mut api_key = match auth_differentiator {
- Ok(auth_type) => auth_type,
- Err(err) => return Err(err),
- };
+ let auth_type = transformers::CashtocodeAuth::try_from((
+ &req.connector_auth_type,
+ &req.request.currency,
+ ))?;
+
+ let mut api_key = get_b64_auth_cashtocode(&req.request.payment_method_type, &auth_type)?;
+
header.append(&mut api_key);
Ok(header)
}
diff --git a/crates/router/src/connector/cashtocode/transformers.rs b/crates/router/src/connector/cashtocode/transformers.rs
index 69c5c983393..4db1bef7e3f 100644
--- a/crates/router/src/connector/cashtocode/transformers.rs
+++ b/crates/router/src/connector/cashtocode/transformers.rs
@@ -1,4 +1,7 @@
-use common_utils::pii::Email;
+use std::collections::HashMap;
+
+use common_utils::{ext_traits::ValueExt, pii::Email};
+use error_stack::{IntoReport, ResultExt};
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -6,7 +9,7 @@ use crate::{
connector::utils::{self, PaymentsAuthorizeRequestData, RouterData},
core::errors,
services,
- types::{self, api, storage::enums},
+ types::{self, storage::enums},
};
#[derive(Default, Debug, Serialize)]
@@ -22,47 +25,39 @@ pub struct CashtocodePaymentsRequest {
requested_url: String,
cancel_url: String,
email: Option<Email>,
- mid: String,
-}
-
-pub struct CashToCodeMandatoryParams {
- pub user_id: Secret<String>,
- pub user_alias: Secret<String>,
- pub requested_url: String,
- pub cancel_url: String,
+ mid: Secret<String>,
}
fn get_mid(
- payment_method_data: &api::payments::PaymentMethodData,
-) -> Result<String, errors::ConnectorError> {
- match payment_method_data {
- api_models::payments::PaymentMethodData::Reward(reward_data) => {
- Ok(reward_data.merchant_id.to_string())
- }
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment methods".to_string(),
- )),
+ connector_auth_type: &types::ConnectorAuthType,
+ payment_method_type: Option<enums::PaymentMethodType>,
+ currency: enums::Currency,
+) -> Result<Secret<String>, errors::ConnectorError> {
+ match CashtocodeAuth::try_from((connector_auth_type, ¤cy)) {
+ Ok(cashtocode_auth) => match payment_method_type {
+ Some(enums::PaymentMethodType::ClassicReward) => Ok(cashtocode_auth
+ .merchant_id_classic
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?),
+ Some(enums::PaymentMethodType::Evoucher) => Ok(cashtocode_auth
+ .merchant_id_evoucher
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType),
+ },
+ Err(_) => Err(errors::ConnectorError::FailedToObtainAuthType)?,
}
}
-fn get_mandatory_params(
- item: &types::PaymentsAuthorizeRouterData,
-) -> Result<CashToCodeMandatoryParams, error_stack::Report<errors::ConnectorError>> {
- let customer_id = item.get_customer_id()?;
- let url = item.request.get_router_return_url()?;
- Ok(CashToCodeMandatoryParams {
- user_id: Secret::new(customer_id.to_owned()),
- user_alias: Secret::new(customer_id),
- requested_url: url.to_owned(),
- cancel_url: url,
- })
-}
-
impl TryFrom<&types::PaymentsAuthorizeRouterData> for CashtocodePaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
- let params: CashToCodeMandatoryParams = get_mandatory_params(item)?;
- let mid = get_mid(&item.request.payment_method_data)?;
+ let customer_id = item.get_customer_id()?;
+ let url = item.request.get_router_return_url()?;
+ let mid = get_mid(
+ &item.connector_auth_type,
+ item.request.payment_method_type,
+ item.request.currency,
+ )
+ .into_report()?;
match item.payment_method {
diesel_models::enums::PaymentMethod::Reward => Ok(Self {
amount: utils::to_currency_base_unit_asf64(
@@ -71,12 +66,12 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for CashtocodePaymentsRequest
)?,
transaction_id: item.attempt_id.clone(),
currency: item.request.currency,
- user_id: params.user_id,
+ user_id: Secret::new(customer_id.to_owned()),
first_name: None,
last_name: None,
- user_alias: params.user_alias,
- requested_url: params.requested_url,
- cancel_url: params.cancel_url,
+ user_alias: Secret::new(customer_id),
+ requested_url: url.to_owned(),
+ cancel_url: url,
email: item.request.email.clone(),
mid,
}),
@@ -85,23 +80,77 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for CashtocodePaymentsRequest
}
}
+#[derive(Default, Debug, Deserialize)]
pub struct CashtocodeAuthType {
- pub(super) api_key: Secret<String>,
+ pub auths: HashMap<enums::Currency, CashtocodeAuth>,
+}
+
+#[derive(Default, Debug, Deserialize)]
+pub struct CashtocodeAuth {
+ pub password_classic: Option<Secret<String>>,
+ pub password_evoucher: Option<Secret<String>>,
+ pub username_classic: Option<Secret<String>>,
+ pub username_evoucher: Option<Secret<String>>,
+ pub merchant_id_classic: Option<Secret<String>>,
+ pub merchant_id_evoucher: Option<Secret<String>>,
}
impl TryFrom<&types::ConnectorAuthType> for CashtocodeAuthType {
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = error_stack::Report<errors::ConnectorError>; // Assuming ErrorStack is the appropriate error type
+
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
- }),
+ types::ConnectorAuthType::CurrencyAuthKey { auth_key_map } => {
+ let transformed_auths = auth_key_map
+ .iter()
+ .map(|(currency, identity_auth_key)| {
+ let cashtocode_auth = identity_auth_key
+ .to_owned()
+ .parse_value::<CashtocodeAuth>("CashtocodeAuth")
+ .change_context(errors::ConnectorError::InvalidDataFormat {
+ field_name: "auth_key_map",
+ })?;
+
+ Ok((currency.to_owned(), cashtocode_auth))
+ })
+ .collect::<Result<_, Self::Error>>()?;
+
+ Ok(Self {
+ auths: transformed_auths,
+ })
+ }
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+impl TryFrom<(&types::ConnectorAuthType, &enums::Currency)> for CashtocodeAuth {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(value: (&types::ConnectorAuthType, &enums::Currency)) -> Result<Self, Self::Error> {
+ let (auth_type, currency) = value;
+
+ if let types::ConnectorAuthType::CurrencyAuthKey { auth_key_map } = auth_type {
+ if let Some(identity_auth_key) = auth_key_map.get(currency) {
+ let cashtocode_auth: Self = identity_auth_key
+ .to_owned()
+ .parse_value("CashtocodeAuth")
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(cashtocode_auth)
+ } else {
+ Err(errors::ConnectorError::CurrencyNotSupported {
+ message: currency.to_string(),
+ connector: "CashToCode",
+ }
+ .into())
+ }
+ } else {
+ Err(errors::ConnectorError::FailedToObtainAuthType.into())
+ }
+ }
+}
+
+#[derive(Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CashtocodePaymentStatus {
Succeeded,
@@ -239,7 +288,7 @@ impl<F, T>
#[derive(Debug, Deserialize)]
pub struct CashtocodeErrorResponse {
- pub error: u32,
+ pub error: String,
pub error_description: String,
pub errors: Option<Vec<CashtocodeErrors>>,
}
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index d518222205e..a8b521daa91 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -97,7 +97,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest {
| api_models::payments::PaymentMethodData::BankTransfer(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::CardRedirect(_)
@@ -273,7 +273,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentsRequest {
| api_models::payments::PaymentMethodData::BankTransfer(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::CardRedirect(_)
@@ -797,7 +797,6 @@ impl From<CheckoutRedirectResponseStatus> for enums::AttemptStatus {
fn from(item: CheckoutRedirectResponseStatus) -> Self {
match item {
CheckoutRedirectResponseStatus::Success => Self::AuthenticationSuccessful,
-
CheckoutRedirectResponseStatus::Failure => Self::Failure,
}
}
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index b1ad8c398a5..b8c5caf1782 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -721,7 +721,7 @@ impl<F>
| payments::PaymentMethodData::BankTransfer(_)
| payments::PaymentMethodData::Crypto(_)
| payments::PaymentMethodData::MandatePayment
- | payments::PaymentMethodData::Reward(_)
+ | payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_)
| payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::CardRedirect(_)
@@ -895,7 +895,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, String)> for NuveiPay
| Some(api::PaymentMethodData::GiftCard(..))
| Some(api::PaymentMethodData::Voucher(..))
| Some(api::PaymentMethodData::CardRedirect(..))
- | Some(api::PaymentMethodData::Reward(..))
+ | Some(api::PaymentMethodData::Reward)
| Some(api::PaymentMethodData::Upi(..))
| None => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nuvei"),
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index eee87c7d9e8..da2f98d3334 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -267,7 +267,7 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod {
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
- | PaymentMethodData::Reward(_)
+ | PaymentMethodData::Reward
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::CardRedirect(_)
| PaymentMethodData::Upi(_)
diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs
index c1f16162fae..a731c3eb575 100644
--- a/crates/router/src/connector/stax/transformers.rs
+++ b/crates/router/src/connector/stax/transformers.rs
@@ -196,7 +196,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
| api::PaymentMethodData::BankTransfer(_)
| api::PaymentMethodData::Crypto(_)
| api::PaymentMethodData::MandatePayment
- | api::PaymentMethodData::Reward(_)
+ | api::PaymentMethodData::Reward
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_)
| api::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 1685b8068cf..8a566e72d82 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1434,7 +1434,7 @@ fn create_stripe_payment_method(
}
payments::PaymentMethodData::Crypto(_)
| payments::PaymentMethodData::MandatePayment
- | payments::PaymentMethodData::Reward(_)
+ | payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_)
| payments::PaymentMethodData::CardRedirect(_)
| payments::PaymentMethodData::Voucher(_)
@@ -2722,7 +2722,7 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSo
| Some(payments::PaymentMethodData::BankRedirect(..))
| Some(payments::PaymentMethodData::PayLater(..))
| Some(payments::PaymentMethodData::Crypto(..))
- | Some(payments::PaymentMethodData::Reward(..))
+ | Some(payments::PaymentMethodData::Reward)
| Some(payments::PaymentMethodData::MandatePayment)
| Some(payments::PaymentMethodData::Upi(..))
| Some(payments::PaymentMethodData::GiftCard(..))
@@ -3210,7 +3210,7 @@ impl
}
api::PaymentMethodData::MandatePayment
| api::PaymentMethodData::Crypto(_)
- | api::PaymentMethodData::Reward(_)
+ | api::PaymentMethodData::Reward
| api::PaymentMethodData::GiftCard(_)
| api::PaymentMethodData::Upi(_)
| api::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs
index 4342b064094..3d467f4198f 100644
--- a/crates/router/src/connector/worldpay/transformers.rs
+++ b/crates/router/src/connector/worldpay/transformers.rs
@@ -87,7 +87,7 @@ fn fetch_payment_instrument(
| api_models::payments::PaymentMethodData::BankTransfer(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs
index 7f8c3d4cd08..851fb2754f9 100644
--- a/crates/router/src/connector/zen/transformers.rs
+++ b/crates/router/src/connector/zen/transformers.rs
@@ -655,7 +655,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for ZenPaymentsRequest {
| api_models::payments::PaymentMethodData::BankDebit(_)
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::MandatePayment
- | api_models::payments::PaymentMethodData::Reward(_)
+ | api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::CardRedirect(_)
| api_models::payments::PaymentMethodData::GiftCard(_) => {
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index 18191545ae0..fcf01e8ac3c 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -382,6 +382,11 @@ pub enum ConnectorError {
InSufficientBalanceInPaymentMethod,
#[error("Server responded with Request Timeout")]
RequestTimeoutReceived,
+ #[error("The given currency method is not configured with the given connector")]
+ CurrencyNotSupported {
+ message: String,
+ connector: &'static str,
+ },
}
#[derive(Debug, thiserror::Error)]
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index e0da78cf0de..6546c26e616 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -223,6 +223,8 @@ pub enum ApiErrorResponse {
IncorrectPaymentMethodConfiguration,
#[error(error_type = ErrorType::InvalidRequestError, code = "WE_05", message = "Unable to process the webhook body")]
WebhookUnprocessableEntity,
+ #[error(error_type = ErrorType::InvalidRequestError, code = "IR_19", message = "{message}")]
+ CurrencyNotSupported { message: String },
}
#[derive(Clone)]
diff --git a/crates/router/src/core/errors/transformers.rs b/crates/router/src/core/errors/transformers.rs
index d91879ac47e..a139261da97 100644
--- a/crates/router/src/core/errors/transformers.rs
+++ b/crates/router/src/core/errors/transformers.rs
@@ -54,6 +54,9 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
Self::ClientSecretInvalid => {
AER::BadRequest(ApiError::new("IR", 9, "The client_secret provided does not match the client_secret associated with the Payment", None))
}
+ Self::CurrencyNotSupported { message } => {
+ AER::BadRequest(ApiError::new("IR", 9, message, None))
+ }
Self::MandateActive => {
AER::BadRequest(ApiError::new("IR", 10, "Customer has active mandate/subsciption", None))
}
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index 4f50655e716..f6a7bd60b12 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -173,6 +173,7 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
errors::ConnectorError::InvalidDataFormat { field_name } => {
errors::ApiErrorResponse::InvalidDataValue { field_name }
},
+ errors::ConnectorError::CurrencyNotSupported { message, connector} => errors::ApiErrorResponse::CurrencyNotSupported { message: format!("Credentials for the currency {message} are not configured with the connector {connector}/hyperswitch") },
_ => errors::ApiErrorResponse::InternalServerError,
};
err.change_context(error)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index f203aeb646a..2e462e4e38b 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1301,7 +1301,7 @@ pub async fn make_pm_data<'a, F: Clone, R>(
(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::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(_)), _) => {
@@ -2948,7 +2948,7 @@ pub async fn get_additional_payment_data(
api_models::payments::PaymentMethodData::MandatePayment => {
api_models::payments::AdditionalPaymentData::MandatePayment {}
}
- api_models::payments::PaymentMethodData::Reward(_) => {
+ api_models::payments::PaymentMethodData::Reward => {
api_models::payments::AdditionalPaymentData::Reward {}
}
api_models::payments::PaymentMethodData::Upi(_) => {
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 4b8d8801566..324f99700ab 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -781,6 +781,9 @@ pub enum ConnectorAuthType {
api_secret: Secret<String>,
key2: Secret<String>,
},
+ CurrencyAuthKey {
+ auth_key_map: HashMap<storage_enums::Currency, pii::SecretSerdeValue>,
+ },
#[default]
NoKey,
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index bfe4450fa67..b04241f5993 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -310,7 +310,7 @@ impl ForeignTryFrom<api_models::payments::PaymentMethodData> for api_enums::Paym
api_models::payments::PaymentMethodData::BankDebit(..) => Ok(Self::BankDebit),
api_models::payments::PaymentMethodData::BankTransfer(..) => Ok(Self::BankTransfer),
api_models::payments::PaymentMethodData::Crypto(..) => Ok(Self::Crypto),
- api_models::payments::PaymentMethodData::Reward(..) => Ok(Self::Reward),
+ api_models::payments::PaymentMethodData::Reward => Ok(Self::Reward),
api_models::payments::PaymentMethodData::Upi(..) => Ok(Self::Upi),
api_models::payments::PaymentMethodData::Voucher(..) => Ok(Self::Voucher),
api_models::payments::PaymentMethodData::GiftCard(..) => Ok(Self::GiftCard),
diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs
index c78134a1d68..141aee4ff49 100644
--- a/crates/router/tests/connectors/cashtocode.rs
+++ b/crates/router/tests/connectors/cashtocode.rs
@@ -41,8 +41,8 @@ impl CashtocodeTest {
payment_method_data: types::api::PaymentMethodData,
) -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
- amount: 3500,
- currency: enums::Currency::USD,
+ amount: 1000,
+ currency: enums::Currency::EUR,
payment_method_data,
confirm: true,
statement_descriptor_suffix: None,
@@ -61,7 +61,7 @@ impl CashtocodeTest {
session_token: None,
enrolled_for_3ds: false,
related_transaction_id: None,
- router_return_url: Some(String::from("http://localhost:8080")),
+ router_return_url: Some(String::from("https://google.com")),
webhook_url: None,
complete_authorize_url: None,
customer_id: Some("John Doe".to_owned()),
@@ -86,16 +86,14 @@ impl CashtocodeTest {
}
}
-//fetch payurl for payment's create
+//fetch payurl for payment create
#[actix_web::test]
async fn should_fetch_pay_url_classic() {
let authorize_response = CONNECTOR
.make_payment(
CashtocodeTest::get_payment_authorize_data(
Some(enums::PaymentMethodType::ClassicReward),
- api_models::payments::PaymentMethodData::Reward(api_models::payments::RewardData {
- merchant_id: "1bc20b0a".to_owned(),
- }),
+ api_models::payments::PaymentMethodData::Reward,
),
CashtocodeTest::get_payment_info(),
)
@@ -113,9 +111,7 @@ async fn should_fetch_pay_url_evoucher() {
.make_payment(
CashtocodeTest::get_payment_authorize_data(
Some(enums::PaymentMethodType::Evoucher),
- api_models::payments::PaymentMethodData::Reward(api_models::payments::RewardData {
- merchant_id: "befb46ee".to_owned(),
- }),
+ api_models::payments::PaymentMethodData::Reward,
),
CashtocodeTest::get_payment_info(),
)
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index f9618b98b88..1fcda761831 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -7902,15 +7902,10 @@
]
},
{
- "type": "object",
- "required": [
+ "type": "string",
+ "enum": [
"reward"
- ],
- "properties": {
- "reward": {
- "$ref": "#/components/schemas/RewardData"
- }
- }
+ ]
},
{
"type": "object",
|
feat
|
[CashToCode] perform currency based connector credentials mapping (#2025)
|
2b8bd03a7243c887c17be658f1d9e9faa462b0c7
|
2023-09-22 15:22:08
|
Sai Harsha Vardhan
|
fix(router): fix attempt status for techincal failures in psync flow (#2252)
| false
|
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 4c62dd5caab..8a97b8139da 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -12,6 +12,7 @@ use crate::{
errors::{self, RouterResult, StorageErrorExt},
mandate,
payments::{types::MultipleCaptureData, PaymentData},
+ utils as core_utils,
},
db::StorageInterface,
routes::metrics,
@@ -311,10 +312,21 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
(Some((multiple_capture_data, capture_update_list)), None)
}
None => {
- let status = match err.status_code {
- 500..=511 => storage::enums::AttemptStatus::Pending,
- _ => storage::enums::AttemptStatus::Failure,
- };
+ let flow_name = core_utils::get_flow_name::<F>()?;
+ let status =
+ // mark previous attempt status for technical failures in PSync flow
+ if flow_name == "PSync" {
+ match err.status_code {
+ // marking failure for 2xx because this is genuine payment failure
+ 200..=299 => storage::enums::AttemptStatus::Failure,
+ _ => payment_data.payment_attempt.status,
+ }
+ } else {
+ match err.status_code {
+ 500..=511 => storage::enums::AttemptStatus::Pending,
+ _ => storage::enums::AttemptStatus::Failure,
+ }
+ };
(
None,
Some(storage::PaymentAttemptUpdate::ErrorUpdate {
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index bf34c132961..feec956d225 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1033,3 +1033,15 @@ pub async fn get_profile_id_from_business_details(
},
}
}
+
+#[inline]
+pub fn get_flow_name<F>() -> RouterResult<String> {
+ Ok(std::any::type_name::<F>()
+ .to_string()
+ .rsplit("::")
+ .next()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Flow stringify failed")?
+ .to_string())
+}
|
fix
|
fix attempt status for techincal failures in psync flow (#2252)
|
0aabd86e0014189a82aff6e287626c0beaaf59b0
|
2024-03-08 00:32:45
|
Shankar Singh C
|
ci: add a step in `check-msrv` get the rust version from `Cargo.toml` (#4001)
| false
|
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 052afd5d25c..efeb31cd1e8 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -111,14 +111,20 @@ jobs:
with:
make-default: true
+ - name: Get rust version from Cargo.toml
+ shell: bash
+ run: |
+ rust_version=$(yq -oy '.workspace.package.rust-version' Cargo.toml)
+ echo "rust_version=${rust_version}" >> $GITHUB_ENV
+
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
- toolchain: "1.70"
+ toolchain: "${{ env.rust_version }}"
- uses: Swatinem/[email protected]
with:
- save-if: ${{ github.event_name == 'push' }}
+ save-if: false
- name: Install cargo-hack
uses: baptiste0928/[email protected]
@@ -258,7 +264,7 @@ jobs:
- uses: Swatinem/[email protected]
with:
- save-if: ${{ github.event_name == 'push' }}
+ save-if: false
# - name: Setup Embark Studios lint rules
# shell: bash
diff --git a/.github/workflows/CI-push.yml b/.github/workflows/CI-push.yml
index c946513f723..ddf00c295b1 100644
--- a/.github/workflows/CI-push.yml
+++ b/.github/workflows/CI-push.yml
@@ -58,10 +58,16 @@ jobs:
with:
make-default: true
+ - name: Get rust version from Cargo.toml
+ shell: bash
+ run: |
+ rust_version=$(yq -oy '.workspace.package.rust-version' Cargo.toml)
+ echo "rust_version=${rust_version}" >> $GITHUB_ENV
+
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
- toolchain: "1.70"
+ toolchain: "${{ env.rust_version }}"
- uses: Swatinem/[email protected]
with:
|
ci
|
add a step in `check-msrv` get the rust version from `Cargo.toml` (#4001)
|
a2616d87b1440f0e723961d70fc1f8c22505cbc0
|
2023-02-27 00:51:29
|
Narayan Bhat
|
refactor(pm_list): modify pm list to support new api contract (#657)
| false
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 00c9ebc0eeb..28964d5b810 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -5,7 +5,7 @@ use url;
use utoipa::ToSchema;
use super::payments::AddressDetails;
-use crate::enums as api_enums;
+use crate::{enums as api_enums, payment_methods};
#[derive(Clone, Debug, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
@@ -284,59 +284,23 @@ pub struct PaymentConnectorCreate {
"installment_payment_enabled": true
}
]))]
- pub payment_methods_enabled: Option<Vec<PaymentMethods>>,
+ pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>,
/// 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.
#[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<serde_json::Value>,
}
+
/// Details of all the payment methods enabled for the connector for the given merchant account
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
-pub struct PaymentMethods {
+pub struct PaymentMethodsEnabled {
/// Type of payment method.
- #[schema(value_type = PaymentMethodType,example = "card")]
+ #[schema(value_type = PaymentMethod,example = "card")]
pub payment_method: api_enums::PaymentMethod,
+
/// Subtype of payment method
- #[schema(value_type = Option<Vec<PaymentMethodSubType>>,example = json!(["credit"]))]
- pub payment_method_types: Option<Vec<api_enums::PaymentMethodType>>,
- /// List of payment method issuers to be enabled for this payment method
- #[schema(example = json!(["HDFC"]))]
- pub payment_method_issuers: Option<Vec<String>>,
- /// List of payment schemes accepted or has the processing capabilities of the processor
- #[schema(example = json!(["MASTER","VISA","DINERS"]))]
- pub payment_schemes: Option<Vec<String>>,
- /// List of currencies accepted or has the processing capabilities of the processor
- #[schema(example = json!(
- {
- "type": "enable_only",
- "list": ["USD", "EUR"]
- }
- ))]
- pub accepted_currencies: Option<AcceptedCurrencies>,
- /// List of Countries accepted or has the processing capabilities of the processor
- #[schema(example = json!(
- {
- "type": "disable_only",
- "list": ["FR", "DE","IN"]
- }
- ))]
- pub accepted_countries: Option<AcceptedCountries>,
- /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents)
- #[schema(example = 1)]
- pub minimum_amount: Option<i32>,
- /// Maximum amount supported by the processor. To be represented in the lowest denomination of
- /// the target currency (For example, for USD it should be in cents)
- #[schema(example = 1313)]
- pub maximum_amount: Option<i32>,
- /// Boolean to enable recurring payments / mandates. Default is true.
- #[schema(default = true, example = false)]
- pub recurring_enabled: bool,
- /// Boolean to enable installment / EMI / BNPL payments. Default is true.
- #[schema(default = true, example = false)]
- pub installment_payment_enabled: bool,
- /// Type of payment experience enabled with the connector
- #[schema(value_type = Option<Vec<PaymentExperience>>,example = json!(["redirect_to_url"]))]
- pub payment_experience: Option<Vec<api_enums::PaymentExperience>>,
+ #[schema(value_type = Option<Vec<PaymentMethodType>>,example = json!(["credit"]))]
+ pub payment_method_types: Option<Vec<payment_methods::RequestPaymentMethodTypes>>,
}
/// List of enabled and disabled currencies, empty in case all currencies are enabled
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index a0261293be5..ed542bbee1a 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -344,36 +344,6 @@ pub enum PaymentMethodIssuerCode {
JpBacs,
}
-#[derive(
- Clone,
- Copy,
- Debug,
- Eq,
- Hash,
- PartialEq,
- serde::Deserialize,
- serde::Serialize,
- frunk::LabelledGeneric,
- ToSchema,
-)]
-#[serde(rename_all = "snake_case")]
-pub enum PaymentIssuer {
- Klarna,
- Affirm,
- AfterpayClearpay,
- AmericanExpress,
- BankOfAmerica,
- Barclays,
- CapitalOne,
- Chase,
- Citi,
- Discover,
- NavyFederalCreditUnion,
- PentagonFederalCreditUnion,
- SynchronyBank,
- WellsFargo,
-}
-
#[derive(
Eq,
PartialEq,
@@ -718,6 +688,25 @@ pub enum BankNames {
VrBankBraunau,
}
+#[derive(
+ Clone,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ frunk::LabelledGeneric,
+)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum CardNetwork {
+ Visa,
+ Mastercard,
+}
+
impl From<AttemptStatus> for IntentStatus {
fn from(s: AttemptStatus) -> Self {
match s {
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 370232323fb..30c6b060745 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -100,14 +100,6 @@ pub struct PaymentMethodResponse {
#[schema(value_type = Option<PaymentMethodType>,example = "credit")]
pub payment_method_type: Option<api_enums::PaymentMethodType>,
- /// The name of the bank/ provider issuing the payment method to the end user
- #[schema(example = "Citibank")]
- pub payment_method_issuer: Option<String>,
-
- /// A standard code representing the issuer of payment method
- #[schema(value_type = Option<PaymentMethodIssuerCode>,example = "jp_applepay")]
- pub payment_method_issuer_code: Option<api_enums::PaymentMethodIssuerCode>,
-
/// Card details from card locker
#[schema(example = json!({"last4": "1142","exp_month": "03","exp_year": "2030"}))]
pub card: Option<CardDetailFromLocker>,
@@ -159,6 +151,99 @@ pub struct CardDetailFromLocker {
pub card_fingerprint: Option<masking::Secret<String>>,
}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
+pub struct PaymentExperienceTypes {
+ pub payment_experience_type: api_enums::PaymentExperience,
+ pub eligible_connectors: Vec<String>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
+pub struct CardNetworkTypes {
+ pub card_network: api_enums::CardNetwork,
+ pub eligible_connectors: Vec<String>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
+pub struct ResponsePaymentMethodTypes {
+ pub payment_method_type: api_enums::PaymentMethodType,
+ pub payment_experience: Option<Vec<PaymentExperienceTypes>>,
+ pub card_networks: Option<Vec<CardNetworkTypes>>,
+}
+
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
+pub struct ResponsePaymentMethodsEnabled {
+ pub payment_method: api_enums::PaymentMethod,
+ pub payment_method_types: Vec<ResponsePaymentMethodTypes>,
+}
+
+#[derive(Clone)]
+pub struct ResponsePaymentMethodIntermediate {
+ pub payment_method_type: api_enums::PaymentMethodType,
+ pub payment_experience: Option<api_enums::PaymentExperience>,
+ pub card_networks: Option<Vec<api_enums::CardNetwork>>,
+ pub payment_method: api_enums::PaymentMethod,
+ pub connector: String,
+}
+
+impl ResponsePaymentMethodIntermediate {
+ pub fn new(
+ pm_type: RequestPaymentMethodTypes,
+ connector: String,
+ pm: api_enums::PaymentMethod,
+ ) -> Self {
+ Self {
+ payment_method_type: pm_type.payment_method_type,
+ payment_experience: pm_type.payment_experience,
+ card_networks: pm_type.card_networks,
+ payment_method: pm,
+ connector,
+ }
+ }
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq, Hash)]
+pub struct RequestPaymentMethodTypes {
+ pub payment_method_type: api_enums::PaymentMethodType,
+ pub payment_experience: Option<api_enums::PaymentExperience>,
+ pub card_networks: Option<Vec<api_enums::CardNetwork>>,
+ /// List of currencies accepted or has the processing capabilities of the processor
+ #[schema(example = json!(
+ {
+ "enable_all":false,
+ "disable_only": ["INR", "CAD", "AED","JPY"],
+ "enable_only": ["EUR","USD"]
+ }
+ ))]
+ pub accepted_currencies: Option<admin::AcceptedCurrencies>,
+
+ /// List of Countries accepted or has the processing capabilities of the processor
+ #[schema(example = json!(
+ {
+ "enable_all":false,
+ "disable_only": ["FR", "DE","IN"],
+ "enable_only": ["UK","AU"]
+ }
+ ))]
+ pub accepted_countries: Option<admin::AcceptedCountries>,
+
+ /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents)
+ #[schema(example = 1)]
+ pub minimum_amount: Option<i32>,
+
+ /// Maximum amount supported by the processor. To be represented in the lowest denomination of
+ /// the target currency (For example, for USD it should be in cents)
+ #[schema(example = 1313)]
+ pub maximum_amount: Option<i32>,
+
+ /// Boolean to enable recurring payments / mandates. Default is true.
+ #[schema(default = true, example = false)]
+ pub recurring_enabled: bool,
+
+ /// Boolean to enable installment / EMI / BNPL payments. Default is true.
+ #[schema(default = true, example = false)]
+ pub installment_payment_enabled: bool,
+}
+
//List Payment Method
#[derive(Debug, serde::Serialize, Default, ToSchema)]
#[serde(deny_unknown_fields)]
@@ -186,6 +271,10 @@ pub struct ListPaymentMethodRequest {
/// Indicates whether the payment method is eligible for installment payments
#[schema(example = true)]
pub installment_payment_enabled: Option<bool>,
+
+ /// Indicates whether the payment method is eligible for card netwotks
+ #[schema(value_type = Option<Vec<CardNetwork>>, example = json!(["visa", "mastercard"]))]
+ pub card_networks: Option<Vec<api_enums::CardNetwork>>,
}
impl<'de> serde::Deserialize<'de> for ListPaymentMethodRequest {
@@ -296,74 +385,34 @@ pub struct ListPaymentMethodResponse {
}
]
))]
- pub payment_methods: Vec<ListPaymentMethod>,
+ pub payment_methods: Vec<ResponsePaymentMethodsEnabled>,
}
+// impl ResponsePaymentMethodTypes {
+// pub fn new(
+// pm_type: RequestPaymentMethodTypes,
+// connector: String,
+// payment_method: api_enums::PaymentMethod,
+// ) -> Self {
+// Self {
+// payment_method_type: pm_type.payment_method_type,
+// payment_experience: pm_type.payment_experience,
+// connector,
+// card_networks: pm_type.card_networks,
+// payment_method,
+// }
+// }
+// }
+
#[derive(Eq, PartialEq, Hash, Debug, serde::Deserialize, ToSchema)]
pub struct ListPaymentMethod {
/// The type of payment method use for the payment.
- #[schema(value_type = PaymentMethodType,example = "card")]
+ #[schema(value_type = PaymentMethod,example = "card")]
pub payment_method: api_enums::PaymentMethod,
/// This is a sub-category of payment method.
- #[schema(value_type = Option<Vec<PaymentMethodSubType>>,example = json!(["credit_card"]))]
- pub payment_method_types: Option<Vec<api_enums::PaymentMethodType>>,
-
- /// The name of the bank/ provider issuing the payment method to the end user
- #[schema(example = json!(["Citibank"]))]
- pub payment_method_issuers: Option<Vec<String>>,
-
- /// A standard code representing the issuer of payment method
- #[schema(value_type = Option<Vec<PaymentMethodIssuerCode>>,example = json!(["jp_applepay"]))]
- pub payment_method_issuer_code: Option<Vec<api_enums::PaymentMethodIssuerCode>>,
-
- /// List of payment schemes accepted or has the processing capabilities of the processor
- #[schema(example = json!(["MASTER", "VISA", "DINERS"]))]
- pub payment_schemes: Option<Vec<String>>,
-
- /// List of Countries accepted or has the processing capabilities of the processor
- #[schema(example = json!(
- {
- "type": "disable_only",
- "list": ["FR", "DE","IN"]
- }
- ))]
- pub accepted_countries: Option<admin::AcceptedCountries>,
-
- /// List of currencies accepted or has the processing capabilities of the processor
- #[schema(example = json!(
- {
- "type": "enable_only",
- "list": ["USD", "EUR"]
- }
- ))]
- pub accepted_currencies: Option<admin::AcceptedCurrencies>,
-
- /// Minimum amount supported by the processor. To be represented in the lowest denomination of
- /// the target currency (For example, for USD it should be in cents)
- #[schema(example = 60000)]
- pub minimum_amount: Option<i64>,
-
- /// Maximum amount supported by the processor. To be represented in the lowest denomination of
- /// the target currency (For example, for USD it should be in cents)
- #[schema(example = 1)]
- pub maximum_amount: Option<i64>,
-
- /// Boolean to enable recurring payments / mandates. Default is true.
- #[schema(example = true)]
- pub recurring_enabled: bool,
-
- /// Boolean to enable installment / EMI / BNPL payments. Default is true.
- #[schema(example = true)]
- pub installment_payment_enabled: bool,
-
- /// Type of payment experience enabled with the connector
- #[schema(value_type = Option<Vec<PaymentExperience>>, example = json!(["redirect_to_url"]))]
- pub payment_experience: Option<Vec<api_enums::PaymentExperience>>,
-
- /// Eligible connectors for this payment method
- #[schema(example = json!(["stripe", "adyen"]))]
- pub eligible_connectors: Option<Vec<String>>,
+ #[schema(value_type = Option<Vec<PaymentMethodType>>,example = json!(["credit"]))]
+ pub payment_method_types: Option<Vec<RequestPaymentMethodTypes>>,
}
/// Currently if the payment method is Wallet or Paylater the relevant fields are `payment_method`
@@ -377,18 +426,9 @@ impl serde::Serialize for ListPaymentMethod {
use serde::ser::SerializeStruct;
let mut state = serializer.serialize_struct("ListPaymentMethod", 4)?;
state.serialize_field("payment_method", &self.payment_method)?;
- state.serialize_field("payment_experience", &self.payment_experience)?;
- state.serialize_field("eligible_connectors", &self.eligible_connectors)?;
- match self.payment_method {
- api_enums::PaymentMethod::Wallet | api_enums::PaymentMethod::PayLater => {
- state.serialize_field("payment_method_issuers", &self.payment_method_issuers)?;
- }
- _ => {
- state.serialize_field("payment_method_issuers", &self.payment_method_issuers)?;
- state.serialize_field("payment_method_types", &self.payment_method_types)?;
- state.serialize_field("payment_schemes", &self.payment_schemes)?;
- }
- }
+
+ state.serialize_field("payment_method_types", &self.payment_method_types)?;
+
state.end()
}
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 4bd7aab5eed..438958ce6f6 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -260,7 +260,7 @@ pub async fn create_payment_connector(
let payment_methods_enabled = match req.payment_methods_enabled {
Some(val) => {
for pm in val.into_iter() {
- let pm_value = utils::Encode::<api::PaymentMethods>::encode_to_value(&pm)
+ let pm_value = utils::Encode::<api::PaymentMethodsEnabled>::encode_to_value(&pm)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Failed while encoding to serde_json::Value, PaymentMethod",
@@ -345,7 +345,7 @@ pub async fn list_payment_connectors(
})?;
let merchant_connector_accounts = store
- .find_merchant_connector_account_by_merchant_id_list(&merchant_id)
+ .find_merchant_connector_account_by_merchant_id_and_disabled_list(&merchant_id, true)
.await
.map_err(|error| {
error.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound)
@@ -387,7 +387,7 @@ pub async fn update_payment_connector(
pm_enabled
.iter()
.flat_map(|payment_method| {
- utils::Encode::<api::PaymentMethods>::encode_to_value(payment_method)
+ utils::Encode::<api::PaymentMethodsEnabled>::encode_to_value(payment_method)
})
.collect::<Vec<serde_json::Value>>()
});
@@ -415,12 +415,12 @@ pub async fn update_payment_connector(
let updated_pm_enabled = updated_mca.payment_methods_enabled.map(|pm| {
pm.into_iter()
.flat_map(|pm_value| {
- ValueExt::<api_models::admin::PaymentMethods>::parse_value(
+ ValueExt::<api_models::admin::PaymentMethodsEnabled>::parse_value(
pm_value,
"PaymentMethods",
)
})
- .collect::<Vec<api_models::admin::PaymentMethods>>()
+ .collect::<Vec<api_models::admin::PaymentMethodsEnabled>>()
});
let response = api::PaymentConnectorCreate {
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index a091a3fffe6..dc8eb35ce96 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1,6 +1,14 @@
use std::collections::{HashMap, HashSet};
-use api_models::{admin, enums as api_enums};
+use api_models::{
+ admin::{self, PaymentMethodsEnabled},
+ enums as api_enums,
+ payment_methods::{
+ CardNetworkTypes, PaymentExperienceTypes, RequestPaymentMethodTypes,
+ ResponsePaymentMethodIntermediate, ResponsePaymentMethodTypes,
+ ResponsePaymentMethodsEnabled,
+ },
+};
use common_utils::{consts, ext_traits::AsyncExt, generate_id};
use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
@@ -79,11 +87,9 @@ pub async fn add_payment_method(
payment_method_id: payment_method_id.to_string(),
payment_method: req.payment_method,
payment_method_type: req.payment_method_type,
- payment_method_issuer: req.payment_method_issuer,
card: None,
metadata: req.metadata,
created: Some(common_utils::date_time::now()),
- payment_method_issuer_code: req.payment_method_issuer_code,
recurring_enabled: false, //[#219]
installment_payment_enabled: false, //[#219]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), //[#219]
@@ -150,6 +156,7 @@ pub async fn add_card(
&locker_id,
merchant_id,
)?;
+
let response = if !locker.mock_locker {
let response = services::call_connector_api(state, request)
.await
@@ -355,7 +362,7 @@ pub async fn list_payment_methods(
let address = payment_intent
.as_ref()
.async_map(|pi| async {
- helpers::get_address_by_id(db, pi.billing_address_id.clone()).await
+ helpers::get_address_by_id(db, pi.shipping_address_id.clone()).await
})
.await
.transpose()?
@@ -376,13 +383,16 @@ pub async fn list_payment_methods(
.transpose()?;
let all_mcas = db
- .find_merchant_connector_account_by_merchant_id_list(&merchant_account.merchant_id)
+ .find_merchant_connector_account_by_merchant_id_and_disabled_list(
+ &merchant_account.merchant_id,
+ false,
+ )
.await
.map_err(|error| {
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
})?;
- let mut response: HashMap<api::ListPaymentMethod, Vec<String>> = HashMap::new();
+ let mut response: Vec<ResponsePaymentMethodIntermediate> = vec![];
for mca in all_mcas {
let payment_methods = match mca.payment_methods_enabled {
Some(pm) => pm,
@@ -401,19 +411,125 @@ pub async fn list_payment_methods(
.await?;
}
+ let mut payment_experiences_consolidated_hm: HashMap<
+ api_enums::PaymentMethod,
+ HashMap<api_enums::PaymentMethodType, HashMap<api_enums::PaymentExperience, Vec<String>>>,
+ > = HashMap::new();
+
+ let mut card_networks_consolidated_hm: HashMap<
+ api_enums::PaymentMethod,
+ HashMap<api_enums::PaymentMethodType, HashMap<api_enums::CardNetwork, Vec<String>>>,
+ > = HashMap::new();
+
+ for element in response.clone() {
+ let payment_method = element.payment_method;
+ let payment_method_type = element.payment_method_type;
+ let connector = element.connector.clone();
+
+ if let Some(payment_experience) = element.payment_experience {
+ if let Some(payment_method_hm) =
+ payment_experiences_consolidated_hm.get_mut(&payment_method)
+ {
+ if let Some(payment_method_type_hm) =
+ payment_method_hm.get_mut(&payment_method_type)
+ {
+ if let Some(vector_of_connectors) =
+ payment_method_type_hm.get_mut(&payment_experience)
+ {
+ vector_of_connectors.push(connector);
+ } else {
+ payment_method_type_hm.insert(payment_experience, vec![connector]);
+ }
+ } else {
+ payment_method_hm.insert(payment_method_type, HashMap::new());
+ }
+ } else {
+ payment_experiences_consolidated_hm.insert(payment_method, HashMap::new());
+ }
+ }
+
+ if let Some(card_networks) = element.card_networks {
+ if let Some(payment_method_hm) = card_networks_consolidated_hm.get_mut(&payment_method)
+ {
+ if let Some(payment_method_type_hm) =
+ payment_method_hm.get_mut(&payment_method_type)
+ {
+ for card_network in card_networks {
+ if let Some(vector_of_connectors) =
+ payment_method_type_hm.get_mut(&card_network)
+ {
+ let connector = element.connector.clone(); //FIXME: remove clone
+ vector_of_connectors.push(connector);
+ } else {
+ let connector = element.connector.clone(); //FIXME: remove clone
+ payment_method_type_hm.insert(card_network, vec![connector]);
+ }
+ }
+ } else {
+ payment_method_hm.insert(payment_method_type, HashMap::new());
+ }
+ } else {
+ card_networks_consolidated_hm.insert(payment_method, HashMap::new());
+ }
+ }
+ }
+
+ let mut payment_method_responses: Vec<ResponsePaymentMethodsEnabled> = vec![];
+ for key in payment_experiences_consolidated_hm.iter() {
+ let mut payment_method_types = vec![];
+ for payment_method_types_hm in key.1 {
+ let mut payment_experience_types = vec![];
+ for payment_experience_type in payment_method_types_hm.1 {
+ payment_experience_types.push(PaymentExperienceTypes {
+ payment_experience_type: *payment_experience_type.0,
+ eligible_connectors: payment_experience_type.1.clone(),
+ })
+ }
+
+ payment_method_types.push(ResponsePaymentMethodTypes {
+ payment_method_type: *payment_method_types_hm.0,
+ payment_experience: Some(payment_experience_types),
+ card_networks: None,
+ })
+ }
+
+ payment_method_responses.push(ResponsePaymentMethodsEnabled {
+ payment_method: *key.0,
+ payment_method_types,
+ })
+ }
+
+ for key in card_networks_consolidated_hm.iter() {
+ let mut payment_method_types = vec![];
+ for payment_method_types_hm in key.1 {
+ let mut card_network_types = vec![];
+ for card_network_type in payment_method_types_hm.1 {
+ card_network_types.push(CardNetworkTypes {
+ card_network: card_network_type.0.clone(),
+ eligible_connectors: card_network_type.1.clone(),
+ })
+ }
+
+ payment_method_types.push(ResponsePaymentMethodTypes {
+ payment_method_type: *payment_method_types_hm.0,
+ card_networks: Some(card_network_types),
+ payment_experience: None,
+ })
+ }
+
+ payment_method_responses.push(ResponsePaymentMethodsEnabled {
+ payment_method: *key.0,
+ payment_method_types,
+ })
+ }
+
response
.is_empty()
.then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound)))
.unwrap_or(Ok(services::ApplicationResponse::Json(
api::ListPaymentMethodResponse {
redirect_url: merchant_account.return_url,
- payment_methods: response
- .into_iter()
- .map(|(mut key, val)| {
- key.eligible_connectors = Some(val);
- key
- })
- .collect(),
+ payment_methods: payment_method_responses,
},
)))
}
@@ -421,54 +537,74 @@ pub async fn list_payment_methods(
async fn filter_payment_methods(
payment_methods: Vec<serde_json::Value>,
req: &mut api::ListPaymentMethodRequest,
- resp: &mut HashMap<api::ListPaymentMethod, Vec<String>>,
+ resp: &mut Vec<ResponsePaymentMethodIntermediate>,
payment_intent: Option<&storage::PaymentIntent>,
payment_attempt: Option<&storage::PaymentAttempt>,
address: Option<&storage::Address>,
- connector_name: String,
+ connector: String,
) -> errors::CustomResult<(), errors::ApiErrorResponse> {
for payment_method in payment_methods.into_iter() {
- if let Ok(payment_method_object) =
- serde_json::from_value::<api::ListPaymentMethod>(payment_method)
- {
- if filter_recurring_based(&payment_method_object, req.recurring_enabled)
- && filter_installment_based(&payment_method_object, req.installment_payment_enabled)
- && filter_amount_based(&payment_method_object, req.amount)
+ let parse_result = serde_json::from_value::<PaymentMethodsEnabled>(payment_method);
+ if let Ok(payment_methods_enabled) = parse_result {
+ let payment_method = payment_methods_enabled.payment_method;
+ for payment_method_type_info in payment_methods_enabled
+ .payment_method_types
+ .unwrap_or_default()
{
- let mut payment_method_object = payment_method_object;
-
- let filter;
- (
- payment_method_object.accepted_countries,
- req.accepted_countries,
- filter,
- ) = filter_pm_country_based(
- &payment_method_object.accepted_countries,
- &req.accepted_countries,
- );
- let filter2;
- (
- payment_method_object.accepted_currencies,
- req.accepted_currencies,
- filter2,
- ) = filter_pm_currencies_based(
- &payment_method_object.accepted_currencies,
- &req.accepted_currencies,
- );
- let filter3 = if let Some(payment_intent) = payment_intent {
- filter_payment_country_based(&payment_method_object, address).await?
- && filter_payment_currency_based(payment_intent, &payment_method_object)
- && filter_payment_amount_based(payment_intent, &payment_method_object)
- && filter_payment_mandate_based(payment_attempt, &payment_method_object)
- .await?
- } else {
- true
- };
-
- if filter && filter2 && filter3 {
- resp.entry(payment_method_object)
- .or_insert_with(Vec::new)
- .push(connector_name.clone());
+ if filter_recurring_based(&payment_method_type_info, req.recurring_enabled)
+ && filter_installment_based(
+ &payment_method_type_info,
+ req.installment_payment_enabled,
+ )
+ && filter_amount_based(&payment_method_type_info, req.amount)
+ {
+ let mut payment_method_object = payment_method_type_info;
+
+ let filter;
+ (
+ payment_method_object.accepted_countries,
+ req.accepted_countries,
+ filter,
+ ) = filter_pm_country_based(
+ &payment_method_object.accepted_countries,
+ &req.accepted_countries,
+ );
+ let filter2;
+ (
+ payment_method_object.accepted_currencies,
+ req.accepted_currencies,
+ filter2,
+ ) = filter_pm_currencies_based(
+ &payment_method_object.accepted_currencies,
+ &req.accepted_currencies,
+ );
+
+ let filter4 = filter_pm_card_network_based(
+ payment_method_object.card_networks.as_ref(),
+ req.card_networks.as_ref(),
+ );
+
+ let filter3 = if let Some(payment_intent) = payment_intent {
+ filter_payment_country_based(&payment_method_object, address).await?
+ && filter_payment_currency_based(payment_intent, &payment_method_object)
+ && filter_payment_amount_based(payment_intent, &payment_method_object)
+ && filter_payment_mandate_based(payment_attempt, &payment_method_object)
+ .await?
+ } else {
+ true
+ };
+
+ let connector = connector.clone();
+
+ let response_pm_type = ResponsePaymentMethodIntermediate::new(
+ payment_method_object,
+ connector,
+ payment_method,
+ );
+
+ if filter && filter2 && filter3 && filter4 {
+ resp.push(response_pm_type);
+ }
}
}
}
@@ -476,6 +612,18 @@ async fn filter_payment_methods(
Ok(())
}
+fn filter_pm_card_network_based(
+ pm_card_networks: Option<&Vec<api_enums::CardNetwork>>,
+ request_card_networks: Option<&Vec<api_enums::CardNetwork>>,
+) -> bool {
+ match (pm_card_networks, request_card_networks) {
+ (Some(pm_card_networks), Some(request_card_networks)) => pm_card_networks
+ .iter()
+ .all(|card_network| request_card_networks.contains(card_network)),
+ (None, Some(_)) => false,
+ _ => true,
+ }
+}
fn filter_pm_country_based(
accepted_countries: &Option<admin::AcceptedCountries>,
req_country_list: &Option<Vec<String>>,
@@ -582,12 +730,20 @@ fn filter_disabled_enum_based<T: Eq + std::hash::Hash + Clone>(
}
}
-fn filter_amount_based(payment_method: &api::ListPaymentMethod, amount: Option<i64>) -> bool {
+fn filter_amount_based(payment_method: &RequestPaymentMethodTypes, amount: Option<i64>) -> bool {
let min_check = amount
- .and_then(|amt| payment_method.minimum_amount.map(|min_amt| amt >= min_amt))
+ .and_then(|amt| {
+ payment_method
+ .minimum_amount
+ .map(|min_amt| amt >= min_amt.into())
+ })
.unwrap_or(true);
let max_check = amount
- .and_then(|amt| payment_method.maximum_amount.map(|max_amt| amt <= max_amt))
+ .and_then(|amt| {
+ payment_method
+ .maximum_amount
+ .map(|max_amt| amt <= max_amt.into())
+ })
.unwrap_or(true);
// let min_check = match (amount, payment_method.minimum_amount) {
// (Some(amt), Some(min_amt)) => amt >= min_amt,
@@ -601,14 +757,14 @@ fn filter_amount_based(payment_method: &api::ListPaymentMethod, amount: Option<i
}
fn filter_recurring_based(
- payment_method: &api::ListPaymentMethod,
+ payment_method: &RequestPaymentMethodTypes,
recurring_enabled: Option<bool>,
) -> bool {
recurring_enabled.map_or(true, |enabled| payment_method.recurring_enabled == enabled)
}
fn filter_installment_based(
- payment_method: &api::ListPaymentMethod,
+ payment_method: &RequestPaymentMethodTypes,
installment_payment_enabled: Option<bool>,
) -> bool {
installment_payment_enabled.map_or(true, |enabled| {
@@ -617,7 +773,7 @@ fn filter_installment_based(
}
async fn filter_payment_country_based(
- pm: &api::ListPaymentMethod,
+ pm: &RequestPaymentMethodTypes,
address: Option<&storage::Address>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(address.map_or(true, |address| {
@@ -639,7 +795,7 @@ async fn filter_payment_country_based(
fn filter_payment_currency_based(
payment_intent: &storage::PaymentIntent,
- pm: &api::ListPaymentMethod,
+ pm: &RequestPaymentMethodTypes,
) -> bool {
payment_intent.currency.map_or(true, |currency| {
pm.accepted_currencies.as_ref().map_or(true, |ac| {
@@ -658,16 +814,16 @@ fn filter_payment_currency_based(
fn filter_payment_amount_based(
payment_intent: &storage::PaymentIntent,
- pm: &api::ListPaymentMethod,
+ pm: &RequestPaymentMethodTypes,
) -> bool {
let amount = payment_intent.amount;
- pm.maximum_amount.map_or(true, |amt| amount < amt)
- && pm.minimum_amount.map_or(true, |amt| amount > amt)
+ pm.maximum_amount.map_or(true, |amt| amount < amt.into())
+ && pm.minimum_amount.map_or(true, |amt| amount > amt.into())
}
async fn filter_payment_mandate_based(
payment_attempt: Option<&storage::PaymentAttempt>,
- pm: &api::ListPaymentMethod,
+ pm: &RequestPaymentMethodTypes,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
let recurring_filter = if !pm.recurring_enabled {
payment_attempt.map_or(true, |pa| pa.mandate_id.is_none())
@@ -684,7 +840,10 @@ pub async fn list_customer_payment_method(
) -> errors::RouterResponse<api::ListCustomerPaymentMethodsResponse> {
let db = &*state.store;
let all_mcas = db
- .find_merchant_connector_account_by_merchant_id_list(&merchant_account.merchant_id)
+ .find_merchant_connector_account_by_merchant_id_and_disabled_list(
+ &merchant_account.merchant_id,
+ false,
+ )
.await
.map_err(|error| {
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
@@ -981,13 +1140,9 @@ pub async fn retrieve_payment_method(
payment_method_id: pm.payment_method_id,
payment_method: pm.payment_method.foreign_into(),
payment_method_type: pm.payment_method_type.map(ForeignInto::foreign_into),
- payment_method_issuer: pm.payment_method_issuer,
card,
metadata: pm.metadata,
created: Some(pm.created_at),
- payment_method_issuer_code: pm
- .payment_method_issuer_code
- .map(ForeignInto::foreign_into),
recurring_enabled: false, //[#219]
installment_payment_enabled: false, //[#219]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), //[#219],
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index 2144bd7e01b..fd0e7798707 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -120,11 +120,9 @@ pub fn mk_add_card_response(
payment_method_id: response.card_id,
payment_method: req.payment_method,
payment_method_type: req.payment_method_type,
- payment_method_issuer: req.payment_method_issuer,
card: Some(card),
metadata: req.metadata,
created: Some(common_utils::date_time::now()),
- payment_method_issuer_code: req.payment_method_issuer_code,
recurring_enabled: false, // [#256]
installment_payment_enabled: false, // #[#256]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), // [#256]
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index de71302582a..aac86f7fc94 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -286,7 +286,10 @@ where
let supported_connectors: &Vec<String> = state.conf.connectors.supported.wallets.as_ref();
let connector_accounts = db
- .find_merchant_connector_account_by_merchant_id_list(&merchant_account.merchant_id)
+ .find_merchant_connector_account_by_merchant_id_and_disabled_list(
+ &merchant_account.merchant_id,
+ false,
+ )
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Database error when querying for merchant connector accounts")?;
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 33ff10c578a..640a4dd503c 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -115,9 +115,10 @@ pub trait MerchantConnectorAccountInterface {
merchant_connector_id: &str,
) -> CustomResult<storage::MerchantConnectorAccount, errors::StorageError>;
- async fn find_merchant_connector_account_by_merchant_id_list(
+ async fn find_merchant_connector_account_by_merchant_id_and_disabled_list(
&self,
merchant_id: &str,
+ get_disabled: bool,
) -> CustomResult<Vec<storage::MerchantConnectorAccount>, errors::StorageError>;
async fn update_merchant_connector_account(
@@ -186,12 +187,13 @@ impl MerchantConnectorAccountInterface for Store {
t.insert(&conn).await.map_err(Into::into).into_report()
}
- async fn find_merchant_connector_account_by_merchant_id_list(
+ async fn find_merchant_connector_account_by_merchant_id_and_disabled_list(
&self,
merchant_id: &str,
+ get_disabled: bool,
) -> CustomResult<Vec<storage::MerchantConnectorAccount>, errors::StorageError> {
let conn = pg_connection(&self.master_pool).await?;
- storage::MerchantConnectorAccount::find_by_merchant_id(&conn, merchant_id)
+ storage::MerchantConnectorAccount::find_by_merchant_id(&conn, merchant_id, get_disabled)
.await
.map_err(Into::into)
.into_report()
@@ -293,9 +295,10 @@ impl MerchantConnectorAccountInterface for MockDb {
Ok(account)
}
- async fn find_merchant_connector_account_by_merchant_id_list(
+ async fn find_merchant_connector_account_by_merchant_id_and_disabled_list(
&self,
_merchant_id: &str,
+ _get_disabled: bool,
) -> CustomResult<Vec<storage::MerchantConnectorAccount>, errors::StorageError> {
// [#172]: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index a399b890652..0cafe525feb 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -141,7 +141,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::MandateStatus,
api_models::enums::PaymentExperience,
api_models::admin::PaymentConnectorCreate,
- api_models::admin::PaymentMethods,
+ api_models::admin::PaymentMethodsEnabled,
api_models::payments::AddressDetails,
api_models::payments::Address,
api_models::payments::OrderDetails,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index f06dc4623d4..85b743ab0aa 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -1,8 +1,8 @@
pub use api_models::admin::{
CreateMerchantAccount, DeleteMcaResponse, DeleteMerchantAccountResponse,
MerchantAccountResponse, MerchantConnectorId, MerchantDetails, MerchantId,
- PaymentConnectorCreate, PaymentMethods, RoutingAlgorithm, ToggleKVRequest, ToggleKVResponse,
- WebhookDetails,
+ PaymentConnectorCreate, PaymentMethodsEnabled, RoutingAlgorithm, ToggleKVRequest,
+ ToggleKVResponse, WebhookDetails,
};
use crate::types::{storage, transformers::Foreign};
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index c567d296ddb..c5767bc2210 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -409,7 +409,6 @@ pub enum PaymentMethodIssuerCode {
JpSepa,
JpBacs,
}
-
#[derive(
Clone,
Copy,
diff --git a/crates/storage_models/src/query/merchant_connector_account.rs b/crates/storage_models/src/query/merchant_connector_account.rs
index e2496aa0e0c..6e63cdf6e66 100644
--- a/crates/storage_models/src/query/merchant_connector_account.rs
+++ b/crates/storage_models/src/query/merchant_connector_account.rs
@@ -89,19 +89,38 @@ impl MerchantConnectorAccount {
pub async fn find_by_merchant_id(
conn: &PgPooledConn,
merchant_id: &str,
+ get_disabled: bool,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<
- <Self as HasTable>::Table,
- _,
- <<Self as HasTable>::Table as Table>::PrimaryKey,
- _,
- >(
- conn,
- dsl::merchant_id.eq(merchant_id.to_owned()),
- None,
- None,
- None,
- )
- .await
+ if get_disabled {
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
+ conn,
+ dsl::merchant_id.eq(merchant_id.to_owned()),
+ None,
+ None,
+ None,
+ )
+ .await
+ } else {
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
+ conn,
+ dsl::merchant_id
+ .eq(merchant_id.to_owned())
+ .and(dsl::disabled.eq(false)),
+ None,
+ None,
+ None,
+ )
+ .await
+ }
}
}
|
refactor
|
modify pm list to support new api contract (#657)
|
718c8a423a0fe263b3dabd595f04e8f5f1d1050f
|
2023-02-28 16:39:35
|
Nishant Joshi
|
fix(list): fix card network filtering (#684)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 131dca2f6f6..780f055252d 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -343,6 +343,10 @@ impl<'de> serde::Deserialize<'de> for ListPaymentMethodRequest {
map.next_value()?,
)?;
}
+ "card_network" => match output.card_networks.as_mut() {
+ Some(inner) => inner.push(map.next_value()?),
+ None => output.card_networks = Some(vec![map.next_value()?]),
+ },
_ => {}
}
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index ae7e46a006b..a702a9dcfa1 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -727,6 +727,7 @@ async fn filter_payment_methods(
let filter4 = filter_pm_card_network_based(
payment_method_object.card_networks.as_ref(),
req.card_networks.as_ref(),
+ &payment_method_object.payment_method_type,
);
let filter3 = if let Some(payment_intent) = payment_intent {
@@ -797,14 +798,20 @@ fn filter_pm_based_on_config<'a>(
fn filter_pm_card_network_based(
pm_card_networks: Option<&Vec<api_enums::CardNetwork>>,
request_card_networks: Option<&Vec<api_enums::CardNetwork>>,
+ pm_type: &api_enums::PaymentMethodType,
) -> bool {
logger::debug!(pm_card_networks=?pm_card_networks);
logger::debug!(request_card_networks=?request_card_networks);
- match (pm_card_networks, request_card_networks) {
- (Some(pm_card_networks), Some(request_card_networks)) => request_card_networks
- .iter()
- .all(|card_network| pm_card_networks.contains(card_network)),
- (None, Some(_)) => false,
+ match pm_type {
+ api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit => {
+ match (pm_card_networks, request_card_networks) {
+ (Some(pm_card_networks), Some(request_card_networks)) => request_card_networks
+ .iter()
+ .all(|card_network| pm_card_networks.contains(card_network)),
+ (None, Some(_)) => false,
+ _ => true,
+ }
+ }
_ => true,
}
}
|
fix
|
fix card network filtering (#684)
|
cda690bf39bc1c26634ed8ba07539196bed59257
|
2024-09-25 16:22:09
|
Pa1NarK
|
fix(api_key): fix api key `list` and `update` endpoints for v2 (#5980)
| false
|
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
new file mode 100644
index 00000000000..5975e9bd6ca
--- /dev/null
+++ b/api-reference-v2/api-reference/api-key/api-key--list.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/api_keys/list
+---
diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json
index 4c053f4d96d..030d29958dc 100644
--- a/api-reference-v2/mint.json
+++ b/api-reference-v2/mint.json
@@ -86,7 +86,8 @@
"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--revoke",
+ "api-reference/api-key/api-key--list"
]
},
{
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 99462e95e07..2a32899880d 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -1433,6 +1433,60 @@
]
}
},
+ "/v2/api_keys/list": {
+ "get": {
+ "tags": [
+ "API Key"
+ ],
+ "summary": "API Key - List",
+ "description": "List all the API Keys associated to a merchant account.",
+ "operationId": "List all API Keys associated with a merchant account",
+ "parameters": [
+ {
+ "name": "limit",
+ "in": "query",
+ "description": "The maximum number of API Keys to include in the response",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ },
+ {
+ "name": "skip",
+ "in": "query",
+ "description": "The number of API Keys to skip when retrieving the list of API keys.",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "List of API Keys retrieved successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RetrieveApiKeyResponse"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
"/v2/customers": {
"post": {
"tags": [
diff --git a/api-reference/api-reference/api-key/api-key--list.mdx b/api-reference/api-reference/api-key/api-key--list.mdx
new file mode 100644
index 00000000000..ba371a57ce9
--- /dev/null
+++ b/api-reference/api-reference/api-key/api-key--list.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /api_keys/{merchant_id}/list
+---
diff --git a/api-reference/mint.json b/api-reference/mint.json
index b5d9a4b6206..03a76fed183 100644
--- a/api-reference/mint.json
+++ b/api-reference/mint.json
@@ -137,7 +137,8 @@
"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--revoke",
+ "api-reference/api-key/api-key--list"
]
},
{
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index f5f01c8c49c..dfcaf157c21 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -4841,6 +4841,69 @@
]
}
},
+ "/api_keys/{merchant_id}/list": {
+ "get": {
+ "tags": [
+ "API Key"
+ ],
+ "summary": "API Key - List",
+ "description": "List all the API Keys associated to a merchant account.",
+ "operationId": "List all API Keys associated with a merchant account",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "description": "The unique identifier for the merchant account",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "description": "The maximum number of API Keys to include in the response",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ },
+ {
+ "name": "skip",
+ "in": "query",
+ "description": "The number of API Keys to skip when retrieving the list of API keys.",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "List of API Keys retrieved successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RetrieveApiKeyResponse"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
"/events/{merchant_id}": {
"get": {
"tags": [
diff --git a/crates/api_models/src/api_keys.rs b/crates/api_models/src/api_keys.rs
index 1fc7ce97be8..65cc6b9a25a 100644
--- a/crates/api_models/src/api_keys.rs
+++ b/crates/api_models/src/api_keys.rs
@@ -154,7 +154,7 @@ pub struct RevokeApiKeyResponse {
}
/// The constraints that are applicable when listing API Keys associated with a merchant account.
-#[derive(Clone, Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ListApiKeyConstraints {
/// The maximum number of API Keys to include in the response.
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index b8a872ffd25..5816df518bd 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -90,6 +90,7 @@ impl_api_event_type!(
CardInfoResponse,
CreateApiKeyResponse,
CreateApiKeyRequest,
+ ListApiKeyConstraints,
MerchantConnectorDeleteResponse,
MerchantConnectorUpdate,
MerchantConnectorCreate,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 85865584494..ae999bb0604 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -183,6 +183,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::api_keys::api_key_retrieve,
routes::api_keys::api_key_update,
routes::api_keys::api_key_revoke,
+ routes::api_keys::api_key_list,
// Routes for events
routes::webhook_events::list_initial_webhook_delivery_attempts,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 6e6e2f6f87d..64fb7a4e93d 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -109,6 +109,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::api_keys::api_key_retrieve,
routes::api_keys::api_key_update,
routes::api_keys::api_key_revoke,
+ routes::api_keys::api_key_list,
//Routes for customers
routes::customers::customers_create,
diff --git a/crates/openapi/src/routes/api_keys.rs b/crates/openapi/src/routes/api_keys.rs
index 7ed2afe91a1..7527c8a1095 100644
--- a/crates/openapi/src/routes/api_keys.rs
+++ b/crates/openapi/src/routes/api_keys.rs
@@ -163,3 +163,44 @@ pub async fn api_key_revoke() {}
security(("admin_api_key" = []))
)]
pub async fn api_key_revoke() {}
+
+#[cfg(feature = "v1")]
+/// API Key - List
+///
+/// List all the API Keys associated to a merchant account.
+#[utoipa::path(
+ get,
+ path = "/api_keys/{merchant_id}/list",
+ params(
+ ("merchant_id" = String, Path, description = "The unique identifier for the merchant account"),
+ ("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."),
+ ),
+ responses(
+ (status = 200, description = "List of API Keys retrieved successfully", body = Vec<RetrieveApiKeyResponse>),
+ ),
+ tag = "API Key",
+ operation_id = "List all API Keys associated with a merchant account",
+ security(("admin_api_key" = []))
+)]
+pub async fn api_key_list() {}
+
+#[cfg(feature = "v2")]
+/// API Key - List
+///
+/// List all the API Keys associated to a merchant account.
+#[utoipa::path(
+ get,
+ 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."),
+ ),
+ responses(
+ (status = 200, description = "List of API Keys retrieved successfully", body = Vec<RetrieveApiKeyResponse>),
+ ),
+ tag = "API Key",
+ operation_id = "List all API Keys associated with a merchant account",
+ security(("admin_api_key" = []))
+)]
+pub async fn api_key_list() {}
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index a00e740b3e6..047e0d9b886 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -9,10 +9,6 @@ use crate::{
types::api as api_types,
};
-/// API Key - Create
-///
-/// Create a new API Key for accessing our APIs from your servers. The plaintext API Key will be
-/// displayed only once on creation, so ensure you store it securely.
#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyCreate))]
pub async fn api_key_create(
@@ -78,9 +74,6 @@ pub async fn api_key_create(
.await
}
-/// API Key - Retrieve
-///
-/// Retrieve information about the specified API Key.
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyRetrieve))]
pub async fn api_key_retrieve(
@@ -117,9 +110,6 @@ pub async fn api_key_retrieve(
}
#[cfg(feature = "v1")]
-/// API Key - Retrieve
-///
-/// Retrieve information about the specified API Key.
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyRetrieve))]
pub async fn api_key_retrieve(
state: web::Data<AppState>,
@@ -150,9 +140,6 @@ pub async fn api_key_retrieve(
}
#[cfg(feature = "v1")]
-/// API Key - Update
-///
-/// Update information for the specified API Key.
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyUpdate))]
pub async fn api_key_update(
state: web::Data<AppState>,
@@ -190,26 +177,27 @@ pub async fn api_key_update(
pub async fn api_key_update(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<(common_utils::id_type::MerchantId, String)>,
+ key_id: web::Path<String>,
json_payload: web::Json<api_types::UpdateApiKeyRequest>,
) -> impl Responder {
let flow = Flow::ApiKeyUpdate;
- let (merchant_id, key_id) = path.into_inner();
+ let api_key_id = key_id.into_inner();
let mut payload = json_payload.into_inner();
- payload.key_id = key_id;
- payload.merchant_id.clone_from(&merchant_id);
+ payload.key_id = api_key_id;
api::server_wrap(
flow,
state,
&req,
payload,
- |state, _, payload, _| api_keys::update_api_key(state, payload),
+ |state, authentication_data, mut payload, _| {
+ payload.merchant_id = authentication_data.merchant_account.get_id().to_owned();
+ api_keys::update_api_key(state, payload)
+ },
auth::auth_type(
- &auth::AdminApiAuth,
- &auth::JWTAuthMerchantFromRoute {
- merchant_id,
- required_permission: Permission::ApiKeyWrite,
+ &auth::AdminApiAuthWithMerchantIdFromHeader,
+ &auth::JWTAuthMerchantFromHeader {
+ required_permission: Permission::ApiKeyRead,
minimum_entity_level: EntityType::Merchant,
},
req.headers(),
@@ -220,10 +208,6 @@ pub async fn api_key_update(
}
#[cfg(feature = "v1")]
-/// API Key - Revoke
-///
-/// Revoke the specified API Key. Once revoked, the API Key can no longer be used for
-/// authenticating with our APIs.
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyRevoke))]
pub async fn api_key_revoke(
state: web::Data<AppState>,
@@ -283,24 +267,7 @@ pub async fn api_key_revoke(
.await
}
-/// API Key - List
-///
-/// List all API Keys associated with your merchant account.
-#[utoipa::path(
- get,
- path = "/api_keys/{merchant_id}/list",
- params(
- ("merchant_id" = String, Path, description = "The unique identifier for the merchant account"),
- ("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."),
- ),
- responses(
- (status = 200, description = "List of API Keys retrieved successfully", body = Vec<RetrieveApiKeyResponse>),
- ),
- tag = "API Key",
- operation_id = "List all API Keys associated with a merchant account",
- security(("admin_api_key" = []))
-)]
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyList))]
pub async fn api_key_list(
state: web::Data<AppState>,
@@ -335,3 +302,34 @@ pub async fn api_key_list(
)
.await
}
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::ApiKeyList))]
+pub async fn api_key_list(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ query: web::Query<api_types::ListApiKeyConstraints>,
+) -> impl Responder {
+ let flow = Flow::ApiKeyList;
+ let payload = query.into_inner();
+
+ api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, authentication_data, payload, _| async move {
+ let merchant_id = authentication_data.merchant_account.get_id().to_owned();
+ api_keys::list_api_keys(state, merchant_id, payload.limit, payload.skip).await
+ },
+ auth::auth_type(
+ &auth::AdminApiAuthWithMerchantIdFromHeader,
+ &auth::JWTAuthMerchantFromHeader {
+ required_permission: Permission::ApiKeyRead,
+ minimum_entity_level: EntityType::Merchant,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ )
+ .await
+}
|
fix
|
fix api key `list` and `update` endpoints for v2 (#5980)
|
ed82af81f9316c266adc7ee8273b0e33e1c83ccf
|
2024-05-27 22:27:07
|
DEEPANSHU BANSAL
|
feat(connector): [AUTHORIZEDOTNET] Implement non-zero mandates (#4758)
| false
|
diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs
index a9e000b82b9..8d0c1db37a2 100644
--- a/crates/router/src/connector/authorizedotnet.rs
+++ b/crates/router/src/connector/authorizedotnet.rs
@@ -79,6 +79,16 @@ impl ConnectorValidation for Authorizedotnet {
),
}
}
+
+ fn validate_mandate_payment(
+ &self,
+ pm_type: Option<types::storage::enums::PaymentMethodType>,
+ pm_data: types::domain::payments::PaymentMethodData,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let mandate_supported_pmd =
+ std::collections::HashSet::from([crate::connector::utils::PaymentMethodDataType::Card]);
+ connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
+ }
}
impl api::Payment for Authorizedotnet {}
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index 3e4d0a382e6..de68438edc4 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -133,20 +133,36 @@ pub enum WalletMethod {
struct TransactionRequest {
transaction_type: TransactionType,
amount: f64,
- currency_code: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- profile: Option<CustomerProfileDetails>,
+ currency_code: common_enums::Currency,
#[serde(skip_serializing_if = "Option::is_none")]
payment: Option<PaymentDetails>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ profile: Option<ProfileDetails>,
order: Order,
#[serde(skip_serializing_if = "Option::is_none")]
+ customer: Option<CustomerDetails>,
+ #[serde(skip_serializing_if = "Option::is_none")]
bill_to: Option<BillTo>,
+ #[serde(skip_serializing_if = "Option::is_none")]
processing_options: Option<ProcessingOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
subsequent_auth_information: Option<SubsequentAuthInformation>,
authorization_indicator_type: Option<AuthorizationIndicator>,
}
+#[derive(Serialize, Deserialize, Debug)]
+#[serde(untagged)]
+enum ProfileDetails {
+ CreateProfileDetails(CreateProfileDetails),
+ CustomerProfileDetails(CustomerProfileDetails),
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateProfileDetails {
+ create_profile: bool,
+}
+
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct CustomerProfileDetails {
@@ -160,6 +176,12 @@ struct PaymentProfileDetails {
payment_profile_id: Secret<String>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CustomerDetails {
+ id: String,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProcessingOptions {
@@ -461,37 +483,37 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
fn try_from(
item: &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
- let (payment_details, processing_options, subsequent_auth_information, profile) = match item
+ let merchant_authentication =
+ AuthorizedotnetAuthType::try_from(&item.router_data.connector_auth_type)?;
+
+ let ref_id = if item.router_data.connector_request_reference_id.len() <= 20 {
+ Some(item.router_data.connector_request_reference_id.clone())
+ } else {
+ None
+ };
+
+ let transaction_request = match item
.router_data
.request
.mandate_id
- .to_owned()
+ .clone()
.and_then(|mandate_ids| mandate_ids.mandate_reference_id)
{
Some(api_models::payments::MandateReferenceId::NetworkMandateId(network_trans_id)) => {
- let processing_options = Some(ProcessingOptions {
- is_subsequent_auth: true,
- });
- let subsequent_auth_info = Some(SubsequentAuthInformation {
- original_network_trans_id: Secret::new(network_trans_id),
- reason: Reason::Resubmission,
- });
- match item.router_data.request.payment_method_data {
- domain::PaymentMethodData::Card(ref ccard) => {
- let payment_details = PaymentDetails::CreditCard(CreditCardDetails {
- card_number: (*ccard.card_number).clone(),
- expiration_date: ccard.get_expiry_date_as_yyyymm("-"),
- card_code: None,
- });
- (
- Some(payment_details),
- processing_options,
- subsequent_auth_info,
- None,
- )
+ TransactionRequest::try_from((item, network_trans_id))?
+ }
+ Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
+ connector_mandate_id,
+ )) => TransactionRequest::try_from((item, connector_mandate_id))?,
+ None => {
+ match &item.router_data.request.payment_method_data {
+ domain::PaymentMethodData::Card(ccard) => {
+ TransactionRequest::try_from((item, ccard))
+ }
+ domain::PaymentMethodData::Wallet(wallet_data) => {
+ TransactionRequest::try_from((item, wallet_data))
}
domain::PaymentMethodData::CardRedirect(_)
- | domain::PaymentMethodData::Wallet(_)
| domain::PaymentMethodData::PayLater(_)
| domain::PaymentMethodData::BankRedirect(_)
| domain::PaymentMethodData::BankDebit(_)
@@ -510,16 +532,116 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
))?
}
}
- }
- Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
- connector_mandate_id,
- )) => (
- None,
- Some(ProcessingOptions {
- is_subsequent_auth: true,
+ }?,
+ };
+ Ok(Self {
+ create_transaction_request: AuthorizedotnetPaymentsRequest {
+ merchant_authentication,
+ ref_id,
+ transaction_request,
+ },
+ })
+ }
+}
+
+impl
+ TryFrom<(
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ String,
+ )> for TransactionRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, network_trans_id): (
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ String,
+ ),
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
+ amount: item.amount,
+ currency_code: item.router_data.request.currency,
+ payment: Some(match item.router_data.request.payment_method_data {
+ domain::PaymentMethodData::Card(ref ccard) => {
+ PaymentDetails::CreditCard(CreditCardDetails {
+ card_number: (*ccard.card_number).clone(),
+ expiration_date: ccard.get_expiry_date_as_yyyymm("-"),
+ card_code: None,
+ })
+ }
+ 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(
+ utils::get_unimplemented_payment_method_error_message("authorizedotnet"),
+ ))?
+ }
+ }),
+ profile: None,
+ order: Order {
+ description: item.router_data.connector_request_reference_id.clone(),
+ },
+ customer: None,
+ bill_to: item
+ .router_data
+ .get_optional_billing()
+ .and_then(|billing_address| billing_address.address.as_ref())
+ .map(|address| BillTo {
+ first_name: address.first_name.clone(),
+ last_name: address.last_name.clone(),
+ address: address.line1.clone(),
+ city: address.city.clone(),
+ state: address.state.clone(),
+ zip: address.zip.clone(),
+ country: address.country,
+ }),
+ processing_options: Some(ProcessingOptions {
+ is_subsequent_auth: true,
+ }),
+ subsequent_auth_information: Some(SubsequentAuthInformation {
+ original_network_trans_id: Secret::new(network_trans_id),
+ reason: Reason::Resubmission,
+ }),
+ authorization_indicator_type: match item.router_data.request.capture_method {
+ Some(capture_method) => Some(AuthorizationIndicator {
+ authorization_indicator: capture_method.try_into()?,
}),
- None,
- Some(CustomerProfileDetails {
+ None => None,
+ },
+ })
+ }
+}
+
+impl
+ TryFrom<(
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ api_models::payments::ConnectorMandateReferenceId,
+ )> for TransactionRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, connector_mandate_id): (
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ api_models::payments::ConnectorMandateReferenceId,
+ ),
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
+ amount: item.amount,
+ currency_code: item.router_data.request.currency,
+ payment: None,
+ profile: Some(ProfileDetails::CustomerProfileDetails(
+ CustomerProfileDetails {
customer_profile_id: Secret::from(
connector_mandate_id
.connector_mandate_id
@@ -532,64 +654,86 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
.ok_or(errors::ConnectorError::MissingConnectorMandateID)?,
),
},
- }),
- ),
- None => {
- match item.router_data.request.payment_method_data {
- domain::PaymentMethodData::Card(ref ccard) => {
- (
- Some(PaymentDetails::CreditCard(CreditCardDetails {
- card_number: (*ccard.card_number).clone(),
- // expiration_date: format!("{expiry_year}-{expiry_month}").into(),
- expiration_date: ccard.get_expiry_date_as_yyyymm("-"),
- card_code: Some(ccard.card_cvc.clone()),
- })),
- Some(ProcessingOptions {
- is_subsequent_auth: true,
- }),
- None,
- None,
- )
- }
- domain::PaymentMethodData::Wallet(ref wallet_data) => (
- Some(get_wallet_data(
- wallet_data,
- &item.router_data.request.complete_authorize_url,
- )?),
- None,
- None,
- None,
- ),
- domain::PaymentMethodData::CardRedirect(_)
- | 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(
- utils::get_unimplemented_payment_method_error_message(
- "authorizedotnet",
- ),
- ))?
- }
- }
- }
- };
- let authorization_indicator_type = match item.router_data.request.capture_method {
- Some(capture_method) => Some(AuthorizationIndicator {
- authorization_indicator: capture_method.try_into()?,
+ },
+ )),
+ order: Order {
+ description: item.router_data.connector_request_reference_id.clone(),
+ },
+ customer: None,
+ bill_to: None,
+ processing_options: Some(ProcessingOptions {
+ is_subsequent_auth: true,
}),
- None => None,
+ subsequent_auth_information: None,
+ authorization_indicator_type: match item.router_data.request.capture_method {
+ Some(capture_method) => Some(AuthorizationIndicator {
+ authorization_indicator: capture_method.try_into()?,
+ }),
+ None => None,
+ },
+ })
+ }
+}
+
+impl
+ TryFrom<(
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ &domain::Card,
+ )> for TransactionRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, ccard): (
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ &domain::Card,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let (profile, customer) = if item
+ .router_data
+ .request
+ .setup_future_usage
+ .map_or(false, |future_usage| {
+ matches!(future_usage, common_enums::FutureUsage::OffSession)
+ })
+ && (item.router_data.request.customer_acceptance.is_some()
+ || item
+ .router_data
+ .request
+ .setup_mandate_details
+ .clone()
+ .map_or(false, |mandate_details| {
+ mandate_details.customer_acceptance.is_some()
+ })) {
+ (
+ Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
+ create_profile: true,
+ })),
+ Some(CustomerDetails {
+ id: item
+ .router_data
+ .customer_id
+ .clone()
+ .ok_or_else(missing_field_err("customer_id"))?,
+ }),
+ )
+ } else {
+ (None, None)
};
- let bill_to = match profile {
- Some(_) => None,
- None => item
+ Ok(Self {
+ transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
+ amount: item.amount,
+ currency_code: item.router_data.request.currency,
+ payment: Some(PaymentDetails::CreditCard(CreditCardDetails {
+ card_number: (*ccard.card_number).clone(),
+ expiration_date: ccard.get_expiry_date_as_yyyymm("-"),
+ card_code: Some(ccard.card_cvc.clone()),
+ })),
+ profile,
+ order: Order {
+ description: item.router_data.connector_request_reference_id.clone(),
+ },
+ customer,
+ bill_to: item
.router_data
.get_optional_billing()
.and_then(|billing_address| billing_address.address.as_ref())
@@ -602,34 +746,64 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
zip: address.zip.clone(),
country: address.country,
}),
- };
- let transaction_request = TransactionRequest {
+ processing_options: None,
+ subsequent_auth_information: None,
+ authorization_indicator_type: match item.router_data.request.capture_method {
+ Some(capture_method) => Some(AuthorizationIndicator {
+ authorization_indicator: capture_method.try_into()?,
+ }),
+ None => None,
+ },
+ })
+ }
+}
+
+impl
+ TryFrom<(
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ &domain::WalletData,
+ )> for TransactionRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, wallet_data): (
+ &AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>,
+ &domain::WalletData,
+ ),
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount,
- currency_code: item.router_data.request.currency.to_string(),
- profile,
- payment: payment_details,
+ currency_code: item.router_data.request.currency,
+ payment: Some(get_wallet_data(
+ wallet_data,
+ &item.router_data.request.complete_authorize_url,
+ )?),
+ profile: None,
order: Order {
description: item.router_data.connector_request_reference_id.clone(),
},
- bill_to,
- processing_options,
- subsequent_auth_information,
- authorization_indicator_type,
- };
-
- let merchant_authentication =
- AuthorizedotnetAuthType::try_from(&item.router_data.connector_auth_type)?;
- let ref_id = if item.router_data.connector_request_reference_id.len() <= 20 {
- Some(item.router_data.connector_request_reference_id.clone())
- } else {
- None
- };
- Ok(Self {
- create_transaction_request: AuthorizedotnetPaymentsRequest {
- merchant_authentication,
- ref_id,
- transaction_request,
+ customer: None,
+ bill_to: item
+ .router_data
+ .get_optional_billing()
+ .and_then(|billing_address| billing_address.address.as_ref())
+ .map(|address| BillTo {
+ first_name: address.first_name.clone(),
+ last_name: address.last_name.clone(),
+ address: address.line1.clone(),
+ city: address.city.clone(),
+ state: address.state.clone(),
+ zip: address.zip.clone(),
+ country: address.country,
+ }),
+ processing_options: None,
+ subsequent_auth_information: None,
+ authorization_indicator_type: match item.router_data.request.capture_method {
+ Some(capture_method) => Some(AuthorizationIndicator {
+ authorization_indicator: capture_method.try_into()?,
+ }),
+ None => None,
},
})
}
@@ -804,6 +978,15 @@ pub struct SecureAcceptance {
#[serde(rename_all = "camelCase")]
pub struct AuthorizedotnetPaymentsResponse {
pub transaction_response: Option<TransactionResponse>,
+ pub profile_response: Option<AuthorizedotnetNonZeroMandateResponse>,
+ pub messages: ResponseMessages,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthorizedotnetNonZeroMandateResponse {
+ customer_profile_id: Option<String>,
+ customer_payment_profile_id_list: Option<Vec<String>>,
pub messages: ResponseMessages,
}
@@ -913,7 +1096,16 @@ impl<F, T>
transaction_response.transaction_id.clone(),
),
redirection_data,
- mandate_reference: None,
+ mandate_reference: item.response.profile_response.map(
+ |profile_response| types::MandateReference {
+ connector_mandate_id: profile_response.customer_profile_id,
+ payment_method_id: profile_response
+ .customer_payment_profile_id_list
+ .and_then(|customer_payment_profile_id_list| {
+ customer_payment_profile_id_list.first().cloned()
+ }),
+ },
+ ),
connector_metadata: metadata,
network_txn_id: transaction_response
.network_trans_id
|
feat
|
[AUTHORIZEDOTNET] Implement non-zero mandates (#4758)
|
760fd3b566f7a898cf79d50e5bdb4629ed3eca5f
|
2024-06-28 15:55:51
|
Pa1NarK
|
chore: fix ui-test configs (#5152)
| false
|
diff --git a/.github/testcases/ui_tests.json b/.github/testcases/ui_tests.json
index a8d46241f3d..b92b0fd4e32 100644
--- a/.github/testcases/ui_tests.json
+++ b/.github/testcases/ui_tests.json
@@ -69,19 +69,19 @@
"id": 12,
"name": "aci przelewy24",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"PLN\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"przelewy24\",\"payment_method_data\":{\"bank_redirect\":{\"przelewy24\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"PLN\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"przelewy24\",\"payment_method_data\":{\"bank_redirect\":{\"przelewy24\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"13": {
"id": 13,
"name": "aci trustly",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"trustly\",\"payment_method_data\":{\"bank_redirect\":{\"trustly\":{\"country\":\"DE\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"trustly\",\"payment_method_data\":{\"bank_redirect\":{\"trustly\":{\"country\":\"DE\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"14": {
"id": "14",
"name": "aci interac",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"CAD\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"interac\",\"payment_method_data\":{\"bank_redirect\":{\"interac\":{\"email\":\"[email protected]\",\"country\":\"CA\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"CAD\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"interac\",\"payment_method_data\":{\"bank_redirect\":{\"interac\":{\"email\":\"[email protected]\",\"country\":\"CA\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"15": {
"id": 15,
@@ -231,7 +231,7 @@
"id": 39,
"name": "shift4 giropay",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"Werner Heisenberg\"}}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"Werner Heisenberg\"}}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"40": {
"id": 40,
@@ -249,19 +249,19 @@
"id": 42,
"name": "shift4 ideal",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"43": {
"id": 43,
"name": "shift4 sofort",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"country\":\"AT\",\"preferred_language\":\"en\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"country\":\"AT\",\"preferred_language\":\"en\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"44": {
"id": 44,
"name": "shift4 eps",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"45": {
"id": 45,
@@ -273,7 +273,7 @@
"id": 46,
"name": "globalpay paypal",
"connector": "globalpay",
- "request": "{\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"paypal\",\"payment_method_data\":{\"wallet\":{\"paypal_redirect\":{}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"paypal\",\"payment_method_data\":{\"wallet\":{\"paypal_redirect\":{}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"47": {
"id": 47,
@@ -291,7 +291,7 @@
"id": 49,
"name": "Worldline Ideal",
"connector": "worldline",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\"},\"bank_name\":\"abn_amro\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\"},\"bank_name\":\"abn_amro\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"50": {
"id": 50,
@@ -483,13 +483,13 @@
"id": 81,
"name": "Adyen Klarna positive",
"connector": "adyen_uk",
- "request": "{\"amount\":1800,\"currency\":\"SEK\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"manual\",\"customer_id\":\"cus_NwicjmCJbghHr2\",\"connector\":[\"adyen\"],\"routing\":{\"type\":\"single\",\"data\":\"adyen\"},\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"klarna_redirect\":{\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":180000,\"account_name\":\"transaction_processing\"}}}"
+ "request": "{\"amount\":1800,\"currency\":\"SEK\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"manual\",\"customer_id\":\"cus_NwicjmCJbghHr2\",\"connector\":[\"adyen\"],\"routing\":{\"type\":\"single\",\"data\":\"adyen\"},\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"klarna_redirect\":{\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":180000,\"account_name\":\"transaction_processing\"}}}"
},
"82": {
"id": 82,
"name": "Adyen walley",
"connector": "adyen_uk",
- "request": "{\"amount\":10000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"walley\",\"payment_method_data\":{\"pay_later\":{\"walley\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
+ "request": "{\"amount\":10000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"walley\",\"payment_method_data\":{\"pay_later\":{\"walley\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
},
"83": {
"id": 83,
@@ -519,13 +519,13 @@
"id": 87,
"name": "mollie p24",
"connector": "mollie",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"przelewy24\",\"payment_method_data\":{\"bank_redirect\":{\"przelewy24\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"przelewy24\",\"payment_method_data\":{\"bank_redirect\":{\"przelewy24\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"88": {
"id": 88,
"name": "mollie banktransfer",
"connector": "mollie",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"sepa_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\",\"name\":\"John Doe\"},\"country\":\"US\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"sepa_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\",\"name\":\"John Doe\"},\"country\":\"US\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"89": {
"id": 89,
@@ -561,13 +561,13 @@
"id": 94,
"name": "Cybersource Card No 3DS",
"connector": "cybersource",
- "request": "{\"amount\":6540,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"amount_to_capture\":65,\"capture_method\":\"automatic\",\"customer_id\":\"stripecustomer\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4622943127013705\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"838\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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\"},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":3200,\"account_name\":\"transaction_processing\"}}}"
+ "request": "{\"amount\":6540,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"amount_to_capture\":65,\"capture_method\":\"automatic\",\"customer_id\":\"stripecustomer\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4622943127013705\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"838\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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\"},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":3200,\"account_name\":\"transaction_processing\"}}}"
},
"95": {
"id": 95,
"name": "Stripe Canadian pre-authorized debit",
"connector": "stripe",
- "request": "{\"mandate_data\":{\"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\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"CAD\"}}},\"setup_future_usage\":\"off_session\",\"amount\":6540,\"currency\":\"CAD\",\"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://google.com\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"acss\",\"payment_method_data\":{\"bank_debit\":{\"acss_bank_debit\":{\"billing_details\":{\"name\":\"Akshaya\",\"email\":\"[email protected]\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"account_number\":\"000123456789\",\"institution_number\":\"000\",\"transit_number\":\"11000\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"mandate_data\":{\"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\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"CAD\"}}},\"setup_future_usage\":\"off_session\",\"amount\":6540,\"currency\":\"CAD\",\"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://google.com\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"acss\",\"payment_method_data\":{\"bank_debit\":{\"acss_bank_debit\":{\"billing_details\":{\"name\":\"Akshaya\",\"email\":\"[email protected]\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"account_number\":\"000123456789\",\"institution_number\":\"000\",\"transit_number\":\"11000\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"96": {
"id": 96,
@@ -849,13 +849,13 @@
"id": 142,
"name": "Stripe Card mandates initiated by merchant",
"connector": "stripe",
- "request": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":20,\"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://hs-payments-test.netlify.app/payments\",\"off_session\":true,\"mandate_id\":\"man_4r40iNQ9wFaGBKEGL7UH\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":20,\"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://hs-payments-test.netlify.app/payments\",\"off_session\":true,\"mandate_id\":\"man_4r40iNQ9wFaGBKEGL7UH\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IE\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"143": {
"id": 143,
"name": "payu klarna processing",
"connector": "payu",
- "request": "{\"amount\":6540,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"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://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4854460198765435\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2040\",\"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\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"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\":\"en-EN\",\"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\"}}"
+ "request": "{\"amount\":6540,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"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://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4854460198765435\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2040\",\"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\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"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\":\"en-EN\",\"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\"}}"
},
"144": {
"id": 144,
@@ -891,19 +891,19 @@
"id": 149,
"name": "Stripe Multibanco Bank Transfer",
"connector": "stripe",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"multibanco\",\"payment_method_data\":{\"bank_transfer\":{\"multibanco_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"multibanco\",\"payment_method_data\":{\"bank_transfer\":{\"multibanco_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"150": {
"id": 150,
"name": "opennode crypto payment",
"connector": "opennode",
- "request": "{\"amount\":100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"customer_id\":\"IatapayCustomer\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"crypto\",\"payment_method_type\":\"crypto_currency\",\"payment_method_data\":{\"crypto\":{}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"customer_id\":\"IatapayCustomer\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"crypto\",\"payment_method_type\":\"crypto_currency\",\"payment_method_data\":{\"crypto\":{}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"151": {
"id": 151,
"name": "coinbase crypto payment",
"connector": "coinbase",
- "request": "{\"amount\":100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"customer_id\":\"IatapayCustomer\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"crypto\",\"payment_method_type\":\"crypto_currency\",\"payment_method_data\":{\"crypto\":{}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"customer_id\":\"IatapayCustomer\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"crypto\",\"payment_method_type\":\"crypto_currency\",\"payment_method_data\":{\"crypto\":{}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"152": {
"id": 152,
@@ -939,13 +939,13 @@
"id": 157,
"name": "shift4eps",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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\":\"three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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\":\"three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AT\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"158": {
"id": 158,
"name": "shift4 ideal",
"connector": "shift4",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"159": {
"id": 159,
@@ -957,13 +957,13 @@
"id": 160,
"name": "Dlocal failed",
"connector": "dlocal",
- "request": "{\"amount\":6540,\"currency\":\"BRL\",\"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\":\"three_ds\",\"return_url\":\"https://google.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\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"BRL\",\"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\":\"three_ds\",\"return_url\":\"https://google.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\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"161": {
"id": 161,
"name": "Dlocal cards failed",
"connector": "dlocal",
- "request": "{\"amount\":6540,\"currency\":\"BRL\",\"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\":\"three_ds\",\"return_url\":\"https://google.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\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"BRL\",\"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\":\"three_ds\",\"return_url\":\"https://google.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\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"BR\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"162": {
"id": 162,
@@ -975,7 +975,7 @@
"id": "163",
"name": "Adyen ClearPay",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"GBP\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"afterpay_clearpay\",\"payment_method_data\":{\"pay_later\":{\"afterpay_clearpay_redirect\":{\"billing_email\":\"[email protected]\",\"billing_name\":\"sakil\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}}}"
+ "request": "{\"amount\":6540,\"currency\":\"GBP\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"afterpay_clearpay\",\"payment_method_data\":{\"pay_later\":{\"afterpay_clearpay_redirect\":{\"billing_email\":\"[email protected]\",\"billing_name\":\"sakil\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}}}"
},
"164": {
"id": 164,
@@ -1017,13 +1017,13 @@
"id": 170,
"name": "Adyen Twint",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"CHF\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"wallet\",\"payment_method_type\":\"twint\",\"payment_method_data\":{\"wallet\":{\"twint_redirect\":{}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"CHF\",\"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://hs-payments-test.netlify.app/payments/\",\"payment_method\":\"wallet\",\"payment_method_type\":\"twint\",\"payment_method_data\":{\"wallet\":{\"twint_redirect\":{}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"171": {
"id": 171,
"name": "Adyen Vipps",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"NOK\",\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"vipps\",\"payment_method_data\":{\"wallet\":{\"vipps_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"NOK\",\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"vipps\",\"payment_method_data\":{\"wallet\":{\"vipps_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"172": {
"id": 172,
@@ -1047,13 +1047,13 @@
"id": 175,
"name": "Adyen DANA",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"IDR\",\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"dana\",\"payment_method_data\":{\"wallet\":{\"dana_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ID\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ID\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"IDR\",\"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://google.com\",\"payment_method\":\"wallet\",\"payment_method_type\":\"dana\",\"payment_method_data\":{\"wallet\":{\"dana_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ID\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ID\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"176": {
"id": 176,
"name": "noon card success scenario",
"connector": "noon",
- "request": "{\"amount\":10,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
+ "request": "{\"amount\":10,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
},
"177": {
"id": 177,
@@ -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\":\"9123456789",\"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\":\"9123456789",\"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\"}}"
+ "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\":\"9123456789\",\"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\":\"9123456789\",\"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,
@@ -1113,31 +1113,31 @@
"id": 186,
"name": "Adyen Bizum",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"bizum\",\"payment_method_data\":{\"bank_redirect\":{\"bizum\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"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\"}}"
+ "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"bizum\",\"payment_method_data\":{\"bank_redirect\":{\"bizum\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"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\"}}"
},
"187": {
"id": 187,
"name": "Adyen Atome",
"connector": "stripe",
- "request": "{\"amount\":10000,\"currency\":\"SGD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"atome\",\"payment_method_data\":{\"pay_later\":{\"atome_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
+ "request": "{\"amount\":10000,\"currency\":\"SGD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"atome\",\"payment_method_data\":{\"pay_later\":{\"atome_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
},
"188": {
"id": 188,
"name": "Adyen atome",
"connector": "adyen",
- "request": "{\"amount\":10000,\"currency\":\"SGD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"atome\",\"payment_method_data\":{\"pay_later\":{\"atome_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
+ "request": "{\"amount\":10000,\"currency\":\"SGD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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\":\"pay_later\",\"payment_method_type\":\"atome\",\"payment_method_data\":{\"pay_later\":{\"atome_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
},
"189": {
"id": 189,
"name": "Bacs ",
"connector": "stripe_uk",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"multibanco\",\"payment_method_data\":{\"bank_transfer\":{\"multibanco_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"multibanco\",\"payment_method_data\":{\"bank_transfer\":{\"multibanco_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"190": {
"id": 190,
"name": "nuvei card no_3ds",
"connector": "nuvei",
- "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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"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\":\"9123456789",\"country_code\":\"+91\"}},\"browser_info\":{\"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\"}}"
+ "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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"browser_info\":{\"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\"}}"
},
"191": {
"id": 191,
@@ -1185,7 +1185,7 @@
"id": 198,
"name": "walley redirect success",
"connector": "adyen_uk",
- "request": "{\"amount\":10000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"walley\",\"payment_method_data\":{\"pay_later\":{\"walley_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
+ "request": "{\"amount\":10000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"pay_later\",\"payment_method_type\":\"walley\",\"payment_method_data\":{\"pay_later\":{\"walley_redirect\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NO\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"metadata\":{\"order_details\":{\"product_name\":\"shoe\",\"quantity\":1,\"amount\":10000}}}"
},
"199": {
"id": 199,
@@ -1203,7 +1203,7 @@
"id": 201,
"name": "zen 3ds card ",
"connector": "zen",
- "request": "{\"amount\":101,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"amount_to_capture\":97,\"customer_id\":\"custhype1232\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments/\",\"email\":\"[email protected]\",\"name\":\"Joseph Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"100\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"PL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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\":\"109.71.40.0\"},\"metadata\":{\"order_category\":\"applepay\"},\"order_details\":[{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":101,\"account_name\":\"transaction_processing\"}]}"
+ "request": "{\"amount\":101,\"currency\":\"PLN\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"amount_to_capture\":97,\"customer_id\":\"custhype1232\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments/\",\"email\":\"[email protected]\",\"name\":\"Joseph Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"100\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"PL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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\":\"109.71.40.0\"},\"metadata\":{\"order_category\":\"applepay\"},\"order_details\":[{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":101,\"account_name\":\"transaction_processing\"}]}"
},
"202": {
"id": "202",
@@ -1215,13 +1215,13 @@
"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\":\"9123456789",\"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\":\"9123456789",\"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\"}}"
+ "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\":\"9123456789\",\"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\":\"9123456789\",\"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\":\"9123456789",\"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\":\"9123456789",\"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\"}}"
+ "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\":\"9123456789\",\"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\":\"9123456789\",\"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,
@@ -1245,13 +1245,13 @@
"id": 208,
"name": "aci EPS success",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"209": {
"id": 209,
"name": "aci GIROPAY success",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"210": {
"id": 210,
@@ -1263,13 +1263,13 @@
"id": 211,
"name": "aci IDEAL success",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"212": {
"id": 212,
"name": "aci SOFORT success",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\",\"preferred_language\":\"en\",\"country\":\"NL\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\",\"preferred_language\":\"en\",\"country\":\"NL\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"213": {
"id": 213,
@@ -1281,13 +1281,13 @@
"id": 214,
"name": "NOON CARD 3DS MANDATES",
"connector": "noon",
- "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"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\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
+ "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"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\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
},
"215": {
"id": 215,
"name": "card no 3ds mandates",
"connector": "noon",
- "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002701\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"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\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
+ "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002701\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"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\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"
},
"216": {
"id": 216,
@@ -1305,7 +1305,7 @@
"id": 218,
"name": "UPI iatapay",
"connector": "iatapay",
- "request": "{\"amount\":5000,\"currency\":\"INR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":5000,\"customer_id\":\"IatapayCustomer\",\"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\":\"upi\",\"payment_method_type\":\"upi_collect\",\"payment_method_data\":{\"upi\":{\"vpa_id\":\"successtest@iata\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IN\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":5000,\"currency\":\"INR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":5000,\"customer_id\":\"IatapayCustomer\",\"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\":\"upi\",\"payment_method_type\":\"upi_collect\",\"payment_method_data\":{\"upi\":{\"vpa_id\":\"successtest@iata\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"IN\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"219": {
"id": 219,
@@ -1323,13 +1323,13 @@
"id": 221,
"name": "nexinets 3ds challenge success scenario",
"connector": "nexinets",
- "request": "{\"amount\":10000,\"currency\":\"EUR\",\"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\":\"three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000007000000031\",\"card_exp_month\":\"05\",\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":10000,\"currency\":\"EUR\",\"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\":\"three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000007000000031\",\"card_exp_month\":\"05\",\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"222": {
"id": 222,
"name": "nexinets ideal success",
"connector": "nexinets",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789",\"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\":\"9123456789",\"country_code\":\"+91\"}},\"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\",\"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://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\"},\"bank_name\":\"ing\"}}},\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"223": {
"id": 223,
@@ -1353,7 +1353,7 @@
"id": 227,
"name": "authorizedotnet payment success for webhook",
"connector": "authorizedotnet",
- "request": "{\"amount\":400,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":40,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"5424000000000015\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2025\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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,\"ip_address\":\"127.2.2.0\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":400,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":40,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"5424000000000015\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2025\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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,\"ip_address\":\"127.2.2.0\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"228": {
"id": 228,
@@ -1383,7 +1383,7 @@
"id": 232,
"name": "Adyen Open Banking UK",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"GBP\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_data\":{\"bank_redirect\":{\"open_banking_uk\":{\"issuer\":\"open_bank_success\",\"country\":\"GB\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"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\":\"GBP\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"bank_redirect\",\"payment_method_data\":{\"bank_redirect\":{\"open_banking_uk\":{\"issuer\":\"open_bank_success\",\"country\":\"GB\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"GB\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"233": {
"id": 233,
@@ -1407,19 +1407,19 @@
"id": 236,
"name": "Adyen Seven Eleven",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seven_eleven\",\"payment_method_data\":{\"voucher\":{\"seven_eleven\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seven_eleven\",\"payment_method_data\":{\"voucher\":{\"seven_eleven\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"237": {
"id": 237,
"name": "Japanese convenience stores LAWSON",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"lawson\",\"payment_method_data\":{\"voucher\":{\"lawson\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"lawson\",\"payment_method_data\":{\"voucher\":{\"lawson\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"238": {
"id": 238,
"name": "Adyen Momo Atm(Napas)",
"connector": "adyen_uk",
- "request": "{\"amount\":65400,\"currency\":\"VND\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card_redirect\",\"payment_method_type\":\"momo_atm\",\"payment_method_data\":{\"card_redirect\":{\"momo_atm\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"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\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":65400,\"currency\":\"VND\",\"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://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card_redirect\",\"payment_method_type\":\"momo_atm\",\"payment_method_data\":{\"card_redirect\":{\"momo_atm\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"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\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"239": {
"id": 239,
@@ -1449,25 +1449,25 @@
"id": 243,
"name": "Mini Stop",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"mini_stop\",\"payment_method_data\":{\"voucher\":{\"mini_stop\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"mini_stop\",\"payment_method_data\":{\"voucher\":{\"mini_stop\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"244": {
"id": 244,
"name": "Family Mart",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"family_mart\",\"payment_method_data\":{\"voucher\":{\"family_mart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"family_mart\",\"payment_method_data\":{\"voucher\":{\"family_mart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"245": {
"id": 245,
"name": "Seicomart",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seicomart\",\"payment_method_data\":{\"voucher\":{\"seicomart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seicomart\",\"payment_method_data\":{\"voucher\":{\"seicomart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"246": {
"id": 246,
"name": "PayEasy",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"pay_easy\",\"payment_method_data\":{\"voucher\":{\"pay_easy\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789"}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"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://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"pay_easy\",\"payment_method_data\":{\"voucher\":{\"pay_easy\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"9123456789\"}}}}"
},
"tests_to_ignore": [
"noon_ui::*",
|
chore
|
fix ui-test configs (#5152)
|
6f90b93cee6eb5fb688750b940ea884af8b1caa3
|
2025-02-05 17:44:40
|
AkshayaFoiger
|
fix(connector): [BOA] throw unsupported error incase of 3DS cards and limit administrative area length to 20 characters (#7174)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index b33555a7c55..a0868d688eb 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -510,17 +510,26 @@ fn build_bill_to(
country: None,
email: email.clone(),
};
+
Ok(address_details
.and_then(|addr| {
- addr.address.as_ref().map(|addr| BillTo {
- first_name: addr.first_name.clone(),
- last_name: addr.last_name.clone(),
- address1: addr.line1.clone(),
- locality: addr.city.clone(),
- administrative_area: addr.to_state_code_as_optional().ok().flatten(),
- postal_code: addr.zip.clone(),
- country: addr.country,
- email,
+ addr.address.as_ref().map(|addr| {
+ let administrative_area = addr.to_state_code_as_optional().unwrap_or_else(|_| {
+ addr.state
+ .clone()
+ .map(|state| Secret::new(format!("{:.20}", state.expose())))
+ });
+
+ BillTo {
+ first_name: addr.first_name.clone(),
+ last_name: addr.last_name.clone(),
+ address1: addr.line1.clone(),
+ locality: addr.city.clone(),
+ administrative_area,
+ postal_code: addr.zip.clone(),
+ country: addr.country,
+ email,
+ }
})
})
.unwrap_or(default_address))
@@ -813,6 +822,13 @@ impl
hyperswitch_domain_models::payment_method_data::Card,
),
) -> Result<Self, Self::Error> {
+ if item.router_data.is_three_ds() {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Card 3DS".to_string(),
+ connector: "BankOfAmerica",
+ })?
+ };
+
let email = 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)));
@@ -2242,6 +2258,13 @@ impl
hyperswitch_domain_models::payment_method_data::Card,
),
) -> Result<Self, Self::Error> {
+ if item.is_three_ds() {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Card 3DS".to_string(),
+ connector: "BankOfAmerica",
+ })?
+ };
+
let order_information = OrderInformationWithBill::try_from(item)?;
let client_reference_information = ClientReferenceInformation::from(item);
let merchant_defined_information =
diff --git a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
index 308565e72fa..0c8a8803254 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
@@ -1,3 +1,5 @@
+import { getCustomExchange } from "./Modifiers";
+
const successfulNo3DSCardDetails = {
card_number: "4242424242424242",
card_exp_month: "01",
@@ -112,7 +114,7 @@ export const connectorDetails = {
},
},
},
- "3DSManualCapture": {
+ "3DSManualCapture": getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -122,14 +124,8 @@ export const connectorDetails = {
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "requires_capture",
- },
- },
- },
- "3DSAutoCapture": {
+ }),
+ "3DSAutoCapture": getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -139,13 +135,7 @@ export const connectorDetails = {
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "requires_customer_action",
- },
- },
- },
+ }),
No3DSManualCapture: {
Request: {
payment_method: "card",
@@ -301,7 +291,7 @@ export const connectorDetails = {
},
},
},
- MandateSingleUse3DSAutoCapture: {
+ MandateSingleUse3DSAutoCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -310,14 +300,8 @@ export const connectorDetails = {
currency: "USD",
mandate_data: singleUseMandateData,
},
- Response: {
- status: 200,
- body: {
- status: "succeeded",
- },
- },
- },
- MandateSingleUse3DSManualCapture: {
+ }),
+ MandateSingleUse3DSManualCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -326,13 +310,7 @@ export const connectorDetails = {
currency: "USD",
mandate_data: singleUseMandateData,
},
- Response: {
- status: 200,
- body: {
- status: "requires_customer_action",
- },
- },
- },
+ }),
MandateSingleUseNo3DSAutoCapture: {
Request: {
payment_method: "card",
@@ -397,7 +375,7 @@ export const connectorDetails = {
},
},
},
- MandateMultiUse3DSAutoCapture: {
+ MandateMultiUse3DSAutoCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -406,14 +384,8 @@ export const connectorDetails = {
currency: "USD",
mandate_data: multiUseMandateData,
},
- Response: {
- status: 200,
- body: {
- status: "requires_capture",
- },
- },
- },
- MandateMultiUse3DSManualCapture: {
+ }),
+ MandateMultiUse3DSManualCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -422,13 +394,7 @@ export const connectorDetails = {
currency: "USD",
mandate_data: multiUseMandateData,
},
- Response: {
- status: 200,
- body: {
- status: "requires_capture",
- },
- },
- },
+ }),
MITAutoCapture: {
Request: {},
Response: {
@@ -659,7 +625,7 @@ export const connectorDetails = {
},
},
},
- PaymentMethodIdMandate3DSAutoCapture: {
+ PaymentMethodIdMandate3DSAutoCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -677,14 +643,8 @@ export const connectorDetails = {
},
},
},
- Response: {
- status: 200,
- body: {
- status: "requires_customer_action",
- },
- },
- },
- PaymentMethodIdMandate3DSManualCapture: {
+ }),
+ PaymentMethodIdMandate3DSManualCapture: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
@@ -701,13 +661,7 @@ export const connectorDetails = {
},
},
},
- Response: {
- status: 200,
- body: {
- status: "requires_customer_action",
- },
- },
- },
+ }),
},
pm_list: {
PmListResponse: {
|
fix
|
[BOA] throw unsupported error incase of 3DS cards and limit administrative area length to 20 characters (#7174)
|
0f2bb6c09bb929a7274af6049ecff5a5f9049ca1
|
2023-08-08 20:07:00
|
DEEPANSHU BANSAL
|
feat(connector): [Stax] Implement Bank Debits and Webhooks for Connector Stax (#1832)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 0daece8a0a9..c89e33b2e0d 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -300,7 +300,7 @@ base_url = "" # Base url used when adding links that should redirect to self
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet" }
mollie = {long_lived_token = false, payment_method = "card"}
-stax = { long_lived_token = true, payment_method = "card" }
+stax = { long_lived_token = true, payment_method = "card,bank_debit" }
[dummy_connector]
payment_ttl = 172800 # Time to live for dummy connector payment in redis
diff --git a/config/development.toml b/config/development.toml
index 920ad46804b..8591e3dae22 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -350,7 +350,7 @@ debit = { currency = "USD" }
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet" }
-stax = { long_lived_token = true, payment_method = "card" }
+stax = { long_lived_token = true, payment_method = "card,bank_debit" }
mollie = {long_lived_token = false, payment_method = "card"}
[connector_customer]
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index b5f23f5015e..c4c8052fc6b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -193,7 +193,7 @@ consumer_group = "SCHEDULER_GROUP"
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet" }
mollie = {long_lived_token = false, payment_method = "card"}
-stax = { long_lived_token = true, payment_method = "card" }
+stax = { long_lived_token = true, payment_method = "card,bank_debit" }
[dummy_connector]
payment_ttl = 172800
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index ec1d77aa6bd..833eba4a04a 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -264,6 +264,46 @@ impl From<PayoutConnectors> for RoutableConnectors {
}
}
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum BankType {
+ Checking,
+ Savings,
+}
+
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum BankHolderType {
+ Personal,
+ Business,
+}
+
/// Name of banks supported by Hyperswitch
#[derive(
Clone,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index ad2859d330f..32e40540385 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -680,6 +680,15 @@ pub enum BankDebitData {
#[schema(value_type = String, example = "John Doe")]
bank_account_holder_name: Option<Secret<String>>,
+
+ #[schema(value_type = String, example = "ACH")]
+ bank_name: Option<enums::BankNames>,
+
+ #[schema(value_type = String, example = "Checking")]
+ bank_type: Option<enums::BankType>,
+
+ #[schema(value_type = String, example = "Personal")]
+ bank_holder_type: Option<enums::BankHolderType>,
},
SepaBankDebit {
/// Billing details for bank debit
diff --git a/crates/router/src/connector/stax.rs b/crates/router/src/connector/stax.rs
index 2795a0bf929..4f16c914132 100644
--- a/crates/router/src/connector/stax.rs
+++ b/crates/router/src/connector/stax.rs
@@ -2,15 +2,18 @@ pub mod transformers;
use std::fmt::Debug;
+use common_utils::ext_traits::ByteSliceExt;
use error_stack::{IntoReport, ResultExt};
use masking::PeekInterface;
use transformers as stax;
+use self::stax::StaxWebhookEventType;
use super::utils::{to_connector_meta, RefundsRequestData};
use crate::{
configs::settings,
consts,
core::errors::{self, CustomResult},
+ db::StorageInterface,
headers,
services::{
self,
@@ -20,7 +23,7 @@ use crate::{
types::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
- ErrorResponse, Response,
+ domain, ErrorResponse, Response,
},
utils::{self, BytesExt},
};
@@ -751,24 +754,86 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
#[async_trait::async_trait]
impl api::IncomingWebhook for Stax {
- fn get_webhook_object_reference_id(
+ async fn verify_webhook_source(
&self,
+ _db: &dyn StorageInterface,
_request: &api::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &str,
+ _connector_label: &str,
+ _key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ Ok(false)
+ }
+
+ fn get_webhook_object_reference_id(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ let webhook_body: stax::StaxWebhookBody = request
+ .body
+ .parse_struct("StaxWebhookBody")
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+
+ match webhook_body.transaction_type {
+ stax::StaxWebhookEventType::Refund => {
+ Ok(api_models::webhooks::ObjectReferenceId::RefundId(
+ api_models::webhooks::RefundIdType::ConnectorRefundId(webhook_body.id),
+ ))
+ }
+ stax::StaxWebhookEventType::Unknown => {
+ Err(errors::ConnectorError::WebhookEventTypeNotFound.into())
+ }
+ stax::StaxWebhookEventType::PreAuth
+ | stax::StaxWebhookEventType::Capture
+ | stax::StaxWebhookEventType::Charge
+ | stax::StaxWebhookEventType::Void => {
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(match webhook_body
+ .transaction_type
+ {
+ stax::StaxWebhookEventType::Capture => webhook_body
+ .auth_id
+ .ok_or(errors::ConnectorError::WebhookReferenceIdNotFound)?,
+ _ => webhook_body.id,
+ }),
+ ))
+ }
+ }
}
fn get_webhook_event_type(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ let details: stax::StaxWebhookBody = request
+ .body
+ .parse_struct("StaxWebhookEventType")
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+
+ Ok(match &details.transaction_type {
+ StaxWebhookEventType::Refund => match &details.success {
+ true => api::IncomingWebhookEvent::RefundSuccess,
+ false => api::IncomingWebhookEvent::RefundFailure,
+ },
+ StaxWebhookEventType::Capture | StaxWebhookEventType::Charge => {
+ match &details.success {
+ true => api::IncomingWebhookEvent::PaymentIntentSuccess,
+ false => api::IncomingWebhookEvent::PaymentIntentFailure,
+ }
+ }
+ StaxWebhookEventType::PreAuth
+ | StaxWebhookEventType::Void
+ | StaxWebhookEventType::Unknown => api::IncomingWebhookEvent::EventNotSupported,
+ })
}
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 reference_object: serde_json::Value = serde_json::from_slice(request.body)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
+ Ok(reference_object)
}
}
diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs
index a04a1e43652..7cb3e8dda27 100644
--- a/crates/router/src/connector/stax/transformers.rs
+++ b/crates/router/src/connector/stax/transformers.rs
@@ -4,7 +4,7 @@ use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::{CardData, PaymentsAuthorizeRequestData, RouterData},
+ connector::utils::{missing_field_err, CardData, PaymentsAuthorizeRequestData, RouterData},
core::errors,
types::{self, api, storage::enums},
};
@@ -37,6 +37,16 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for StaxPaymentsRequest {
payment_method_id: Secret::new(item.get_payment_method_token()?),
})
}
+ api::PaymentMethodData::BankDebit(_) => {
+ let pre_auth = !item.request.is_auto_capture()?;
+ Ok(Self {
+ meta: StaxPaymentsRequestMetaData { tax: 0 },
+ total: item.request.amount,
+ is_refundable: true,
+ pre_auth,
+ payment_method_id: Secret::new(item.get_payment_method_token()?),
+ })
+ }
_ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
}
}
@@ -115,11 +125,23 @@ pub struct StaxTokenizeData {
customer_id: Secret<String>,
}
+#[derive(Debug, Serialize)]
+pub struct StaxBankTokenizeData {
+ person_name: Secret<String>,
+ bank_account: Secret<String>,
+ bank_routing: Secret<String>,
+ bank_name: api_models::enums::BankNames,
+ bank_type: api_models::enums::BankType,
+ bank_holder_type: api_models::enums::BankHolderType,
+ customer_id: Secret<String>,
+}
+
#[derive(Debug, Serialize)]
#[serde(tag = "method")]
#[serde(rename_all = "lowercase")]
pub enum StaxTokenRequest {
Card(StaxTokenizeData),
+ Bank(StaxBankTokenizeData),
}
impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
@@ -138,6 +160,29 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
};
Ok(Self::Card(stax_card_data))
}
+ api_models::payments::PaymentMethodData::BankDebit(
+ api_models::payments::BankDebitData::AchBankDebit {
+ billing_details,
+ account_number,
+ routing_number,
+ bank_name,
+ bank_type,
+ bank_holder_type,
+ ..
+ },
+ ) => {
+ let stax_bank_data = StaxBankTokenizeData {
+ person_name: billing_details.name,
+ bank_account: account_number,
+ bank_routing: routing_number,
+ bank_name: bank_name.ok_or_else(missing_field_err("bank_name"))?,
+ bank_type: bank_type.ok_or_else(missing_field_err("bank_type"))?,
+ bank_holder_type: bank_holder_type
+ .ok_or_else(missing_field_err("bank_holder_type"))?,
+ customer_id: Secret::new(customer_id),
+ };
+ Ok(Self::Bank(stax_bank_data))
+ }
api::PaymentMethodData::BankDebit(_)
| api::PaymentMethodData::Wallet(_)
| api::PaymentMethodData::PayLater(_)
@@ -355,3 +400,24 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
})
}
}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum StaxWebhookEventType {
+ PreAuth,
+ Capture,
+ Charge,
+ Void,
+ Refund,
+ #[serde(other)]
+ Unknown,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct StaxWebhookBody {
+ #[serde(rename = "type")]
+ pub transaction_type: StaxWebhookEventType,
+ pub id: String,
+ pub auth_id: Option<String>,
+ pub success: bool,
+}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index a0d2ca9637c..948ed7518ad 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -2485,7 +2485,10 @@
"account_number",
"routing_number",
"card_holder_name",
- "bank_account_holder_name"
+ "bank_account_holder_name",
+ "bank_name",
+ "bank_type",
+ "bank_holder_type"
],
"properties": {
"billing_details": {
@@ -2508,6 +2511,18 @@
"bank_account_holder_name": {
"type": "string",
"example": "John Doe"
+ },
+ "bank_name": {
+ "type": "string",
+ "example": "ACH"
+ },
+ "bank_type": {
+ "type": "string",
+ "example": "Checking"
+ },
+ "bank_holder_type": {
+ "type": "string",
+ "example": "Personal"
}
}
}
|
feat
|
[Stax] Implement Bank Debits and Webhooks for Connector Stax (#1832)
|
8e008bcd45785c23a82e0afb46ac43eadfc4d913
|
2023-01-09 15:18:47
|
Sanchith Hegde
|
chore: address/remove Jira tickets in code (#312)
| false
|
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 269bfd50a59..26b2f0a2f12 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1,4 +1,4 @@
-use error_stack::{report, ResultExt};
+use error_stack::{report, FutureExt, ResultExt};
use uuid::Uuid;
use crate::{
@@ -253,18 +253,13 @@ async fn get_parent_merchant(
report!(errors::ValidationError::MissingRequiredField {
field_name: "parent_merchant_id".to_string()
})
- .attach_printable(
- "If `sub_merchants_enabled` is true, then `parent_merchant_id` is mandatory",
- )
- .change_context(errors::ApiErrorResponse::MissingRequiredField {
- field_name: "parent_merchant_id".to_string(),
+ .change_context(errors::ApiErrorResponse::PreconditionFailed {
+ message: "If `sub_merchants_enabled` is `true`, then `parent_merchant_id` is mandatory".to_string(),
})
})
- // TODO: Update the API validation error structs to provide more info about which field caused an error
- // In this case we have multiple fields which use merchant_id (merchant_id & parent_merchant_id)
- // making it hard to figure out what went wrong
- // https://juspay.atlassian.net/browse/ORCA-358
- .map(|id| validate_merchant_id(db, id))?.await?.merchant_id
+ .map(|id| validate_merchant_id(db, id).change_context(
+ errors::ApiErrorResponse::InvalidDataValue { field_name: "parent_merchant_id" }
+ ))?.await?.merchant_id
)
}
_ => None,
diff --git a/crates/router/src/env.rs b/crates/router/src/env.rs
index d01f20053a5..2648151700f 100644
--- a/crates/router/src/env.rs
+++ b/crates/router/src/env.rs
@@ -7,9 +7,8 @@ pub mod logger {
///
/// Setup logging sub-system.
///
- // TODO (prom-monitoring): Ideally tracing/opentelementry structs shouldn't be pushed out
- // Find an abstraction so that source crate is unaware about underlying implementation
- // https://juspay.atlassian.net/browse/ORCA-345
+ // TODO (prom-monitoring): Ideally tracing/opentelementry structs shouldn't be pushed out.
+ // Return a custom error type instead of `opentelemetry::metrics::MetricsError`.
pub fn setup(
conf: &config::Log,
) -> Result<TelemetryGuard, router_env::opentelemetry::metrics::MetricsError> {
|
chore
|
address/remove Jira tickets in code (#312)
|
1a8f5ff2258a90f9cef5bcf5a1891804250f4560
|
2023-06-27 11:21:15
|
Sai Harsha Vardhan
|
feat(router): add `connector_transaction_id` in payments response (#1542)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index c5e0e6977ca..863ed792fca 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1392,6 +1392,10 @@ pub struct PaymentsResponse {
/// Any user defined fields can be passed here.
#[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
pub udf: Option<pii::SecretSerdeValue>,
+
+ /// A unique identifier for a payment provided by the connector
+ #[schema(value_type = Option<String>, example = "993672945374576J")]
+ pub connector_transaction_id: Option<String>,
}
#[derive(Clone, Debug, serde::Deserialize, ToSchema)]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index cc61b606e32..53d99868285 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -465,6 +465,7 @@ where
)
.set_ephemeral_key(ephemeral_key_option.map(ForeignFrom::foreign_from))
.set_udf(payment_intent.udf)
+ .set_connector_transaction_id(payment_attempt.connector_transaction_id)
.to_owned(),
)
}
@@ -509,6 +510,7 @@ where
metadata: payment_intent.metadata,
order_details: payment_intent.order_details,
udf: payment_intent.udf,
+ connector_transaction_id: payment_attempt.connector_transaction_id,
..Default::default()
}),
});
|
feat
|
add `connector_transaction_id` in payments response (#1542)
|
ce732db9b2f98924a2b1d44ea5eb1000b6cbb498
|
2024-10-25 16:38:38
|
Prajjwal Kumar
|
feat(euclid): add dynamic routing in core flows (#6333)
| false
|
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 9374acb024d..4b0f33da3e7 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -3952,12 +3952,12 @@
}
},
{
- "name": "status",
+ "name": "enable",
"in": "query",
- "description": "Boolean value for mentioning the expected state of dynamic routing",
+ "description": "Feature to enable for success based routing",
"required": true,
"schema": {
- "type": "boolean"
+ "$ref": "#/components/schemas/SuccessBasedRoutingFeatures"
}
}
],
@@ -3998,87 +3998,6 @@
]
}
},
- "/account/:account_id/business_profile/:profile_id/dynamic_routing/success_based/config/:algorithm_id": {
- "patch": {
- "tags": [
- "Routing"
- ],
- "summary": "Routing - Update config for success based dynamic routing",
- "description": "Update config for success based dynamic routing",
- "operationId": "Update configs for success based dynamic routing algorithm",
- "parameters": [
- {
- "name": "account_id",
- "in": "path",
- "description": "Merchant id",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "profile_id",
- "in": "path",
- "description": "The unique identifier for a profile",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "algorithm_id",
- "in": "path",
- "description": "The unique identifier for routing algorithm",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/SuccessBasedRoutingConfig"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "Routing Algorithm updated",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RoutingDictionaryRecord"
- }
- }
- }
- },
- "400": {
- "description": "Request body is malformed"
- },
- "403": {
- "description": "Forbidden"
- },
- "404": {
- "description": "Resource missing"
- },
- "422": {
- "description": "Unprocessable request"
- },
- "500": {
- "description": "Internal server error"
- }
- },
- "security": [
- {
- "admin_api_key": []
- }
- ]
- }
- },
"/blocklist": {
"delete": {
"tags": [
@@ -9458,23 +9377,6 @@
"ZWL"
]
},
- "CurrentBlockThreshold": {
- "type": "object",
- "properties": {
- "duration_in_mins": {
- "type": "integer",
- "format": "int64",
- "nullable": true,
- "minimum": 0
- },
- "max_total_count": {
- "type": "integer",
- "format": "int64",
- "nullable": true,
- "minimum": 0
- }
- }
- },
"CustomerAcceptance": {
"type": "object",
"description": "This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.",
@@ -23624,80 +23526,14 @@
"destination"
]
},
- "SuccessBasedRoutingConfig": {
- "type": "object",
- "properties": {
- "params": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SuccessBasedRoutingConfigParams"
- },
- "nullable": true
- },
- "config": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SuccessBasedRoutingConfigBody"
- }
- ],
- "nullable": true
- }
- }
- },
- "SuccessBasedRoutingConfigBody": {
- "type": "object",
- "properties": {
- "min_aggregates_size": {
- "type": "integer",
- "format": "int32",
- "nullable": true,
- "minimum": 0
- },
- "default_success_rate": {
- "type": "number",
- "format": "double",
- "nullable": true
- },
- "max_aggregates_size": {
- "type": "integer",
- "format": "int32",
- "nullable": true,
- "minimum": 0
- },
- "current_block_threshold": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CurrentBlockThreshold"
- }
- ],
- "nullable": true
- }
- }
- },
- "SuccessBasedRoutingConfigParams": {
+ "SuccessBasedRoutingFeatures": {
"type": "string",
"enum": [
- "PaymentMethod",
- "PaymentMethodType",
- "Currency",
- "AuthenticationType"
+ "metrics",
+ "dynamic_connector_selection",
+ "none"
]
},
- "SuccessBasedRoutingUpdateConfigQuery": {
- "type": "object",
- "required": [
- "algorithm_id",
- "profile_id"
- ],
- "properties": {
- "algorithm_id": {
- "type": "string"
- },
- "profile_id": {
- "type": "string"
- }
- }
- },
"SurchargeDetailsResponse": {
"type": "object",
"required": [
@@ -23961,11 +23797,11 @@
"ToggleSuccessBasedRoutingQuery": {
"type": "object",
"required": [
- "status"
+ "enable"
],
"properties": {
- "status": {
- "type": "boolean"
+ "enable": {
+ "$ref": "#/components/schemas/SuccessBasedRoutingFeatures"
}
}
},
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index fc65ab037c2..47d75b2e835 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -522,22 +522,51 @@ pub struct DynamicAlgorithmWithTimestamp<T> {
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
pub struct DynamicRoutingAlgorithmRef {
- pub success_based_algorithm:
- Option<DynamicAlgorithmWithTimestamp<common_utils::id_type::RoutingId>>,
+ pub success_based_algorithm: Option<SuccessBasedAlgorithm>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct SuccessBasedAlgorithm {
+ pub algorithm_id_with_timestamp:
+ DynamicAlgorithmWithTimestamp<common_utils::id_type::RoutingId>,
+ #[serde(default)]
+ pub enabled_feature: SuccessBasedRoutingFeatures,
+}
+
+impl SuccessBasedAlgorithm {
+ pub fn update_enabled_features(&mut self, feature_to_enable: SuccessBasedRoutingFeatures) {
+ self.enabled_feature = feature_to_enable
+ }
}
impl DynamicRoutingAlgorithmRef {
- pub fn update_algorithm_id(&mut self, new_id: common_utils::id_type::RoutingId) {
- self.success_based_algorithm = Some(DynamicAlgorithmWithTimestamp {
- algorithm_id: Some(new_id),
- timestamp: common_utils::date_time::now_unix_timestamp(),
+ pub fn update_algorithm_id(
+ &mut self,
+ new_id: common_utils::id_type::RoutingId,
+ enabled_feature: SuccessBasedRoutingFeatures,
+ ) {
+ self.success_based_algorithm = Some(SuccessBasedAlgorithm {
+ algorithm_id_with_timestamp: DynamicAlgorithmWithTimestamp {
+ algorithm_id: Some(new_id),
+ timestamp: common_utils::date_time::now_unix_timestamp(),
+ },
+ enabled_feature,
})
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ToggleSuccessBasedRoutingQuery {
- pub status: bool,
+ pub enable: SuccessBasedRoutingFeatures,
+}
+
+#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum SuccessBasedRoutingFeatures {
+ Metrics,
+ DynamicConnectorSelection,
+ #[default]
+ None,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -551,7 +580,7 @@ pub struct SuccessBasedRoutingUpdateConfigQuery {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct ToggleSuccessBasedRoutingWrapper {
pub profile_id: common_utils::id_type::ProfileId,
- pub status: bool,
+ pub feature_to_enable: SuccessBasedRoutingFeatures,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 28a7f44c7a8..15845667999 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -160,7 +160,6 @@ Never share your secret api keys. Keep them guarded and secure.
routes::routing::routing_retrieve_default_config_for_profiles,
routes::routing::routing_update_default_config_for_profile,
routes::routing::toggle_success_based_routing,
- routes::routing::success_based_routing_update_configs,
// Routes for blocklist
routes::blocklist::remove_entry_from_blocklist,
@@ -566,6 +565,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::routing::RoutingDictionaryRecord,
api_models::routing::RoutingKind,
api_models::routing::RoutableConnectorChoice,
+ api_models::routing::SuccessBasedRoutingFeatures,
api_models::routing::LinkedRoutingConfigRetrieveResponse,
api_models::routing::RoutingRetrieveResponse,
api_models::routing::ProfileDefaultRoutingConfig,
@@ -577,11 +577,6 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::routing::ConnectorVolumeSplit,
api_models::routing::ConnectorSelection,
api_models::routing::ToggleSuccessBasedRoutingQuery,
- api_models::routing::SuccessBasedRoutingConfig,
- api_models::routing::SuccessBasedRoutingConfigParams,
- api_models::routing::SuccessBasedRoutingConfigBody,
- api_models::routing::CurrentBlockThreshold,
- api_models::routing::SuccessBasedRoutingUpdateConfigQuery,
api_models::routing::ToggleSuccessBasedRoutingPath,
api_models::routing::ast::RoutableChoiceKind,
api_models::enums::RoutableConnectors,
diff --git a/crates/openapi/src/routes/routing.rs b/crates/openapi/src/routes/routing.rs
index 009708d860d..0bb79a2bbe4 100644
--- a/crates/openapi/src/routes/routing.rs
+++ b/crates/openapi/src/routes/routing.rs
@@ -266,7 +266,7 @@ pub async fn routing_update_default_config_for_profile() {}
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
- ("status" = bool, Query, description = "Boolean value for mentioning the expected state of dynamic routing"),
+ ("enable" = SuccessBasedRoutingFeatures, Query, description = "Feature to enable for success based routing"),
),
responses(
(status = 200, description = "Routing Algorithm created", body = RoutingDictionaryRecord),
@@ -281,30 +281,3 @@ pub async fn routing_update_default_config_for_profile() {}
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn toggle_success_based_routing() {}
-
-#[cfg(feature = "v1")]
-/// Routing - Update config for success based dynamic routing
-///
-/// Update config for success based dynamic routing
-#[utoipa::path(
- patch,
- path = "/account/:account_id/business_profile/:profile_id/dynamic_routing/success_based/config/:algorithm_id",
- request_body = SuccessBasedRoutingConfig,
- params(
- ("account_id" = String, Path, description = "Merchant id"),
- ("profile_id" = String, Path, description = "The unique identifier for a profile"),
- ("algorithm_id" = String, Path, description = "The unique identifier for routing algorithm"),
- ),
- responses(
- (status = 200, description = "Routing Algorithm updated", body = RoutingDictionaryRecord),
- (status = 400, description = "Request body is malformed"),
- (status = 500, description = "Internal server error"),
- (status = 404, description = "Resource missing"),
- (status = 422, description = "Unprocessable request"),
- (status = 403, description = "Forbidden"),
- ),
- tag = "Routing",
- operation_id = "Update configs for success based dynamic routing algorithm",
- security(("admin_api_key" = []))
-)]
-pub async fn success_based_routing_update_configs() {}
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index aa4ff406a2c..d095b471e2d 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -328,6 +328,20 @@ pub enum RoutingError {
VolumeSplitFailed,
#[error("Unable to parse metadata")]
MetadataParsingError,
+ #[error("Unable to retrieve success based routing config")]
+ SuccessBasedRoutingConfigError,
+ #[error("Unable to calculate success based routing config from dynamic routing service")]
+ SuccessRateCalculationError,
+ #[error("Success rate client from dynamic routing gRPC service not initialized")]
+ SuccessRateClientInitializationError,
+ #[error("Unable to convert from '{from}' to '{to}'")]
+ GenericConversionError { from: String, to: String },
+ #[error("Invalid success based connector label received from dynamic routing service: '{0}'")]
+ InvalidSuccessBasedConnectorLabel(String),
+ #[error("unable to find '{field}'")]
+ GenericNotFoundError { field: String },
+ #[error("Unable to deserialize from '{from}' to '{to}'")]
+ DeserializationError { from: String, to: String },
}
#[derive(Debug, Clone, thiserror::Error)]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index a76e24af0c2..de58eeed100 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5583,6 +5583,19 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed eligibility analysis and fallback")?;
+ // dynamic success based connector selection
+ #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
+ let connectors = {
+ if business_profile.dynamic_routing_algorithm.is_some() {
+ routing::perform_success_based_routing(state, connectors.clone(), business_profile)
+ .await
+ .map_err(|e| logger::error!(success_rate_routing_error=?e))
+ .unwrap_or(connectors)
+ } else {
+ connectors
+ }
+ };
+
let connector_data = connectors
.into_iter()
.map(|conn| {
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 7aa67a9b50f..a18996ccc3b 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1918,8 +1918,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
{
- if let Some(dynamic_routing_algorithm) = business_profile.dynamic_routing_algorithm.clone()
- {
+ if business_profile.dynamic_routing_algorithm.is_some() {
let state = state.clone();
let business_profile = business_profile.clone();
let payment_attempt = payment_attempt.clone();
@@ -1930,7 +1929,6 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
&payment_attempt,
routable_connectors,
&business_profile,
- dynamic_routing_algorithm,
)
.await
.map_err(|e| logger::error!(dynamic_routing_metrics_error=?e))
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 11908ae0d99..40721e9b4c3 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -7,6 +7,8 @@ use std::{
sync::Arc,
};
+#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
+use api_models::routing as api_routing;
use api_models::{
admin as admin_api,
enums::{self as api_enums, CountryAlpha2},
@@ -21,6 +23,10 @@ use euclid::{
enums as euclid_enums,
frontend::{ast, dir as euclid_dir},
};
+#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
+use external_services::grpc_client::dynamic_routing::{
+ success_rate::CalSuccessRateResponse, SuccessBasedDynamicRouting,
+};
use kgraph_utils::{
mca as mca_graph,
transformers::{IntoContext, IntoDirValue},
@@ -1227,3 +1233,114 @@ pub fn make_dsl_input_for_surcharge(
};
Ok(backend_input)
}
+
+/// success based dynamic routing
+#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
+pub async fn perform_success_based_routing(
+ state: &SessionState,
+ routable_connectors: Vec<api_routing::RoutableConnectorChoice>,
+ business_profile: &domain::Profile,
+) -> RoutingResult<Vec<api_routing::RoutableConnectorChoice>> {
+ let success_based_dynamic_routing_algo_ref: api_routing::DynamicRoutingAlgorithmRef =
+ business_profile
+ .dynamic_routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("DynamicRoutingAlgorithmRef"))
+ .transpose()
+ .change_context(errors::RoutingError::DeserializationError {
+ from: "JSON".to_string(),
+ to: "DynamicRoutingAlgorithmRef".to_string(),
+ })
+ .attach_printable("unable to deserialize DynamicRoutingAlgorithmRef from JSON")?
+ .unwrap_or_default();
+
+ let success_based_algo_ref = success_based_dynamic_routing_algo_ref
+ .success_based_algorithm
+ .ok_or(errors::RoutingError::GenericNotFoundError { field: "success_based_algorithm".to_string() })
+ .attach_printable(
+ "success_based_algorithm not found in dynamic_routing_algorithm from business_profile table",
+ )?;
+
+ if success_based_algo_ref.enabled_feature
+ == api_routing::SuccessBasedRoutingFeatures::DynamicConnectorSelection
+ {
+ logger::debug!(
+ "performing success_based_routing for profile {}",
+ business_profile.get_id().get_string_repr()
+ );
+ let client = state
+ .grpc_client
+ .dynamic_routing
+ .success_rate_client
+ .as_ref()
+ .ok_or(errors::RoutingError::SuccessRateClientInitializationError)
+ .attach_printable("success_rate gRPC client not found")?;
+
+ let success_based_routing_configs = routing::helpers::fetch_success_based_routing_configs(
+ state,
+ business_profile,
+ success_based_algo_ref
+ .algorithm_id_with_timestamp
+ .algorithm_id
+ .ok_or(errors::RoutingError::GenericNotFoundError {
+ field: "success_based_routing_algorithm_id".to_string(),
+ })
+ .attach_printable(
+ "success_based_routing_algorithm_id not found in business_profile",
+ )?,
+ )
+ .await
+ .change_context(errors::RoutingError::SuccessBasedRoutingConfigError)
+ .attach_printable("unable to fetch success_rate based dynamic routing configs")?;
+
+ let tenant_business_profile_id = routing::helpers::generate_tenant_business_profile_id(
+ &state.tenant.redis_key_prefix,
+ business_profile.get_id().get_string_repr(),
+ );
+
+ let success_based_connectors: CalSuccessRateResponse = client
+ .calculate_success_rate(
+ tenant_business_profile_id,
+ success_based_routing_configs,
+ routable_connectors,
+ )
+ .await
+ .change_context(errors::RoutingError::SuccessRateCalculationError)
+ .attach_printable(
+ "unable to calculate/fetch success rate from dynamic routing service",
+ )?;
+
+ let mut connectors = Vec::with_capacity(success_based_connectors.labels_with_score.len());
+ for label_with_score in success_based_connectors.labels_with_score {
+ let (connector, merchant_connector_id) = label_with_score.label
+ .split_once(':')
+ .ok_or(errors::RoutingError::InvalidSuccessBasedConnectorLabel(label_with_score.label.to_string()))
+ .attach_printable(
+ "unable to split connector_name and mca_id from the label obtained by the dynamic routing service",
+ )?;
+ connectors.push(api_routing::RoutableConnectorChoice {
+ choice_kind: api_routing::RoutableChoiceKind::FullStruct,
+ connector: common_enums::RoutableConnectors::from_str(connector)
+ .change_context(errors::RoutingError::GenericConversionError {
+ from: "String".to_string(),
+ to: "RoutableConnectors".to_string(),
+ })
+ .attach_printable("unable to convert String to RoutableConnectors")?,
+ merchant_connector_id: Some(
+ common_utils::id_type::MerchantConnectorAccountId::wrap(
+ merchant_connector_id.to_string(),
+ )
+ .change_context(errors::RoutingError::GenericConversionError {
+ from: "String".to_string(),
+ to: "MerchantConnectorAccountId".to_string(),
+ })
+ .attach_printable("unable to convert MerchantConnectorAccountId from string")?,
+ ),
+ });
+ }
+ logger::debug!(success_based_routing_connectors=?connectors);
+ Ok(connectors)
+ } else {
+ Ok(routable_connectors)
+ }
+}
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 926b30081bf..0bd38918ee7 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -441,9 +441,13 @@ pub async fn link_routing_config(
utils::when(
matches!(
dynamic_routing_ref.success_based_algorithm,
- Some(routing_types::DynamicAlgorithmWithTimestamp {
- algorithm_id: Some(ref id),
- timestamp: _
+ Some(routing::SuccessBasedAlgorithm {
+ algorithm_id_with_timestamp:
+ routing_types::DynamicAlgorithmWithTimestamp {
+ algorithm_id: Some(ref id),
+ timestamp: _
+ },
+ enabled_feature: _
}) if id == &algorithm_id
),
|| {
@@ -453,7 +457,17 @@ pub async fn link_routing_config(
},
)?;
- dynamic_routing_ref.update_algorithm_id(algorithm_id);
+ dynamic_routing_ref.update_algorithm_id(
+ algorithm_id,
+ dynamic_routing_ref
+ .success_based_algorithm
+ .clone()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "missing success_based_algorithm in dynamic_algorithm_ref from business_profile table",
+ )?
+ .enabled_feature,
+ );
helpers::update_business_profile_active_dynamic_algorithm_ref(
db,
key_manager_state,
@@ -1169,7 +1183,7 @@ pub async fn toggle_success_based_routing(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- status: bool,
+ feature_to_enable: routing::SuccessBasedRoutingFeatures,
profile_id: common_utils::id_type::ProfileId,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
metrics::ROUTING_CREATE_REQUEST_RECEIVED.add(
@@ -1205,115 +1219,158 @@ pub async fn toggle_success_based_routing(
)?
.unwrap_or_default();
- if status {
- let default_success_based_routing_config = routing::SuccessBasedRoutingConfig::default();
- let algorithm_id = common_utils::generate_routing_id_of_default_length();
- let timestamp = common_utils::date_time::now();
- let algo = RoutingAlgorithm {
- algorithm_id: algorithm_id.clone(),
- profile_id: business_profile.get_id().to_owned(),
- merchant_id: merchant_account.get_id().to_owned(),
- name: "Dynamic routing algorithm".to_string(),
- description: None,
- kind: diesel_models::enums::RoutingAlgorithmKind::Dynamic,
- algorithm_data: serde_json::json!(default_success_based_routing_config),
- created_at: timestamp,
- modified_at: timestamp,
- algorithm_for: common_enums::TransactionType::Payment,
- };
-
- let record = db
- .insert_routing_algorithm(algo)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to insert record in routing algorithm table")?;
-
- success_based_dynamic_routing_algo_ref.update_algorithm_id(algorithm_id);
- helpers::update_business_profile_active_dynamic_algorithm_ref(
- db,
- key_manager_state,
- &key_store,
- business_profile,
- success_based_dynamic_routing_algo_ref,
- )
- .await?;
-
- let new_record = record.foreign_into();
-
- metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(
- &metrics::CONTEXT,
- 1,
- &add_attributes([("profile_id", profile_id.get_string_repr().to_owned())]),
- );
- Ok(service_api::ApplicationResponse::Json(new_record))
- } else {
- let timestamp = common_utils::date_time::now_unix_timestamp();
- match success_based_dynamic_routing_algo_ref.success_based_algorithm {
- Some(algorithm_ref) => {
- if let Some(algorithm_id) = algorithm_ref.algorithm_id {
- let dynamic_routing_algorithm = routing_types::DynamicRoutingAlgorithmRef {
- success_based_algorithm: Some(
- routing_types::DynamicAlgorithmWithTimestamp {
- algorithm_id: None,
- timestamp,
- },
- ),
- };
-
- // redact cache for success based routing configs
- let cache_key = format!(
- "{}_{}",
- business_profile.get_id().get_string_repr(),
- algorithm_id.get_string_repr()
- );
- let cache_entries_to_redact =
- vec![cache::CacheKind::SuccessBasedDynamicRoutingCache(
- cache_key.into(),
- )];
- let _ = cache::publish_into_redact_channel(
- state.store.get_cache_store().as_ref(),
- cache_entries_to_redact,
- )
- .await
- .map_err(|e| {
- logger::error!(
- "unable to publish into the redact channel for evicting the success based routing config cache {e:?}"
+ match feature_to_enable {
+ routing::SuccessBasedRoutingFeatures::Metrics
+ | routing::SuccessBasedRoutingFeatures::DynamicConnectorSelection => {
+ if let Some(ref mut algo_with_timestamp) =
+ success_based_dynamic_routing_algo_ref.success_based_algorithm
+ {
+ match algo_with_timestamp
+ .algorithm_id_with_timestamp
+ .algorithm_id
+ .clone()
+ {
+ Some(algorithm_id) => {
+ // algorithm is already present in profile
+ if algo_with_timestamp.enabled_feature == feature_to_enable {
+ // algorithm already has the required feature
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Success rate based routing is already enabled"
+ .to_string(),
+ })?
+ } else {
+ // enable the requested feature for the algorithm
+ algo_with_timestamp.update_enabled_features(feature_to_enable);
+ let record = db
+ .find_routing_algorithm_by_profile_id_algorithm_id(
+ business_profile.get_id(),
+ &algorithm_id,
+ )
+ .await
+ .to_not_found_response(
+ errors::ApiErrorResponse::ResourceIdNotFound,
+ )?;
+ let response = record.foreign_into();
+ helpers::update_business_profile_active_dynamic_algorithm_ref(
+ db,
+ key_manager_state,
+ &key_store,
+ business_profile,
+ success_based_dynamic_routing_algo_ref,
+ )
+ .await?;
+
+ metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(
+ &metrics::CONTEXT,
+ 1,
+ &add_attributes([(
+ "profile_id",
+ profile_id.get_string_repr().to_owned(),
+ )]),
+ );
+ Ok(service_api::ApplicationResponse::Json(response))
+ }
+ }
+ None => {
+ // algorithm isn't present in profile
+ helpers::default_success_based_routing_setup(
+ &state,
+ key_store,
+ business_profile,
+ feature_to_enable,
+ merchant_account.get_id().to_owned(),
+ success_based_dynamic_routing_algo_ref,
)
- });
+ .await
+ }
+ }
+ } else {
+ // algorithm isn't present in profile
+ helpers::default_success_based_routing_setup(
+ &state,
+ key_store,
+ business_profile,
+ feature_to_enable,
+ merchant_account.get_id().to_owned(),
+ success_based_dynamic_routing_algo_ref,
+ )
+ .await
+ }
+ }
+ routing::SuccessBasedRoutingFeatures::None => {
+ // disable success based routing for the requested profile
+ let timestamp = common_utils::date_time::now_unix_timestamp();
+ match success_based_dynamic_routing_algo_ref.success_based_algorithm {
+ Some(algorithm_ref) => {
+ if let Some(algorithm_id) =
+ algorithm_ref.algorithm_id_with_timestamp.algorithm_id
+ {
+ let dynamic_routing_algorithm = routing_types::DynamicRoutingAlgorithmRef {
+ success_based_algorithm: Some(routing::SuccessBasedAlgorithm {
+ algorithm_id_with_timestamp:
+ routing_types::DynamicAlgorithmWithTimestamp {
+ algorithm_id: None,
+ timestamp,
+ },
+ enabled_feature: routing::SuccessBasedRoutingFeatures::None,
+ }),
+ };
- let record = db
- .find_routing_algorithm_by_profile_id_algorithm_id(
- business_profile.get_id(),
- &algorithm_id,
+ // redact cache for success based routing configs
+ let cache_key = format!(
+ "{}_{}",
+ business_profile.get_id().get_string_repr(),
+ algorithm_id.get_string_repr()
+ );
+ let cache_entries_to_redact =
+ vec![cache::CacheKind::SuccessBasedDynamicRoutingCache(
+ cache_key.into(),
+ )];
+ let _ = cache::publish_into_redact_channel(
+ state.store.get_cache_store().as_ref(),
+ cache_entries_to_redact,
)
.await
- .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
- let response = record.foreign_into();
- helpers::update_business_profile_active_dynamic_algorithm_ref(
- db,
- key_manager_state,
- &key_store,
- business_profile,
- dynamic_routing_algorithm,
- )
- .await?;
-
- metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(
- &metrics::CONTEXT,
- 1,
- &add_attributes([("profile_id", profile_id.get_string_repr().to_owned())]),
- );
-
- Ok(service_api::ApplicationResponse::Json(response))
- } else {
- Err(errors::ApiErrorResponse::PreconditionFailed {
- message: "Algorithm is already inactive".to_string(),
- })?
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to publish into the redact channel for evicting the success based routing config cache")?;
+
+ let record = db
+ .find_routing_algorithm_by_profile_id_algorithm_id(
+ business_profile.get_id(),
+ &algorithm_id,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
+ let response = record.foreign_into();
+ helpers::update_business_profile_active_dynamic_algorithm_ref(
+ db,
+ key_manager_state,
+ &key_store,
+ business_profile,
+ dynamic_routing_algorithm,
+ )
+ .await?;
+
+ metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(
+ &metrics::CONTEXT,
+ 1,
+ &add_attributes([(
+ "profile_id",
+ profile_id.get_string_repr().to_owned(),
+ )]),
+ );
+
+ Ok(service_api::ApplicationResponse::Json(response))
+ } else {
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Algorithm is already inactive".to_string(),
+ })?
+ }
}
+ None => Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Success rate based routing is already disabled".to_string(),
+ })?,
}
- None => Err(errors::ApiErrorResponse::PreconditionFailed {
- message: "Algorithm is already inactive".to_string(),
- })?,
}
}
}
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 22966208dd4..6b584583174 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -12,10 +12,16 @@ use api_models::routing as routing_types;
use common_utils::ext_traits::ValueExt;
use common_utils::{ext_traits::Encode, id_type, types::keymanager::KeyManagerState};
use diesel_models::configs;
+#[cfg(feature = "v1")]
+use diesel_models::routing_algorithm;
use error_stack::ResultExt;
-#[cfg(feature = "dynamic_routing")]
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use external_services::grpc_client::dynamic_routing::SuccessBasedDynamicRouting;
+#[cfg(feature = "v1")]
+use hyperswitch_domain_models::api::ApplicationResponse;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
+use router_env::logger;
+#[cfg(any(feature = "dynamic_routing", feature = "v1"))]
use router_env::{instrument, metrics::add_attributes, tracing};
use rustc_hash::FxHashSet;
use storage_impl::redis::cache;
@@ -29,8 +35,10 @@ use crate::{
types::{domain, storage},
utils::StringExt,
};
-#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
-use crate::{core::metrics as core_metrics, routes::metrics};
+#[cfg(feature = "v1")]
+use crate::{core::metrics as core_metrics, routes::metrics, types::transformers::ForeignInto};
+pub const SUCCESS_BASED_DYNAMIC_ROUTING_ALGORITHM: &str =
+ "Success rate based dynamic routing algorithm";
/// Provides us with all the configured configs of the Merchant in the ascending time configured
/// manner and chooses the first of them
@@ -594,28 +602,8 @@ pub async fn refresh_success_based_routing_cache(
pub async fn fetch_success_based_routing_configs(
state: &SessionState,
business_profile: &domain::Profile,
- dynamic_routing_algorithm: serde_json::Value,
+ success_based_routing_id: id_type::RoutingId,
) -> RouterResult<routing_types::SuccessBasedRoutingConfig> {
- let dynamic_routing_algorithm_ref = dynamic_routing_algorithm
- .parse_value::<routing_types::DynamicRoutingAlgorithmRef>("DynamicRoutingAlgorithmRef")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("unable to parse dynamic_routing_algorithm_ref")?;
-
- let success_based_routing_id = dynamic_routing_algorithm_ref
- .success_based_algorithm
- .ok_or(errors::ApiErrorResponse::GenericNotFoundError {
- message: "success_based_algorithm not found in dynamic_routing_algorithm_ref"
- .to_string(),
- })?
- .algorithm_id
- // error can be possible when the feature is toggled off.
- .ok_or(errors::ApiErrorResponse::GenericNotFoundError {
- message: format!(
- "unable to find algorithm_id in success based algorithm config as the feature is disabled for profile_id: {}",
- business_profile.get_id().get_string_repr()
- ),
- })?;
-
let key = format!(
"{}_{}",
business_profile.get_id().get_string_repr(),
@@ -657,156 +645,185 @@ pub async fn push_metrics_for_success_based_routing(
payment_attempt: &storage::PaymentAttempt,
routable_connectors: Vec<routing_types::RoutableConnectorChoice>,
business_profile: &domain::Profile,
- dynamic_routing_algorithm: serde_json::Value,
) -> RouterResult<()> {
- let client = state
- .grpc_client
- .dynamic_routing
- .success_rate_client
- .as_ref()
- .ok_or(errors::ApiErrorResponse::GenericNotFoundError {
- message: "success_rate gRPC client not found".to_string(),
- })?;
-
- let payment_connector = &payment_attempt.connector.clone().ok_or(
- errors::ApiErrorResponse::GenericNotFoundError {
- message: "unable to derive payment connector from payment attempt".to_string(),
- },
- )?;
-
- let success_based_routing_configs =
- fetch_success_based_routing_configs(state, business_profile, dynamic_routing_algorithm)
- .await
+ let success_based_dynamic_routing_algo_ref: routing_types::DynamicRoutingAlgorithmRef =
+ business_profile
+ .dynamic_routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("DynamicRoutingAlgorithmRef"))
+ .transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("unable to retrieve success_rate based dynamic routing configs")?;
+ .attach_printable("Failed to deserialize DynamicRoutingAlgorithmRef from JSON")?
+ .unwrap_or_default();
- let tenant_business_profile_id = format!(
- "{}:{}",
- state.tenant.redis_key_prefix,
- business_profile.get_id().get_string_repr()
- );
+ let success_based_algo_ref = success_based_dynamic_routing_algo_ref
+ .success_based_algorithm
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("success_based_algorithm not found in dynamic_routing_algorithm from business_profile table")?;
+
+ if success_based_algo_ref.enabled_feature != routing_types::SuccessBasedRoutingFeatures::None {
+ let client = state
+ .grpc_client
+ .dynamic_routing
+ .success_rate_client
+ .as_ref()
+ .ok_or(errors::ApiErrorResponse::GenericNotFoundError {
+ message: "success_rate gRPC client not found".to_string(),
+ })?;
+
+ let payment_connector = &payment_attempt.connector.clone().ok_or(
+ errors::ApiErrorResponse::GenericNotFoundError {
+ message: "unable to derive payment connector from payment attempt".to_string(),
+ },
+ )?;
- let success_based_connectors = client
- .calculate_success_rate(
- tenant_business_profile_id.clone(),
- success_based_routing_configs.clone(),
- routable_connectors.clone(),
+ let success_based_routing_configs = fetch_success_based_routing_configs(
+ state,
+ business_profile,
+ success_based_algo_ref
+ .algorithm_id_with_timestamp
+ .algorithm_id
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "success_based_routing_algorithm_id not found in business_profile",
+ )?,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("unable to calculate/fetch success rate from dynamic routing service")?;
-
- let payment_status_attribute =
- get_desired_payment_status_for_success_routing_metrics(&payment_attempt.status);
-
- let first_success_based_connector_label = &success_based_connectors
- .labels_with_score
- .first()
- .ok_or(errors::ApiErrorResponse::InternalServerError)
- .attach_printable(
- "unable to fetch the first connector from list of connectors obtained from dynamic routing service",
- )?
- .label
- .to_string();
-
- let (first_success_based_connector, merchant_connector_id) = first_success_based_connector_label
- .split_once(':')
- .ok_or(errors::ApiErrorResponse::InternalServerError)
- .attach_printable(
- "unable to split connector_name and mca_id from the first connector obtained from dynamic routing service",
- )?;
-
- let outcome = get_success_based_metrics_outcome_for_payment(
- &payment_status_attribute,
- payment_connector.to_string(),
- first_success_based_connector.to_string(),
- );
-
- core_metrics::DYNAMIC_SUCCESS_BASED_ROUTING.add(
- &metrics::CONTEXT,
- 1,
- &add_attributes([
- ("tenant", state.tenant.name.clone()),
- (
- "merchant_id",
- payment_attempt.merchant_id.get_string_repr().to_string(),
- ),
- (
- "profile_id",
- payment_attempt.profile_id.get_string_repr().to_string(),
- ),
- ("merchant_connector_id", merchant_connector_id.to_string()),
- (
- "payment_id",
- payment_attempt.payment_id.get_string_repr().to_string(),
- ),
- (
- "success_based_routing_connector",
- first_success_based_connector.to_string(),
- ),
- ("payment_connector", payment_connector.to_string()),
- (
- "currency",
- payment_attempt
- .currency
- .map_or_else(|| "None".to_string(), |currency| currency.to_string()),
- ),
- (
- "payment_method",
- payment_attempt.payment_method.map_or_else(
- || "None".to_string(),
- |payment_method| payment_method.to_string(),
+ .attach_printable("unable to retrieve success_rate based dynamic routing configs")?;
+
+ let tenant_business_profile_id = generate_tenant_business_profile_id(
+ &state.tenant.redis_key_prefix,
+ business_profile.get_id().get_string_repr(),
+ );
+
+ let success_based_connectors = client
+ .calculate_success_rate(
+ tenant_business_profile_id.clone(),
+ success_based_routing_configs.clone(),
+ routable_connectors.clone(),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "unable to calculate/fetch success rate from dynamic routing service",
+ )?;
+
+ let payment_status_attribute =
+ get_desired_payment_status_for_success_routing_metrics(&payment_attempt.status);
+
+ let first_success_based_connector_label = &success_based_connectors
+ .labels_with_score
+ .first()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "unable to fetch the first connector from list of connectors obtained from dynamic routing service",
+ )?
+ .label
+ .to_string();
+
+ let (first_success_based_connector, merchant_connector_id) = first_success_based_connector_label
+ .split_once(':')
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "unable to split connector_name and mca_id from the first connector obtained from dynamic routing service",
+ )?;
+
+ let outcome = get_success_based_metrics_outcome_for_payment(
+ &payment_status_attribute,
+ payment_connector.to_string(),
+ first_success_based_connector.to_string(),
+ );
+
+ core_metrics::DYNAMIC_SUCCESS_BASED_ROUTING.add(
+ &metrics::CONTEXT,
+ 1,
+ &add_attributes([
+ ("tenant", state.tenant.name.clone()),
+ (
+ "merchant_id",
+ payment_attempt.merchant_id.get_string_repr().to_string(),
),
- ),
- (
- "payment_method_type",
- payment_attempt.payment_method_type.map_or_else(
- || "None".to_string(),
- |payment_method_type| payment_method_type.to_string(),
+ (
+ "profile_id",
+ payment_attempt.profile_id.get_string_repr().to_string(),
),
- ),
- (
- "capture_method",
- payment_attempt.capture_method.map_or_else(
- || "None".to_string(),
- |capture_method| capture_method.to_string(),
+ ("merchant_connector_id", merchant_connector_id.to_string()),
+ (
+ "payment_id",
+ payment_attempt.payment_id.get_string_repr().to_string(),
),
- ),
- (
- "authentication_type",
- payment_attempt.authentication_type.map_or_else(
- || "None".to_string(),
- |authentication_type| authentication_type.to_string(),
+ (
+ "success_based_routing_connector",
+ first_success_based_connector.to_string(),
),
- ),
- ("payment_status", payment_attempt.status.to_string()),
- ("conclusive_classification", outcome.to_string()),
- ]),
- );
-
- client
- .update_success_rate(
- tenant_business_profile_id,
- success_based_routing_configs,
- vec![routing_types::RoutableConnectorChoiceWithStatus::new(
- routing_types::RoutableConnectorChoice {
- choice_kind: api_models::routing::RoutableChoiceKind::FullStruct,
- connector: common_enums::RoutableConnectors::from_str(
- payment_connector.as_str(),
- )
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("unable to infer routable_connector from connector")?,
- merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
- },
- payment_status_attribute == common_enums::AttemptStatus::Charged,
- )],
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable(
- "unable to update success based routing window in dynamic routing service",
- )?;
- Ok(())
+ ("payment_connector", payment_connector.to_string()),
+ (
+ "currency",
+ payment_attempt
+ .currency
+ .map_or_else(|| "None".to_string(), |currency| currency.to_string()),
+ ),
+ (
+ "payment_method",
+ payment_attempt.payment_method.map_or_else(
+ || "None".to_string(),
+ |payment_method| payment_method.to_string(),
+ ),
+ ),
+ (
+ "payment_method_type",
+ payment_attempt.payment_method_type.map_or_else(
+ || "None".to_string(),
+ |payment_method_type| payment_method_type.to_string(),
+ ),
+ ),
+ (
+ "capture_method",
+ payment_attempt.capture_method.map_or_else(
+ || "None".to_string(),
+ |capture_method| capture_method.to_string(),
+ ),
+ ),
+ (
+ "authentication_type",
+ payment_attempt.authentication_type.map_or_else(
+ || "None".to_string(),
+ |authentication_type| authentication_type.to_string(),
+ ),
+ ),
+ ("payment_status", payment_attempt.status.to_string()),
+ ("conclusive_classification", outcome.to_string()),
+ ]),
+ );
+ logger::debug!("successfully pushed success_based_routing metrics");
+
+ client
+ .update_success_rate(
+ tenant_business_profile_id,
+ success_based_routing_configs,
+ vec![routing_types::RoutableConnectorChoiceWithStatus::new(
+ routing_types::RoutableConnectorChoice {
+ choice_kind: api_models::routing::RoutableChoiceKind::FullStruct,
+ connector: common_enums::RoutableConnectors::from_str(
+ payment_connector.as_str(),
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to infer routable_connector from connector")?,
+ merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
+ },
+ payment_status_attribute == common_enums::AttemptStatus::Charged,
+ )],
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "unable to update success based routing window in dynamic routing service",
+ )?;
+ Ok(())
+ } else {
+ Ok(())
+ }
}
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
@@ -875,3 +892,67 @@ fn get_success_based_metrics_outcome_for_payment(
_ => common_enums::SuccessBasedRoutingConclusiveState::NonDeterministic,
}
}
+
+/// generates cache key with tenant's redis key prefix and profile_id
+pub fn generate_tenant_business_profile_id(
+ redis_key_prefix: &str,
+ business_profile_id: &str,
+) -> String {
+ format!("{}:{}", redis_key_prefix, business_profile_id)
+}
+
+/// default config setup for success_based_routing
+#[cfg(feature = "v1")]
+#[instrument(skip_all)]
+pub async fn default_success_based_routing_setup(
+ state: &SessionState,
+ key_store: domain::MerchantKeyStore,
+ business_profile: domain::Profile,
+ feature_to_enable: routing_types::SuccessBasedRoutingFeatures,
+ merchant_id: id_type::MerchantId,
+ mut success_based_dynamic_routing_algo: routing_types::DynamicRoutingAlgorithmRef,
+) -> RouterResult<ApplicationResponse<routing_types::RoutingDictionaryRecord>> {
+ let db = state.store.as_ref();
+ let key_manager_state = &state.into();
+ let profile_id = business_profile.get_id().to_owned();
+ let default_success_based_routing_config = routing_types::SuccessBasedRoutingConfig::default();
+ let algorithm_id = common_utils::generate_routing_id_of_default_length();
+ let timestamp = common_utils::date_time::now();
+ let algo = routing_algorithm::RoutingAlgorithm {
+ algorithm_id: algorithm_id.clone(),
+ profile_id: profile_id.clone(),
+ merchant_id,
+ name: SUCCESS_BASED_DYNAMIC_ROUTING_ALGORITHM.to_string(),
+ description: None,
+ kind: diesel_models::enums::RoutingAlgorithmKind::Dynamic,
+ algorithm_data: serde_json::json!(default_success_based_routing_config),
+ created_at: timestamp,
+ modified_at: timestamp,
+ algorithm_for: common_enums::TransactionType::Payment,
+ };
+
+ let record = db
+ .insert_routing_algorithm(algo)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to insert record in routing algorithm table")?;
+
+ success_based_dynamic_routing_algo.update_algorithm_id(algorithm_id, feature_to_enable);
+ update_business_profile_active_dynamic_algorithm_ref(
+ db,
+ key_manager_state,
+ &key_store,
+ business_profile,
+ success_based_dynamic_routing_algo,
+ )
+ .await?;
+
+ let new_record = record.foreign_into();
+
+ core_metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(
+ &metrics::CONTEXT,
+ 1,
+ &add_attributes([("profile_id", profile_id.get_string_repr().to_string())]),
+ );
+ Ok(ApplicationResponse::Json(new_record))
+}
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 3e0355a884a..f3a589524a1 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -942,7 +942,7 @@ pub async fn toggle_success_based_routing(
) -> impl Responder {
let flow = Flow::ToggleDynamicRouting;
let wrapper = routing_types::ToggleSuccessBasedRoutingWrapper {
- status: query.into_inner().status,
+ feature_to_enable: query.into_inner().enable,
profile_id: path.into_inner().profile_id,
};
Box::pin(oss_api::server_wrap(
@@ -958,7 +958,7 @@ pub async fn toggle_success_based_routing(
state,
auth.merchant_account,
auth.key_store,
- wrapper.status,
+ wrapper.feature_to_enable,
wrapper.profile_id,
)
},
|
feat
|
add dynamic routing in core flows (#6333)
|
9cba7da0d3d4b87101debef8ec25b52a908975c5
|
2023-08-02 14:58:22
|
Sakil Mostak
|
feat(connector): [Boku] Implement Authorize, Psync, Refund and Rsync flow (#1699)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 66825779f07..fdea4e03b76 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4000,6 +4000,7 @@ dependencies = [
"ring",
"router_derive",
"router_env",
+ "roxmltree",
"serde",
"serde_json",
"serde_path_to_error",
@@ -4064,6 +4065,15 @@ dependencies = [
"vergen",
]
+[[package]]
+name = "roxmltree"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8f595a457b6b8c6cda66a48503e92ee8d19342f905948f29c383200ec9eb1d8"
+dependencies = [
+ "xmlparser",
+]
+
[[package]]
name = "rust-embed"
version = "6.7.0"
diff --git a/config/config.example.toml b/config/config.example.toml
index 0415330c89b..664477ec910 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -157,7 +157,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
-boku.base_url = "https://country-api4-stage.boku.com"
+boku.base_url = "https://$-api4-stage.boku.com"
braintree.base_url = "https://api.sandbox.braintreegateway.com/"
cashtocode.base_url = "https://cluster05.api-test.cashtocode.com"
checkout.base_url = "https://api.sandbox.checkout.com/"
diff --git a/config/development.toml b/config/development.toml
index c5b85d4a1fb..eec00445963 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -123,7 +123,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
-boku.base_url = "https://country-api4-stage.boku.com"
+boku.base_url = "https://$-api4-stage.boku.com"
braintree.base_url = "https://api.sandbox.braintreegateway.com/"
cashtocode.base_url = "https://cluster05.api-test.cashtocode.com"
checkout.base_url = "https://api.sandbox.checkout.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index a8a8ecde604..cc93127fb65 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -80,7 +80,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
-boku.base_url = "https://country-api4-stage.boku.com"
+boku.base_url = "https://$-api4-stage.boku.com"
braintree.base_url = "https://api.sandbox.braintreegateway.com/"
cashtocode.base_url = "https://cluster05.api-test.cashtocode.com"
checkout.base_url = "https://api.sandbox.checkout.com/"
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 129472c9d08..53303a2230b 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -78,7 +78,7 @@ pub enum Connector {
Bitpay,
Bambora,
Bluesnap,
- // Boku, added as template code for future usage
+ Boku,
Braintree,
Cashtocode,
Checkout,
@@ -192,7 +192,7 @@ pub enum RoutableConnectors {
Bitpay,
Bambora,
Bluesnap,
- // Boku, added as template code for future usage
+ Boku,
Braintree,
Cashtocode,
Checkout,
diff --git a/crates/common_utils/src/ext_traits.rs b/crates/common_utils/src/ext_traits.rs
index eac24ac0753..e562c5914f0 100644
--- a/crates/common_utils/src/ext_traits.rs
+++ b/crates/common_utils/src/ext_traits.rs
@@ -61,6 +61,15 @@ where
where
Self: Serialize;
+ ///
+ /// Functionality, for specifically encoding `Self` into `String`
+ /// after serialization by using `serde::Serialize`
+ /// specifically, to convert into XML `String`.
+ ///
+ fn encode_to_string_of_xml(&'e self) -> CustomResult<String, errors::ParsingError>
+ where
+ Self: Serialize;
+
///
/// Functionality, for specifically encoding `Self` into `serde_json::Value`
/// after serialization by using `serde::Serialize`
@@ -131,6 +140,16 @@ where
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
+ fn encode_to_string_of_xml(&'e self) -> CustomResult<String, errors::ParsingError>
+ where
+ Self: Serialize,
+ {
+ quick_xml::se::to_string(self)
+ .into_report()
+ .change_context(errors::ParsingError::EncodeError("xml"))
+ .attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
+ }
+
fn encode_to_value(&'e self) -> CustomResult<serde_json::Value, errors::ParsingError>
where
Self: Serialize,
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 45091f0f61f..dc2ad5370ee 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -69,6 +69,7 @@ rand = "0.8.5"
regex = "1.8.4"
reqwest = { version = "0.11.18", features = ["json", "native-tls", "gzip", "multipart"] }
ring = "0.16.20"
+roxmltree = "0.18.0"
serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0.96"
serde_path_to_error = "0.1.11"
diff --git a/crates/router/src/connector/boku.rs b/crates/router/src/connector/boku.rs
index 70aa46e99bf..628417f4870 100644
--- a/crates/router/src/connector/boku.rs
+++ b/crates/router/src/connector/boku.rs
@@ -2,14 +2,20 @@ mod transformers;
use std::fmt::Debug;
-use error_stack::{IntoReport, ResultExt};
-use masking::ExposeInterface;
+use common_utils::ext_traits::XmlExt;
+use error_stack::{IntoReport, Report, ResultExt};
+use masking::{ExposeInterface, PeekInterface, Secret, WithType};
+use ring::hmac;
+use roxmltree;
+use time::OffsetDateTime;
use transformers as boku;
use crate::{
configs::settings,
+ consts,
core::errors::{self, CustomResult},
- headers,
+ headers, logger,
+ routes::metrics,
services::{
self,
request::{self, Mask},
@@ -20,7 +26,7 @@ use crate::{
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse, Response,
},
- utils::{self, BytesExt},
+ utils::{self, BytesExt, OptionExt},
};
#[derive(Debug, Clone)]
@@ -56,16 +62,40 @@ where
fn build_headers(
&self,
req: &types::RouterData<Flow, Request, Response>,
- _connectors: &settings::Connectors,
+ connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
- headers::CONTENT_TYPE.to_string(),
- types::PaymentsAuthorizeType::get_content_type(self)
- .to_string()
- .into(),
- )];
- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- header.append(&mut api_key);
+ let connector_auth = boku::BokuAuthType::try_from(&req.connector_auth_type)?;
+
+ let boku_url = Self::get_url(self, req, connectors)?;
+
+ let content_type = Self::common_get_content_type(self);
+
+ let connector_method = Self::get_http_method(self);
+
+ let timestamp = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000;
+
+ let secret_key = boku::BokuAuthType::try_from(&req.connector_auth_type)?
+ .key_id
+ .expose();
+
+ let to_sign = format!(
+ "{} {}\nContent-Type: {}\n{}",
+ connector_method, boku_url, &content_type, timestamp
+ );
+
+ let key = hmac::Key::new(hmac::HMAC_SHA256, secret_key.as_bytes());
+
+ let tag = hmac::sign(&key, to_sign.as_bytes());
+
+ let signature = hex::encode(tag);
+
+ let auth_val = format!("2/HMAC_SHA256(H+SHA256(E)) timestamp={timestamp}, signature={signature} signed-headers=Content-Type, key-id={}", connector_auth.key_id.peek());
+
+ let header = vec![
+ (headers::CONTENT_TYPE.to_string(), content_type.into()),
+ (headers::AUTHORIZATION.to_string(), auth_val.into_masked()),
+ ];
+
Ok(header)
}
}
@@ -76,12 +106,12 @@ impl ConnectorCommon for Boku {
}
fn common_get_content_type(&self) -> &'static str {
- "application/json"
+ "text/xml;charset=utf-8"
}
fn validate_auth_type(
&self,
val: &types::ConnectorAuthType,
- ) -> Result<(), error_stack::Report<errors::ConnectorError>> {
+ ) -> Result<(), Report<errors::ConnectorError>> {
boku::BokuAuthType::try_from(val)?;
Ok(())
}
@@ -90,33 +120,24 @@ impl ConnectorCommon for Boku {
connectors.boku.base_url.as_ref()
}
- fn get_auth_header(
- &self,
- auth_type: &types::ConnectorAuthType,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let auth = boku::BokuAuthType::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,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: boku::BokuErrorResponse = res
+ let response_data: Result<boku::BokuErrorResponse, Report<errors::ConnectorError>> = res
.response
- .parse_struct("BokuErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- Ok(ErrorResponse {
- status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
- })
+ .parse_struct("boku::BokuErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed);
+
+ match response_data {
+ Ok(response) => Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ }),
+ Err(_) => get_xml_deserialized(res),
+ }
}
}
@@ -147,16 +168,25 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
self.build_headers(req, connectors)
}
+ fn get_http_method(&self) -> services::Method {
+ services::Method::Post
+ }
+
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
- _req: &types::PaymentsAuthorizeRouterData,
- _connectors: &settings::Connectors,
+ req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let boku_url = get_country_url(
+ req.connector_meta_data.clone(),
+ self.base_url(connectors).to_string(),
+ )?;
+
+ Ok(format!("{boku_url}/billing/3.0/begin-single-charge"))
}
fn get_request_body(
@@ -166,7 +196,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
let req_obj = boku::BokuPaymentsRequest::try_from(req)?;
let boku_req = types::RequestBody::log_and_get_request_body(
&req_obj,
- utils::Encode::<boku::BokuPaymentsRequest>::encode_to_string_of_json,
+ utils::Encode::<boku::BokuPaymentsRequest>::encode_to_string_of_xml,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(boku_req))
@@ -197,10 +227,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
data: &types::PaymentsAuthorizeRouterData,
res: Response,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: boku::BokuPaymentsResponse = res
- .response
- .parse_struct("Boku PaymentsAuthorizeResponse")
+ let response_data = String::from_utf8(res.response.to_vec())
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ let response = response_data
+ .parse_xml::<boku::BokuResponse>()
+ .into_report()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -233,10 +268,28 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
fn get_url(
&self,
- _req: &types::PaymentsSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let boku_url = get_country_url(
+ req.connector_meta_data.clone(),
+ self.base_url(connectors).to_string(),
+ )?;
+
+ Ok(format!("{boku_url}/billing/3.0/query-charge"))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
+ let req_obj = boku::BokuPsyncRequest::try_from(req)?;
+ let boku_req = types::RequestBody::log_and_get_request_body(
+ &req_obj,
+ utils::Encode::<boku::BokuPsyncRequest>::encode_to_string_of_xml,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(boku_req))
}
fn build_request(
@@ -250,6 +303,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .body(types::PaymentsSyncType::get_request_body(self, req)?)
.build(),
))
}
@@ -259,10 +313,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
data: &types::PaymentsSyncRouterData,
res: Response,
) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
- let response: boku::BokuPaymentsResponse = res
- .response
- .parse_struct("boku PaymentsSyncResponse")
+ let response_data = String::from_utf8(res.response.to_vec())
+ .into_report()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ let response = response_data
+ .parse_xml::<boku::BokuResponse>()
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -331,10 +390,15 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
data: &types::PaymentsCaptureRouterData,
res: Response,
) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: boku::BokuPaymentsResponse = res
- .response
- .parse_struct("Boku PaymentsCaptureResponse")
+ let response_data = String::from_utf8(res.response.to_vec())
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ let response = response_data
+ .parse_xml::<boku::BokuResponse>()
+ .into_report()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -370,10 +434,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
fn get_url(
&self,
- _req: &types::RefundsRouterData<api::Execute>,
- _connectors: &settings::Connectors,
+ req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let boku_url = get_country_url(
+ req.connector_meta_data.clone(),
+ self.base_url(connectors).to_string(),
+ )?;
+
+ Ok(format!("{boku_url}/billing/3.0/refund-charge"))
}
fn get_request_body(
@@ -383,7 +452,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
let req_obj = boku::BokuRefundRequest::try_from(req)?;
let boku_req = types::RequestBody::log_and_get_request_body(
&req_obj,
- utils::Encode::<boku::BokuRefundRequest>::encode_to_string_of_json,
+ utils::Encode::<boku::BokuRefundRequest>::encode_to_string_of_xml,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(boku_req))
@@ -445,10 +514,28 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
fn get_url(
&self,
- _req: &types::RefundSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &types::RefundSyncRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let boku_url = get_country_url(
+ req.connector_meta_data.clone(),
+ self.base_url(connectors).to_string(),
+ )?;
+
+ Ok(format!("{boku_url}/billing/3.0/query-refund"))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefundSyncRouterData,
+ ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
+ let req_obj = boku::BokuRsyncRequest::try_from(req)?;
+ let boku_req = types::RequestBody::log_and_get_request_body(
+ &req_obj,
+ utils::Encode::<boku::BokuPaymentsRequest>::encode_to_string_of_xml,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(boku_req))
}
fn build_request(
@@ -472,10 +559,10 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
data: &types::RefundSyncRouterData,
res: Response,
) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
- let response: boku::RefundResponse =
- res.response
- .parse_struct("boku RefundSyncResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: boku::BokuRsyncResponse = res
+ .response
+ .parse_struct("boku BokuRsyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -514,3 +601,43 @@ impl api::IncomingWebhook for Boku {
Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
+
+fn get_country_url(
+ meta_data: Option<Secret<serde_json::Value, WithType>>,
+ base_url: String,
+) -> Result<String, Report<errors::ConnectorError>> {
+ let conn_meta_data: boku::BokuMetaData = meta_data
+ .parse_value("Object")
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ Ok(base_url.replace('$', &conn_meta_data.country.to_lowercase()))
+}
+
+// validate xml format for the error
+fn get_xml_deserialized(res: Response) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ metrics::RESPONSE_DESERIALIZATION_FAILURE.add(
+ &metrics::CONTEXT,
+ 1,
+ &[metrics::request::add_attributes("connector", "boku")],
+ );
+
+ let response_data = String::from_utf8(res.response.to_vec())
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ // check for whether the response is in xml format
+ match roxmltree::Document::parse(&response_data) {
+ // in case of unexpected response but in xml format
+ Ok(_) => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
+ // in case of unexpected response but in html or string format
+ Err(_) => {
+ logger::error!("UNEXPECTED RESPONSE FROM CONNECTOR: {}", response_data);
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(),
+ reason: Some(response_data),
+ })
+ }
+ }
+}
diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs
index 885ba5172db..8605bba32af 100644
--- a/crates/router/src/connector/boku/transformers.rs
+++ b/crates/router/src/connector/boku/transformers.rs
@@ -1,107 +1,254 @@
+use std::fmt;
+
use masking::Secret;
use serde::{Deserialize, Serialize};
+use url::Url;
+use uuid::Uuid;
use crate::{
- connector::utils::PaymentsAuthorizeRequestData,
+ connector::utils::{AddressDetailsData, RouterData},
core::errors,
+ services::{self, RedirectForm},
types::{self, api, storage::enums},
};
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct BokuPaymentsRequest {
- amount: i64,
- card: BokuCard,
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum BokuPaymentsRequest {
+ BeginSingleCharge(SingleChargeData),
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct SingleChargeData {
+ total_amount: i64,
+ currency: String,
+ country: String,
+ merchant_id: Secret<String>,
+ merchant_transaction_id: Secret<String>,
+ merchant_request_id: String,
+ merchant_item_description: String,
+ notification_url: Option<String>,
+ payment_method: String,
+ charge_type: String,
+ hosted: Option<BokuHostedData>,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub enum BokuPaymentType {
+ Dana,
+ Momo,
+ Gcash,
+ GoPay,
+ Kakaopay,
+}
+
+impl fmt::Display for BokuPaymentType {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Self::Dana => write!(f, "Dana"),
+ Self::Momo => write!(f, "Momo"),
+ Self::Gcash => write!(f, "Gcash"),
+ Self::GoPay => write!(f, "GoPay"),
+ Self::Kakaopay => write!(f, "Kakaopay"),
+ }
+ }
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct BokuCard {
- name: Secret<String>,
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
+#[derive(Debug, Clone, Serialize)]
+pub enum BokuChargeType {
+ Hosted,
+}
+
+impl fmt::Display for BokuChargeType {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Self::Hosted => write!(f, "hosted"),
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "kebab-case")]
+struct BokuHostedData {
+ forward_url: String,
}
impl TryFrom<&types::PaymentsAuthorizeRouterData> for BokuPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
match item.request.payment_method_data.clone() {
- api::PaymentMethodData::Card(req_card) => {
- let card = BokuCard {
- name: req_card.card_holder_name,
- 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.request.is_auto_capture()?,
- };
- Ok(Self {
- amount: item.request.amount,
- card,
- })
+ api_models::payments::PaymentMethodData::Wallet(wallet_data) => {
+ Self::try_from((item, &wallet_data))
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+ _ => Err(errors::ConnectorError::NotSupported {
+ message: format!("{:?}", item.request.payment_method_type),
+ connector: "Boku",
+ payment_experience: api_models::enums::PaymentExperience::RedirectToUrl.to_string(),
+ })?,
}
}
}
-// Auth Struct
+impl TryFrom<(&types::PaymentsAuthorizeRouterData, &api::WalletData)> for BokuPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ value: (&types::PaymentsAuthorizeRouterData, &api::WalletData),
+ ) -> Result<Self, Self::Error> {
+ let (item, wallet_data) = value;
+ let address = item.get_billing_address()?;
+ let country = address.get_country()?.to_string();
+ let payment_method = get_wallet_type(wallet_data)?;
+ let hosted = get_hosted_data(item);
+ let auth_type = BokuAuthType::try_from(&item.connector_auth_type)?;
+ let merchant_item_description = item.get_description()?;
+ let payment_data = SingleChargeData {
+ total_amount: item.request.amount,
+ currency: item.request.currency.to_string(),
+ country,
+ merchant_id: auth_type.merchant_id,
+ merchant_transaction_id: Secret::new(item.payment_id.to_string()),
+ merchant_request_id: Uuid::new_v4().to_string(),
+ merchant_item_description,
+ notification_url: item.request.webhook_url.clone(),
+ payment_method,
+ charge_type: BokuChargeType::Hosted.to_string(),
+ hosted,
+ };
+
+ Ok(Self::BeginSingleCharge(payment_data))
+ }
+}
+
+fn get_wallet_type(wallet_data: &api::WalletData) -> Result<String, errors::ConnectorError> {
+ match wallet_data {
+ api_models::payments::WalletData::DanaRedirect { .. } => {
+ Ok(BokuPaymentType::Dana.to_string())
+ }
+ api_models::payments::WalletData::MomoRedirect { .. } => {
+ Ok(BokuPaymentType::Momo.to_string())
+ }
+ api_models::payments::WalletData::GcashRedirect { .. } => {
+ Ok(BokuPaymentType::Gcash.to_string())
+ }
+ api_models::payments::WalletData::GoPayRedirect { .. } => {
+ Ok(BokuPaymentType::GoPay.to_string())
+ }
+ api_models::payments::WalletData::KakaoPayRedirect { .. } => {
+ Ok(BokuPaymentType::Kakaopay.to_string())
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment method".to_string(),
+ )),
+ }
+}
+
pub struct BokuAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) merchant_id: Secret<String>,
+ pub(super) key_id: Secret<String>,
}
impl TryFrom<&types::ConnectorAuthType> for BokuAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
+ types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ merchant_id: key1.to_owned(),
+ key_id: api_key.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-// PaymentsResponse
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum BokuPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename = "query-charge-request")]
+#[serde(rename_all = "kebab-case")]
+pub struct BokuPsyncRequest {
+ country: String,
+ merchant_id: Secret<String>,
+ merchant_transaction_id: Secret<String>,
}
-impl From<BokuPaymentStatus> for enums::AttemptStatus {
- fn from(item: BokuPaymentStatus) -> Self {
- match item {
- BokuPaymentStatus::Succeeded => Self::Charged,
- BokuPaymentStatus::Failed => Self::Failure,
- BokuPaymentStatus::Processing => Self::Authorizing,
- }
+impl TryFrom<&types::PaymentsSyncRouterData> for BokuPsyncRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::PaymentsSyncRouterData) -> Result<Self, Self::Error> {
+ let address = item.get_billing_address()?;
+ let country = address.get_country()?.to_string();
+ let auth_type = BokuAuthType::try_from(&item.connector_auth_type)?;
+
+ Ok(Self {
+ country,
+ merchant_id: auth_type.merchant_id,
+ merchant_transaction_id: Secret::new(item.payment_id.to_string()),
+ })
}
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+// Connector Meta Data
+#[derive(Debug, Clone, Deserialize)]
+pub struct BokuMetaData {
+ pub(super) country: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum BokuResponse {
+ BeginSingleChargeResponse(BokuPaymentsResponse),
+ QueryChargeResponse(BokuPsyncResponse),
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
pub struct BokuPaymentsResponse {
- status: BokuPaymentStatus,
- id: String,
+ charge_status: String, // xml parse only string to fields
+ charge_id: String,
+ hosted: Option<HostedUrlResponse>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct HostedUrlResponse {
+ redirect_url: Option<Url>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename = "query-charge-response")]
+#[serde(rename_all = "kebab-case")]
+pub struct BokuPsyncResponse {
+ charges: ChargeResponseData,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct ChargeResponseData {
+ charge: SingleChargeResponseData,
}
-impl<F, T>
- TryFrom<types::ResponseRouterData<F, BokuPaymentsResponse, T, types::PaymentsResponseData>>
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct SingleChargeResponseData {
+ charge_status: String,
+ charge_id: String,
+}
+
+impl<F, T> TryFrom<types::ResponseRouterData<F, BokuResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::ResponseRouterData<F, BokuPaymentsResponse, T, types::PaymentsResponseData>,
+ item: types::ResponseRouterData<F, BokuResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
+ let (status, transaction_id, redirection_data) = match item.response {
+ BokuResponse::BeginSingleChargeResponse(response) => get_authorize_response(response),
+ BokuResponse::QueryChargeResponse(response) => get_psync_response(response),
+ }?;
+
Ok(Self {
- status: enums::AttemptStatus::from(item.response.status),
+ status,
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: None,
+ resource_id: types::ResponseId::ConnectorTransactionId(transaction_id),
+ redirection_data,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
@@ -112,47 +259,95 @@ impl<F, T>
}
}
+fn get_response_status(status: String) -> enums::AttemptStatus {
+ match status.as_str() {
+ "Success" => enums::AttemptStatus::Charged,
+ "Failure" => enums::AttemptStatus::Failure,
+ _ => enums::AttemptStatus::Pending,
+ }
+}
+
+fn get_authorize_response(
+ response: BokuPaymentsResponse,
+) -> Result<(enums::AttemptStatus, String, Option<RedirectForm>), errors::ConnectorError> {
+ let status = get_response_status(response.charge_status);
+ let redirection_data = match response.hosted {
+ Some(hosted_value) => Ok(hosted_value
+ .redirect_url
+ .map(|url| services::RedirectForm::from((url, services::Method::Get)))),
+ None => Err(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "redirect_url",
+ }),
+ }?;
+
+ Ok((status, response.charge_id, redirection_data))
+}
+
+fn get_psync_response(
+ response: BokuPsyncResponse,
+) -> Result<(enums::AttemptStatus, String, Option<RedirectForm>), errors::ConnectorError> {
+ let status = get_response_status(response.charges.charge.charge_status);
+
+ Ok((status, response.charges.charge.charge_id, None))
+}
+
// REFUND :
-#[derive(Default, Debug, Serialize)]
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename = "refund-charge-request")]
pub struct BokuRefundRequest {
- pub amount: i64,
+ refund_amount: i64,
+ merchant_id: Secret<String>,
+ merchant_request_id: String,
+ merchant_refund_id: Secret<String>,
+ charge_id: String,
+ reason_code: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub enum BokuRefundReasonCode {
+ NonFulfillment,
+}
+
+impl fmt::Display for BokuRefundReasonCode {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Self::NonFulfillment => write!(f, "8"),
+ }
+ }
}
impl<F> TryFrom<&types::RefundsRouterData<F>> for BokuRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
- Ok(Self {
- amount: item.request.refund_amount,
- })
+ let auth_type = BokuAuthType::try_from(&item.connector_auth_type)?;
+ let payment_data = Self {
+ refund_amount: item.request.refund_amount,
+ merchant_id: auth_type.merchant_id,
+ merchant_refund_id: Secret::new(item.request.refund_id.to_string()),
+ merchant_request_id: Uuid::new_v4().to_string(),
+ charge_id: item.request.connector_transaction_id.to_string(),
+ reason_code: BokuRefundReasonCode::NonFulfillment.to_string(),
+ };
+
+ Ok(payment_data)
}
}
-// Type definition for Refund Response
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename = "refund-charge-response")]
+pub struct RefundResponse {
+ charge_id: String,
+ refund_status: String,
}
-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,
- }
+fn get_refund_status(status: String) -> enums::RefundStatus {
+ match status.as_str() {
+ "Success" => enums::RefundStatus::Success,
+ "Failure" => enums::RefundStatus::Failure,
+ _ => enums::RefundStatus::Pending,
}
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
- id: String,
- status: RefundStatus,
-}
-
impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
for types::RefundsRouterData<api::Execute>
{
@@ -162,25 +357,69 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.response.charge_id,
+ refund_status: get_refund_status(item.response.refund_status),
}),
..item.data
})
}
}
-impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename = "query-refund-request")]
+#[serde(rename_all = "kebab-case")]
+pub struct BokuRsyncRequest {
+ country: String,
+ merchant_id: Secret<String>,
+ merchant_transaction_id: Secret<String>,
+}
+
+impl TryFrom<&types::RefundSyncRouterData> for BokuRsyncRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::RefundSyncRouterData) -> Result<Self, Self::Error> {
+ let address = item.get_billing_address()?;
+ let country = address.get_country()?.to_string();
+ let auth_type = BokuAuthType::try_from(&item.connector_auth_type)?;
+
+ Ok(Self {
+ country,
+ merchant_id: auth_type.merchant_id,
+ merchant_transaction_id: Secret::new(item.payment_id.to_string()),
+ })
+ }
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename = "query-refund-response")]
+#[serde(rename_all = "kebab-case")]
+pub struct BokuRsyncResponse {
+ refunds: RefundResponseData,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct RefundResponseData {
+ refund: SingleRefundResponseData,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct SingleRefundResponseData {
+ refund_status: String, // quick-xml only parse string as a field
+ refund_id: String,
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::RSync, BokuRsyncResponse>>
for types::RefundsRouterData<api::RSync>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::RSync, RefundResponse>,
+ item: types::RefundsResponseRouterData<api::RSync, BokuRsyncResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.response.refunds.refund.refund_id,
+ refund_status: get_refund_status(item.response.refunds.refund.refund_status),
}),
..item.data
})
@@ -194,3 +433,14 @@ pub struct BokuErrorResponse {
pub message: String,
pub reason: Option<String>,
}
+
+#[derive(Debug, Serialize)]
+pub struct BokuConnMetaData {
+ country: String,
+}
+
+fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
+ item.return_url
+ .clone()
+ .map(|url| BokuHostedData { forward_url: url })
+}
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index 18e0265038a..f020d50f808 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -18,6 +18,7 @@ pub const DEFAULT_FULFILLMENT_TIME: i64 = 15 * 60;
// String literals
pub(crate) const NO_ERROR_MESSAGE: &str = "No error message";
pub(crate) const NO_ERROR_CODE: &str = "No error code";
+pub(crate) const UNSUPPORTED_ERROR_MESSAGE: &str = "Unsupported response type";
pub(crate) const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector";
// General purpose base64 engines
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 44e14c949ce..d7d8897eeb5 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -284,7 +284,7 @@ impl ConnectorData {
enums::Connector::Bambora => Ok(Box::new(&connector::Bambora)),
enums::Connector::Bitpay => Ok(Box::new(&connector::Bitpay)),
enums::Connector::Bluesnap => Ok(Box::new(&connector::Bluesnap)),
- // enums::Connector::Boku => Ok(Box::new(&connector::Boku)), added as template code for future usage
+ enums::Connector::Boku => Ok(Box::new(&connector::Boku)),
enums::Connector::Braintree => Ok(Box::new(&connector::Braintree)),
enums::Connector::Cashtocode => Ok(Box::new(&connector::Cashtocode)),
enums::Connector::Checkout => Ok(Box::new(&connector::Checkout)),
diff --git a/crates/router/tests/connectors/boku.rs b/crates/router/tests/connectors/boku.rs
index 132852f904e..e971ad271e4 100644
--- a/crates/router/tests/connectors/boku.rs
+++ b/crates/router/tests/connectors/boku.rs
@@ -12,7 +12,7 @@ impl utils::Connector for BokuTest {
use router::connector::Boku;
types::api::ConnectorData {
connector: Box::new(&Boku),
- connector_name: types::Connector::DummyConnector1,
+ connector_name: types::Connector::Boku,
get_token: types::api::GetToken::Connector,
}
}
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 0ae7c40d42d..22223275af2 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -167,4 +167,4 @@ api_key="API Key"
[boku]
api_key="API Key"
-key1 = "transaction key"
\ No newline at end of file
+key1 = "MERCHANT ID"
\ No newline at end of file
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index be303878459..4db52f964b3 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -3439,6 +3439,7 @@
"bitpay",
"bambora",
"bluesnap",
+ "boku",
"braintree",
"cashtocode",
"checkout",
|
feat
|
[Boku] Implement Authorize, Psync, Refund and Rsync flow (#1699)
|
c72a592e5e1d5c8ed16ae8fea89a7e3cfd365532
|
2023-07-14 20:28:13
|
chikke srujan
|
feat(connector): [Globepay] Add Refund and Refund Sync flow (#1706)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f265af4d90e..e0e11520ad0 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -947,7 +947,7 @@ pub struct BankDebitBilling {
#[serde(rename_all = "snake_case")]
pub enum WalletData {
/// The wallet data for Ali Pay QrCode
- AliPay(Box<AliPay>),
+ AliPayQr(Box<AliPayQr>),
/// The wallet data for Ali Pay redirect
AliPayRedirect(AliPayRedirection),
/// The wallet data for Ali Pay HK redirect
@@ -977,6 +977,8 @@ pub enum WalletData {
WeChatPayRedirect(Box<WeChatPayRedirection>),
/// The wallet data for WeChat Pay
WeChatPay(Box<WeChatPay>),
+ /// The wallet data for WeChat Pay Display QrCode
+ WeChatPayQr(Box<WeChatPayQr>),
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -1019,11 +1021,14 @@ pub struct WeChatPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPay {}
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct WeChatPayQr {}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaypalRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
-pub struct AliPay {}
+pub struct AliPayQr {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AliPayRedirection {}
diff --git a/crates/router/src/connector/globepay.rs b/crates/router/src/connector/globepay.rs
index 2f6c59eac07..bd3bfdb920a 100644
--- a/crates/router/src/connector/globepay.rs
+++ b/crates/router/src/connector/globepay.rs
@@ -327,22 +327,152 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData>
for Globepay
{
+ fn get_headers(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ 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::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let query_params = get_globlepay_query_params(&req.connector_auth_type)?;
+ Ok(format!(
+ "{}api/v1.0/gateway/partners/{}/orders/{}/refunds/{}{query_params}",
+ self.base_url(connectors),
+ get_partner_code(&req.connector_auth_type)?,
+ req.payment_id,
+ req.request.refund_id
+ ))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
+ let connector_req = globepay::GlobepayRefundRequest::try_from(req)?;
+ let globepay_req = types::RequestBody::log_and_get_request_body(
+ &connector_req,
+ utils::Encode::<globepay::GlobepayRefundRequest>::encode_to_string_of_json,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(globepay_req))
+ }
+
fn build_request(
&self,
- _req: &types::RefundsRouterData<api::Execute>,
- _connectors: &settings::Connectors,
+ req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("Refund".to_string()).into())
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Put)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::RefundExecuteType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundsRouterData<api::Execute>,
+ res: Response,
+ ) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
+ let response: globepay::GlobepayRefundResponse = res
+ .response
+ .parse_struct("Globalpay RefundResponse")
+ .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: Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
}
}
impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Globepay {
+ fn get_headers(
+ &self,
+ req: &types::RefundSyncRouterData,
+ 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::RefundSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let query_params = get_globlepay_query_params(&req.connector_auth_type)?;
+ Ok(format!(
+ "{}api/v1.0/gateway/partners/{}/orders/{}/refunds/{}{query_params}",
+ self.base_url(connectors),
+ get_partner_code(&req.connector_auth_type)?,
+ req.payment_id,
+ req.request.refund_id
+ ))
+ }
+
fn build_request(
&self,
- _req: &types::RefundSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &types::RefundSyncRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("Refund Sync".to_string()).into())
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundSyncRouterData,
+ res: Response,
+ ) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
+ let response: globepay::GlobepayRefundResponse = res
+ .response
+ .parse_struct("Globalpay RefundResponse")
+ .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: Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
}
}
diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rs
index 413a7a2e945..c084607c4d2 100644
--- a/crates/router/src/connector/globepay/transformers.rs
+++ b/crates/router/src/connector/globepay/transformers.rs
@@ -8,6 +8,7 @@ use crate::{
core::errors,
types::{self, api, storage::enums},
};
+type Error = error_stack::Report<errors::ConnectorError>;
#[derive(Debug, Serialize)]
pub struct GlobepayPaymentsRequest {
@@ -24,12 +25,12 @@ pub enum GlobepayChannel {
}
impl TryFrom<&types::PaymentsAuthorizeRouterData> for GlobepayPaymentsRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
let channel: GlobepayChannel = match &item.request.payment_method_data {
api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
- api::WalletData::AliPay(_) => GlobepayChannel::Alipay,
- api::WalletData::WeChatPay(_) => GlobepayChannel::Wechat,
+ api::WalletData::AliPayQr(_) => GlobepayChannel::Alipay,
+ api::WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat,
_ => Err(errors::ConnectorError::NotImplemented(
"Payment method".to_string(),
))?,
@@ -54,7 +55,7 @@ pub struct GlobepayAuthType {
}
impl TryFrom<&types::ConnectorAuthType> for GlobepayAuthType {
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
@@ -110,13 +111,14 @@ pub enum GlobepayReturnCode {
NotPermitted,
InvalidChannel,
DuplicateOrderId,
+ OrderNotPaid,
}
impl<F, T>
TryFrom<types::ResponseRouterData<F, GlobepayPaymentsResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
{
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(
item: types::ResponseRouterData<
F,
@@ -206,7 +208,7 @@ impl<F, T>
TryFrom<types::ResponseRouterData<F, GlobepaySyncResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
{
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(
item: types::ResponseRouterData<F, GlobepaySyncResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
@@ -260,74 +262,81 @@ fn get_error_response(
#[derive(Debug, Serialize)]
pub struct GlobepayRefundRequest {
- pub amount: i64,
+ pub fee: i64,
}
impl<F> TryFrom<&types::RefundsRouterData<F>> for GlobepayRefundRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
- amount: item.request.refund_amount,
+ fee: item.request.refund_amount,
})
}
}
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
+#[derive(Debug, Deserialize)]
+pub enum GlobepayRefundStatus {
+ Waiting,
+ CreateFailed,
Failed,
- #[default]
- Processing,
+ Success,
+ Finished,
+ Change,
}
-impl From<RefundStatus> for enums::RefundStatus {
- fn from(item: RefundStatus) -> Self {
+impl From<GlobepayRefundStatus> for enums::RefundStatus {
+ fn from(item: GlobepayRefundStatus) -> Self {
match item {
- RefundStatus::Succeeded => Self::Success,
- RefundStatus::Failed => Self::Failure,
- RefundStatus::Processing => Self::Pending,
+ GlobepayRefundStatus::Finished => Self::Success, //FINISHED: Refund success(funds has already been returned to user's account)
+ GlobepayRefundStatus::Failed
+ | GlobepayRefundStatus::CreateFailed
+ | GlobepayRefundStatus::Change => Self::Failure, //CHANGE: Refund can not return to user's account. Manual operation is required
+ GlobepayRefundStatus::Waiting | GlobepayRefundStatus::Success => Self::Pending, // SUCCESS: Submission succeeded, but refund is not yet complete. Waiting = Submission succeeded, but refund is not yet complete.
}
}
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
- id: String,
- status: RefundStatus,
-}
-
-impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
- for types::RefundsRouterData<api::Execute>
-{
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(
- item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
- ) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
- }),
- ..item.data
- })
- }
+#[derive(Debug, Deserialize)]
+pub struct GlobepayRefundResponse {
+ pub result_code: Option<GlobepayRefundStatus>,
+ pub refund_id: Option<String>,
+ pub return_code: GlobepayReturnCode,
+ pub return_msg: Option<String>,
}
-impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
- for types::RefundsRouterData<api::RSync>
+impl<T> TryFrom<types::RefundsResponseRouterData<T, GlobepayRefundResponse>>
+ for types::RefundsRouterData<T>
{
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(
- item: types::RefundsResponseRouterData<api::RSync, RefundResponse>,
+ item: types::RefundsResponseRouterData<T, GlobepayRefundResponse>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
- }),
- ..item.data
- })
+ if item.response.return_code == GlobepayReturnCode::Success {
+ let globepay_refund_id = item
+ .response
+ .refund_id
+ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+ let globepay_refund_status = item
+ .response
+ .result_code
+ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: globepay_refund_id,
+ refund_status: enums::RefundStatus::from(globepay_refund_status),
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ response: Err(get_error_response(
+ item.response.return_code,
+ item.response.return_msg,
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 204f6f44290..5e1e565b504 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -167,12 +167,13 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::disputes::DisputeResponsePaymentsRetrieve,
api_models::payments::AddressDetails,
api_models::payments::BankDebitData,
- api_models::payments::AliPay,
+ api_models::payments::AliPayQr,
api_models::payments::AliPayRedirection,
api_models::payments::AliPayHkRedirection,
api_models::payments::MbWayRedirection,
api_models::payments::MobilePayRedirection,
api_models::payments::WeChatPayRedirection,
+ api_models::payments::WeChatPayQr,
api_models::payments::BankDebitBilling,
api_models::payments::CryptoData,
api_models::payments::RewardData,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index c6d34ef6dd9..f1c8266d123 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -1739,10 +1739,10 @@
}
}
},
- "AliPay": {
+ "AliPayHkRedirection": {
"type": "object"
},
- "AliPayHkRedirection": {
+ "AliPayQr": {
"type": "object"
},
"AliPayRedirection": {
@@ -8761,11 +8761,11 @@
{
"type": "object",
"required": [
- "ali_pay"
+ "ali_pay_qr"
],
"properties": {
- "ali_pay": {
- "$ref": "#/components/schemas/AliPay"
+ "ali_pay_qr": {
+ "$ref": "#/components/schemas/AliPayQr"
}
}
},
@@ -8933,12 +8933,26 @@
"$ref": "#/components/schemas/WeChatPay"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "we_chat_pay_qr"
+ ],
+ "properties": {
+ "we_chat_pay_qr": {
+ "$ref": "#/components/schemas/WeChatPayQr"
+ }
+ }
}
]
},
"WeChatPay": {
"type": "object"
},
+ "WeChatPayQr": {
+ "type": "object"
+ },
"WeChatPayRedirection": {
"type": "object"
},
|
feat
|
[Globepay] Add Refund and Refund Sync flow (#1706)
|
f14f87a1061e4e2862d3084d62f026c2bc58d781
|
2023-03-30 15:13:34
|
ItsMeShashank
|
deps(api_models): put the errors module behind a feature flag (#815)
| false
|
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index 9d372fa0667..62ad3871839 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -4,14 +4,19 @@ version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[features]
+errors = [
+ "dep:actix-web",
+ "dep:reqwest",
+]
[dependencies]
-actix-web = "4.3.1"
+actix-web = { version = "4.3.1", optional = true }
error-stack = "0.3.1"
frunk = "0.4.1"
frunk_core = "0.4.1"
mime = "0.3.16"
-reqwest = "0.11.14"
+reqwest = { version = "0.11.14", optional = true }
serde = { version = "1.0.155", features = ["derive"] }
serde_json = "1.0.94"
strum = { version = "0.24.1", features = ["derive"] }
diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index a08b6fd6207..86e0971390a 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -6,6 +6,7 @@ pub mod cards_info;
pub mod customers;
pub mod disputes;
pub mod enums;
+#[cfg(feature = "errors")]
pub mod errors;
pub mod files;
pub mod mandates;
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index 43b69fc413b..0cdf3bb6bc8 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -50,14 +50,6 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
}
}
-pub struct IncomingWebhookRequestDetails<'a> {
- pub method: actix_web::http::Method,
- pub headers: &'a actix_web::http::header::HeaderMap,
- pub body: &'a [u8],
- pub query_params: String,
- pub query_params_json: &'a [u8],
-}
-
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
pub enum RefundIdType {
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 19a149a06d3..fc9508d28f8 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -79,7 +79,7 @@ utoipa-swagger-ui = { version = "3.1.0", features = ["actix-web"] }
uuid = { version = "1.3.0", features = ["serde", "v4"] }
# First party crates
-api_models = { version = "0.1.0", path = "../api_models" }
+api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
common_utils = { version = "0.1.0", path = "../common_utils" }
external_services = { version = "0.1.0", path = "../external_services" }
masking = { version = "0.1.0", path = "../masking" }
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 813708b3fe6..6740c1d3b15 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -783,7 +783,7 @@ impl api::IncomingWebhook for Adyen {
fn get_dispute_details(
&self,
- request: &api_models::webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index 9df8fb33903..204881dd712 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -722,7 +722,7 @@ impl api::IncomingWebhook for Trustpay {
fn get_dispute_details(
&self,
- request: &api_models::webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> {
let trustpay_response: trustpay::TrustpayWebhookResponse = request
.body
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 5c8b1717d4e..60b5887eccc 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -301,7 +301,7 @@ async fn disputes_incoming_webhook_flow<W: api::OutgoingWebhookType>(
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
connector: &(dyn api::Connector + Sync),
- request_details: &api_models::webhooks::IncomingWebhookRequestDetails<'_>,
+ request_details: &api::IncomingWebhookRequestDetails<'_>,
event_type: api_models::webhooks::IncomingWebhookEvent,
) -> CustomResult<(), errors::WebhooksFlowError> {
metrics::INCOMING_DISPUTE_WEBHOOK_METRIC.add(&metrics::CONTEXT, 1, &[]);
@@ -497,7 +497,7 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("There was an error in parsing the query params")?;
- let mut request_details = api_models::webhooks::IncomingWebhookRequestDetails {
+ let mut request_details = api::IncomingWebhookRequestDetails {
method: req.method().clone(),
headers: req.headers(),
query_params: req.query_string().to_string(),
diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs
index 0647ee0e923..9374d77de5e 100644
--- a/crates/router/src/types/api/webhooks.rs
+++ b/crates/router/src/types/api/webhooks.rs
@@ -1,7 +1,6 @@
pub use api_models::webhooks::{
- IncomingWebhookDetails, IncomingWebhookEvent, IncomingWebhookRequestDetails,
- MerchantWebhookConfig, ObjectReferenceId, OutgoingWebhook, OutgoingWebhookContent,
- OutgoingWebhookType, WebhookFlow,
+ IncomingWebhookDetails, IncomingWebhookEvent, MerchantWebhookConfig, ObjectReferenceId,
+ OutgoingWebhook, OutgoingWebhookContent, OutgoingWebhookType, WebhookFlow,
};
use error_stack::ResultExt;
@@ -13,6 +12,14 @@ use crate::{
utils::crypto,
};
+pub struct IncomingWebhookRequestDetails<'a> {
+ pub method: actix_web::http::Method,
+ 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]
pub trait IncomingWebhook: ConnectorCommon + Sync {
fn get_webhook_body_decoding_algorithm(
|
deps
|
put the errors module behind a feature flag (#815)
|
e6d43a001a083ae4a388bde916abf7ad5eb98d22
|
2024-08-30 12:46:44
|
likhinbopanna
|
ci(cypress): Handle failures for trustpay bank-redirects (#5734)
| false
|
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js
index 4d2b607a6c0..c209fe5a6dc 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js
@@ -321,7 +321,10 @@ export const connectorDetails = {
Response: {
status: 200,
body: {
- status: "requires_customer_action",
+ status: "failed",
+ error_code: "1133001",
+ error_message:
+ "Giropay payments are not enabled in Project 4107608031",
},
},
},
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index fdbd8e51970..6540632c893 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -247,10 +247,9 @@ function bankRedirectRedirection(
break;
case "ideal":
cy.contains("button", "Select your bank").click();
- cy.get('[data-testid="ideal-box-bank-item-INGBNL2A-content"]')
- .should("be.visible")
- .click();
-
+ cy.get(
+ 'button[data-testid="bank-item"][id="bank-item-INGBNL2A"]'
+ ).click();
break;
case "giropay":
cy.get("._transactionId__header__iXVd_").should(
|
ci
|
Handle failures for trustpay bank-redirects (#5734)
|
1ac3eb0a36030412ef51ec2664e8af43c9c2fc54
|
2023-05-23 18:15:07
|
SamraatBansal
|
fix: populate meta_data in payment_intent (#1240)
| false
|
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index edaa922df53..1d0ad7a37b6 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -3,6 +3,7 @@ use std::marker::PhantomData;
use async_trait::async_trait;
use common_utils::ext_traits::{AsyncExt, Encode, ValueExt};
use error_stack::{self, ResultExt};
+use masking::Secret;
use router_derive::PaymentOperation;
use router_env::{instrument, tracing};
use storage_models::ephemeral_key;
@@ -544,6 +545,7 @@ impl PaymentCreate {
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Encoding Metadata to value failed")?;
+ let meta_data = metadata.clone().map(Secret::new);
let (business_country, business_label) = helpers::get_business_details(
request.business_country,
@@ -573,6 +575,7 @@ impl PaymentCreate {
business_country,
business_label,
active_attempt_id,
+ meta_data,
..storage::PaymentIntentNew::default()
})
}
|
fix
|
populate meta_data in payment_intent (#1240)
|
d1c9305ebb12216650b78f719755a6ebe96198d4
|
2023-02-26 22:35:06
|
Arun Raj M
|
chore: adding build only sandbox feature to reduce build time (#664)
| false
|
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index ffca6ea0246..74ec896cf99 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -105,7 +105,7 @@ jobs:
- name: Test compilation
shell: bash
- run: cargo hack check --workspace --each-feature --no-dev-deps
+ run: cargo hack check --features="sandbox" --ignore-unknown-features
# cargo-deny:
# name: Run cargo-deny
@@ -183,7 +183,7 @@ jobs:
- name: Test compilation
shell: bash
- run: cargo hack check --workspace --each-feature --no-dev-deps
+ run: cargo hack check --features="sandbox" --ignore-unknown-features
# - name: Run tests
# shell: bash
|
chore
|
adding build only sandbox feature to reduce build time (#664)
|
d2212cb7eafa37c00ce3a8897a6ae4f1266f01cf
|
2025-01-07 22:37:46
|
Chethan Rao
|
fix: consider status of payment method before filtering wallets in list pm (#7004)
| false
|
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 164c0e9557a..deae78b5540 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3470,12 +3470,14 @@ pub async fn list_payment_methods(
.any(|mca| mca.payment_method == enums::PaymentMethod::Wallet);
if wallet_pm_exists {
match db
- .find_payment_method_by_customer_id_merchant_id_list(
+ .find_payment_method_by_customer_id_merchant_id_status(
&((&state).into()),
&key_store,
- &customer.customer_id,
- merchant_account.get_id(),
+ &customer.customer_id,
+ merchant_account.get_id(),
+ common_enums::PaymentMethodStatus::Active,
None,
+ merchant_account.storage_scheme,
)
.await
{
|
fix
|
consider status of payment method before filtering wallets in list pm (#7004)
|
9bee5ab3f10d7d7c832c2ba5c4990bd85af32928
|
2024-03-07 14:03:46
|
github-actions
|
chore(version): 2024.03.07.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35eacaecbdc..9854b0f67b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,24 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.03.07.1
+
+### Features
+
+- **users:** Add new API get the user and role details of specific user ([#3988](https://github.com/juspay/hyperswitch/pull/3988)) ([`ba42fba`](https://github.com/juspay/hyperswitch/commit/ba42fbaed0adb2a3e4d9f2d07a4f0d99ba227241))
+
+### Bug Fixes
+
+- **users:** Revert using mget in authorization ([#3999](https://github.com/juspay/hyperswitch/pull/3999)) ([`7375b86`](https://github.com/juspay/hyperswitch/commit/7375b866a2a2767df2f213bc9eb61268392fb60d))
+
+### Refactors
+
+- **router:** Store `ApplepayPaymentMethod` in `payment_method_data` column of `payment_attempt` table ([#3940](https://github.com/juspay/hyperswitch/pull/3940)) ([`6671bff`](https://github.com/juspay/hyperswitch/commit/6671bff3b11e9548a0085046d2594cad9f2571e2))
+
+**Full Changelog:** [`2024.03.07.0...2024.03.07.1`](https://github.com/juspay/hyperswitch/compare/2024.03.07.0...2024.03.07.1)
+
+- - -
+
## 2024.03.07.0
### Features
|
chore
|
2024.03.07.1
|
fe62b1fe2137de456a6a0e8e315fd0592c29577d
|
2024-10-14 18:44:36
|
Mrudul Vajpayee
|
refactor: add user agent header in outgoing webhooks (#6289)
| false
|
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index aa2aae928c8..fbf69278357 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -13,6 +13,7 @@ use common_utils::{
use diesel_models::process_tracker::business_status;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
+use hyperswitch_interfaces::consts;
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
use router_env::{
instrument,
@@ -606,10 +607,16 @@ pub(crate) fn get_outgoing_webhook_request(
outgoing_webhook: api::OutgoingWebhook,
business_profile: &domain::Profile,
) -> CustomResult<OutgoingWebhookRequestContent, errors::WebhooksFlowError> {
- let mut headers = vec![(
- reqwest::header::CONTENT_TYPE.to_string(),
- mime::APPLICATION_JSON.essence_str().into(),
- )];
+ let mut headers = vec![
+ (
+ reqwest::header::CONTENT_TYPE.to_string(),
+ mime::APPLICATION_JSON.essence_str().into(),
+ ),
+ (
+ reqwest::header::USER_AGENT.to_string(),
+ consts::USER_AGENT.to_string().into(),
+ ),
+ ];
let transformed_outgoing_webhook = WebhookType::from(outgoing_webhook);
let payment_response_hash_key = business_profile.payment_response_hash_key.clone();
|
refactor
|
add user agent header in outgoing webhooks (#6289)
|
0bda934aca6bc53b21ab3c2be2af27219ef4f68a
|
2024-10-18 19:39:32
|
GORAKHNATH YADAV
|
docs: upload new logos (#6368)
| false
|
diff --git a/README.md b/README.md
index e8dd2f31674..ccdd6e19b6d 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,6 @@ Here are the components of Hyperswitch that deliver the whole solution:
Jump in and contribute to these repositories to help improve and expand Hyperswitch!
<br>
-<img src="./docs/imgs/hyperswitch-product.png" alt="Hyperswitch-Product" width="50%"/>
<a href="#Quick Setup">
<h2 id="quick-setup">⚡️ Quick Setup</h2>
diff --git a/docs/imgs/hyperswitch-logo-dark.svg b/docs/imgs/hyperswitch-logo-dark.svg
index fbf0d89d410..7bc3c7a6f70 100644
--- a/docs/imgs/hyperswitch-logo-dark.svg
+++ b/docs/imgs/hyperswitch-logo-dark.svg
@@ -1,29 +1,36 @@
-<svg width="766" height="100" viewBox="0 0 766 100" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_1969_1952)">
-<path d="M370.801 53.4399C370.801 70.0799 360.581 79.9999 346.441 79.9999C338.621 79.9999 331.811 76.7899 328.701 71.4799V99.0399H317.771V27.6899H327.791L328.691 35.5099C331.801 30.1999 338.411 26.6899 346.431 26.6899C360.061 26.6899 370.791 36.2099 370.791 53.4499L370.801 53.4399ZM359.471 53.4399C359.471 42.9199 353.261 36.3999 344.231 36.3999C335.611 36.2999 329.001 42.9099 329.001 53.5399C329.001 64.1699 335.621 70.2799 344.231 70.2799C352.841 70.2799 359.471 63.9699 359.471 53.4399Z" fill="white"/>
-<path d="M428.931 56.3498H389.641C389.841 65.9698 396.151 70.9798 404.171 70.9798C410.181 70.9798 415.201 68.1698 417.301 62.5598H428.431C425.721 72.9798 416.501 79.9998 403.971 79.9998C388.631 79.9998 378.511 69.3798 378.511 53.2398C378.511 37.0998 388.631 26.5798 403.871 26.5798C419.111 26.5798 428.931 36.7998 428.931 52.2398V56.3498ZM389.741 48.7298H417.801C417.201 39.8098 411.291 35.2998 403.871 35.2998C396.451 35.2998 390.541 39.8098 389.741 48.7298Z" fill="white"/>
-<path d="M448.281 27.6899C443.181 27.6899 439.051 31.8199 439.051 36.9199V79.0099H450.081V51.6499V39.8199C450.081 38.5499 451.111 37.5099 452.391 37.5099H469.231V27.6899H448.291H448.281Z" fill="white"/>
-<path d="M300.14 27.5898L286.01 70.1898L270.77 27.6898H258.94L278.48 78.3098C279.08 79.9098 279.38 81.2198 279.38 82.5198C279.38 83.2298 279.31 83.8798 279.19 84.4798L279.16 84.5898C279.09 84.9098 279.01 85.2098 278.91 85.4998L278.17 88.2098C277.99 88.8798 277.38 89.3398 276.69 89.3398H261.14V99.0598H272.47C280.09 99.0598 286.4 97.2598 290.01 87.2298L311.56 27.6898L300.13 27.5898H300.14Z" fill="white"/>
-<path d="M206.82 78.9999H217.74V51.3399C217.74 42.7199 222.45 36.7099 231.17 36.7099C238.79 36.6099 243.5 41.1199 243.5 51.0399V78.9999H254.43V49.3299C254.43 31.7899 243.71 26.5799 233.98 26.5799C226.56 26.5799 220.75 29.4899 217.74 34.2999V6.63989H206.82V78.9999Z" fill="white"/>
-<path d="M483.66 63.4699C483.76 68.7799 488.67 71.8899 495.39 71.8899C502.11 71.8899 506.11 69.3799 506.11 64.8699C506.11 60.9599 504.11 58.8599 498.29 57.9499L487.97 56.1499C477.95 54.4499 474.04 49.2299 474.04 41.9199C474.04 32.6999 483.16 26.6899 494.79 26.6899C507.32 26.6899 516.44 32.6999 516.54 42.9299H505.72C505.62 37.7199 501.11 34.8099 494.8 34.8099C488.49 34.8099 484.98 37.3199 484.98 41.5299C484.98 45.2399 487.59 46.9399 493.3 47.9399L503.42 49.7399C512.94 51.4399 517.35 56.1499 517.35 63.8699C517.35 74.4899 507.53 80.0099 495.6 80.0099C482.07 80.0099 472.95 73.4999 472.75 63.4699H483.68H483.66Z" fill="white"/>
-<path d="M542.19 66.9799L553.82 27.6899H565.25L576.68 66.9799L586.4 27.6899H597.93L583.4 79.0099H571.07L559.44 39.9199L547.71 79.0099H535.28L520.65 27.6899H532.18L542.2 66.9799H542.19Z" fill="white"/>
-<path d="M604.34 6.63989H616.47V18.0699H604.34V6.63989ZM604.94 27.6899H615.86V79.0099H604.94V27.6899Z" fill="white"/>
-<path d="M685.32 36.1099C676.8 36.1099 670.99 42.3199 670.99 53.2499C670.99 64.7799 677 70.3899 685.02 70.3899C691.43 70.3899 696.15 66.7799 698.25 59.9699H709.88C707.27 72.3999 697.85 80.0199 685.22 80.0199C669.99 80.0199 659.76 69.3998 659.76 53.2599C659.76 37.1199 669.98 26.5999 685.32 26.5999C697.85 26.5999 707.17 33.7199 709.88 46.1399H698.05C696.25 39.7299 691.33 36.1199 685.32 36.1199V36.1099Z" fill="white"/>
-<path d="M642.87 69.2799C642.23 69.2799 641.72 68.7599 641.72 68.1299V37.41H653.65V27.69H641.72V13.95H630.8V22.87C630.8 26.08 629.8 27.68 626.59 27.68H622.18V37.4H630.8V65.0599C630.8 73.9799 635.71 78.99 644.63 78.99H653.55V69.2699H642.88L642.87 69.2799Z" fill="white"/>
-<path d="M745.22 26.5799C737.8 26.5799 731.99 29.4899 728.98 34.2999V6.63989H718.06V78.9999H728.98V51.3399C728.98 42.7199 733.69 36.7099 742.41 36.7099C750.03 36.6099 754.74 41.1199 754.74 51.0399V78.9999H765.67V49.3299C765.67 31.7899 754.95 26.5799 745.22 26.5799Z" fill="white"/>
-<g clip-path="url(#clip1_1969_1952)">
-<path d="M135.792 0H42.875C19.1958 0 0 19.1958 0 42.875C0 66.5542 19.1958 85.75 42.875 85.75H135.792C159.471 85.75 178.667 66.5542 178.667 42.875C178.667 19.1958 159.471 0 135.792 0Z" fill="#006DF9"/>
-<path d="M140.261 56.4367C147.751 56.4367 153.822 50.3649 153.822 42.8751C153.822 35.3852 147.751 29.3135 140.261 29.3135C132.771 29.3135 126.699 35.3852 126.699 42.8751C126.699 50.3649 132.771 56.4367 140.261 56.4367Z" fill="white"/>
-<path d="M53.2718 53.4511L39.0877 31.4253C38.7683 30.9299 38.0448 30.9299 37.7254 31.4253L23.5413 53.4511C23.1925 53.9888 23.5804 54.6993 24.2224 54.6993H52.5907C53.2327 54.6993 53.6206 53.9888 53.2718 53.4511Z" fill="white"/>
-<path d="M100.55 30.353H78.1172C77.3972 30.353 76.8135 30.9367 76.8135 31.6567V54.0899C76.8135 54.8099 77.3972 55.3936 78.1172 55.3936H100.55C101.27 55.3936 101.854 54.8099 101.854 54.0899V31.6567C101.854 30.9367 101.27 30.353 100.55 30.353Z" fill="white"/>
-</g>
+<svg width="540" height="103" viewBox="0 0 540 103" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_1484_2488)">
+<path d="M413.393 100.636C412.67 100.656 411.967 100.596 411.245 100.495C409.297 100.213 407.469 99.5893 405.783 98.5625C402.048 96.3077 399.658 93.026 398.674 88.7176C398.453 87.7512 398.353 86.7647 398.353 85.7782C398.333 81.8321 399.618 78.3693 402.228 75.4299C404.497 72.8931 407.309 71.3429 410.622 70.6986C411.546 70.5175 412.469 70.4168 413.393 70.4571V74.9668C413.353 74.9869 413.313 75.0071 413.273 75.0473C412.731 75.4299 412.188 75.8325 411.666 76.2553C410.481 77.2217 409.357 78.2485 408.413 79.4766C407.148 81.1073 406.305 82.8992 406.184 85.0131C406.124 86.0198 406.244 87.0063 406.566 87.9525C407.349 90.3081 409.779 92.7441 413.192 92.8045C413.393 92.8045 413.433 92.8448 413.433 93.0663C413.413 94.093 413.413 96.1466 413.413 96.1466V96.3278C413.393 97.7572 413.393 99.1867 413.393 100.636Z" fill="#0099FF"/>
+<path d="M413.394 74.9464V70.4367C414.217 70.4165 415.021 70.4971 415.824 70.6179C417.33 70.8595 418.776 71.3024 420.141 72.007C422.972 73.4767 425.201 75.5706 426.707 78.4294C427.571 80.0803 428.133 81.8319 428.354 83.664C428.615 85.8182 428.414 87.9523 427.772 90.026C427.029 92.3815 425.784 94.4552 424.037 96.2067C421.908 98.3207 419.378 99.6897 416.446 100.314C415.442 100.515 414.418 100.636 413.394 100.616V96.2873V96.1262C413.394 96.1262 413.454 96.086 413.474 96.0658C415.041 94.9585 416.527 93.7505 417.812 92.301C418.655 91.3547 419.378 90.3481 419.88 89.1804C420.583 87.5295 420.864 85.8383 420.503 84.0465C419.86 80.785 416.948 78.3489 413.595 78.2684C413.374 78.2684 413.394 78.0872 413.394 78.0872V74.9464Z" fill="#0561E2"/>
+<path d="M445.225 74.6642V90.1262C445.225 90.9718 445.084 91.7771 444.823 92.5623C444.562 93.3475 444.14 94.032 443.618 94.636C443.076 95.24 442.413 95.703 441.61 96.0654C440.807 96.4077 439.863 96.5889 438.819 96.5889C437.132 96.5889 435.747 96.1862 434.682 95.401C433.598 94.6159 432.895 93.3676 432.554 91.6563L436.108 90.8108C436.228 91.5154 436.51 92.0791 436.971 92.5019C437.413 92.9247 437.975 93.126 438.638 93.126C439.722 93.126 440.465 92.7636 440.847 92.0187C441.229 91.2939 441.429 90.2672 441.429 88.9787V74.6642H445.225ZM452.775 74.6642V88.0727C452.775 88.5961 452.855 89.1397 453.016 89.7236C453.177 90.2873 453.438 90.8309 453.819 91.3141C454.181 91.7973 454.683 92.1999 455.305 92.5019C455.907 92.824 456.671 92.965 457.574 92.965C458.478 92.965 459.241 92.8039 459.843 92.5019C460.446 92.1999 460.948 91.7973 461.329 91.3141C461.691 90.8309 461.972 90.3074 462.132 89.7236C462.293 89.1397 462.373 88.5961 462.373 88.0727V74.6642H466.169V88.1935H466.149C466.149 89.482 465.928 90.6497 465.486 91.6765C465.044 92.7234 464.442 93.5891 463.679 94.3139C462.916 95.0387 462.012 95.6024 460.968 95.9849C459.924 96.3876 458.779 96.5688 457.554 96.5688C456.329 96.5688 455.185 96.3674 454.16 95.9849C453.116 95.6024 452.213 95.0387 451.43 94.3139C450.646 93.5891 450.044 92.7032 449.622 91.6765C449.18 90.6497 448.98 89.482 448.98 88.1935V74.6642H452.775ZM477.213 74.1206C478.338 74.1206 479.422 74.3018 480.486 74.6239C481.53 74.9662 482.494 75.5299 483.338 76.3151L480.526 79.2545C480.125 78.6706 479.583 78.2478 478.92 77.966C478.237 77.6841 477.534 77.5633 476.791 77.5633C476.35 77.5633 475.928 77.6237 475.506 77.7244C475.084 77.8251 474.723 77.9861 474.402 78.2076C474.06 78.429 473.799 78.7109 473.599 79.0733C473.398 79.4357 473.297 79.8383 473.297 80.3215C473.297 81.0463 473.538 81.61 474.06 81.9724C474.562 82.3549 475.185 82.6972 475.928 82.9589C476.671 83.2408 477.474 83.5227 478.358 83.7844C479.241 84.0461 480.044 84.4085 480.807 84.8716C481.55 85.3346 482.173 85.9587 482.675 86.7036C483.177 87.4687 483.438 88.4955 483.438 89.7437C483.438 90.8913 483.237 91.8979 482.816 92.7435C482.394 93.6092 481.832 94.3139 481.109 94.8776C480.386 95.4413 479.562 95.8641 478.619 96.146C477.675 96.4278 476.671 96.5688 475.647 96.5688C474.321 96.5688 473.036 96.3473 471.831 95.9044C470.607 95.4614 469.542 94.7165 468.659 93.6696L471.53 90.8913C471.992 91.5959 472.594 92.1395 473.358 92.5422C474.121 92.9448 474.904 93.126 475.747 93.126C476.189 93.126 476.631 93.0656 477.072 92.9448C477.514 92.824 477.916 92.6428 478.277 92.4012C478.639 92.1597 478.92 91.8577 479.141 91.4751C479.362 91.1127 479.482 90.6698 479.482 90.1866C479.482 89.4015 479.221 88.7975 478.719 88.3747C478.217 87.9519 477.595 87.5895 476.852 87.3076C476.109 87.0258 475.285 86.7439 474.402 86.4822C473.518 86.2205 472.695 85.8581 471.972 85.4151C471.229 84.9722 470.607 84.3682 470.104 83.6032C469.602 82.8381 469.341 81.8315 469.341 80.5631C469.341 79.4558 469.562 78.5096 470.024 77.7043C470.466 76.8989 471.068 76.2346 471.811 75.691C472.534 75.1675 473.378 74.7649 474.321 74.5031C475.265 74.2414 476.229 74.1206 477.213 74.1206ZM522.756 74.6642L527.997 83.1804L533.298 74.6642H537.816L529.804 86.905V96.0654H526.009V86.905L517.997 74.6642H522.756ZM493.78 74.6642C494.804 74.6642 495.788 74.7649 496.751 74.9662C497.695 75.1675 498.539 75.5098 499.262 75.9728C499.984 76.456 500.567 77.0801 500.989 77.8653C501.41 78.6706 501.631 79.6571 501.631 80.845C501.631 82.1939 501.39 83.2811 500.928 84.1065C500.466 84.932 499.844 85.5762 499.061 86.0191C498.278 86.4621 497.374 86.7842 496.33 86.9452C495.286 87.1063 494.221 87.1868 493.097 87.1868H490.386V96.0453H486.591V74.6642H493.78ZM512.194 74.6642L521.39 96.0453H517.053L515.065 91.153H505.828L503.9 96.0453H499.643L508.92 74.6642H512.194ZM510.446 79.1941L507.113 87.8915H513.74L510.446 79.1941ZM493.097 77.9257H490.386V83.9454H492.695C493.237 83.9454 493.8 83.9253 494.382 83.885C494.964 83.8448 495.506 83.724 495.988 83.5227C496.47 83.3213 496.872 83.0193 497.193 82.6167C497.494 82.214 497.655 81.6503 497.655 80.9255C497.655 80.2611 497.515 79.7377 497.233 79.335C496.952 78.9324 496.591 78.6304 496.149 78.429C495.707 78.2076 495.205 78.0868 494.663 78.0264C494.121 77.966 493.599 77.9257 493.097 77.9257Z" fill="white"/>
</g>
+<path d="M377.022 95.8446C376.683 95.8446 376.374 95.8167 376.096 95.7611C375.818 95.7105 375.611 95.6549 375.474 95.5942L376.02 93.7357C376.435 93.847 376.804 93.895 377.128 93.8798C377.451 93.8647 377.737 93.7433 377.985 93.5157C378.238 93.2881 378.46 92.9164 378.652 92.4006L378.933 91.6268L374.67 79.8232H377.097L380.048 88.8656H380.17L383.121 79.8232H385.556L380.754 93.0302C380.531 93.6371 380.248 94.1504 379.904 94.5701C379.56 94.9949 379.151 95.3136 378.675 95.526C378.2 95.7384 377.649 95.8446 377.022 95.8446Z" fill="#A9A9A9"/>
+<path d="M363.436 91.4753V75.9395H365.704V81.7123H365.84C365.972 81.4695 366.161 81.1889 366.409 80.8703C366.657 80.5517 367.001 80.2735 367.441 80.0358C367.881 79.7931 368.462 79.6717 369.186 79.6717C370.126 79.6717 370.966 79.9094 371.704 80.3848C372.442 80.8601 373.022 81.5454 373.441 82.4405C373.866 83.3357 374.078 84.4129 374.078 85.6721C374.078 86.9314 373.869 88.0111 373.449 88.9113C373.029 89.8064 372.453 90.4967 371.719 90.9822C370.986 91.4626 370.149 91.7029 369.208 91.7029C368.5 91.7029 367.921 91.584 367.471 91.3463C367.026 91.1086 366.677 90.8305 366.424 90.5119C366.172 90.1933 365.977 89.9101 365.84 89.6623H365.651V91.4753H363.436ZM365.658 85.6493C365.658 86.4686 365.777 87.1867 366.015 87.8037C366.252 88.4207 366.596 88.9037 367.046 89.2526C367.497 89.5965 368.048 89.7685 368.7 89.7685C369.378 89.7685 369.944 89.5889 370.399 89.2299C370.855 88.8657 371.198 88.3727 371.431 87.7506C371.669 87.1286 371.788 86.4282 371.788 85.6493C371.788 84.8806 371.671 84.1903 371.439 83.5784C371.211 82.9665 370.867 82.4835 370.407 82.1295C369.952 81.7755 369.383 81.5985 368.7 81.5985C368.043 81.5985 367.486 81.7679 367.031 82.1068C366.581 82.4456 366.24 82.9184 366.007 83.5253C365.775 84.1322 365.658 84.8402 365.658 85.6493Z" fill="#A9A9A9"/>
+<path d="M349.871 91.7029C348.93 91.7029 348.091 91.4626 347.353 90.9822C346.619 90.4967 346.043 89.8064 345.623 88.9113C345.208 88.0111 345.001 86.9314 345.001 85.6721C345.001 84.4129 345.211 83.3357 345.631 82.4405C346.055 81.5454 346.637 80.8601 347.375 80.3848C348.114 79.9094 348.951 79.6717 349.886 79.6717C350.609 79.6717 351.191 79.7931 351.631 80.0358C352.076 80.2735 352.42 80.5517 352.663 80.8703C352.91 81.1889 353.103 81.4695 353.239 81.7123H353.376V75.9395H355.644V91.4753H353.429V89.6623H353.239C353.103 89.9101 352.905 90.1933 352.648 90.5119C352.395 90.8305 352.046 91.1086 351.601 91.3463C351.156 91.584 350.579 91.7029 349.871 91.7029ZM350.372 89.7685C351.024 89.7685 351.575 89.5965 352.025 89.2526C352.481 88.9037 352.825 88.4207 353.057 87.8037C353.295 87.1867 353.414 86.4686 353.414 85.6493C353.414 84.8402 353.297 84.1322 353.065 83.5253C352.832 82.9184 352.491 82.4456 352.041 82.1068C351.591 81.7679 351.034 81.5985 350.372 81.5985C349.689 81.5985 349.12 81.7755 348.665 82.1295C348.21 82.4835 347.866 82.9665 347.633 83.5784C347.406 84.1903 347.292 84.8806 347.292 85.6493C347.292 86.4282 347.408 87.1286 347.641 87.7506C347.873 88.3727 348.217 88.8657 348.673 89.2299C349.133 89.5889 349.699 89.7685 350.372 89.7685Z" fill="#A9A9A9"/>
+<path d="M338.634 91.7106C337.486 91.7106 336.497 91.4653 335.668 90.9748C334.844 90.4792 334.207 89.7838 333.756 88.8887C333.311 87.9885 333.089 86.9341 333.089 85.7254C333.089 84.5319 333.311 83.48 333.756 82.5697C334.207 81.6594 334.834 80.9488 335.638 80.438C336.447 79.9273 337.393 79.6719 338.475 79.6719C339.132 79.6719 339.769 79.7806 340.386 79.9981C341.003 80.2155 341.557 80.5569 342.048 81.0222C342.538 81.4874 342.925 82.0918 343.208 82.8352C343.492 83.5735 343.633 84.4712 343.633 85.5282V86.3323H334.371V84.633H341.411C341.411 84.0363 341.289 83.5078 341.046 83.0476C340.804 82.5823 340.462 82.2157 340.022 81.9476C339.587 81.6796 339.077 81.5456 338.49 81.5456C337.853 81.5456 337.296 81.7024 336.821 82.0159C336.351 82.3244 335.987 82.729 335.729 83.2296C335.476 83.7252 335.349 84.2638 335.349 84.8454V86.173C335.349 86.9518 335.486 87.6143 335.759 88.1604C336.037 88.7066 336.424 89.1238 336.92 89.4121C337.415 89.6953 337.994 89.8369 338.657 89.8369C339.087 89.8369 339.479 89.7762 339.833 89.6549C340.187 89.5284 340.493 89.3413 340.751 89.0935C341.009 88.8457 341.206 88.5397 341.342 88.1756L343.489 88.5625C343.317 89.1946 343.009 89.7484 342.564 90.2238C342.124 90.6941 341.57 91.0608 340.902 91.3237C340.24 91.5817 339.484 91.7106 338.634 91.7106Z" fill="#A9A9A9"/>
+<path d="M326.473 91.4753V79.8234H328.665V81.6743H328.786C328.999 81.0473 329.373 80.5542 329.909 80.1951C330.45 79.831 331.062 79.6489 331.745 79.6489C331.886 79.6489 332.053 79.654 332.245 79.6641C332.443 79.6742 332.597 79.6869 332.708 79.702V81.8716C332.617 81.8463 332.455 81.8185 332.223 81.7881C331.99 81.7527 331.757 81.735 331.525 81.735C330.989 81.735 330.511 81.8488 330.091 82.0764C329.676 82.2989 329.348 82.6099 329.105 83.0095C328.862 83.4039 328.741 83.854 328.741 84.3597V91.4753H326.473Z" fill="#A9A9A9"/>
+<path d="M319.598 91.7106C318.45 91.7106 317.461 91.4653 316.632 90.9748C315.808 90.4792 315.17 89.7838 314.72 88.8887C314.275 87.9885 314.053 86.9341 314.053 85.7254C314.053 84.5319 314.275 83.48 314.72 82.5697C315.17 81.6594 315.797 80.9488 316.602 80.438C317.411 79.9273 318.356 79.6719 319.439 79.6719C320.096 79.6719 320.733 79.7806 321.35 79.9981C321.967 80.2155 322.521 80.5569 323.012 81.0222C323.502 81.4874 323.889 82.0918 324.172 82.8352C324.455 83.5735 324.597 84.4712 324.597 85.5282V86.3323H315.335V84.633H322.374C322.374 84.0363 322.253 83.5078 322.01 83.0476C321.768 82.5823 321.426 82.2157 320.986 81.9476C320.551 81.6796 320.041 81.5456 319.454 81.5456C318.817 81.5456 318.26 81.7024 317.785 82.0159C317.315 82.3244 316.951 82.729 316.693 83.2296C316.44 83.7252 316.313 84.2638 316.313 84.8454V86.173C316.313 86.9518 316.45 87.6143 316.723 88.1604C317.001 88.7066 317.388 89.1238 317.884 89.4121C318.379 89.6953 318.958 89.8369 319.621 89.8369C320.051 89.8369 320.443 89.7762 320.797 89.6549C321.151 89.5284 321.457 89.3413 321.714 89.0935C321.972 88.8457 322.17 88.5397 322.306 88.1756L324.453 88.5625C324.281 89.1946 323.973 89.7484 323.527 90.2238C323.087 90.6941 322.534 91.0608 321.866 91.3237C321.204 91.5817 320.448 91.7106 319.598 91.7106Z" fill="#A9A9A9"/>
+<path d="M300.47 91.4751L297.041 79.8232H299.385L301.668 88.3801H301.782L304.073 79.8232H306.417L308.693 88.3422H308.807L311.075 79.8232H313.419L309.998 91.4751H307.684L305.317 83.0624H305.143L302.776 91.4751H300.47Z" fill="#A9A9A9"/>
+<path d="M290.975 91.7106C289.883 91.7106 288.93 91.4603 288.116 90.9596C287.301 90.459 286.669 89.7585 286.219 88.8583C285.769 87.9582 285.544 86.9063 285.544 85.7026C285.544 84.4939 285.769 83.437 286.219 82.5317C286.669 81.6265 287.301 80.9235 288.116 80.4229C288.93 79.9222 289.883 79.6719 290.975 79.6719C292.068 79.6719 293.021 79.9222 293.835 80.4229C294.649 80.9235 295.282 81.6265 295.732 82.5317C296.182 83.437 296.407 84.4939 296.407 85.7026C296.407 86.9063 296.182 87.9582 295.732 88.8583C295.282 89.7585 294.649 90.459 293.835 90.9596C293.021 91.4603 292.068 91.7106 290.975 91.7106ZM290.983 89.8066C291.691 89.8066 292.278 89.6195 292.743 89.2452C293.208 88.871 293.552 88.3728 293.775 87.7508C294.002 87.1288 294.116 86.4435 294.116 85.695C294.116 84.9516 294.002 84.2689 293.775 83.6469C293.552 83.0198 293.208 82.5166 292.743 82.1373C292.278 81.758 291.691 81.5683 290.983 81.5683C290.27 81.5683 289.678 81.758 289.208 82.1373C288.743 82.5166 288.396 83.0198 288.169 83.6469C287.946 84.2689 287.835 84.9516 287.835 85.695C287.835 86.4435 287.946 87.1288 288.169 87.7508C288.396 88.3728 288.743 88.871 289.208 89.2452C289.678 89.6195 290.27 89.8066 290.983 89.8066Z" fill="#A9A9A9"/>
+<path d="M273.524 95.8449V79.8236H275.739V81.7125H275.929C276.061 81.4697 276.25 81.189 276.498 80.8704C276.746 80.5518 277.09 80.2737 277.53 80.036C277.97 79.7932 278.551 79.6719 279.274 79.6719C280.215 79.6719 281.055 79.9096 281.793 80.3849C282.531 80.8603 283.11 81.5456 283.53 82.4407C283.955 83.3358 284.167 84.413 284.167 85.6723C284.167 86.9315 283.957 88.0113 283.538 88.9114C283.118 89.8066 282.541 90.4969 281.808 90.9824C281.075 91.4628 280.238 91.703 279.297 91.703C278.589 91.703 278.01 91.5842 277.56 91.3465C277.115 91.1088 276.766 90.8307 276.513 90.5121C276.26 90.1935 276.066 89.9102 275.929 89.6624H275.793V95.8449H273.524ZM275.747 85.6495C275.747 86.4688 275.866 87.1869 276.104 87.8039C276.341 88.4209 276.685 88.9039 277.135 89.2528C277.585 89.5967 278.137 89.7686 278.789 89.7686C279.467 89.7686 280.033 89.5891 280.488 89.2301C280.943 88.8659 281.287 88.3728 281.52 87.7508C281.758 87.1288 281.876 86.4283 281.876 85.6495C281.876 84.8808 281.76 84.1905 281.527 83.5786C281.3 82.9667 280.956 82.4837 280.496 82.1297C280.041 81.7757 279.472 81.5987 278.789 81.5987C278.132 81.5987 277.575 81.7681 277.12 82.1069C276.67 82.4458 276.329 82.9186 276.096 83.5255C275.863 84.1324 275.747 84.8404 275.747 85.6495Z" fill="#A9A9A9"/>
+<path d="M266.571 32.9729C266.571 44.125 259.583 50.7735 249.914 50.7735C244.567 50.7735 239.911 48.6221 237.784 45.0633V63.5341H230.311V15.7151H237.162L237.777 20.9561C239.904 17.3973 244.424 15.0449 249.907 15.0449C259.227 15.0449 266.564 21.4253 266.564 32.9796L266.571 32.9729ZM258.824 32.9729C258.824 25.9223 254.578 21.5526 248.403 21.5526C242.509 21.4856 237.989 25.9156 237.989 33.0399C237.989 40.1641 242.516 44.2591 248.403 44.2591C254.29 44.2591 258.824 40.0301 258.824 32.9729Z" fill="white"/>
+<path d="M306.324 34.9231H279.459C279.596 41.3705 283.91 44.7282 289.394 44.7282C293.504 44.7282 296.936 42.845 298.372 39.0851H305.982C304.129 46.0686 297.825 50.7735 289.257 50.7735C278.768 50.7735 271.849 43.6559 271.849 32.8388C271.849 22.0217 278.768 14.9712 289.189 14.9712C299.61 14.9712 306.324 21.8207 306.324 32.1686V34.9231V34.9231ZM279.527 29.8162H298.714C298.304 23.838 294.263 20.8154 289.189 20.8154C284.115 20.8154 280.074 23.838 279.527 29.8162Z" fill="white"/>
+<path d="M319.549 15.7188C316.062 15.7188 313.238 18.4867 313.238 21.9047V50.1136H320.78V31.7768V23.8483C320.78 22.9972 321.485 22.3001 322.36 22.3001H333.874V15.7188H319.556H319.549Z" fill="white"/>
+<path d="M218.26 15.6538L208.599 44.2045L198.178 15.7208H190.089L203.45 49.6465C203.86 50.7188 204.065 51.5968 204.065 52.4681C204.065 52.9439 204.017 53.3795 203.935 53.7817L203.915 53.8554C203.867 54.0699 203.812 54.2709 203.744 54.4653L203.238 56.2815C203.115 56.7306 202.698 57.0389 202.226 57.0389H191.593V63.5532H199.34C204.551 63.5532 208.865 62.3469 211.334 55.6247L226.069 15.7208L218.253 15.6538H218.26Z" fill="white"/>
+<path d="M154.45 50.1067H161.917V31.5689C161.917 25.7918 165.138 21.7638 171.1 21.7638C176.31 21.6968 179.531 24.7194 179.531 31.3679V50.1067H187.004V30.2218C187.004 18.4665 179.674 14.9747 173.021 14.9747C167.948 14.9747 163.975 16.925 161.917 20.1487V1.61084H154.45V50.1067V50.1067Z" fill="white"/>
+<path d="M343.752 39.695C343.82 43.2538 347.178 45.3381 351.773 45.3381C356.367 45.3381 359.103 43.6559 359.103 40.6333C359.103 38.0128 357.735 36.6054 353.755 35.9955L346.699 34.7891C339.848 33.6498 337.174 30.1513 337.174 25.2521C337.174 19.0728 343.41 15.0449 351.362 15.0449C359.93 15.0449 366.166 19.0728 366.234 25.929H358.836C358.767 22.4373 355.684 20.487 351.369 20.487C347.055 20.487 344.654 22.1692 344.654 24.9907C344.654 27.4772 346.439 28.6165 350.343 29.2867L357.263 30.4931C363.773 31.6325 366.788 34.7891 366.788 39.9631C366.788 47.0806 360.073 50.7802 351.916 50.7802C342.665 50.7802 336.429 46.4171 336.292 39.695H343.766H343.752Z" fill="white"/>
+<path d="M383.775 42.0505L391.727 15.7183H399.543L407.358 42.0505L414.005 15.7183H421.889L411.953 50.1131H403.523L395.57 23.9148L387.55 50.1131H379.05L369.047 15.7183H376.931L383.782 42.0505H383.775Z" fill="white"/>
+<path d="M426.269 1.60986H434.563V9.27029H426.269V1.60986ZM426.679 15.7176H434.146V50.1125H426.679V15.7176Z" fill="white"/>
+<path d="M481.638 21.3629C475.813 21.3629 471.84 25.5249 471.84 32.8502C471.84 40.5776 475.949 44.3375 481.433 44.3375C485.816 44.3375 489.043 41.918 490.479 37.3539H498.432C496.647 45.6846 490.206 50.7915 481.57 50.7915C471.156 50.7915 464.161 43.674 464.161 32.8569C464.161 22.0398 471.149 14.9893 481.638 14.9893C490.206 14.9893 496.579 19.7611 498.432 28.085H490.343C489.112 23.789 485.748 21.3696 481.638 21.3696V21.3629Z" fill="white"/>
+<path d="M452.618 43.5926C452.18 43.5926 451.832 43.2441 451.832 42.8219V22.2332H459.989V15.7188H451.832V6.51025H444.365V12.4885C444.365 14.6398 443.681 15.7121 441.486 15.7121H438.471V22.2265H444.365V40.7643C444.365 46.7426 447.722 50.1003 453.821 50.1003H459.921V43.5859H452.625L452.618 43.5926Z" fill="white"/>
+<path d="M522.594 14.9747C517.52 14.9747 513.547 16.925 511.489 20.1487V1.61084H504.022V50.1067H511.489V31.5689C511.489 25.7918 514.71 21.7638 520.672 21.7638C525.883 21.6968 529.103 24.7194 529.103 31.3679V50.1067H536.577V30.2218C536.577 18.4665 529.247 14.9747 522.594 14.9747V14.9747Z" fill="white"/>
+<path d="M99.661 0H31.467C14.0882 0 0 14.1622 0 31.6322C0 49.1022 14.0882 63.2644 31.467 63.2644H99.661C117.04 63.2644 131.128 49.1022 131.128 31.6322C131.128 14.1622 117.04 0 99.661 0Z" fill="#0070FF"/>
+<path d="M102.945 41.6438C108.442 41.6438 112.899 37.1642 112.899 31.6383C112.899 26.1124 108.442 21.6328 102.945 21.6328C97.4484 21.6328 92.9922 26.1124 92.9922 31.6383C92.9922 37.1642 97.4484 41.6438 102.945 41.6438Z" fill="white"/>
+<path d="M39.1028 39.4306L28.6927 23.1804C28.4583 22.8149 27.9273 22.8149 27.6928 23.1804L17.2828 39.4306C17.0268 39.8273 17.3115 40.3515 17.7827 40.3515H38.6029C39.0741 40.3515 39.3588 39.8273 39.1028 39.4306V39.4306Z" fill="white"/>
+<path d="M73.802 22.3906H57.3377C56.8092 22.3906 56.3809 22.8213 56.3809 23.3525V39.9032C56.3809 40.4344 56.8092 40.8651 57.3377 40.8651H73.802C74.3304 40.8651 74.7588 40.4344 74.7588 39.9032V23.3525C74.7588 22.8213 74.3304 22.3906 73.802 22.3906Z" fill="white"/>
<defs>
-<clipPath id="clip0_1969_1952">
-<rect width="765.66" height="99.05" fill="white"/>
-</clipPath>
-<clipPath id="clip1_1969_1952">
-<rect width="178.667" height="85.75" fill="white"/>
+<clipPath id="clip0_1484_2488">
+<rect width="140.853" height="33.2142" fill="white" transform="translate(398.348 69.228)"/>
</clipPath>
</defs>
</svg>
diff --git a/docs/imgs/hyperswitch-logo-light.svg b/docs/imgs/hyperswitch-logo-light.svg
index c951a909dd4..5cd74b1f50d 100644
--- a/docs/imgs/hyperswitch-logo-light.svg
+++ b/docs/imgs/hyperswitch-logo-light.svg
@@ -1,29 +1,36 @@
-<svg width="766" height="100" viewBox="0 0 766 100" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_1969_1952)">
-<path d="M370.801 53.4399C370.801 70.0799 360.581 79.9999 346.441 79.9999C338.621 79.9999 331.811 76.7899 328.701 71.4799V99.0399H317.771V27.6899H327.791L328.691 35.5099C331.801 30.1999 338.411 26.6899 346.431 26.6899C360.061 26.6899 370.791 36.2099 370.791 53.4499L370.801 53.4399ZM359.471 53.4399C359.471 42.9199 353.261 36.3999 344.231 36.3999C335.611 36.2999 329.001 42.9099 329.001 53.5399C329.001 64.1699 335.621 70.2799 344.231 70.2799C352.841 70.2799 359.471 63.9699 359.471 53.4399Z" fill="#242628"/>
-<path d="M428.931 56.3498H389.641C389.841 65.9698 396.151 70.9798 404.171 70.9798C410.181 70.9798 415.201 68.1698 417.301 62.5598H428.431C425.721 72.9798 416.501 79.9998 403.971 79.9998C388.631 79.9998 378.511 69.3798 378.511 53.2398C378.511 37.0998 388.631 26.5798 403.871 26.5798C419.111 26.5798 428.931 36.7998 428.931 52.2398V56.3498ZM389.741 48.7298H417.801C417.201 39.8098 411.291 35.2998 403.871 35.2998C396.451 35.2998 390.541 39.8098 389.741 48.7298Z" fill="#242628"/>
-<path d="M448.281 27.6899C443.181 27.6899 439.051 31.8199 439.051 36.9199V79.0099H450.081V51.6499V39.8199C450.081 38.5499 451.111 37.5099 452.391 37.5099H469.231V27.6899H448.291H448.281Z" fill="#242628"/>
-<path d="M300.14 27.5898L286.01 70.1898L270.77 27.6898H258.94L278.48 78.3098C279.08 79.9098 279.38 81.2198 279.38 82.5198C279.38 83.2298 279.31 83.8798 279.19 84.4798L279.16 84.5898C279.09 84.9098 279.01 85.2098 278.91 85.4998L278.17 88.2098C277.99 88.8798 277.38 89.3398 276.69 89.3398H261.14V99.0598H272.47C280.09 99.0598 286.4 97.2598 290.01 87.2298L311.56 27.6898L300.13 27.5898H300.14Z" fill="#242628"/>
-<path d="M206.82 78.9999H217.74V51.3399C217.74 42.7199 222.45 36.7099 231.17 36.7099C238.79 36.6099 243.5 41.1199 243.5 51.0399V78.9999H254.43V49.3299C254.43 31.7899 243.71 26.5799 233.98 26.5799C226.56 26.5799 220.75 29.4899 217.74 34.2999V6.63989H206.82V78.9999Z" fill="#242628"/>
-<path d="M483.66 63.4699C483.76 68.7799 488.67 71.8899 495.39 71.8899C502.11 71.8899 506.11 69.3799 506.11 64.8699C506.11 60.9599 504.11 58.8599 498.29 57.9499L487.97 56.1499C477.95 54.4499 474.04 49.2299 474.04 41.9199C474.04 32.6999 483.16 26.6899 494.79 26.6899C507.32 26.6899 516.44 32.6999 516.54 42.9299H505.72C505.62 37.7199 501.11 34.8099 494.8 34.8099C488.49 34.8099 484.98 37.3199 484.98 41.5299C484.98 45.2399 487.59 46.9399 493.3 47.9399L503.42 49.7399C512.94 51.4399 517.35 56.1499 517.35 63.8699C517.35 74.4899 507.53 80.0099 495.6 80.0099C482.07 80.0099 472.95 73.4999 472.75 63.4699H483.68H483.66Z" fill="#242628"/>
-<path d="M542.19 66.9799L553.82 27.6899H565.25L576.68 66.9799L586.4 27.6899H597.93L583.4 79.0099H571.07L559.44 39.9199L547.71 79.0099H535.28L520.65 27.6899H532.18L542.2 66.9799H542.19Z" fill="#242628"/>
-<path d="M604.34 6.63989H616.47V18.0699H604.34V6.63989ZM604.94 27.6899H615.86V79.0099H604.94V27.6899Z" fill="#242628"/>
-<path d="M685.32 36.1099C676.8 36.1099 670.99 42.3199 670.99 53.2499C670.99 64.7799 677 70.3899 685.02 70.3899C691.43 70.3899 696.15 66.7799 698.25 59.9699H709.88C707.27 72.3999 697.85 80.0199 685.22 80.0199C669.99 80.0199 659.76 69.3998 659.76 53.2599C659.76 37.1199 669.98 26.5999 685.32 26.5999C697.85 26.5999 707.17 33.7199 709.88 46.1399H698.05C696.25 39.7299 691.33 36.1199 685.32 36.1199V36.1099Z" fill="#242628"/>
-<path d="M642.87 69.2799C642.23 69.2799 641.72 68.7599 641.72 68.1299V37.41H653.65V27.69H641.72V13.95H630.8V22.87C630.8 26.08 629.8 27.68 626.59 27.68H622.18V37.4H630.8V65.0599C630.8 73.9799 635.71 78.99 644.63 78.99H653.55V69.2699H642.88L642.87 69.2799Z" fill="#242628"/>
-<path d="M745.22 26.5799C737.8 26.5799 731.99 29.4899 728.98 34.2999V6.63989H718.06V78.9999H728.98V51.3399C728.98 42.7199 733.69 36.7099 742.41 36.7099C750.03 36.6099 754.74 41.1199 754.74 51.0399V78.9999H765.67V49.3299C765.67 31.7899 754.95 26.5799 745.22 26.5799Z" fill="#242628"/>
-<g clip-path="url(#clip1_1969_1952)">
-<path d="M135.792 0H42.875C19.1958 0 0 19.1958 0 42.875C0 66.5542 19.1958 85.75 42.875 85.75H135.792C159.471 85.75 178.667 66.5542 178.667 42.875C178.667 19.1958 159.471 0 135.792 0Z" fill="#006DF9"/>
-<path d="M140.261 56.4367C147.751 56.4367 153.822 50.3649 153.822 42.8751C153.822 35.3852 147.751 29.3135 140.261 29.3135C132.771 29.3135 126.699 35.3852 126.699 42.8751C126.699 50.3649 132.771 56.4367 140.261 56.4367Z" fill="white"/>
-<path d="M53.2718 53.4511L39.0877 31.4253C38.7683 30.9299 38.0448 30.9299 37.7254 31.4253L23.5413 53.4511C23.1925 53.9888 23.5804 54.6993 24.2224 54.6993H52.5907C53.2327 54.6993 53.6206 53.9888 53.2718 53.4511Z" fill="white"/>
-<path d="M100.55 30.353H78.1172C77.3972 30.353 76.8135 30.9367 76.8135 31.6567V54.0899C76.8135 54.8099 77.3972 55.3936 78.1172 55.3936H100.55C101.27 55.3936 101.854 54.8099 101.854 54.0899V31.6567C101.854 30.9367 101.27 30.353 100.55 30.353Z" fill="white"/>
-</g>
+<svg width="540" height="103" viewBox="0 0 540 103" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_1484_2449)">
+<path d="M413.393 100.636C412.67 100.656 411.967 100.596 411.245 100.495C409.297 100.213 407.469 99.5893 405.783 98.5625C402.048 96.3077 399.658 93.026 398.674 88.7176C398.453 87.7512 398.353 86.7647 398.353 85.7782C398.333 81.8321 399.618 78.3693 402.228 75.4299C404.497 72.8931 407.309 71.3429 410.622 70.6986C411.546 70.5175 412.469 70.4168 413.393 70.4571V74.9668C413.353 74.9869 413.313 75.0071 413.273 75.0473C412.731 75.4299 412.188 75.8325 411.666 76.2553C410.481 77.2217 409.357 78.2485 408.413 79.4766C407.148 81.1073 406.305 82.8992 406.184 85.0131C406.124 86.0198 406.244 87.0063 406.566 87.9525C407.349 90.3081 409.779 92.7441 413.192 92.8045C413.393 92.8045 413.433 92.8448 413.433 93.0663C413.413 94.093 413.413 96.1466 413.413 96.1466V96.3278C413.393 97.7572 413.393 99.1867 413.393 100.636Z" fill="#0099FF"/>
+<path d="M413.394 74.9464V70.4367C414.217 70.4165 415.021 70.4971 415.824 70.6179C417.33 70.8595 418.776 71.3024 420.141 72.007C422.972 73.4767 425.201 75.5706 426.707 78.4294C427.571 80.0803 428.133 81.8319 428.354 83.664C428.615 85.8182 428.414 87.9523 427.772 90.026C427.029 92.3815 425.784 94.4552 424.037 96.2067C421.908 98.3207 419.378 99.6897 416.446 100.314C415.442 100.515 414.418 100.636 413.394 100.616V96.2873V96.1262C413.394 96.1262 413.454 96.086 413.474 96.0658C415.041 94.9585 416.527 93.7505 417.812 92.301C418.655 91.3547 419.378 90.3481 419.88 89.1804C420.583 87.5295 420.864 85.8383 420.503 84.0465C419.86 80.785 416.948 78.3489 413.595 78.2684C413.374 78.2684 413.394 78.0872 413.394 78.0872V74.9464Z" fill="#0561E2"/>
+<path d="M445.225 74.6642V90.1262C445.225 90.9718 445.084 91.7771 444.823 92.5623C444.562 93.3475 444.14 94.032 443.618 94.636C443.076 95.24 442.413 95.703 441.61 96.0654C440.807 96.4077 439.863 96.5889 438.819 96.5889C437.132 96.5889 435.747 96.1862 434.682 95.401C433.598 94.6159 432.895 93.3676 432.554 91.6563L436.108 90.8108C436.228 91.5154 436.51 92.0791 436.971 92.5019C437.413 92.9247 437.975 93.126 438.638 93.126C439.722 93.126 440.465 92.7636 440.847 92.0187C441.229 91.2939 441.429 90.2672 441.429 88.9787V74.6642H445.225ZM452.775 74.6642V88.0727C452.775 88.5961 452.855 89.1397 453.016 89.7236C453.177 90.2873 453.438 90.8309 453.819 91.3141C454.181 91.7973 454.683 92.1999 455.305 92.5019C455.907 92.824 456.671 92.965 457.574 92.965C458.478 92.965 459.241 92.8039 459.843 92.5019C460.446 92.1999 460.948 91.7973 461.329 91.3141C461.691 90.8309 461.972 90.3074 462.132 89.7236C462.293 89.1397 462.373 88.5961 462.373 88.0727V74.6642H466.169V88.1935H466.149C466.149 89.482 465.928 90.6497 465.486 91.6765C465.044 92.7234 464.442 93.5891 463.679 94.3139C462.916 95.0387 462.012 95.6024 460.968 95.9849C459.924 96.3876 458.779 96.5688 457.554 96.5688C456.329 96.5688 455.185 96.3674 454.16 95.9849C453.116 95.6024 452.213 95.0387 451.43 94.3139C450.646 93.5891 450.044 92.7032 449.622 91.6765C449.18 90.6497 448.98 89.482 448.98 88.1935V74.6642H452.775ZM477.213 74.1206C478.338 74.1206 479.422 74.3018 480.486 74.6239C481.53 74.9662 482.494 75.5299 483.338 76.3151L480.526 79.2545C480.125 78.6706 479.583 78.2478 478.92 77.966C478.237 77.6841 477.534 77.5633 476.791 77.5633C476.35 77.5633 475.928 77.6237 475.506 77.7244C475.084 77.8251 474.723 77.9861 474.402 78.2076C474.06 78.429 473.799 78.7109 473.599 79.0733C473.398 79.4357 473.297 79.8383 473.297 80.3215C473.297 81.0463 473.538 81.61 474.06 81.9724C474.562 82.3549 475.185 82.6972 475.928 82.9589C476.671 83.2408 477.474 83.5227 478.358 83.7844C479.241 84.0461 480.044 84.4085 480.807 84.8716C481.55 85.3346 482.173 85.9587 482.675 86.7036C483.177 87.4687 483.438 88.4955 483.438 89.7437C483.438 90.8913 483.237 91.8979 482.816 92.7435C482.394 93.6092 481.832 94.3139 481.109 94.8776C480.386 95.4413 479.562 95.8641 478.619 96.146C477.675 96.4278 476.671 96.5688 475.647 96.5688C474.321 96.5688 473.036 96.3473 471.831 95.9044C470.607 95.4614 469.542 94.7165 468.659 93.6696L471.53 90.8913C471.992 91.5959 472.594 92.1395 473.358 92.5422C474.121 92.9448 474.904 93.126 475.747 93.126C476.189 93.126 476.631 93.0656 477.072 92.9448C477.514 92.824 477.916 92.6428 478.277 92.4012C478.639 92.1597 478.92 91.8577 479.141 91.4751C479.362 91.1127 479.482 90.6698 479.482 90.1866C479.482 89.4015 479.221 88.7975 478.719 88.3747C478.217 87.9519 477.595 87.5895 476.852 87.3076C476.109 87.0258 475.285 86.7439 474.402 86.4822C473.518 86.2205 472.695 85.8581 471.972 85.4151C471.229 84.9722 470.607 84.3682 470.104 83.6032C469.602 82.8381 469.341 81.8315 469.341 80.5631C469.341 79.4558 469.562 78.5096 470.024 77.7043C470.466 76.8989 471.068 76.2346 471.811 75.691C472.534 75.1675 473.378 74.7649 474.321 74.5031C475.265 74.2414 476.229 74.1206 477.213 74.1206ZM522.756 74.6642L527.997 83.1804L533.298 74.6642H537.816L529.804 86.905V96.0654H526.009V86.905L517.997 74.6642H522.756ZM493.78 74.6642C494.804 74.6642 495.788 74.7649 496.751 74.9662C497.695 75.1675 498.539 75.5098 499.262 75.9728C499.984 76.456 500.567 77.0801 500.989 77.8653C501.41 78.6706 501.631 79.6571 501.631 80.845C501.631 82.1939 501.39 83.2811 500.928 84.1065C500.466 84.932 499.844 85.5762 499.061 86.0191C498.278 86.4621 497.374 86.7842 496.33 86.9452C495.286 87.1063 494.221 87.1868 493.097 87.1868H490.386V96.0453H486.591V74.6642H493.78ZM512.194 74.6642L521.39 96.0453H517.053L515.065 91.153H505.828L503.9 96.0453H499.643L508.92 74.6642H512.194ZM510.446 79.1941L507.113 87.8915H513.74L510.446 79.1941ZM493.097 77.9257H490.386V83.9454H492.695C493.237 83.9454 493.8 83.9253 494.382 83.885C494.964 83.8448 495.506 83.724 495.988 83.5227C496.47 83.3213 496.872 83.0193 497.193 82.6167C497.494 82.214 497.655 81.6503 497.655 80.9255C497.655 80.2611 497.515 79.7377 497.233 79.335C496.952 78.9324 496.591 78.6304 496.149 78.429C495.707 78.2076 495.205 78.0868 494.663 78.0264C494.121 77.966 493.599 77.9257 493.097 77.9257Z" fill="#444444"/>
</g>
+<path d="M377.022 95.8446C376.683 95.8446 376.374 95.8167 376.096 95.7611C375.818 95.7105 375.611 95.6549 375.474 95.5942L376.02 93.7357C376.435 93.847 376.804 93.895 377.128 93.8798C377.451 93.8647 377.737 93.7433 377.985 93.5157C378.238 93.2881 378.46 92.9164 378.652 92.4006L378.933 91.6268L374.67 79.8232H377.097L380.048 88.8656H380.17L383.121 79.8232H385.556L380.754 93.0302C380.531 93.6371 380.248 94.1504 379.904 94.5701C379.56 94.9949 379.151 95.3136 378.675 95.526C378.2 95.7384 377.649 95.8446 377.022 95.8446Z" fill="#A9A9A9"/>
+<path d="M363.436 91.4753V75.9395H365.704V81.7123H365.84C365.972 81.4695 366.161 81.1889 366.409 80.8703C366.657 80.5517 367.001 80.2735 367.441 80.0358C367.881 79.7931 368.462 79.6717 369.186 79.6717C370.126 79.6717 370.966 79.9094 371.704 80.3848C372.442 80.8601 373.022 81.5454 373.441 82.4405C373.866 83.3357 374.078 84.4129 374.078 85.6721C374.078 86.9314 373.869 88.0111 373.449 88.9113C373.029 89.8064 372.453 90.4967 371.719 90.9822C370.986 91.4626 370.149 91.7029 369.208 91.7029C368.5 91.7029 367.921 91.584 367.471 91.3463C367.026 91.1086 366.677 90.8305 366.424 90.5119C366.172 90.1933 365.977 89.9101 365.84 89.6623H365.651V91.4753H363.436ZM365.658 85.6493C365.658 86.4686 365.777 87.1867 366.015 87.8037C366.252 88.4207 366.596 88.9037 367.046 89.2526C367.497 89.5965 368.048 89.7685 368.7 89.7685C369.378 89.7685 369.944 89.5889 370.399 89.2299C370.855 88.8657 371.198 88.3727 371.431 87.7506C371.669 87.1286 371.788 86.4282 371.788 85.6493C371.788 84.8806 371.671 84.1903 371.439 83.5784C371.211 82.9665 370.867 82.4835 370.407 82.1295C369.952 81.7755 369.383 81.5985 368.7 81.5985C368.043 81.5985 367.486 81.7679 367.031 82.1068C366.581 82.4456 366.24 82.9184 366.007 83.5253C365.775 84.1322 365.658 84.8402 365.658 85.6493Z" fill="#A9A9A9"/>
+<path d="M349.871 91.7029C348.93 91.7029 348.091 91.4626 347.353 90.9822C346.619 90.4967 346.043 89.8064 345.623 88.9113C345.208 88.0111 345.001 86.9314 345.001 85.6721C345.001 84.4129 345.211 83.3357 345.631 82.4405C346.055 81.5454 346.637 80.8601 347.375 80.3848C348.114 79.9094 348.951 79.6717 349.886 79.6717C350.609 79.6717 351.191 79.7931 351.631 80.0358C352.076 80.2735 352.42 80.5517 352.663 80.8703C352.91 81.1889 353.103 81.4695 353.239 81.7123H353.376V75.9395H355.644V91.4753H353.429V89.6623H353.239C353.103 89.9101 352.905 90.1933 352.648 90.5119C352.395 90.8305 352.046 91.1086 351.601 91.3463C351.156 91.584 350.579 91.7029 349.871 91.7029ZM350.372 89.7685C351.024 89.7685 351.575 89.5965 352.025 89.2526C352.481 88.9037 352.825 88.4207 353.057 87.8037C353.295 87.1867 353.414 86.4686 353.414 85.6493C353.414 84.8402 353.297 84.1322 353.065 83.5253C352.832 82.9184 352.491 82.4456 352.041 82.1068C351.591 81.7679 351.034 81.5985 350.372 81.5985C349.689 81.5985 349.12 81.7755 348.665 82.1295C348.21 82.4835 347.866 82.9665 347.633 83.5784C347.406 84.1903 347.292 84.8806 347.292 85.6493C347.292 86.4282 347.408 87.1286 347.641 87.7506C347.873 88.3727 348.217 88.8657 348.673 89.2299C349.133 89.5889 349.699 89.7685 350.372 89.7685Z" fill="#A9A9A9"/>
+<path d="M338.634 91.7106C337.486 91.7106 336.497 91.4653 335.668 90.9748C334.844 90.4792 334.207 89.7838 333.756 88.8887C333.311 87.9885 333.089 86.9341 333.089 85.7254C333.089 84.5319 333.311 83.48 333.756 82.5697C334.207 81.6594 334.834 80.9488 335.638 80.438C336.447 79.9273 337.393 79.6719 338.475 79.6719C339.132 79.6719 339.769 79.7806 340.386 79.9981C341.003 80.2155 341.557 80.5569 342.048 81.0222C342.538 81.4874 342.925 82.0918 343.208 82.8352C343.492 83.5735 343.633 84.4712 343.633 85.5282V86.3323H334.371V84.633H341.411C341.411 84.0363 341.289 83.5078 341.046 83.0476C340.804 82.5823 340.462 82.2157 340.022 81.9476C339.587 81.6796 339.077 81.5456 338.49 81.5456C337.853 81.5456 337.296 81.7024 336.821 82.0159C336.351 82.3244 335.987 82.729 335.729 83.2296C335.476 83.7252 335.349 84.2638 335.349 84.8454V86.173C335.349 86.9518 335.486 87.6143 335.759 88.1604C336.037 88.7066 336.424 89.1238 336.92 89.4121C337.415 89.6953 337.994 89.8369 338.657 89.8369C339.087 89.8369 339.479 89.7762 339.833 89.6549C340.187 89.5284 340.493 89.3413 340.751 89.0935C341.009 88.8457 341.206 88.5397 341.342 88.1756L343.489 88.5625C343.317 89.1946 343.009 89.7484 342.564 90.2238C342.124 90.6941 341.57 91.0608 340.902 91.3237C340.24 91.5817 339.484 91.7106 338.634 91.7106Z" fill="#A9A9A9"/>
+<path d="M326.473 91.4753V79.8234H328.665V81.6743H328.786C328.999 81.0473 329.373 80.5542 329.909 80.1951C330.45 79.831 331.062 79.6489 331.745 79.6489C331.886 79.6489 332.053 79.654 332.245 79.6641C332.443 79.6742 332.597 79.6869 332.708 79.702V81.8716C332.617 81.8463 332.455 81.8185 332.223 81.7881C331.99 81.7527 331.757 81.735 331.525 81.735C330.989 81.735 330.511 81.8488 330.091 82.0764C329.676 82.2989 329.348 82.6099 329.105 83.0095C328.862 83.4039 328.741 83.854 328.741 84.3597V91.4753H326.473Z" fill="#A9A9A9"/>
+<path d="M319.598 91.7106C318.45 91.7106 317.461 91.4653 316.632 90.9748C315.808 90.4792 315.17 89.7838 314.72 88.8887C314.275 87.9885 314.053 86.9341 314.053 85.7254C314.053 84.5319 314.275 83.48 314.72 82.5697C315.17 81.6594 315.797 80.9488 316.602 80.438C317.411 79.9273 318.356 79.6719 319.439 79.6719C320.096 79.6719 320.733 79.7806 321.35 79.9981C321.967 80.2155 322.521 80.5569 323.012 81.0222C323.502 81.4874 323.889 82.0918 324.172 82.8352C324.455 83.5735 324.597 84.4712 324.597 85.5282V86.3323H315.335V84.633H322.374C322.374 84.0363 322.253 83.5078 322.01 83.0476C321.768 82.5823 321.426 82.2157 320.986 81.9476C320.551 81.6796 320.041 81.5456 319.454 81.5456C318.817 81.5456 318.26 81.7024 317.785 82.0159C317.315 82.3244 316.951 82.729 316.693 83.2296C316.44 83.7252 316.313 84.2638 316.313 84.8454V86.173C316.313 86.9518 316.45 87.6143 316.723 88.1604C317.001 88.7066 317.388 89.1238 317.884 89.4121C318.379 89.6953 318.958 89.8369 319.621 89.8369C320.051 89.8369 320.443 89.7762 320.797 89.6549C321.151 89.5284 321.457 89.3413 321.714 89.0935C321.972 88.8457 322.17 88.5397 322.306 88.1756L324.453 88.5625C324.281 89.1946 323.973 89.7484 323.527 90.2238C323.087 90.6941 322.534 91.0608 321.866 91.3237C321.204 91.5817 320.448 91.7106 319.598 91.7106Z" fill="#A9A9A9"/>
+<path d="M300.47 91.4751L297.041 79.8232H299.385L301.668 88.3801H301.782L304.073 79.8232H306.417L308.693 88.3422H308.807L311.075 79.8232H313.419L309.998 91.4751H307.684L305.317 83.0624H305.143L302.776 91.4751H300.47Z" fill="#A9A9A9"/>
+<path d="M290.975 91.7106C289.883 91.7106 288.93 91.4603 288.116 90.9596C287.301 90.459 286.669 89.7585 286.219 88.8583C285.769 87.9582 285.544 86.9063 285.544 85.7026C285.544 84.4939 285.769 83.437 286.219 82.5317C286.669 81.6265 287.301 80.9235 288.116 80.4229C288.93 79.9222 289.883 79.6719 290.975 79.6719C292.068 79.6719 293.021 79.9222 293.835 80.4229C294.649 80.9235 295.282 81.6265 295.732 82.5317C296.182 83.437 296.407 84.4939 296.407 85.7026C296.407 86.9063 296.182 87.9582 295.732 88.8583C295.282 89.7585 294.649 90.459 293.835 90.9596C293.021 91.4603 292.068 91.7106 290.975 91.7106ZM290.983 89.8066C291.691 89.8066 292.278 89.6195 292.743 89.2452C293.208 88.871 293.552 88.3728 293.775 87.7508C294.002 87.1288 294.116 86.4435 294.116 85.695C294.116 84.9516 294.002 84.2689 293.775 83.6469C293.552 83.0198 293.208 82.5166 292.743 82.1373C292.278 81.758 291.691 81.5683 290.983 81.5683C290.27 81.5683 289.678 81.758 289.208 82.1373C288.743 82.5166 288.396 83.0198 288.169 83.6469C287.946 84.2689 287.835 84.9516 287.835 85.695C287.835 86.4435 287.946 87.1288 288.169 87.7508C288.396 88.3728 288.743 88.871 289.208 89.2452C289.678 89.6195 290.27 89.8066 290.983 89.8066Z" fill="#A9A9A9"/>
+<path d="M273.524 95.8449V79.8236H275.739V81.7125H275.929C276.061 81.4697 276.25 81.189 276.498 80.8704C276.746 80.5518 277.09 80.2737 277.53 80.036C277.97 79.7932 278.551 79.6719 279.274 79.6719C280.215 79.6719 281.055 79.9096 281.793 80.3849C282.531 80.8603 283.11 81.5456 283.53 82.4407C283.955 83.3358 284.167 84.413 284.167 85.6723C284.167 86.9315 283.957 88.0113 283.538 88.9114C283.118 89.8066 282.541 90.4969 281.808 90.9824C281.075 91.4628 280.238 91.703 279.297 91.703C278.589 91.703 278.01 91.5842 277.56 91.3465C277.115 91.1088 276.766 90.8307 276.513 90.5121C276.26 90.1935 276.066 89.9102 275.929 89.6624H275.793V95.8449H273.524ZM275.747 85.6495C275.747 86.4688 275.866 87.1869 276.104 87.8039C276.341 88.4209 276.685 88.9039 277.135 89.2528C277.585 89.5967 278.137 89.7686 278.789 89.7686C279.467 89.7686 280.033 89.5891 280.488 89.2301C280.943 88.8659 281.287 88.3728 281.52 87.7508C281.758 87.1288 281.876 86.4283 281.876 85.6495C281.876 84.8808 281.76 84.1905 281.527 83.5786C281.3 82.9667 280.956 82.4837 280.496 82.1297C280.041 81.7757 279.472 81.5987 278.789 81.5987C278.132 81.5987 277.575 81.7681 277.12 82.1069C276.67 82.4458 276.329 82.9186 276.096 83.5255C275.863 84.1324 275.747 84.8404 275.747 85.6495Z" fill="#A9A9A9"/>
+<path d="M266.571 32.9729C266.571 44.125 259.583 50.7735 249.914 50.7735C244.567 50.7735 239.911 48.6221 237.784 45.0633V63.5341H230.311V15.7151H237.162L237.777 20.9561C239.904 17.3973 244.424 15.0449 249.907 15.0449C259.227 15.0449 266.564 21.4253 266.564 32.9796L266.571 32.9729ZM258.824 32.9729C258.824 25.9223 254.578 21.5526 248.403 21.5526C242.509 21.4856 237.989 25.9156 237.989 33.0399C237.989 40.1641 242.516 44.2591 248.403 44.2591C254.29 44.2591 258.824 40.0301 258.824 32.9729Z" fill="#151515"/>
+<path d="M306.324 34.9231H279.459C279.596 41.3705 283.91 44.7282 289.394 44.7282C293.504 44.7282 296.936 42.845 298.372 39.0851H305.982C304.129 46.0686 297.825 50.7735 289.257 50.7735C278.768 50.7735 271.849 43.6559 271.849 32.8388C271.849 22.0217 278.768 14.9712 289.189 14.9712C299.61 14.9712 306.324 21.8207 306.324 32.1686V34.9231V34.9231ZM279.527 29.8162H298.714C298.304 23.838 294.263 20.8154 289.189 20.8154C284.115 20.8154 280.074 23.838 279.527 29.8162Z" fill="#151515"/>
+<path d="M319.549 15.7188C316.062 15.7188 313.238 18.4867 313.238 21.9047V50.1136H320.78V31.7768V23.8483C320.78 22.9972 321.485 22.3001 322.36 22.3001H333.874V15.7188H319.556H319.549Z" fill="#151515"/>
+<path d="M218.26 15.6538L208.599 44.2045L198.178 15.7208H190.089L203.45 49.6465C203.86 50.7188 204.065 51.5968 204.065 52.4681C204.065 52.9439 204.017 53.3795 203.935 53.7817L203.915 53.8554C203.867 54.0699 203.812 54.2709 203.744 54.4653L203.238 56.2815C203.115 56.7306 202.698 57.0389 202.226 57.0389H191.593V63.5532H199.34C204.551 63.5532 208.865 62.3469 211.334 55.6247L226.069 15.7208L218.253 15.6538H218.26Z" fill="#151515"/>
+<path d="M154.45 50.1067H161.917V31.5689C161.917 25.7918 165.138 21.7638 171.1 21.7638C176.31 21.6968 179.531 24.7194 179.531 31.3679V50.1067H187.004V30.2218C187.004 18.4665 179.674 14.9747 173.021 14.9747C167.948 14.9747 163.975 16.925 161.917 20.1487V1.61084H154.45V50.1067V50.1067Z" fill="#151515"/>
+<path d="M343.752 39.695C343.82 43.2538 347.178 45.3381 351.773 45.3381C356.367 45.3381 359.103 43.6559 359.103 40.6333C359.103 38.0128 357.735 36.6054 353.755 35.9955L346.699 34.7891C339.848 33.6498 337.174 30.1513 337.174 25.2521C337.174 19.0728 343.41 15.0449 351.362 15.0449C359.93 15.0449 366.166 19.0728 366.234 25.929H358.836C358.767 22.4373 355.684 20.487 351.369 20.487C347.055 20.487 344.654 22.1692 344.654 24.9907C344.654 27.4772 346.439 28.6165 350.343 29.2867L357.263 30.4931C363.773 31.6325 366.788 34.7891 366.788 39.9631C366.788 47.0806 360.073 50.7802 351.916 50.7802C342.665 50.7802 336.429 46.4171 336.292 39.695H343.766H343.752Z" fill="#151515"/>
+<path d="M383.775 42.0505L391.727 15.7183H399.543L407.358 42.0505L414.005 15.7183H421.889L411.953 50.1131H403.523L395.57 23.9148L387.55 50.1131H379.05L369.047 15.7183H376.931L383.782 42.0505H383.775Z" fill="#151515"/>
+<path d="M426.269 1.60986H434.563V9.27029H426.269V1.60986ZM426.679 15.7176H434.146V50.1125H426.679V15.7176Z" fill="#151515"/>
+<path d="M481.638 21.3629C475.813 21.3629 471.84 25.5249 471.84 32.8502C471.84 40.5776 475.949 44.3375 481.433 44.3375C485.816 44.3375 489.043 41.918 490.479 37.3539H498.432C496.647 45.6846 490.206 50.7915 481.57 50.7915C471.156 50.7915 464.161 43.674 464.161 32.8569C464.161 22.0398 471.149 14.9893 481.638 14.9893C490.206 14.9893 496.579 19.7611 498.432 28.085H490.343C489.112 23.789 485.748 21.3696 481.638 21.3696V21.3629Z" fill="#151515"/>
+<path d="M452.618 43.5926C452.18 43.5926 451.832 43.2441 451.832 42.8219V22.2332H459.989V15.7188H451.832V6.51025H444.365V12.4885C444.365 14.6398 443.681 15.7121 441.486 15.7121H438.471V22.2265H444.365V40.7643C444.365 46.7426 447.722 50.1003 453.821 50.1003H459.921V43.5859H452.625L452.618 43.5926Z" fill="#151515"/>
+<path d="M522.594 14.9747C517.52 14.9747 513.547 16.925 511.489 20.1487V1.61084H504.022V50.1067H511.489V31.5689C511.489 25.7918 514.71 21.7638 520.672 21.7638C525.883 21.6968 529.103 24.7194 529.103 31.3679V50.1067H536.577V30.2218C536.577 18.4665 529.247 14.9747 522.594 14.9747V14.9747Z" fill="#151515"/>
+<path d="M99.661 0H31.467C14.0882 0 0 14.1622 0 31.6322C0 49.1022 14.0882 63.2644 31.467 63.2644H99.661C117.04 63.2644 131.128 49.1022 131.128 31.6322C131.128 14.1622 117.04 0 99.661 0Z" fill="#0070FF"/>
+<path d="M102.945 41.6438C108.442 41.6438 112.899 37.1642 112.899 31.6383C112.899 26.1124 108.442 21.6328 102.945 21.6328C97.4484 21.6328 92.9922 26.1124 92.9922 31.6383C92.9922 37.1642 97.4484 41.6438 102.945 41.6438Z" fill="white"/>
+<path d="M39.1028 39.4306L28.6927 23.1804C28.4583 22.8149 27.9273 22.8149 27.6928 23.1804L17.2828 39.4306C17.0268 39.8273 17.3115 40.3515 17.7827 40.3515H38.6029C39.0741 40.3515 39.3588 39.8273 39.1028 39.4306V39.4306Z" fill="white"/>
+<path d="M73.802 22.3906H57.3377C56.8092 22.3906 56.3809 22.8213 56.3809 23.3525V39.9032C56.3809 40.4344 56.8092 40.8651 57.3377 40.8651H73.802C74.3304 40.8651 74.7588 40.4344 74.7588 39.9032V23.3525C74.7588 22.8213 74.3304 22.3906 73.802 22.3906Z" fill="white"/>
<defs>
-<clipPath id="clip0_1969_1952">
-<rect width="765.66" height="99.05" fill="white"/>
-</clipPath>
-<clipPath id="clip1_1969_1952">
-<rect width="178.667" height="85.75" fill="white"/>
+<clipPath id="clip0_1484_2449">
+<rect width="140.853" height="33.2142" fill="white" transform="translate(398.348 69.228)"/>
</clipPath>
</defs>
</svg>
diff --git a/docs/imgs/hyperswitch-product.png b/docs/imgs/hyperswitch-product.png
deleted file mode 100644
index ad1c6c1ed03..00000000000
Binary files a/docs/imgs/hyperswitch-product.png and /dev/null differ
diff --git a/docs/imgs/switch.png b/docs/imgs/switch.png
index 9482864c99d..6cf6b8689aa 100644
Binary files a/docs/imgs/switch.png and b/docs/imgs/switch.png differ
|
docs
|
upload new logos (#6368)
|
54d6b1083fab5d2b0c7637c150524460a16a3fec
|
2023-11-27 20:34:49
|
Chethan Rao
|
ci: update the credentails for generating token in release new version workflow (#2989)
| false
|
diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml
index b54e240d96f..2f8ae7e4819 100644
--- a/.github/workflows/release-new-version.yml
+++ b/.github/workflows/release-new-version.yml
@@ -23,19 +23,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Generate a token
- if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
- id: generate_token
- uses: actions/create-github-app-token@v1
- with:
- app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }}
- private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }}
-
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- token: ${{ steps.generate_token.outputs.token }}
+ token: ${{ secrets.AUTO_RELEASE_PAT }}
- name: Install Rust
uses: dtolnay/rust-toolchain@master
@@ -51,8 +43,8 @@ jobs:
- name: Set Git Configuration
shell: bash
run: |
- git config --local user.name 'hyperswitch-bot[bot]'
- git config --local user.email '148525504+hyperswitch-bot[bot]@users.noreply.github.com'
+ git config --local user.name 'github-actions'
+ git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Update Postman collection files from Postman directories
shell: bash
|
ci
|
update the credentails for generating token in release new version workflow (#2989)
|
c7665d7f35cbb79a0c046619affb7d393eb73960
|
2023-01-18 22:17:15
|
Denis Andrejew
|
perf: avoid making copies of strings (#412)
| false
|
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index 18a3ae13487..3944379f789 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -60,10 +60,11 @@ impl CustomerInterface for Store {
.map_err(Into::into)
.into_report()?;
maybe_customer.map_or(Ok(None), |customer| {
- if customer.name == Some(REDACTED.to_string()) {
- Err(errors::StorageError::CustomerRedacted)?
- } else {
- Ok(Some(customer))
+ // in the future, once #![feature(is_some_and)] is stable, we can make this more concise:
+ // `if customer.name.is_some_and(|ref name| name == REDACTED) ...`
+ match customer.name {
+ Some(ref name) if name == REDACTED => Err(errors::StorageError::CustomerRedacted)?,
+ _ => Ok(Some(customer)),
}
})
}
@@ -97,10 +98,9 @@ impl CustomerInterface for Store {
.await
.map_err(Into::into)
.into_report()?;
- if customer.name == Some(REDACTED.to_string()) {
- Err(errors::StorageError::CustomerRedacted)?
- } else {
- Ok(customer)
+ match customer.name {
+ Some(ref name) if name == REDACTED => Err(errors::StorageError::CustomerRedacted)?,
+ _ => Ok(customer),
}
}
|
perf
|
avoid making copies of strings (#412)
|
7645edfa2e00500da3f8f117cc1a485fe1f41ab5
|
2024-05-28 13:12:55
|
Sampras Lopes
|
fix(docker-compose): fix docker compose syntax (#4782)
| false
|
diff --git a/docker-compose.yml b/docker-compose.yml
index a1e9e1dee92..c993262e744 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -135,8 +135,8 @@ services:
context: ./docker
dockerfile: web.Dockerfile
environment:
- - HYPERSWITCH_PUBLISHABLE_KEY=${HYPERSWITCH_PUBLISHABLE_KEY:PUBLISHABLE_KEY}
- - HYPERSWITCH_SECRET_KEY=${HYPERSWITCH_SECRET_KEY:SECRET_KEY}
+ - HYPERSWITCH_PUBLISHABLE_KEY=${HYPERSWITCH_PUBLISHABLE_KEY:-PUBLISHABLE_KEY}
+ - HYPERSWITCH_SECRET_KEY=${HYPERSWITCH_SECRET_KEY:-SECRET_KEY}
- HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080}
- HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050}
- SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252}
|
fix
|
fix docker compose syntax (#4782)
|
374f2c28cd2b5ec47f3e67eb3fb925cdff5c208a
|
2023-07-18 23:12:37
|
Hrithikesh
|
fix(webhook): do not fail webhook verification if merchant_secret is not set by merchant (#1732)
| false
|
diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs
index 14bd5695bb7..5fd5621ef9e 100644
--- a/crates/router/src/types/api/webhooks.rs
+++ b/crates/router/src/types/api/webhooks.rs
@@ -4,7 +4,7 @@ pub use api_models::webhooks::{
OutgoingWebhook, OutgoingWebhookContent, WebhookFlow,
};
use common_utils::ext_traits::ValueExt;
-use error_stack::{IntoReport, ResultExt};
+use error_stack::ResultExt;
use masking::ExposeInterface;
use super::ConnectorCommon;
@@ -101,22 +101,25 @@ pub trait IncomingWebhook: ConnectorCommon + Sync {
)
})?
.connector_webhook_details;
- let merchant_secret = merchant_connector_webhook_details
- .ok_or(errors::ConnectorError::WebhookSourceVerificationFailed)
- .into_report()
- .attach_printable_lazy(|| format!("Merchant Secret not configured {}", debug_suffix))?
- .expose()
- .parse_value::<MerchantConnectorWebhookDetails>("MerchantConnectorWebhookDetails")
- .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)
- .attach_printable_lazy(|| {
- format!(
- "Deserializing MerchantConnectorWebhookDetails failed {}",
- debug_suffix
- )
- })?
- .merchant_secret
- .expose();
+
+ let merchant_secret = match merchant_connector_webhook_details {
+ Some(merchant_connector_webhook_details) => merchant_connector_webhook_details
+ .parse_value::<MerchantConnectorWebhookDetails>("MerchantConnectorWebhookDetails")
+ .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)
+ .attach_printable_lazy(|| {
+ format!(
+ "Deserializing MerchantConnectorWebhookDetails failed {}",
+ debug_suffix
+ )
+ })?
+ .merchant_secret
+ .expose(),
+ None => "default_secret".to_string(),
+ };
//need to fetch merchant secret from config table with caching in future for enhanced performance
+
+ //If merchant has not set the secret for webhook source verification, "default_secret" is returned.
+ //So it will fail during verification step and goes to psync flow.
Ok(merchant_secret.into_bytes())
}
|
fix
|
do not fail webhook verification if merchant_secret is not set by merchant (#1732)
|
266a075ab653b96505a4f8f26688153ced952c8f
|
2024-04-11 22:43:39
|
AkshayaFoiger
|
refactor(connectors): [ZSL] add Local bank Transfer (#4337)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index b5138ab898d..a24dfa17311 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -130,7 +130,7 @@ pub enum Connector {
Plaid,
Riskified,
Zen,
- // Zsl, Added as template code for future usage
+ Zsl,
}
impl Connector {
@@ -208,7 +208,7 @@ impl Connector {
| Self::Worldline
| Self::Worldpay
| Self::Zen
- // | Self::Zsl Added as template code for future usage
+ | Self::Zsl
| Self::Signifyd
| Self::Plaid
| Self::Riskified
@@ -266,7 +266,7 @@ impl Connector {
| Self::Worldline
| Self::Worldpay
| Self::Zen
- // | Self::Zsl, Added as template code for future usage
+ | Self::Zsl
| Self::Signifyd
| Self::Plaid
| Self::Riskified
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index ab27b52af3e..ae8f49c759d 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -167,7 +167,7 @@ pub enum RoutableConnectors {
Worldline,
Worldpay,
Zen,
- // Zsl, Added as template code for future usage
+ Zsl,
}
impl AttemptStatus {
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 6e2cce946a3..63219edab72 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -278,7 +278,7 @@ impl ConnectorConfig {
Connector::Worldline => Ok(connector_data.worldline),
Connector::Worldpay => Ok(connector_data.worldpay),
Connector::Zen => Ok(connector_data.zen),
- // Connector::Zsl => Ok(connector_data.zsl), Added as template code for future usage
+ Connector::Zsl => Ok(connector_data.zsl),
#[cfg(feature = "dummy_connector")]
Connector::DummyConnector1 => Ok(connector_data.dummy_connector),
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index ab18af1be0b..f9919d8b91b 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -98,6 +98,8 @@ pub trait RouterData {
fn get_optional_billing_state(&self) -> Option<Secret<String>>;
fn get_optional_billing_first_name(&self) -> Option<Secret<String>>;
fn get_optional_billing_last_name(&self) -> Option<Secret<String>>;
+ fn get_optional_billing_phone_number(&self) -> Option<Secret<String>>;
+ fn get_optional_billing_email(&self) -> Option<Email>;
}
pub trait PaymentResponseRouterData {
@@ -300,6 +302,22 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
})
}
+ fn get_optional_billing_phone_number(&self) -> Option<Secret<String>> {
+ self.address
+ .get_payment_method_billing()
+ .and_then(|billing_address| {
+ billing_address
+ .clone()
+ .phone
+ .and_then(|phone_data| phone_data.number)
+ })
+ }
+
+ fn get_optional_billing_email(&self) -> Option<Email> {
+ self.address
+ .get_payment_method_billing()
+ .and_then(|billing_address| billing_address.clone().email)
+ }
fn to_connector_meta<T>(&self) -> Result<T, Error>
where
T: serde::de::DeserializeOwned,
diff --git a/crates/router/src/connector/zsl.rs b/crates/router/src/connector/zsl.rs
index 5453a22ecb5..5d5a95b0a83 100644
--- a/crates/router/src/connector/zsl.rs
+++ b/crates/router/src/connector/zsl.rs
@@ -2,23 +2,27 @@ pub mod transformers;
use std::fmt::Debug;
-use error_stack::{report, ResultExt};
+use common_utils::ext_traits::ValueExt;
+use diesel_models::enums;
+use error_stack::ResultExt;
use masking::ExposeInterface;
use transformers as zsl;
use crate::{
configs::settings,
+ connector::utils as connector_utils,
core::errors::{self, CustomResult},
events::connector_api_logs::ConnectorEvent,
headers,
services::{
self,
- request::{self, Mask},
+ request::{self},
ConnectorIntegration, ConnectorValidation,
},
types::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
+ transformers::ForeignFrom,
ErrorResponse, RequestContent, Response,
},
utils::BytesExt,
@@ -40,31 +44,19 @@ impl api::RefundExecute for Zsl {}
impl api::RefundSync for Zsl {}
impl api::PaymentToken for Zsl {}
-impl
- ConnectorIntegration<
- api::PaymentMethodToken,
- types::PaymentMethodTokenizationData,
- types::PaymentsResponseData,
- > for Zsl
-{
- // Not Implemented (R)
-}
-
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Zsl
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
- req: &types::RouterData<Flow, Request, Response>,
+ _req: &types::RouterData<Flow, Request, Response>,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
+ let header = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
)];
- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- header.append(&mut api_key);
Ok(header)
}
}
@@ -79,72 +71,57 @@ impl ConnectorCommon for Zsl {
}
fn common_get_content_type(&self) -> &'static str {
- "application/json"
+ "application/x-www-form-urlencoded"
}
fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
connectors.zsl.base_url.as_ref()
}
- fn get_auth_header(
- &self,
- auth_type: &types::ConnectorAuthType,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let auth = zsl::ZslAuthType::try_from(auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
-
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- format!("{}:{}", auth.api_key.expose(), auth.merchant_id.expose()).into_masked(),
- )])
- }
-
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: zsl::ZslErrorResponse = res
- .response
- .parse_struct("ZslErrorResponse")
+ let response = serde_urlencoded::from_bytes::<zsl::ZslErrorResponse>(&res.response)
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+ let error_reason = zsl::ZslResponseStatus::try_from(response.status.clone())?.to_string();
+
Ok(ErrorResponse {
status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
- attempt_status: None,
+ code: response.status,
+ message: error_reason.clone(),
+ reason: Some(error_reason),
+ attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: None,
})
}
}
impl ConnectorValidation for Zsl {
- //TODO: implement functions when support enabled
-}
-
-impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
- for Zsl
-{
- //TODO: implement sessions flow
-}
-
-impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
- for Zsl
-{
-}
+ fn validate_capture_method(
+ &self,
+ capture_method: Option<enums::CaptureMethod>,
+ _pmt: Option<enums::PaymentMethodType>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let capture_method = capture_method.unwrap_or_default();
+ match capture_method {
+ enums::CaptureMethod::Automatic => Ok(()),
+ enums::CaptureMethod::Manual
+ | enums::CaptureMethod::ManualMultiple
+ | enums::CaptureMethod::Scheduled => Err(
+ connector_utils::construct_not_supported_error_report(capture_method, self.id()),
+ ),
+ }
+ }
-impl
- ConnectorIntegration<
- api::SetupMandate,
- types::SetupMandateRequestData,
- types::PaymentsResponseData,
- > for Zsl
-{
+ fn is_webhook_source_verification_mandatory(&self) -> bool {
+ true
+ }
}
impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
@@ -165,9 +142,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_url(
&self,
_req: &types::PaymentsAuthorizeRouterData,
- _connectors: &settings::Connectors,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}ecp", self.base_url(connectors)))
}
fn get_request_body(
@@ -182,7 +159,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
req,
))?;
let connector_req = zsl::ZslPaymentsRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
}
fn build_request(
@@ -213,12 +190,12 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: zsl::ZslPaymentsResponse = res
- .response
- .parse_struct("Zsl PaymentsAuthorizeResponse")
+ let response = serde_urlencoded::from_bytes::<zsl::ZslPaymentsResponse>(&res.response)
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- event_builder.map(|i| i.set_response_body(&response));
+
+ event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -233,47 +210,259 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
+
+ fn get_5xx_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
}
impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
for Zsl
{
+ fn handle_response(
+ &self,
+ data: &types::PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: zsl::ZslWebhookResponse = res
+ .response
+ .parse_struct("ZslWebhookResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsSessionRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Session flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::TokenizationRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "PaymentMethod Tokenization flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::RefreshTokenRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "AccessTokenAuth flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "SetupMandate flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
for Zsl
{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsCaptureRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Capture flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
for Zsl
{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsCancelRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Void flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
-impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Zsl {}
+impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Zsl {
+ fn build_request(
+ &self,
+ _req: &types::RefundsRouterData<api::Execute>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Refund flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
-impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Zsl {}
+impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Zsl {
+ fn build_request(
+ &self,
+ _req: &types::RefundSyncRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Rsync flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
#[async_trait::async_trait]
impl api::IncomingWebhook for Zsl {
fn get_webhook_object_reference_id(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::PaymentAttemptId(notif.mer_ref),
+ ))
}
fn get_webhook_event_type(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+
+ Ok(api_models::webhooks::IncomingWebhookEvent::foreign_from(
+ notif.status,
+ ))
}
fn get_webhook_resource_object(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let response = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ Ok(Box::new(response))
}
+
+ async fn verify_webhook_source(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
+ _merchant_account: &types::domain::MerchantAccount,
+ merchant_connector_account: types::domain::MerchantConnectorAccount,
+ _connector_label: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ let connector_account_details = merchant_connector_account
+ .connector_account_details
+ .parse_value::<types::ConnectorAuthType>("ConnectorAuthType")
+ .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)?;
+ let auth_type = zsl::ZslAuthType::try_from(&connector_account_details)?;
+ let key = auth_type.api_key.expose();
+ let mer_id = auth_type.merchant_id.expose();
+ let webhook_response = get_webhook_object_from_body(request.body)?;
+ let signature = zsl::calculate_signature(
+ webhook_response.enctype,
+ zsl::ZslSignatureType::WebhookSignature {
+ status: webhook_response.status,
+ txn_id: webhook_response.txn_id,
+ txn_date: webhook_response.txn_date,
+ paid_ccy: webhook_response.paid_ccy.to_string(),
+ paid_amt: webhook_response.paid_amt,
+ mer_ref: webhook_response.mer_ref,
+ mer_id,
+ key,
+ },
+ )?;
+
+ Ok(signature.eq(&webhook_response.signature))
+ }
+
+ fn get_webhook_api_response(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<services::api::ApplicationResponse<serde_json::Value>, errors::ConnectorError>
+ {
+ Ok(services::api::ApplicationResponse::TextPlain(
+ "CALLBACK-OK".to_string(),
+ ))
+ }
+}
+
+fn get_webhook_object_from_body(
+ body: &[u8],
+) -> CustomResult<zsl::ZslWebhookResponse, errors::ConnectorError> {
+ let response: zsl::ZslWebhookResponse =
+ serde_urlencoded::from_bytes::<zsl::ZslWebhookResponse>(body)
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ Ok(response)
}
diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs
index f14f0279cb9..c869cc3e555 100644
--- a/crates/router/src/connector/zsl/transformers.rs
+++ b/crates/router/src/connector/zsl/transformers.rs
@@ -1,15 +1,29 @@
-use masking::Secret;
+use std::collections::HashMap;
+
+use base64::Engine;
+use common_utils::{crypto::GenerateDigest, date_time, pii::Email};
+use error_stack::ResultExt;
+use masking::{ExposeInterface, Secret};
+use ring::digest;
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::PaymentsAuthorizeRequestData,
+ connector::utils::{self as connector_utils, PaymentsAuthorizeRequestData, RouterData},
+ consts,
core::errors,
+ services,
types::{self, domain, storage::enums},
};
-//TODO: Fill the struct with respective fields
+mod auth_error {
+ pub const INVALID_SIGNATURE: &str = "INVALID_SIGNATURE";
+}
+mod zsl_version {
+ pub const VERSION_1: &str = "1";
+}
+
pub struct ZslRouterData<T> {
- pub amount: i64, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: String,
pub router_data: T,
}
@@ -23,14 +37,14 @@ impl<T>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- (_currency_unit, _currency, amount, item): (
+ (currency_unit, currency, txn_amount, item): (
&types::api::CurrencyUnit,
types::storage::enums::Currency,
i64,
T,
),
) -> Result<Self, Self::Error> {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ let amount = connector_utils::get_amount_as_string(currency_unit, txn_amount, currency)?;
Ok(Self {
amount,
router_data: item,
@@ -38,48 +52,6 @@ impl<T>
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct ZslPaymentsRequest {
- amount: i64,
- card: ZslCard,
-}
-
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct ZslCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
-}
-
-impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPaymentsRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(
- item: &ZslRouterData<&types::PaymentsAuthorizeRouterData>,
- ) -> Result<Self, Self::Error> {
- match item.router_data.request.payment_method_data.clone() {
- domain::PaymentMethodData::Card(req_card) => {
- let card = ZslCard {
- number: req_card.card_number,
- expiry_month: req_card.card_exp_month,
- expiry_year: req_card.card_exp_year,
- cvc: req_card.card_cvc,
- complete: item.router_data.request.is_auto_capture()?,
- };
- Ok(Self {
- amount: item.amount.to_owned(),
- card,
- })
- }
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
- }
- }
-}
-
-//TODO: Fill the struct with respective fields
-// Auth Struct
pub struct ZslAuthType {
pub(super) api_key: Secret<String>,
pub(super) merchant_id: Secret<String>,
@@ -91,38 +63,241 @@ impl TryFrom<&types::ConnectorAuthType> for ZslAuthType {
match auth_type {
types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
api_key: api_key.to_owned(),
- merchant_id: key1.to_owned(),
+ merchant_id: key1.clone(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum ZslPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
-}
-
-impl From<ZslPaymentStatus> for enums::AttemptStatus {
- fn from(item: ZslPaymentStatus) -> Self {
- match item {
- ZslPaymentStatus::Succeeded => Self::Charged,
- ZslPaymentStatus::Failed => Self::Failure,
- ZslPaymentStatus::Processing => Self::Authorizing,
- }
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ZslPaymentsRequest {
+ process_type: ProcessType,
+ process_code: ProcessCode,
+ txn_amt: String,
+ ccy: api_models::enums::Currency,
+ mer_ref: String,
+ mer_txn_date: String,
+ mer_id: Secret<String>,
+ lang: String,
+ success_url: String,
+ failure_url: String,
+ success_s2s_url: String,
+ failure_s2s_url: String,
+ enctype: EncodingType,
+ signature: Secret<String>,
+ country: api_models::enums::CountryAlpha2,
+ verno: String,
+ service_code: ServiceCode,
+ cust_tag: String,
+ #[serde(flatten)]
+ payment_method: ZslPaymentMethods,
+ name: Option<Secret<String>>,
+ family_name: Option<Secret<String>>,
+ tel_phone: Option<Secret<String>>,
+ email: Option<Email>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ZslPaymentMethods {
+ LocalBankTransfer(LocalBankTransaferRequest),
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct LocalBankTransaferRequest {
+ bank_code: Option<String>,
+ pay_method: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ProcessType {
+ #[serde(rename = "0200")]
+ PaymentRequest,
+ #[serde(rename = "0208")]
+ PaymentResponse,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ProcessCode {
+ #[serde(rename = "200002")]
+ API,
+ #[serde(rename = "200003")]
+ CallBack,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum EncodingType {
+ #[serde(rename = "1")]
+ MD5,
+ #[serde(rename = "2")]
+ Sha1,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum ServiceCode {
+ MPG,
+}
+
+impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &ZslRouterData<&types::PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let payment_method = match item.router_data.request.payment_method_data.clone() {
+ domain::PaymentMethodData::BankTransfer(bank_transfer_data) => {
+ match *bank_transfer_data {
+ api_models::payments::BankTransferData::LocalBankTransfer { bank_code } => Ok(
+ ZslPaymentMethods::LocalBankTransfer(LocalBankTransaferRequest {
+ bank_code,
+ pay_method: None,
+ }),
+ ),
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::SepaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BacsBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. }
+ | api_models::payments::BankTransferData::PermataBankTransfer { .. }
+ | api_models::payments::BankTransferData::BcaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BniVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BriVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::CimbVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::DanamonVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::MandiriVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::Pix {}
+ | api_models::payments::BankTransferData::Pse {} => {
+ Err(errors::ConnectorError::NotImplemented(
+ connector_utils::get_unimplemented_payment_method_error_message(
+ item.router_data.connector.as_str(),
+ ),
+ ))
+ }
+ }
+ }
+ domain::PaymentMethodData::Card(_)
+ | domain::PaymentMethodData::CardRedirect(_)
+ | domain::PaymentMethodData::Wallet(_)
+ | domain::PaymentMethodData::PayLater(_)
+ | domain::PaymentMethodData::BankRedirect(_)
+ | domain::PaymentMethodData::BankDebit(_)
+ | domain::PaymentMethodData::Crypto(_)
+ | domain::PaymentMethodData::MandatePayment
+ | domain::PaymentMethodData::Reward
+ | domain::PaymentMethodData::Upi(_)
+ | domain::PaymentMethodData::Voucher(_)
+ | domain::PaymentMethodData::GiftCard(_)
+ | domain::PaymentMethodData::CardToken(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ connector_utils::get_unimplemented_payment_method_error_message(
+ item.router_data.connector.as_str(),
+ ),
+ ))
+ }
+ }?;
+ let auth_type = ZslAuthType::try_from(&item.router_data.connector_auth_type)?;
+ let key: Secret<String> = auth_type.api_key;
+ let mer_id = auth_type.merchant_id;
+ let mer_txn_date =
+ date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ let txn_amt = item.amount.clone();
+ let ccy = item.router_data.request.currency;
+ let mer_ref = item.router_data.connector_request_reference_id.clone();
+ let signature = calculate_signature(
+ EncodingType::MD5,
+ ZslSignatureType::RequestSignature {
+ txn_amt: txn_amt.clone(),
+ ccy: ccy.to_string(),
+ mer_ref: mer_ref.clone(),
+ mer_id: mer_id.clone().expose(),
+ mer_txn_date: mer_txn_date.clone(),
+ key: key.expose(),
+ },
+ )?;
+ let tel_phone = item.router_data.get_optional_billing_phone_number();
+ let email = item.router_data.get_optional_billing_email();
+ let name = item.router_data.get_optional_billing_first_name();
+ let family_name = item.router_data.get_optional_billing_last_name();
+ let router_url = item.router_data.request.get_router_return_url()?;
+ let webhook_url = item.router_data.request.get_webhook_url()?;
+ let billing_country = item.router_data.get_optional_billing_country().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "billing.address.country",
+ },
+ )?;
+
+ let lang = item
+ .router_data
+ .request
+ .browser_info
+ .as_ref()
+ .and_then(|browser_data| {
+ browser_data.language.as_ref().map(|language| {
+ language
+ .split_once('-')
+ .map_or(language.to_uppercase(), |(lang, _)| lang.to_uppercase())
+ })
+ })
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "browser_info.language",
+ })?;
+
+ let cust_tag = item
+ .router_data
+ .customer_id
+ .clone()
+ .and_then(|customer_id| {
+ let cust_id = customer_id.replace(['_', '-'], "");
+ let id_len = cust_id.len();
+ if id_len > 10 {
+ cust_id.get(id_len - 10..id_len).map(|id| id.to_string())
+ } else {
+ Some(cust_id)
+ }
+ })
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "customer_id",
+ })?;
+
+ Ok(Self {
+ process_type: ProcessType::PaymentRequest,
+ process_code: ProcessCode::API,
+ txn_amt,
+ ccy,
+ mer_ref,
+ mer_txn_date,
+ mer_id,
+ lang,
+ success_url: router_url.clone(),
+ failure_url: router_url.clone(),
+ success_s2s_url: webhook_url.clone(),
+ failure_s2s_url: webhook_url.clone(),
+ enctype: EncodingType::MD5,
+ signature,
+ verno: zsl_version::VERSION_1.to_owned(),
+ service_code: ServiceCode::MPG,
+ country: billing_country,
+ payment_method,
+ name,
+ family_name,
+ tel_phone,
+ email,
+ cust_tag,
+ })
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ZslPaymentsResponse {
- status: ZslPaymentStatus,
- id: String,
+ process_type: ProcessType,
+ process_code: ProcessCode,
+ status: String,
+ mer_ref: String,
+ mer_id: String,
+ enctype: EncodingType,
+ txn_url: String,
+ signature: Secret<String>,
}
impl<F, T>
@@ -133,27 +308,630 @@ impl<F, T>
fn try_from(
item: types::ResponseRouterData<F, ZslPaymentsResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: enums::AttemptStatus::from(item.response.status),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- }),
- ..item.data
- })
+ if item.response.status.eq("0") && !item.response.txn_url.is_empty() {
+ let auth_type = ZslAuthType::try_from(&item.data.connector_auth_type)?;
+ let key: Secret<String> = auth_type.api_key;
+ let mer_id = auth_type.merchant_id;
+ let calculated_signature = calculate_signature(
+ item.response.enctype,
+ ZslSignatureType::ResponseSignature {
+ status: item.response.status.clone(),
+ txn_url: item.response.txn_url.clone(),
+ mer_ref: item.response.mer_ref.clone(),
+ mer_id: mer_id.clone().expose(),
+ key: key.expose(),
+ },
+ )?;
+
+ if calculated_signature.clone().eq(&item.response.signature) {
+ let decoded_redirect_url_bytes: Vec<u8> = base64::engine::general_purpose::STANDARD
+ .decode(item.response.txn_url.clone())
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ let redirect_url = String::from_utf8(decoded_redirect_url_bytes)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending, // Redirect is always expected after success response
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.mer_ref.clone(),
+ ),
+ redirection_data: Some(services::RedirectForm::Form {
+ endpoint: redirect_url,
+ method: services::Method::Get,
+ form_fields: HashMap::new(),
+ }),
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.mer_ref.clone()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ } else {
+ // When the signature check fails
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: auth_error::INVALID_SIGNATURE.to_string(),
+ reason: Some(auth_error::INVALID_SIGNATURE.to_string()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
+ } else {
+ let error_reason =
+ ZslResponseStatus::try_from(item.response.status.clone())?.to_string();
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: item.response.status.clone(),
+ message: error_reason.clone(),
+ reason: Some(error_reason.clone()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ZslWebhookResponse {
+ pub process_type: ProcessType,
+ pub process_code: ProcessCode,
+ pub status: String,
+ pub txn_id: String,
+ pub txn_date: String,
+ pub paid_ccy: api_models::enums::Currency,
+ pub paid_amt: String,
+ pub consr_paid_ccy: api_models::enums::Currency,
+ pub consr_paid_amt: String,
+ pub service_fee_ccy: api_models::enums::Currency,
+ pub service_fee: String,
+ pub txn_amt: String,
+ pub ccy: String,
+ pub mer_ref: String,
+ pub mer_txn_date: String,
+ pub mer_id: String,
+ pub enctype: EncodingType,
+ pub signature: Secret<String>,
+}
+
+impl types::transformers::ForeignFrom<String> for api_models::webhooks::IncomingWebhookEvent {
+ fn foreign_from(status: String) -> Self {
+ match status.as_str() {
+ //any response with status != 0 are a failed deposit transaction
+ "0" => Self::PaymentIntentSuccess,
+ _ => Self::PaymentIntentFailure,
+ }
+ }
+}
+
+impl<F, T> TryFrom<types::ResponseRouterData<F, ZslWebhookResponse, T, types::PaymentsResponseData>>
+ for types::RouterData<F, T, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<F, ZslWebhookResponse, T, types::PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ if item.response.status == "0" {
+ Ok(Self {
+ status: enums::AttemptStatus::Charged,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.mer_ref.clone(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.mer_ref.clone()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ } else {
+ let error_reason =
+ ZslResponseStatus::try_from(item.response.status.clone())?.to_string();
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: item.response.status.clone(),
+ message: error_reason.clone(),
+ reason: Some(error_reason.clone()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+impl TryFrom<String> for ZslResponseStatus {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(status: String) -> Result<Self, Self::Error> {
+ match status.as_str() {
+ "0" => Ok(Self::Normal),
+ "1000" => Ok(Self::InternalError),
+ "1001" => Ok(Self::BreakDownMessageError),
+ "1002" => Ok(Self::FormatError),
+ "1004" => Ok(Self::InvalidTransaction),
+ "1005" => Ok(Self::TransactionCountryNotFound),
+ "1006" => Ok(Self::MerchantIdNotFound),
+ "1007" => Ok(Self::AccountDisabled),
+ "1008" => Ok(Self::DuplicateMerchantReference),
+ "1009" => Ok(Self::InvalidPayAmount),
+ "1010" => Ok(Self::PayAmountNotFound),
+ "1011" => Ok(Self::InvalidCurrencyCode),
+ "1012" => Ok(Self::CurrencyCodeNotFound),
+ "1013" => Ok(Self::ReferenceNotFound),
+ "1014" => Ok(Self::TransmissionTimeNotFound),
+ "1015" => Ok(Self::PayMethodNotFound),
+ "1016" => Ok(Self::BankCodeNotFound),
+ "1017" => Ok(Self::InvalidShowPayPage),
+ "1018" => Ok(Self::ShowPayPageNotFound),
+ "1019" => Ok(Self::SuccessUrlNotFound),
+ "1020" => Ok(Self::SuccessCallbackUrlNotFound),
+ "1021" => Ok(Self::FailUrlNotFound),
+ "1022" => Ok(Self::FailCallbackUrlNotFound),
+ "1023" => Ok(Self::MacNotFound),
+ "1025" => Ok(Self::OriginalTransactionNotFound),
+ "1026" => Ok(Self::DeblockDataError),
+ "1028" => Ok(Self::PspAckNotYetReturn),
+ "1029" => Ok(Self::BankBranchNameNotFound),
+ "1030" => Ok(Self::BankAccountIDNotFound),
+ "1031" => Ok(Self::BankAccountNameNotFound),
+ "1032" => Ok(Self::IdentityIDNotFound),
+ "1033" => Ok(Self::ErrorConnectingToPsp),
+ "1034" => Ok(Self::CountryPspNotAvailable),
+ "1035" => Ok(Self::UnsupportedPayAmount),
+ "1036" => Ok(Self::RecordMismatch),
+ "1037" => Ok(Self::NoRecord),
+ "1038" => Ok(Self::PspError),
+ "1039" => Ok(Self::UnsupportedEncryptionType),
+ "1040" => Ok(Self::ExceedTransactionLimitCount),
+ "1041" => Ok(Self::ExceedTransactionLimitAmount),
+ "1042" => Ok(Self::ExceedTransactionAccountLimitCount),
+ "1043" => Ok(Self::ExceedTransactionAccountLimitAmount),
+ "1044" => Ok(Self::ExchangeRateError),
+ "1045" => Ok(Self::InvalidEncoding),
+ "1046" => Ok(Self::CustomerNameNotFound),
+ "1047" => Ok(Self::CustomerFamilyNameNotFound),
+ "1048" => Ok(Self::CustomerTelPhoneNotFound),
+ "1049" => Ok(Self::InsufficientFund),
+ "1050" => Ok(Self::ServiceCodeIsMissing),
+ "1051" => Ok(Self::CurrencyIdNotMatch),
+ "1052" => Ok(Self::NoPendingRecord),
+ "1053" => Ok(Self::NoLoadBalancerRuleDefineForTransaction),
+ "1054" => Ok(Self::NoPaymentProviderAvailable),
+ "1055" => Ok(Self::UnsupportedPayMethod),
+ "1056" => Ok(Self::PendingTransaction),
+ "1057" => Ok(Self::OtherError1059),
+ "1058" => Ok(Self::OtherError1058),
+ "1059" => Ok(Self::OtherError1059),
+ "1084" => Ok(Self::InvalidRequestId),
+ "5043" => Ok(Self::BeneficiaryBankAccountIsNotAvailable),
+ "5053" => Ok(Self::BaidNotFound),
+ "5057" => Ok(Self::InvalidBaid),
+ "5059" => Ok(Self::InvalidBaidStatus),
+ "5107" => Ok(Self::AutoUploadBankDisabled),
+ "5108" => Ok(Self::InvalidNature),
+ "5109" => Ok(Self::SmsCreateDateNotFound),
+ "5110" => Ok(Self::InvalidSmsCreateDate),
+ "5111" => Ok(Self::RecordNotFound),
+ "5112" => Ok(Self::InsufficientBaidAvailableBalance),
+ "5113" => Ok(Self::ExceedTxnAmountLimit),
+ "5114" => Ok(Self::BaidBalanceNotFound),
+ "5115" => Ok(Self::AutoUploadIndicatorNotFound),
+ "5116" => Ok(Self::InvalidBankAcctStatus),
+ "5117" => Ok(Self::InvalidAutoUploadIndicator),
+ "5118" => Ok(Self::InvalidPidStatus),
+ "5119" => Ok(Self::InvalidProviderStatus),
+ "5120" => Ok(Self::InvalidBankAccountSystemSwitchEnabled),
+ "5121" => Ok(Self::AutoUploadProviderDisabled),
+ "5122" => Ok(Self::AutoUploadBankNotFound),
+ "5123" => Ok(Self::AutoUploadBankAcctNotFound),
+ "5124" => Ok(Self::AutoUploadProviderNotFound),
+ "5125" => Ok(Self::UnsupportedBankCode),
+ "5126" => Ok(Self::BalanceOverrideIndicatorNotFound),
+ "5127" => Ok(Self::InvalidBalanceOverrideIndicator),
+ "10000" => Ok(Self::VernoInvalid),
+ "10001" => Ok(Self::ServiceCodeInvalid),
+ "10002" => Ok(Self::PspResponseSignatureIsNotValid),
+ "10003" => Ok(Self::ProcessTypeNotFound),
+ "10004" => Ok(Self::ProcessCodeNotFound),
+ "10005" => Ok(Self::EnctypeNotFound),
+ "10006" => Ok(Self::VernoNotFound),
+ "10007" => Ok(Self::DepositBankNotFound),
+ "10008" => Ok(Self::DepositFlowNotFound),
+ "10009" => Ok(Self::CustDepositDateNotFound),
+ "10010" => Ok(Self::CustTagNotFound),
+ "10011" => Ok(Self::CountryValueInvalid),
+ "10012" => Ok(Self::CurrencyCodeValueInvalid),
+ "10013" => Ok(Self::MerTxnDateInvalid),
+ "10014" => Ok(Self::CustDepositDateInvalid),
+ "10015" => Ok(Self::TxnAmtInvalid),
+ "10016" => Ok(Self::SuccessCallbackUrlInvalid),
+ "10017" => Ok(Self::DepositFlowInvalid),
+ "10018" => Ok(Self::ProcessTypeInvalid),
+ "10019" => Ok(Self::ProcessCodeInvalid),
+ "10020" => Ok(Self::UnsupportedMerRefLength),
+ "10021" => Ok(Self::DepositBankLengthOverLimit),
+ "10022" => Ok(Self::CustTagLengthOverLimit),
+ "10023" => Ok(Self::SignatureLengthOverLimit),
+ "10024" => Ok(Self::RequestContainInvalidTag),
+ "10025" => Ok(Self::RequestSignatureNotMatch),
+ "10026" => Ok(Self::InvalidCustomer),
+ "10027" => Ok(Self::SchemeNotFound),
+ "10028" => Ok(Self::PspResponseFieldsMissing),
+ "10029" => Ok(Self::PspResponseMerRefNotMatchWithRequestMerRef),
+ "10030" => Ok(Self::PspResponseMerIdNotMatchWithRequestMerId),
+ "10031" => Ok(Self::UpdateDepositFailAfterResponse),
+ "10032" => Ok(Self::UpdateUsedLimitTransactionCountFailAfterSuccessResponse),
+ "10033" => Ok(Self::UpdateCustomerLastDepositRecordAfterSuccessResponse),
+ "10034" => Ok(Self::CreateDepositFail),
+ "10035" => Ok(Self::CreateDepositMsgFail),
+ "10036" => Ok(Self::UpdateStatusSubStatusFail),
+ "10037" => Ok(Self::AddDepositRecordToSchemeAccount),
+ "10038" => Ok(Self::EmptyResponse),
+ "10039" => Ok(Self::AubConfirmErrorFromPh),
+ "10040" => Ok(Self::ProviderEmailAddressNotFound),
+ "10041" => Ok(Self::AubConnectionTimeout),
+ "10042" => Ok(Self::AubConnectionIssue),
+ "10043" => Ok(Self::AubMsgTypeMissing),
+ "10044" => Ok(Self::AubMsgCodeMissing),
+ "10045" => Ok(Self::AubVersionMissing),
+ "10046" => Ok(Self::AubEncTypeMissing),
+ "10047" => Ok(Self::AubSignMissing),
+ "10048" => Ok(Self::AubInfoMissing),
+ "10049" => Ok(Self::AubErrorCodeMissing),
+ "10050" => Ok(Self::AubMsgTypeInvalid),
+ "10051" => Ok(Self::AubMsgCodeInvalid),
+ "10052" => Ok(Self::AubBaidMissing),
+ "10053" => Ok(Self::AubResponseSignNotMatch),
+ "10054" => Ok(Self::SmsConnectionTimeout),
+ "10055" => Ok(Self::SmsConnectionIssue),
+ "10056" => Ok(Self::SmsConfirmErrorFromPh),
+ "10057" => Ok(Self::SmsMsgTypeMissing),
+ "10058" => Ok(Self::SmsMsgCodeMissing),
+ "10059" => Ok(Self::SmsVersionMissing),
+ "10060" => Ok(Self::SmsEncTypeMissing),
+ "10061" => Ok(Self::SmsSignMissing),
+ "10062" => Ok(Self::SmsInfoMissing),
+ "10063" => Ok(Self::SmsErrorCodeMissing),
+ "10064" => Ok(Self::SmsMsgTypeInvalid),
+ "10065" => Ok(Self::SmsMsgCodeInvalid),
+ "10066" => Ok(Self::SmsResponseSignNotMatch),
+ "10067" => Ok(Self::SmsRequestReachMaximumLimit),
+ "10068" => Ok(Self::SyncConnectionTimeout),
+ "10069" => Ok(Self::SyncConnectionIssue),
+ "10070" => Ok(Self::SyncConfirmErrorFromPh),
+ "10071" => Ok(Self::SyncMsgTypeMissing),
+ "10072" => Ok(Self::SyncMsgCodeMissing),
+ "10073" => Ok(Self::SyncVersionMissing),
+ "10074" => Ok(Self::SyncEncTypeMissing),
+ "10075" => Ok(Self::SyncSignMissing),
+ "10076" => Ok(Self::SyncInfoMissing),
+ "10077" => Ok(Self::SyncErrorCodeMissing),
+ "10078" => Ok(Self::SyncMsgTypeInvalid),
+ "10079" => Ok(Self::SyncMsgCodeInvalid),
+ "10080" => Ok(Self::SyncResponseSignNotMatch),
+ "10081" => Ok(Self::AccountExpired),
+ "10082" => Ok(Self::ExceedMaxMinAmount),
+ "10083" => Ok(Self::WholeNumberAmountLessThanOne),
+ "10084" => Ok(Self::AddDepositRecordToSchemeChannel),
+ "10085" => Ok(Self::UpdateUtilizedAmountFailAfterSuccessResponse),
+ "10086" => Ok(Self::PidResponseInvalidFormat),
+ "10087" => Ok(Self::PspNameNotFound),
+ "10088" => Ok(Self::LangIsMissing),
+ "10089" => Ok(Self::FailureCallbackUrlInvalid),
+ "10090" => Ok(Self::SuccessRedirectUrlInvalid),
+ "10091" => Ok(Self::FailureRedirectUrlInvalid),
+ "10092" => Ok(Self::LangValueInvalid),
+ "10093" => Ok(Self::OnlineDepositSessionTimeout),
+ "10094" => Ok(Self::AccessPaymentPageRouteFieldMissing),
+ "10095" => Ok(Self::AmountNotMatch),
+ "10096" => Ok(Self::PidCallbackFieldsMissing),
+ "10097" => Ok(Self::TokenNotMatch),
+ "10098" => Ok(Self::OperationDuplicated),
+ "10099" => Ok(Self::PayPageDomainNotAvailable),
+ "10100" => Ok(Self::PayPageConfirmSignatureNotMatch),
+ "10101" => Ok(Self::PaymentPageConfirmationFieldMissing),
+ "10102" => Ok(Self::MultipleCallbackFromPsp),
+ "10103" => Ok(Self::PidNotAvailable),
+ "10104" => Ok(Self::PidDepositUrlNotValidOrEmp),
+ "10105" => Ok(Self::PspSelfRedirectTagNotValid),
+ "20000" => Ok(Self::InternalError20000),
+ "20001" => Ok(Self::DepositTimeout),
+ _ => Err(errors::ConnectorError::ResponseHandlingFailed.into()),
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, strum::Display)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum ZslResponseStatus {
+ Normal,
+ InternalError,
+ BreakDownMessageError,
+ FormatError,
+ InvalidTransaction,
+ TransactionCountryNotFound,
+ MerchantIdNotFound,
+ AccountDisabled,
+ DuplicateMerchantReference,
+ InvalidPayAmount,
+ PayAmountNotFound,
+ InvalidCurrencyCode,
+ CurrencyCodeNotFound,
+ ReferenceNotFound,
+ TransmissionTimeNotFound,
+ PayMethodNotFound,
+ BankCodeNotFound,
+ InvalidShowPayPage,
+ ShowPayPageNotFound,
+ SuccessUrlNotFound,
+ SuccessCallbackUrlNotFound,
+ FailUrlNotFound,
+ FailCallbackUrlNotFound,
+ MacNotFound,
+ OriginalTransactionNotFound,
+ DeblockDataError,
+ PspAckNotYetReturn,
+ BankBranchNameNotFound,
+ BankAccountIDNotFound,
+ BankAccountNameNotFound,
+ IdentityIDNotFound,
+ ErrorConnectingToPsp,
+ CountryPspNotAvailable,
+ UnsupportedPayAmount,
+ RecordMismatch,
+ NoRecord,
+ PspError,
+ UnsupportedEncryptionType,
+ ExceedTransactionLimitCount,
+ ExceedTransactionLimitAmount,
+ ExceedTransactionAccountLimitCount,
+ ExceedTransactionAccountLimitAmount,
+ ExchangeRateError,
+ InvalidEncoding,
+ CustomerNameNotFound,
+ CustomerFamilyNameNotFound,
+ CustomerTelPhoneNotFound,
+ InsufficientFund,
+ ServiceCodeIsMissing,
+ CurrencyIdNotMatch,
+ NoPendingRecord,
+ NoLoadBalancerRuleDefineForTransaction,
+ NoPaymentProviderAvailable,
+ UnsupportedPayMethod,
+ PendingTransaction,
+ OtherError1059,
+ OtherError1058,
+ InvalidRequestId,
+ BeneficiaryBankAccountIsNotAvailable,
+ BaidNotFound,
+ InvalidBaid,
+ InvalidBaidStatus,
+ AutoUploadBankDisabled,
+ InvalidNature,
+ SmsCreateDateNotFound,
+ InvalidSmsCreateDate,
+ RecordNotFound,
+ InsufficientBaidAvailableBalance,
+ ExceedTxnAmountLimit,
+ BaidBalanceNotFound,
+ AutoUploadIndicatorNotFound,
+ InvalidBankAcctStatus,
+ InvalidAutoUploadIndicator,
+ InvalidPidStatus,
+ InvalidProviderStatus,
+ InvalidBankAccountSystemSwitchEnabled,
+ AutoUploadProviderDisabled,
+ AutoUploadBankNotFound,
+ AutoUploadBankAcctNotFound,
+ AutoUploadProviderNotFound,
+ UnsupportedBankCode,
+ BalanceOverrideIndicatorNotFound,
+ InvalidBalanceOverrideIndicator,
+ VernoInvalid,
+ ServiceCodeInvalid,
+ PspResponseSignatureIsNotValid,
+ ProcessTypeNotFound,
+ ProcessCodeNotFound,
+ EnctypeNotFound,
+ VernoNotFound,
+ DepositBankNotFound,
+ DepositFlowNotFound,
+ CustDepositDateNotFound,
+ CustTagNotFound,
+ CountryValueInvalid,
+ CurrencyCodeValueInvalid,
+ MerTxnDateInvalid,
+ CustDepositDateInvalid,
+ TxnAmtInvalid,
+ SuccessCallbackUrlInvalid,
+ DepositFlowInvalid,
+ ProcessTypeInvalid,
+ ProcessCodeInvalid,
+ UnsupportedMerRefLength,
+ DepositBankLengthOverLimit,
+ CustTagLengthOverLimit,
+ SignatureLengthOverLimit,
+ RequestContainInvalidTag,
+ RequestSignatureNotMatch,
+ InvalidCustomer,
+ SchemeNotFound,
+ PspResponseFieldsMissing,
+ PspResponseMerRefNotMatchWithRequestMerRef,
+ PspResponseMerIdNotMatchWithRequestMerId,
+ UpdateDepositFailAfterResponse,
+ UpdateUsedLimitTransactionCountFailAfterSuccessResponse,
+ UpdateCustomerLastDepositRecordAfterSuccessResponse,
+ CreateDepositFail,
+ CreateDepositMsgFail,
+ UpdateStatusSubStatusFail,
+ AddDepositRecordToSchemeAccount,
+ EmptyResponse,
+ AubConfirmErrorFromPh,
+ ProviderEmailAddressNotFound,
+ AubConnectionTimeout,
+ AubConnectionIssue,
+ AubMsgTypeMissing,
+ AubMsgCodeMissing,
+ AubVersionMissing,
+ AubEncTypeMissing,
+ AubSignMissing,
+ AubInfoMissing,
+ AubErrorCodeMissing,
+ AubMsgTypeInvalid,
+ AubMsgCodeInvalid,
+ AubBaidMissing,
+ AubResponseSignNotMatch,
+ SmsConnectionTimeout,
+ SmsConnectionIssue,
+ SmsConfirmErrorFromPh,
+ SmsMsgTypeMissing,
+ SmsMsgCodeMissing,
+ SmsVersionMissing,
+ SmsEncTypeMissing,
+ SmsSignMissing,
+ SmsInfoMissing,
+ SmsErrorCodeMissing,
+ SmsMsgTypeInvalid,
+ SmsMsgCodeInvalid,
+ SmsResponseSignNotMatch,
+ SmsRequestReachMaximumLimit,
+ SyncConnectionTimeout,
+ SyncConnectionIssue,
+ SyncConfirmErrorFromPh,
+ SyncMsgTypeMissing,
+ SyncMsgCodeMissing,
+ SyncVersionMissing,
+ SyncEncTypeMissing,
+ SyncSignMissing,
+ SyncInfoMissing,
+ SyncErrorCodeMissing,
+ SyncMsgTypeInvalid,
+ SyncMsgCodeInvalid,
+ SyncResponseSignNotMatch,
+ AccountExpired,
+ ExceedMaxMinAmount,
+ WholeNumberAmountLessThanOne,
+ AddDepositRecordToSchemeChannel,
+ UpdateUtilizedAmountFailAfterSuccessResponse,
+ PidResponseInvalidFormat,
+ PspNameNotFound,
+ LangIsMissing,
+ FailureCallbackUrlInvalid,
+ SuccessRedirectUrlInvalid,
+ FailureRedirectUrlInvalid,
+ LangValueInvalid,
+ OnlineDepositSessionTimeout,
+ AccessPaymentPageRouteFieldMissing,
+ AmountNotMatch,
+ PidCallbackFieldsMissing,
+ TokenNotMatch,
+ OperationDuplicated,
+ PayPageDomainNotAvailable,
+ PayPageConfirmSignatureNotMatch,
+ PaymentPageConfirmationFieldMissing,
+ MultipleCallbackFromPsp,
+ PidNotAvailable,
+ PidDepositUrlNotValidOrEmp,
+ PspSelfRedirectTagNotValid,
+ InternalError20000,
+ DepositTimeout,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ZslErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
+ pub status: String,
+}
+
+pub enum ZslSignatureType {
+ RequestSignature {
+ txn_amt: String,
+ ccy: String,
+ mer_ref: String,
+ mer_id: String,
+ mer_txn_date: String,
+ key: String,
+ },
+ ResponseSignature {
+ status: String,
+ txn_url: String,
+ mer_ref: String,
+ mer_id: String,
+ key: String,
+ },
+ WebhookSignature {
+ status: String,
+ txn_id: String,
+ txn_date: String,
+ paid_ccy: String,
+ paid_amt: String,
+ mer_ref: String,
+ mer_id: String,
+ key: String,
+ },
+}
+
+pub fn calculate_signature(
+ enctype: EncodingType,
+ signature_data: ZslSignatureType,
+) -> Result<Secret<String>, error_stack::Report<errors::ConnectorError>> {
+ let signature_data = match signature_data {
+ ZslSignatureType::RequestSignature {
+ txn_amt,
+ ccy,
+ mer_ref,
+ mer_id,
+ mer_txn_date,
+ key,
+ } => format!("{txn_amt}{ccy}{mer_ref}{mer_id}{mer_txn_date}{key}"),
+ ZslSignatureType::ResponseSignature {
+ status,
+ txn_url,
+ mer_ref,
+ mer_id,
+ key,
+ } => {
+ format!("{status}{txn_url}{mer_ref}{mer_id}{key}")
+ }
+ ZslSignatureType::WebhookSignature {
+ status,
+ txn_id,
+ txn_date,
+ paid_ccy,
+ paid_amt,
+ mer_ref,
+ mer_id,
+ key,
+ } => format!("{status}{txn_id}{txn_date}{paid_ccy}{paid_amt}{mer_ref}{mer_id}{key}"),
+ };
+ let message = signature_data.as_bytes();
+
+ let encoded_data = match enctype {
+ EncodingType::MD5 => hex::encode(
+ common_utils::crypto::Md5
+ .generate_digest(message)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?,
+ ),
+ EncodingType::Sha1 => {
+ hex::encode(digest::digest(&digest::SHA1_FOR_LEGACY_USE_ONLY, message))
+ }
+ };
+ Ok(Secret::new(encoded_data))
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index eaa63f1b2fa..c7e1e4118b4 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1916,10 +1916,10 @@ pub(crate) fn validate_auth_and_metadata_type(
zen::transformers::ZenAuthType::try_from(val)?;
Ok(())
}
- // api_enums::Connector::Zsl => {
- // zsl::transformers::ZslAuthType::try_from(val)?;
- // Ok(())
- // } Added as template code for future usage
+ api_enums::Connector::Zsl => {
+ zsl::transformers::ZslAuthType::try_from(val)?;
+ Ok(())
+ }
api_enums::Connector::Signifyd => {
signifyd::transformers::SignifydAuthType::try_from(val)?;
Ok(())
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index bc75f794c70..dd7a082195c 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -385,7 +385,7 @@ impl ConnectorData {
enums::Connector::Tsys => Ok(Box::new(&connector::Tsys)),
enums::Connector::Volt => Ok(Box::new(&connector::Volt)),
enums::Connector::Zen => Ok(Box::new(&connector::Zen)),
- // enums::Connector::Zsl => Ok(Box::new(&connector::Zsl)), Added as template code for future usage
+ enums::Connector::Zsl => Ok(Box::new(&connector::Zsl)),
enums::Connector::Signifyd
| enums::Connector::Plaid
| enums::Connector::Riskified
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 34941d89986..ace6b725f74 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -247,7 +247,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Worldline => Self::Worldline,
api_enums::Connector::Worldpay => Self::Worldpay,
api_enums::Connector::Zen => Self::Zen,
- // api_enums::Connector::Zsl => Self::Zsl, Added as template code for future usage
+ api_enums::Connector::Zsl => Self::Zsl,
#[cfg(feature = "dummy_connector")]
api_enums::Connector::DummyConnector1 => Self::DummyConnector1,
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 6f260de51d2..a1b1940fc81 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -207,8 +207,6 @@ api_key="API Key"
[ebanx]
api_key="API Key"
-
[zsl]
-api_key="API Key"
+api_key= "Key"
key1= "Merchant id"
-
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 99770c7ff95..2f67bae0d14 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -7182,7 +7182,8 @@
"signifyd",
"plaid",
"riskified",
- "zen"
+ "zen",
+ "zsl"
]
},
"ConnectorMetadata": {
@@ -16967,7 +16968,8 @@
"wise",
"worldline",
"worldpay",
- "zen"
+ "zen",
+ "zsl"
]
},
"RoutingAlgorithm": {
diff --git a/postman/collection-dir/zsl/.auth.json b/postman/collection-dir/zsl/.auth.json
new file mode 100644
index 00000000000..915a2835790
--- /dev/null
+++ b/postman/collection-dir/zsl/.auth.json
@@ -0,0 +1,22 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/.event.meta.json b/postman/collection-dir/zsl/.event.meta.json
new file mode 100644
index 00000000000..2df9d47d936
--- /dev/null
+++ b/postman/collection-dir/zsl/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.prerequest.js",
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/.info.json b/postman/collection-dir/zsl/.info.json
new file mode 100644
index 00000000000..4104ea8926c
--- /dev/null
+++ b/postman/collection-dir/zsl/.info.json
@@ -0,0 +1,9 @@
+{
+ "info": {
+ "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9",
+ "name": "zsl",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "27028646"
+ }
+}
diff --git a/postman/collection-dir/zsl/.meta.json b/postman/collection-dir/zsl/.meta.json
new file mode 100644
index 00000000000..91b6a65c5bc
--- /dev/null
+++ b/postman/collection-dir/zsl/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Health check",
+ "Flow Testcases"
+ ]
+}
diff --git a/postman/collection-dir/zsl/.variable.json b/postman/collection-dir/zsl/.variable.json
new file mode 100644
index 00000000000..7341fd0b82e
--- /dev/null
+++ b/postman/collection-dir/zsl/.variable.json
@@ -0,0 +1,94 @@
+{
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/.meta.json
new file mode 100644
index 00000000000..bd972090b19
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "QuickStart",
+ "Happy Cases"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json
new file mode 100644
index 00000000000..baaff734b05
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Scenario1-Create payment with confirm true"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
new file mode 100644
index 00000000000..abc159198ae
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
new file mode 100644
index 00000000000..30cad8de4e9
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// Response body should have redirect_to_url as next action type
+if (jsonData?.next_action.type) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.next_action.type).to.eql("redirect_to_url");
+ },
+ );
+}
+
+// Response body should have status = requires_customer_action
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
new file mode 100644
index 00000000000..6609ff9bb9c
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -0,0 +1,88 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "amount_to_capture": 6540,
+ "authentication_type": "three_ds",
+ "billing": {
+ "address": {
+ "city": "San Fransico",
+ "country": "CN",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "confirm": true,
+ "currency": "CNY",
+ "customer_id": "StripeCustomer",
+ "description": "Its my first payment request",
+ "email": "[email protected]",
+ "metadata": {
+ "login_date": "2019-09-10T10:11:12Z",
+ "new_customer": "true",
+ "udf1": "value1"
+ },
+ "name": "John Doe",
+ "payment_method": "bank_transfer",
+ "payment_method_type": "local_bank_transfer",
+ "payment_method_data": {
+ "bank_transfer": {
+ "local_bank_transfer": {}
+ }
+ },
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "city": "San Fransico",
+ "country": "US",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "browser_info": {
+ "language": "en-EN"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json
new file mode 100644
index 00000000000..7d3e10f6db8
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Merchant Account - Create",
+ "API Key - Create",
+ "Payment Connector - Create",
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js
new file mode 100644
index 00000000000..4e27c5a5025
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js
@@ -0,0 +1,46 @@
+// Validate status 2xx
+pm.test("[POST]::/api_keys/:merchant_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/api_keys/:merchant_id - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id
+if (jsonData?.key_id) {
+ pm.collectionVariables.set("api_key_id", jsonData.key_id);
+ console.log(
+ "- use {{api_key_id}} as collection variable for value",
+ jsonData.key_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json
new file mode 100644
index 00000000000..4e4c6628497
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json
@@ -0,0 +1,52 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw_json_formatted": {
+ "name": "API Key 1",
+ "description": null,
+ "expiration": "2069-09-23T01:02:03.000Z"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
new file mode 100644
index 00000000000..d3d62bd40e0
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
@@ -0,0 +1,55 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/accounts - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id
+if (jsonData?.merchant_id) {
+ pm.collectionVariables.set("merchant_id", jsonData.merchant_id);
+ console.log(
+ "- use {{merchant_id}} as collection variable for value",
+ jsonData.merchant_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key
+if (jsonData?.publishable_key) {
+ pm.collectionVariables.set("publishable_key", jsonData.publishable_key);
+ console.log(
+ "- use {{publishable_key}} as collection variable for value",
+ jsonData.publishable_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json
new file mode 100644
index 00000000000..ffeea3410a4
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json
@@ -0,0 +1,95 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "merchant_id": "postman_merchant_GHAction_{{$guid}}",
+ "locker_id": "m0010",
+ "merchant_name": "NewAge Retailer",
+ "primary_business_details": [
+ {
+ "country": "US",
+ "business": "default"
+ }
+ ],
+ "merchant_details": {
+ "primary_contact_person": "John Test",
+ "primary_email": "[email protected]",
+ "primary_phone": "sunt laborum",
+ "secondary_contact_person": "John Test2",
+ "secondary_email": "[email protected]",
+ "secondary_phone": "cillum do dolor id",
+ "website": "www.example.com",
+ "about_business": "Online Retail with a wide selection of organic products for North America",
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US"
+ }
+ },
+ "return_url": "https://duck.com",
+ "webhook_details": {
+ "webhook_version": "1.0.1",
+ "webhook_username": "ekart_retail",
+ "webhook_password": "password_ekart@123",
+ "payment_created_enabled": true,
+ "payment_succeeded_enabled": true,
+ "payment_failed_enabled": true
+ },
+ "sub_merchants_enabled": false,
+ "metadata": {
+ "city": "NY",
+ "unit": "245"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
new file mode 100644
index 00000000000..88e92d8d84a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test(
+ "[POST]::/account/:account_id/connectors - Status code is 2xx",
+ function () {
+ pm.response.to.be.success;
+ },
+);
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/account/:account_id/connectors - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id
+if (jsonData?.merchant_connector_id) {
+ pm.collectionVariables.set(
+ "merchant_connector_id",
+ jsonData.merchant_connector_id,
+ );
+ console.log(
+ "- use {{merchant_connector_id}} as collection variable for value",
+ jsonData.merchant_connector_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json
new file mode 100644
index 00000000000..bda34190e77
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -0,0 +1,95 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "connector_type": "fiz_operations",
+ "connector_name": "zsl",
+ "connector_account_details": {
+ "auth_type": "BodyKey",
+ "api_key": "{{connector_api_key}}",
+ "key1": "{{connector_key1}}"
+ },
+ "test_mode": false,
+ "disabled": false,
+ "business_country": "US",
+ "business_label": "default",
+ "payment_methods_enabled": [
+ {
+ "payment_method": "bank_transfer",
+ "payment_method_types": [
+ {
+ "payment_method_type": "local_bank_transfer",
+ "payment_experience": "redirect_to_url",
+ "card_networks": null,
+ "accepted_currencies": null,
+ "accepted_countries": null,
+ "minimum_amount": -1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "city": "NY",
+ "unit": "245"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js
new file mode 100644
index 00000000000..30cad8de4e9
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// Response body should have redirect_to_url as next action type
+if (jsonData?.next_action.type) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.next_action.type).to.eql("redirect_to_url");
+ },
+ );
+}
+
+// Response body should have status = requires_customer_action
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json
new file mode 100644
index 00000000000..6609ff9bb9c
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -0,0 +1,88 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "amount_to_capture": 6540,
+ "authentication_type": "three_ds",
+ "billing": {
+ "address": {
+ "city": "San Fransico",
+ "country": "CN",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "confirm": true,
+ "currency": "CNY",
+ "customer_id": "StripeCustomer",
+ "description": "Its my first payment request",
+ "email": "[email protected]",
+ "metadata": {
+ "login_date": "2019-09-10T10:11:12Z",
+ "new_customer": "true",
+ "udf1": "value1"
+ },
+ "name": "John Doe",
+ "payment_method": "bank_transfer",
+ "payment_method_type": "local_bank_transfer",
+ "payment_method_data": {
+ "bank_transfer": {
+ "local_bank_transfer": {}
+ }
+ },
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "city": "San Fransico",
+ "country": "US",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "browser_info": {
+ "language": "en-EN"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Health check/.meta.json b/postman/collection-dir/zsl/Health check/.meta.json
new file mode 100644
index 00000000000..66ee7e50cab
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "New Request"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/.event.meta.json b/postman/collection-dir/zsl/Health check/New Request/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/event.test.js b/postman/collection-dir/zsl/Health check/New Request/event.test.js
new file mode 100644
index 00000000000..b490b8be090
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/event.test.js
@@ -0,0 +1,4 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
diff --git a/postman/collection-dir/zsl/Health check/New Request/request.json b/postman/collection-dir/zsl/Health check/New Request/request.json
new file mode 100644
index 00000000000..4e1e0a0d9e6
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/request.json
@@ -0,0 +1,13 @@
+{
+ "method": "GET",
+ "header": [],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/response.json b/postman/collection-dir/zsl/Health check/New Request/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/event.prerequest.js b/postman/collection-dir/zsl/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/zsl/event.test.js b/postman/collection-dir/zsl/event.test.js
new file mode 100644
index 00000000000..fb52caec30f
--- /dev/null
+++ b/postman/collection-dir/zsl/event.test.js
@@ -0,0 +1,13 @@
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log("[LOG]::payment_id - " + jsonData.payment_id);
+}
+
+console.log("[LOG]::x-request-id - " + pm.response.headers.get("x-request-id"));
diff --git a/postman/collection-json/zsl.postman_collection.json b/postman/collection-json/zsl.postman_collection.json
new file mode 100644
index 00000000000..ff69c558ec9
--- /dev/null
+++ b/postman/collection-json/zsl.postman_collection.json
@@ -0,0 +1,796 @@
+{
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);",
+ "}",
+ "",
+ "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "item": [
+ {
+ "name": "Health check",
+ "item": [
+ {
+ "name": "New Request",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Flow Testcases",
+ "item": [
+ {
+ "name": "QuickStart",
+ "item": [
+ {
+ "name": "Merchant Account - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id",
+ "if (jsonData?.merchant_id) {",
+ " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);",
+ " console.log(",
+ " \"- use {{merchant_id}} as collection variable for value\",",
+ " jsonData.merchant_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key",
+ "if (jsonData?.publishable_key) {",
+ " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);",
+ " console.log(",
+ " \"- use {{publishable_key}} as collection variable for value\",",
+ " jsonData.publishable_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"merchant_id\":\"postman_merchant_GHAction_{{$guid}}\",\"locker_id\":\"m0010\",\"merchant_name\":\"NewAge Retailer\",\"primary_business_details\":[{\"country\":\"US\",\"business\":\"default\"}],\"merchant_details\":{\"primary_contact_person\":\"John Test\",\"primary_email\":\"[email protected]\",\"primary_phone\":\"sunt laborum\",\"secondary_contact_person\":\"John Test2\",\"secondary_email\":\"[email protected]\",\"secondary_phone\":\"cillum do dolor id\",\"website\":\"www.example.com\",\"about_business\":\"Online Retail with a wide selection of organic products for North America\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"return_url\":\"https://duck.com\",\"webhook_details\":{\"webhook_version\":\"1.0.1\",\"webhook_username\":\"ekart_retail\",\"webhook_password\":\"password_ekart@123\",\"payment_created_enabled\":true,\"payment_succeeded_enabled\":true,\"payment_failed_enabled\":true},\"sub_merchants_enabled\":false,\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+ },
+ "response": []
+ },
+ {
+ "name": "API Key - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id",
+ "if (jsonData?.key_id) {",
+ " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);",
+ " console.log(",
+ " \"- use {{api_key_id}} as collection variable for value\",",
+ " jsonData.key_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Payment Connector - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",",
+ " function () {",
+ " pm.response.to.be.success;",
+ " },",
+ ");",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id",
+ "if (jsonData?.merchant_connector_id) {",
+ " pm.collectionVariables.set(",
+ " \"merchant_connector_id\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ " console.log(",
+ " \"- use {{merchant_connector_id}} as collection variable for value\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"zsl\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"bank_transfer\",\"payment_method_types\":[{\"payment_method_type\":\"local_bank_transfer\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":-1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have redirect_to_url as next action type",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have status = requires_customer_action",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"[email protected]\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Happy Cases",
+ "item": [
+ {
+ "name": "Scenario1-Create payment with confirm true",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have redirect_to_url as next action type",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have status = requires_customer_action",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"[email protected]\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "info": {
+ "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9",
+ "name": "zsl",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "27028646"
+ },
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
|
refactor
|
[ZSL] add Local bank Transfer (#4337)
|
42eedf3a8c2e62fc22bcead370d129ebaf11a00b
|
2023-11-23 17:22:20
|
Kartikeya Hegde
|
fix(drainer): increase jobs picked only when stream is not empty (#2958)
| false
|
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index a5294546de4..986240f0a36 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -15,7 +15,7 @@ level = "DEBUG" # What you see in your terminal.
[log.telemetry]
traces_enabled = false # Whether traces are enabled.
-metrics_enabled = false # Whether metrics are enabled.
+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
diff --git a/crates/drainer/src/lib.rs b/crates/drainer/src/lib.rs
index 7ccfd600d66..04dff49b746 100644
--- a/crates/drainer/src/lib.rs
+++ b/crates/drainer/src/lib.rs
@@ -23,7 +23,7 @@ pub async fn start_drainer(
loop_interval: u32,
) -> errors::DrainerResult<()> {
let mut stream_index: u8 = 0;
- let mut jobs_picked: u8 = 0;
+ let jobs_picked = Arc::new(atomic::AtomicU8::new(0));
let mut shutdown_interval =
tokio::time::interval(std::time::Duration::from_millis(shutdown_interval.into()));
@@ -61,11 +61,11 @@ pub async fn start_drainer(
stream_index,
max_read_count,
active_tasks.clone(),
+ jobs_picked.clone(),
));
- jobs_picked += 1;
}
- (stream_index, jobs_picked) = utils::increment_stream_index(
- (stream_index, jobs_picked),
+ stream_index = utils::increment_stream_index(
+ (stream_index, jobs_picked.clone()),
number_of_streams,
&mut loop_interval,
)
@@ -119,13 +119,19 @@ async fn drainer_handler(
stream_index: u8,
max_read_count: u64,
active_tasks: Arc<atomic::AtomicU64>,
+ jobs_picked: Arc<atomic::AtomicU8>,
) -> errors::DrainerResult<()> {
active_tasks.fetch_add(1, atomic::Ordering::Release);
let stream_name = utils::get_drainer_stream_name(store.clone(), stream_index);
- let drainer_result =
- Box::pin(drainer(store.clone(), max_read_count, stream_name.as_str())).await;
+ let drainer_result = Box::pin(drainer(
+ store.clone(),
+ max_read_count,
+ stream_name.as_str(),
+ jobs_picked,
+ ))
+ .await;
if let Err(error) = drainer_result {
logger::error!(?error)
@@ -145,11 +151,15 @@ async fn drainer(
store: Arc<Store>,
max_read_count: u64,
stream_name: &str,
+ jobs_picked: Arc<atomic::AtomicU8>,
) -> errors::DrainerResult<()> {
let stream_read =
match utils::read_from_stream(stream_name, max_read_count, store.redis_conn.as_ref()).await
{
- Ok(result) => result,
+ Ok(result) => {
+ jobs_picked.fetch_add(1, atomic::Ordering::SeqCst);
+ result
+ }
Err(error) => {
if let errors::DrainerError::RedisError(redis_err) = error.current_context() {
if let redis_interface::errors::RedisError::StreamEmptyOrNotAvailable =
diff --git a/crates/drainer/src/utils.rs b/crates/drainer/src/utils.rs
index 5a995652bb1..5abc7e474c2 100644
--- a/crates/drainer/src/utils.rs
+++ b/crates/drainer/src/utils.rs
@@ -1,4 +1,7 @@
-use std::{collections::HashMap, sync::Arc};
+use std::{
+ collections::HashMap,
+ sync::{atomic, Arc},
+};
use error_stack::IntoReport;
use redis_interface as redis;
@@ -127,19 +130,20 @@ pub fn parse_stream_entries<'a>(
// Here the output is in the format (stream_index, jobs_picked),
// similar to the first argument of the function
pub async fn increment_stream_index(
- (index, jobs_picked): (u8, u8),
+ (index, jobs_picked): (u8, Arc<atomic::AtomicU8>),
total_streams: u8,
interval: &mut tokio::time::Interval,
-) -> (u8, u8) {
+) -> u8 {
if index == total_streams - 1 {
interval.tick().await;
- match jobs_picked {
+ match jobs_picked.load(atomic::Ordering::SeqCst) {
0 => metrics::CYCLES_COMPLETED_UNSUCCESSFULLY.add(&metrics::CONTEXT, 1, &[]),
_ => metrics::CYCLES_COMPLETED_SUCCESSFULLY.add(&metrics::CONTEXT, 1, &[]),
}
- (0, 0)
+ jobs_picked.store(0, atomic::Ordering::SeqCst);
+ 0
} else {
- (index + 1, jobs_picked)
+ index + 1
}
}
|
fix
|
increase jobs picked only when stream is not empty (#2958)
|
dae14139604b52e11f84c1341bfcb2e58c62a884
|
2024-06-06 00:34:57
|
Swangi Kumari
|
refactor(connector): [KLARNA] Add dynamic fields for klarna payment method (#4891)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index ce039c1156e..7ee39a33d32 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -433,7 +433,7 @@ pub enum FieldType {
UserFullName,
UserEmailAddress,
UserPhoneNumber,
- UserCountryCode, //phone number's country code
+ UserPhoneNumberCountryCode, //phone number's country code
UserCountry { options: Vec<String> }, //for country inside payment method data ex- bank redirect
UserCurrency { options: Vec<String> },
UserCryptoCurrencyNetwork, //for crypto network associated with the cryptopcurrency
@@ -494,7 +494,7 @@ impl PartialEq for FieldType {
(Self::UserFullName, Self::UserFullName) => true,
(Self::UserEmailAddress, Self::UserEmailAddress) => true,
(Self::UserPhoneNumber, Self::UserPhoneNumber) => true,
- (Self::UserCountryCode, Self::UserCountryCode) => true,
+ (Self::UserPhoneNumberCountryCode, Self::UserPhoneNumberCountryCode) => true,
(
Self::UserCountry {
options: options_self,
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 6f1ce4458ea..1639963188f 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -8243,6 +8243,139 @@ impl Default for super::settings::RequiredFields {
common : HashMap::new(),
}
),
+ (
+ enums::Connector::Klarna,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from([
+ (
+ "shipping.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.first_name".to_string(),
+ display_name: "shipping_first_name".to_string(),
+ field_type: enums::FieldType::UserShippingName,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.last_name".to_string(),
+ display_name: "shipping_last_name".to_string(),
+ field_type: enums::FieldType::UserShippingName,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserShippingAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserShippingAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.line2".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.line2".to_string(),
+ display_name: "line2".to_string(),
+ field_type: enums::FieldType::UserShippingAddressLine2,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserShippingAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.state".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.state".to_string(),
+ display_name: "state".to_string(),
+ field_type: enums::FieldType::UserShippingAddressState,
+ value: None,
+ }
+ ),
+ (
+ "shipping.email".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "shipping.phone.number".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.phone.number".to_string(),
+ display_name: "phone_number".to_string(),
+ field_type: enums::FieldType::UserPhoneNumber,
+ value: None,
+ }
+ ),
+ (
+ "shipping.phone.country_code".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.phone.country_code".to_string(),
+ display_name: "phone_country_code".to_string(),
+ field_type: enums::FieldType::UserPhoneNumberCountryCode,
+ value: None,
+ }
+ ),
+ (
+ "shipping.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserShippingAddressCountry{
+ options: vec![
+ "AU".to_string(),
+ "AT".to_string(),
+ "BE".to_string(),
+ "CA".to_string(),
+ "CZ".to_string(),
+ "DK".to_string(),
+ "FI".to_string(),
+ "FR".to_string(),
+ "DE".to_string(),
+ "GR".to_string(),
+ "IE".to_string(),
+ "IT".to_string(),
+ "NL".to_string(),
+ "NZ".to_string(),
+ "NO".to_string(),
+ "PL".to_string(),
+ "PT".to_string(),
+ "ES".to_string(),
+ "SE".to_string(),
+ "CH".to_string(),
+ "GB".to_string(),
+ "US".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
+ ]),
+ }
+ )
]),
},
),
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index a12df1d916a..434e6e26781 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -9262,7 +9262,7 @@
{
"type": "string",
"enum": [
- "user_country_code"
+ "user_phone_number_country_code"
]
},
{
|
refactor
|
[KLARNA] Add dynamic fields for klarna payment method (#4891)
|
9be012826abe87ffa2d0cea5423aed3e50449de2
|
2024-11-28 05:52:13
|
github-actions
|
chore(version): 2024.11.28.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb6f79e9624..dd80af8cf7a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.11.28.0
+
+### Bug Fixes
+
+- **users:** Check lineage across entities in invite ([#6677](https://github.com/juspay/hyperswitch/pull/6677)) ([`f3424b7`](https://github.com/juspay/hyperswitch/commit/f3424b7576554215945f61b52f38e43bb1e5a8b7))
+
+### Refactors
+
+- **core:** Add error handling wrapper to wehbook ([#6636](https://github.com/juspay/hyperswitch/pull/6636)) ([`4b45d21`](https://github.com/juspay/hyperswitch/commit/4b45d21269437479435302aa1ea7d3d741e2a009))
+
+**Full Changelog:** [`2024.11.27.0...2024.11.28.0`](https://github.com/juspay/hyperswitch/compare/2024.11.27.0...2024.11.28.0)
+
+- - -
+
## 2024.11.27.0
### Features
|
chore
|
2024.11.28.0
|
c5ebb891d8e787d47d609344fd59fd6961331050
|
2023-09-27 18:39:42
|
github-actions
|
chore(version): v1.48.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1f37059173..25c6cbda775 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,32 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.48.0 (2023-09-27)
+
+### Features
+
+- **core:** Create surcharge_metadata field in payment attempt ([#2371](https://github.com/juspay/hyperswitch/pull/2371)) ([`934542e`](https://github.com/juspay/hyperswitch/commit/934542e92625620d71b940e99d4ae58239a60ce4))
+- **router:**
+ - Append payment_id to secondary key for payment_intent in kv flow ([#2378](https://github.com/juspay/hyperswitch/pull/2378)) ([`ee91552`](https://github.com/juspay/hyperswitch/commit/ee9155208d6c0a3d5d5422b469bfa7a80671cd86))
+ - Pass customers address in retrieve customer ([#2376](https://github.com/juspay/hyperswitch/pull/2376)) ([`f6cfb05`](https://github.com/juspay/hyperswitch/commit/f6cfb05fa042b5f68a5cb6fa17090d2beb91303b))
+
+### Bug Fixes
+
+- **db:** Merchant_account cache invalidation based on publishable_key ([#2365](https://github.com/juspay/hyperswitch/pull/2365)) ([`22a8291`](https://github.com/juspay/hyperswitch/commit/22a8291ea66bc564218af0a4a2695eef70ce6790))
+- **router:** Allow address updates in payments update flow ([#2375](https://github.com/juspay/hyperswitch/pull/2375)) ([`0d3dd00`](https://github.com/juspay/hyperswitch/commit/0d3dd0033c5ec9eabc967cb1872f0699546aba89))
+
+### Refactors
+
+- **connector:**
+ - [Payme]Enhance currency Mapping with ConnectorCurrencyCommon Trait ([#2194](https://github.com/juspay/hyperswitch/pull/2194)) ([`77b51d5`](https://github.com/juspay/hyperswitch/commit/77b51d5cbe531526f2f20a0ee4a78e95b00d87de))
+ - [bluesnap] add refund status and webhooks ([#2374](https://github.com/juspay/hyperswitch/pull/2374)) ([`fe43458`](https://github.com/juspay/hyperswitch/commit/fe43458ddc0fa1cc31f2b326056baea54af57136))
+- Insert requires cvv config to configs table if not found in db ([#2208](https://github.com/juspay/hyperswitch/pull/2208)) ([`68b3310`](https://github.com/juspay/hyperswitch/commit/68b3310993c5196f9f9038f27c5cd7dad82b24d1))
+
+**Full Changelog:** [`v1.47.0...v1.48.0`](https://github.com/juspay/hyperswitch/compare/v1.47.0...v1.48.0)
+
+- - -
+
+
## 1.47.0 (2023-09-27)
### Features
|
chore
|
v1.48.0
|
2798f575605cc4439166344e57ff19b612f1304a
|
2024-10-17 12:56:52
|
Riddhiagrawal001
|
fix(users): Add max wrong attempts for two-fa (#6247)
| false
|
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index bb61a025180..4dc2a1a301a 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -18,8 +18,9 @@ use crate::user::{
ResetPasswordRequest, RotatePasswordRequest, SendVerifyEmailRequest, SignUpRequest,
SignUpWithMerchantIdRequest, SsoSignInRequest, SwitchMerchantRequest,
SwitchOrganizationRequest, SwitchProfileRequest, TokenResponse, TwoFactorAuthStatusResponse,
- UpdateUserAccountDetailsRequest, UpdateUserAuthenticationMethodRequest, UserFromEmailRequest,
- UserMerchantCreate, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
+ TwoFactorStatus, UpdateUserAccountDetailsRequest, UpdateUserAuthenticationMethodRequest,
+ UserFromEmailRequest, UserMerchantCreate, VerifyEmailRequest, VerifyRecoveryCodeRequest,
+ VerifyTotpRequest,
};
#[cfg(feature = "recon")]
@@ -62,6 +63,7 @@ common_utils::impl_api_event_type!(
GetUserRoleDetailsResponseV2,
TokenResponse,
TwoFactorAuthStatusResponse,
+ TwoFactorStatus,
UserFromEmailRequest,
BeginTotpResponse,
VerifyRecoveryCodeRequest,
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index d66f9f3bc03..089089038b8 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -196,6 +196,23 @@ pub struct TwoFactorAuthStatusResponse {
pub recovery_code: bool,
}
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct TwoFactorAuthAttempts {
+ pub is_completed: bool,
+ pub remaining_attempts: u8,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct TwoFactorAuthStatusResponseWithAttempts {
+ pub totp: TwoFactorAuthAttempts,
+ pub recovery_code: TwoFactorAuthAttempts,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct TwoFactorStatus {
+ pub status: Option<TwoFactorAuthStatusResponseWithAttempts>,
+}
+
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UserFromEmailRequest {
pub token: Secret<String>,
diff --git a/crates/router/src/consts/user.rs b/crates/router/src/consts/user.rs
index 5984a876503..aa427992082 100644
--- a/crates/router/src/consts/user.rs
+++ b/crates/router/src/consts/user.rs
@@ -15,6 +15,10 @@ pub const TOTP_DIGITS: usize = 6;
pub const TOTP_VALIDITY_DURATION_IN_SECONDS: u64 = 30;
/// Number of totps allowed as network delay. 1 would mean one totp before current totp and one totp after are valids.
pub const TOTP_TOLERANCE: u8 = 1;
+/// Number of maximum attempts user has for totp
+pub const TOTP_MAX_ATTEMPTS: u8 = 4;
+/// Number of maximum attempts user has for recovery code
+pub const RECOVERY_CODE_MAX_ATTEMPTS: u8 = 4;
pub const MAX_PASSWORD_LENGTH: usize = 70;
pub const MIN_PASSWORD_LENGTH: usize = 8;
@@ -23,6 +27,10 @@ pub const REDIS_TOTP_PREFIX: &str = "TOTP_";
pub const REDIS_RECOVERY_CODE_PREFIX: &str = "RC_";
pub const REDIS_TOTP_SECRET_PREFIX: &str = "TOTP_SEC_";
pub const REDIS_TOTP_SECRET_TTL_IN_SECS: i64 = 15 * 60; // 15 minutes
+pub const REDIS_TOTP_ATTEMPTS_PREFIX: &str = "TOTP_ATTEMPTS_";
+pub const REDIS_RECOVERY_CODE_ATTEMPTS_PREFIX: &str = "RC_ATTEMPTS_";
+pub const REDIS_TOTP_ATTEMPTS_TTL_IN_SECS: i64 = 5 * 60; // 5 mins
+pub const REDIS_RECOVERY_CODE_ATTEMPTS_TTL_IN_SECS: i64 = 10 * 60; // 10 mins
pub const REDIS_SSO_PREFIX: &str = "SSO_";
pub const REDIS_SSO_TTL: i64 = 5 * 60; // 5 minutes
diff --git a/crates/router/src/core/errors/user.rs b/crates/router/src/core/errors/user.rs
index e3c4bedab72..df4ce1d8148 100644
--- a/crates/router/src/core/errors/user.rs
+++ b/crates/router/src/core/errors/user.rs
@@ -90,6 +90,10 @@ pub enum UserErrors {
SSOFailed,
#[error("profile_id missing in JWT")]
JwtProfileIdMissing,
+ #[error("Maximum attempts reached for TOTP")]
+ MaxTotpAttemptsReached,
+ #[error("Maximum attempts reached for Recovery Code")]
+ MaxRecoveryCodeAttemptsReached,
}
impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorResponse> for UserErrors {
@@ -229,6 +233,12 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
Self::JwtProfileIdMissing => {
AER::Unauthorized(ApiError::new(sub_code, 47, self.get_error_message(), None))
}
+ Self::MaxTotpAttemptsReached => {
+ AER::BadRequest(ApiError::new(sub_code, 48, self.get_error_message(), None))
+ }
+ Self::MaxRecoveryCodeAttemptsReached => {
+ AER::BadRequest(ApiError::new(sub_code, 49, self.get_error_message(), None))
+ }
}
}
}
@@ -269,6 +279,8 @@ impl UserErrors {
Self::InvalidTotp => "Invalid TOTP",
Self::TotpRequired => "TOTP required",
Self::InvalidRecoveryCode => "Invalid Recovery Code",
+ Self::MaxTotpAttemptsReached => "Maximum attempts reached for TOTP",
+ Self::MaxRecoveryCodeAttemptsReached => "Maximum attempts reached for Recovery Code",
Self::TwoFactorAuthRequired => "Two factor auth required",
Self::TwoFactorAuthNotSetup => "Two factor auth not setup",
Self::TotpSecretNotFound => "TOTP secret not found",
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index c816c73a524..822c29b21d9 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -1686,6 +1686,13 @@ pub async fn verify_totp(
return Err(UserErrors::TotpNotSetup.into());
}
+ let user_totp_attempts =
+ tfa_utils::get_totp_attempts_from_redis(&state, &user_token.user_id).await?;
+
+ if user_totp_attempts >= consts::user::TOTP_MAX_ATTEMPTS {
+ return Err(UserErrors::MaxTotpAttemptsReached.into());
+ }
+
let user_totp_secret = user_from_db
.decrypt_and_get_totp_secret(&state)
.await?
@@ -1702,6 +1709,13 @@ pub async fn verify_totp(
.change_context(UserErrors::InternalServerError)?
!= req.totp.expose()
{
+ let _ = tfa_utils::insert_totp_attempts_in_redis(
+ &state,
+ &user_token.user_id,
+ user_totp_attempts + 1,
+ )
+ .await
+ .inspect_err(|error| logger::error!(?error));
return Err(UserErrors::InvalidTotp.into());
}
@@ -1856,15 +1870,31 @@ pub async fn verify_recovery_code(
return Err(UserErrors::TwoFactorAuthNotSetup.into());
}
+ let user_recovery_code_attempts =
+ tfa_utils::get_recovery_code_attempts_from_redis(&state, &user_token.user_id).await?;
+
+ if user_recovery_code_attempts >= consts::user::RECOVERY_CODE_MAX_ATTEMPTS {
+ return Err(UserErrors::MaxRecoveryCodeAttemptsReached.into());
+ }
+
let mut recovery_codes = user_from_db
.get_recovery_codes()
.ok_or(UserErrors::InternalServerError)?;
- let matching_index = utils::user::password::get_index_for_correct_recovery_code(
+ let Some(matching_index) = utils::user::password::get_index_for_correct_recovery_code(
&req.recovery_code,
&recovery_codes,
)?
- .ok_or(UserErrors::InvalidRecoveryCode)?;
+ else {
+ let _ = tfa_utils::insert_recovery_code_attempts_in_redis(
+ &state,
+ &user_token.user_id,
+ user_recovery_code_attempts + 1,
+ )
+ .await
+ .inspect_err(|error| logger::error!(?error));
+ return Err(UserErrors::InvalidRecoveryCode.into());
+ };
tfa_utils::insert_recovery_code_in_redis(&state, user_from_db.get_user_id()).await?;
let _ = recovery_codes.remove(matching_index);
@@ -1924,10 +1954,17 @@ pub async fn terminate_two_factor_auth(
}
}
- let current_flow = domain::CurrentFlow::new(user_token, domain::SPTFlow::TOTP.into())?;
+ let current_flow = domain::CurrentFlow::new(user_token.clone(), domain::SPTFlow::TOTP.into())?;
let next_flow = current_flow.next(user_from_db, &state).await?;
let token = next_flow.get_token(&state).await?;
+ let _ = tfa_utils::delete_totp_attempts_from_redis(&state, &user_token.user_id)
+ .await
+ .inspect_err(|error| logger::error!(?error));
+ let _ = tfa_utils::delete_recovery_code_attempts_from_redis(&state, &user_token.user_id)
+ .await
+ .inspect_err(|error| logger::error!(?error));
+
auth::cookies::set_cookie_response(
user_api::TokenResponse {
token: token.clone(),
@@ -1950,6 +1987,40 @@ pub async fn check_two_factor_auth_status(
))
}
+pub async fn check_two_factor_auth_status_with_attempts(
+ state: SessionState,
+ user_token: auth::UserIdFromAuth,
+) -> UserResponse<user_api::TwoFactorStatus> {
+ let user_from_db: domain::UserFromStorage = state
+ .global_store
+ .find_user_by_id(&user_token.user_id)
+ .await
+ .change_context(UserErrors::InternalServerError)?
+ .into();
+ if user_from_db.get_totp_status() == TotpStatus::NotSet {
+ return Ok(ApplicationResponse::Json(user_api::TwoFactorStatus {
+ status: None,
+ }));
+ };
+
+ let totp = user_api::TwoFactorAuthAttempts {
+ is_completed: tfa_utils::check_totp_in_redis(&state, &user_token.user_id).await?,
+ remaining_attempts: consts::user::TOTP_MAX_ATTEMPTS
+ - tfa_utils::get_totp_attempts_from_redis(&state, &user_token.user_id).await?,
+ };
+ let recovery_code = user_api::TwoFactorAuthAttempts {
+ is_completed: tfa_utils::check_recovery_code_in_redis(&state, &user_token.user_id).await?,
+ remaining_attempts: consts::user::RECOVERY_CODE_MAX_ATTEMPTS
+ - tfa_utils::get_recovery_code_attempts_from_redis(&state, &user_token.user_id).await?,
+ };
+ Ok(ApplicationResponse::Json(user_api::TwoFactorStatus {
+ status: Some(user_api::TwoFactorAuthStatusResponseWithAttempts {
+ totp,
+ recovery_code,
+ }),
+ }))
+}
+
pub async fn create_user_authentication_method(
state: SessionState,
req: user_api::CreateUserAuthenticationMethodRequest,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 823cb25b004..560aa0d34ef 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1853,7 +1853,12 @@ impl User {
// Two factor auth routes
route = route.service(
web::scope("/2fa")
+ // TODO: to be deprecated
.service(web::resource("").route(web::get().to(user::check_two_factor_auth_status)))
+ .service(
+ web::resource("/v2")
+ .route(web::get().to(user::check_two_factor_auth_status_with_attempts)),
+ )
.service(
web::scope("/totp")
.service(web::resource("/begin").route(web::get().to(user::totp_begin)))
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 16786e71768..e07a2fa10ef 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -682,6 +682,23 @@ pub async fn check_two_factor_auth_status(
.await
}
+pub async fn check_two_factor_auth_status_with_attempts(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+) -> HttpResponse {
+ let flow = Flow::TwoFactorAuthStatus;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ (),
+ |state, user, _, _| user_core::check_two_factor_auth_status_with_attempts(state, user),
+ &auth::SinglePurposeOrLoginTokenAuth(TokenPurpose::TOTP),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
pub async fn get_sso_auth_url(
state: web::Data<AppState>,
req: HttpRequest,
diff --git a/crates/router/src/utils/user/two_factor_auth.rs b/crates/router/src/utils/user/two_factor_auth.rs
index bebe58ebd86..73d692a00e0 100644
--- a/crates/router/src/utils/user/two_factor_auth.rs
+++ b/crates/router/src/utils/user/two_factor_auth.rs
@@ -139,3 +139,90 @@ pub async fn delete_recovery_code_from_redis(
.change_context(UserErrors::InternalServerError)
.map(|_| ())
}
+
+fn get_totp_attempts_key(user_id: &str) -> String {
+ format!("{}{}", consts::user::REDIS_TOTP_ATTEMPTS_PREFIX, user_id)
+}
+fn get_recovery_code_attempts_key(user_id: &str) -> String {
+ format!(
+ "{}{}",
+ consts::user::REDIS_RECOVERY_CODE_ATTEMPTS_PREFIX,
+ user_id
+ )
+}
+
+pub async fn insert_totp_attempts_in_redis(
+ state: &SessionState,
+ user_id: &str,
+ user_totp_attempts: u8,
+) -> UserResult<()> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .set_key_with_expiry(
+ &get_totp_attempts_key(user_id),
+ user_totp_attempts,
+ consts::user::REDIS_TOTP_ATTEMPTS_TTL_IN_SECS,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+}
+pub async fn get_totp_attempts_from_redis(state: &SessionState, user_id: &str) -> UserResult<u8> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .get_key::<Option<u8>>(&get_totp_attempts_key(user_id))
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .map(|v| v.unwrap_or(0))
+}
+
+pub async fn insert_recovery_code_attempts_in_redis(
+ state: &SessionState,
+ user_id: &str,
+ user_recovery_code_attempts: u8,
+) -> UserResult<()> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .set_key_with_expiry(
+ &get_recovery_code_attempts_key(user_id),
+ user_recovery_code_attempts,
+ consts::user::REDIS_RECOVERY_CODE_ATTEMPTS_TTL_IN_SECS,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+}
+
+pub async fn get_recovery_code_attempts_from_redis(
+ state: &SessionState,
+ user_id: &str,
+) -> UserResult<u8> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .get_key::<Option<u8>>(&get_recovery_code_attempts_key(user_id))
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .map(|v| v.unwrap_or(0))
+}
+
+pub async fn delete_totp_attempts_from_redis(
+ state: &SessionState,
+ user_id: &str,
+) -> UserResult<()> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .delete_key(&get_totp_attempts_key(user_id))
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .map(|_| ())
+}
+
+pub async fn delete_recovery_code_attempts_from_redis(
+ state: &SessionState,
+ user_id: &str,
+) -> UserResult<()> {
+ let redis_conn = super::get_redis_connection(state)?;
+ redis_conn
+ .delete_key(&get_recovery_code_attempts_key(user_id))
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .map(|_| ())
+}
|
fix
|
Add max wrong attempts for two-fa (#6247)
|
032d58cdbbf388cf25cbf2e43b0117b83f7d076d
|
2024-02-28 19:10:20
|
Sagar naik
|
feat(analytics): add force retrieve call for force retrieve calls (#3565)
| false
|
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index d67166c0d04..87560032ea4 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -71,7 +71,7 @@ pub async fn payment_intents_create(
))
.await
}
-#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieveForceSync))]
pub async fn payment_intents_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@@ -96,7 +96,7 @@ pub async fn payment_intents_retrieve(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
- let flow = Flow::PaymentsRetrieve;
+ let flow = Flow::PaymentsRetrieveForceSync;
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(wrap::compatibility_api_wrap::<
_,
@@ -131,7 +131,7 @@ pub async fn payment_intents_retrieve(
))
.await
}
-#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
+#[instrument(skip_all, fields(flow))]
pub async fn payment_intents_retrieve_with_gateway_creds(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
@@ -160,7 +160,13 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
- let flow = Flow::PaymentsRetrieve;
+ let flow = match json_payload.force_sync {
+ Some(true) => Flow::PaymentsRetrieveForceSync,
+ _ => Flow::PaymentsRetrieve,
+ };
+
+ tracing::Span::current().record("flow", &flow.to_string());
+
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(wrap::compatibility_api_wrap::<
_,
diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rs
index 77c3a61fa78..80ebbc4f84d 100644
--- a/crates/router/src/compatibility/stripe/refunds.rs
+++ b/crates/router/src/compatibility/stripe/refunds.rs
@@ -57,14 +57,14 @@ pub async fn refund_create(
))
.await
}
-#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
+#[instrument(skip_all, fields(flow))]
pub async fn refund_retrieve_with_gateway_creds(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
form_payload: web::Bytes,
) -> HttpResponse {
- let refund_request = match qs_config
+ let refund_request: refund_types::RefundsRetrieveRequest = match qs_config
.deserialize_bytes(&form_payload)
.map_err(|err| report!(errors::StripeErrorCode::from(err)))
{
@@ -72,7 +72,12 @@ pub async fn refund_retrieve_with_gateway_creds(
Err(err) => return api::log_and_return_error_response(err),
};
- let flow = Flow::RefundsRetrieve;
+ let flow = match refund_request.force_sync {
+ Some(true) => Flow::RefundsRetrieveForceSync,
+ _ => Flow::RefundsRetrieve,
+ };
+
+ tracing::Span::current().record("flow", &flow.to_string());
Box::pin(wrap::compatibility_api_wrap::<
_,
@@ -103,7 +108,7 @@ pub async fn refund_retrieve_with_gateway_creds(
))
.await
}
-#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
+#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieveForceSync))]
pub async fn refund_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@@ -115,7 +120,7 @@ pub async fn refund_retrieve(
merchant_connector_details: None,
};
- let flow = Flow::RefundsRetrieve;
+ let flow = Flow::RefundsRetrieveForceSync;
Box::pin(wrap::compatibility_api_wrap::<
_,
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 515e41ec91f..6522dc4697c 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -78,7 +78,7 @@ pub async fn setup_intents_create(
))
.await
}
-#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieve))]
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsRetrieveForceSync))]
pub async fn setup_intents_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
@@ -103,7 +103,7 @@ pub async fn setup_intents_retrieve(
Err(err) => return api::log_and_return_error_response(report!(err)),
};
- let flow = Flow::PaymentsRetrieve;
+ let flow = Flow::PaymentsRetrieveForceSync;
Box::pin(wrap::compatibility_api_wrap::<
_,
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index edbdee7bf6f..b209fd57169 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -103,6 +103,7 @@ impl From<Flow> for ApiIdentifier {
Flow::PaymentsCreate
| Flow::PaymentsRetrieve
+ | Flow::PaymentsRetrieveForceSync
| Flow::PaymentsUpdate
| Flow::PaymentsConfirm
| Flow::PaymentsCapture
@@ -124,6 +125,7 @@ impl From<Flow> for ApiIdentifier {
Flow::RefundsCreate
| Flow::RefundsRetrieve
+ | Flow::RefundsRetrieveForceSync
| Flow::RefundsUpdate
| Flow::RefundsList => Self::Refunds,
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index b822e6d4e68..24849d828e2 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -229,7 +229,7 @@ pub async fn payments_start(
operation_id = "Retrieve a Payment",
security(("api_key" = []), ("publishable_key" = []))
)]
-#[instrument(skip(state, req), fields(flow = ?Flow::PaymentsRetrieve, payment_id))]
+#[instrument(skip(state, req), fields(flow, payment_id))]
// #[get("/{payment_id}")]
pub async fn payments_retrieve(
state: web::Data<app::AppState>,
@@ -237,7 +237,10 @@ pub async fn payments_retrieve(
path: web::Path<String>,
json_payload: web::Query<payment_types::PaymentRetrieveBody>,
) -> impl Responder {
- let flow = Flow::PaymentsRetrieve;
+ let flow = match json_payload.force_sync {
+ Some(true) => Flow::PaymentsRetrieveForceSync,
+ _ => Flow::PaymentsRetrieve,
+ };
let payload = payment_types::PaymentsRetrieveRequest {
resource_id: payment_types::PaymentIdType::PaymentIntentId(path.to_string()),
merchant_id: json_payload.merchant_id.clone(),
@@ -249,6 +252,7 @@ pub async fn payments_retrieve(
};
tracing::Span::current().record("payment_id", &path.to_string());
+ tracing::Span::current().record("flow", &flow.to_string());
let (auth_type, auth_flow) =
match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
@@ -300,7 +304,7 @@ pub async fn payments_retrieve(
operation_id = "Retrieve a Payment",
security(("api_key" = []))
)]
-#[instrument(skip(state, req), fields(flow = ?Flow::PaymentsRetrieve, payment_id))]
+#[instrument(skip(state, req), fields(flow, payment_id))]
// #[post("/sync")]
pub async fn payments_retrieve_with_gateway_creds(
state: web::Data<app::AppState>,
@@ -320,9 +324,13 @@ pub async fn payments_retrieve_with_gateway_creds(
merchant_connector_details: json_payload.merchant_connector_details.clone(),
..Default::default()
};
- let flow = Flow::PaymentsRetrieve;
+ let flow = match json_payload.force_sync {
+ Some(true) => Flow::PaymentsRetrieveForceSync,
+ _ => Flow::PaymentsRetrieve,
+ };
tracing::Span::current().record("payment_id", &json_payload.payment_id);
+ tracing::Span::current().record("flow", &flow.to_string());
let locking_action = payload.get_locking_input(flow.clone());
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 47e9f2bf42a..ef9ffb41124 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -63,7 +63,7 @@ pub async fn refunds_create(
operation_id = "Retrieve a Refund",
security(("api_key" = []))
)]
-#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
+#[instrument(skip_all, fields(flow))]
// #[get("/{id}")]
pub async fn refunds_retrieve(
state: web::Data<AppState>,
@@ -76,7 +76,12 @@ pub async fn refunds_retrieve(
force_sync: query_params.force_sync,
merchant_connector_details: None,
};
- let flow = Flow::RefundsRetrieve;
+ let flow = match query_params.force_sync {
+ Some(true) => Flow::RefundsRetrieveForceSync,
+ _ => Flow::RefundsRetrieve,
+ };
+
+ tracing::Span::current().record("flow", &flow.to_string());
Box::pin(api::server_wrap(
flow,
@@ -115,14 +120,20 @@ pub async fn refunds_retrieve(
operation_id = "Retrieve a Refund",
security(("api_key" = []))
)]
-#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieve))]
+#[instrument(skip_all, fields(flow))]
// #[post("/sync")]
pub async fn refunds_retrieve_with_body(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<refunds::RefundsRetrieveRequest>,
) -> HttpResponse {
- let flow = Flow::RefundsRetrieve;
+ let flow = match json_payload.force_sync {
+ Some(true) => Flow::RefundsRetrieveForceSync,
+ _ => Flow::RefundsRetrieve,
+ };
+
+ tracing::Span::current().record("flow", &flow.to_string());
+
Box::pin(api::server_wrap(
flow,
state,
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 4790e60acb1..08148084349 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -129,6 +129,8 @@ pub enum Flow {
PaymentsCreate,
/// Payments Retrieve flow.
PaymentsRetrieve,
+ /// Payments Retrieve force sync flow.
+ PaymentsRetrieveForceSync,
/// Payments update flow.
PaymentsUpdate,
/// Payments confirm flow.
@@ -170,6 +172,8 @@ pub enum Flow {
RefundsCreate,
/// Refunds retrieve flow.
RefundsRetrieve,
+ /// Refunds retrieve force sync flow.
+ RefundsRetrieveForceSync,
/// Refunds update flow.
RefundsUpdate,
/// Refunds list flow.
|
feat
|
add force retrieve call for force retrieve calls (#3565)
|
5e4b0826e6375b4e85916ee4990e405bb27e2a78
|
2024-07-10 22:51:06
|
Swangi Kumari
|
refactor(connector): Update connector_refund_id and Refactor Webhook Status (#5280)
| false
|
diff --git a/crates/router/src/connector/razorpay/transformers.rs b/crates/router/src/connector/razorpay/transformers.rs
index 5e9d6ff1dd4..5618c85d531 100644
--- a/crates/router/src/connector/razorpay/transformers.rs
+++ b/crates/router/src/connector/razorpay/transformers.rs
@@ -1220,7 +1220,25 @@ impl From<RefundStatus> for enums::RefundStatus {
pub struct RefundResponse {
txn_id: Option<String>,
- refund: Refund,
+ refund: RefundRes,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RefundRes {
+ id: u64,
+ status: RefundStatus,
+ amount: FloatMajorUnit,
+ merchant_id: Option<Secret<String>>,
+ gateway: Gateway,
+ txn_detail_id: u64,
+ unique_request_id: String,
+ epg_txn_id: Option<String>,
+ response_code: Option<String>,
+ error_message: Option<String>,
+ processed: bool,
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
+ date_created: Option<PrimitiveDateTime>,
}
impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
@@ -1230,11 +1248,35 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
fn try_from(
item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.refund.unique_request_id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.refund.status),
+ let epg_txn_id = item.response.refund.epg_txn_id.clone();
+ let refund_status = enums::RefundStatus::from(item.response.refund.status);
+
+ let response = match epg_txn_id {
+ Some(epg_txn_id) => Ok(types::RefundsResponseData {
+ connector_refund_id: epg_txn_id,
+ refund_status,
+ }),
+ None => Err(types::ErrorResponse {
+ code: item
+ .response
+ .refund
+ .error_message
+ .clone()
+ .unwrap_or(consts::NO_ERROR_CODE.to_string()),
+ message: item
+ .response
+ .refund
+ .response_code
+ .clone()
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: item.response.refund.response_code.clone(),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(item.response.refund.unique_request_id.clone()),
}),
+ };
+ Ok(Self {
+ response,
..item.data
})
}
@@ -1249,7 +1291,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.refund.unique_request_id.to_string(),
+ connector_refund_id: item
+ .data
+ .request
+ .connector_refund_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
refund_status: enums::RefundStatus::from(item.response.refund.status),
}),
..item.data
@@ -1334,6 +1381,7 @@ pub enum RazorpayPaymentStatus {
Authorized,
Captured,
Failed,
+ Refunded,
}
#[derive(Debug, Serialize, Eq, PartialEq, Deserialize)]
@@ -1357,6 +1405,7 @@ impl TryFrom<RazorpayWebhookPayload> for api_models::webhooks::IncomingWebhookEv
}
RazorpayPaymentStatus::Captured => Some(Self::PaymentIntentSuccess),
RazorpayPaymentStatus::Failed => Some(Self::PaymentIntentFailure),
+ RazorpayPaymentStatus::Refunded => None,
},
|refund_data| match refund_data.entity.status {
RazorpayRefundStatus::Pending => None,
|
refactor
|
Update connector_refund_id and Refactor Webhook Status (#5280)
|
5aae1798257b5ee0c5a62104e4711748cdb5f935
|
2024-02-22 13:08:56
|
Swangi Kumari
|
refactor(connector): [NMI] add hyperswitch loader to card 3ds (#3755)
| false
|
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 6ac349d4931..01b56329e54 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -1783,6 +1783,31 @@ pub fn build_redirection_form(
head {
(PreEscaped(r#"<script src="https://secure.networkmerchants.com/js/v1/Gateway.js"></script>"#))
}
+ body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" {
+
+ div id="loader-wrapper" {
+ 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..." }
+ }
+
+ div id="threeds-wrapper" style="display: flex; width: 100%; height: 100vh; align-items: center; justify-content: center;" {""}
+ }
(PreEscaped(format!("<script>
const gateway = Gateway.create('{public_key_val}');
@@ -1800,10 +1825,10 @@ pub fn build_redirection_form(
responseForm.method='POST';
const threeDSsecureInterface = threeDS.createUI(options);
- threeDSsecureInterface.start('body');
threeDSsecureInterface.on('challenge', function(e) {{
console.log('Challenged');
+ document.getElementById('loader-wrapper').style.display = 'none';
}});
threeDSsecureInterface.on('complete', function(e) {{
@@ -1858,6 +1883,7 @@ pub fn build_redirection_form(
responseForm.submit();
}});
+ threeDSsecureInterface.start('#threeds-wrapper');
</script>"
)))
}
|
refactor
|
[NMI] add hyperswitch loader to card 3ds (#3755)
|
95810dd6d82632fc7777112c6b10edb96897af0b
|
2023-08-04 08:18:21
|
github-actions
|
chore(version): v1.16.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7e950782357..255319de78d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,30 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.16.0 (2023-08-04)
+
+### Features
+
+- **connector:**
+ - [Adyen] implement PaySafe ([#1805](https://github.com/juspay/hyperswitch/pull/1805)) ([`0f09199`](https://github.com/juspay/hyperswitch/commit/0f0919963fd1c887d3315039420a939bb377e738))
+ - [Adyen] Add support for gift cards balance ([#1672](https://github.com/juspay/hyperswitch/pull/1672)) ([`c4796ff`](https://github.com/juspay/hyperswitch/commit/c4796ffdb77a6270e7abc2e65e142ee4e7639b54))
+ - [Square] Add template code for connector Square ([#1834](https://github.com/juspay/hyperswitch/pull/1834)) ([`80b74e0`](https://github.com/juspay/hyperswitch/commit/80b74e096d56e08685ad52fb3049f6b611d587b3))
+ - [Adyen] implement Oxxo ([#1808](https://github.com/juspay/hyperswitch/pull/1808)) ([`5ed3f34`](https://github.com/juspay/hyperswitch/commit/5ed3f34c24c82d182921d317361bc9fc72be58ce))
+
+### Bug Fixes
+
+- **webhooks:** Do not send duplicate webhooks ([#1850](https://github.com/juspay/hyperswitch/pull/1850)) ([`0d996b8`](https://github.com/juspay/hyperswitch/commit/0d996b8960c7445289e451744c4bdeeb87d7d567))
+
+### Refactors
+
+- **connector:** Use utility function to raise payment method not implemented errors ([#1847](https://github.com/juspay/hyperswitch/pull/1847)) ([`f2fcc25`](https://github.com/juspay/hyperswitch/commit/f2fcc2595ae6f1c0ac5553c1a21ab33a6078b3e2))
+- **payment_methods:** Add `requires_cvv` field to customer payment method list api object ([#1852](https://github.com/juspay/hyperswitch/pull/1852)) ([`2dec2ca`](https://github.com/juspay/hyperswitch/commit/2dec2ca50bbac0eed6f9fc562662b86436b4b656))
+
+**Full Changelog:** [`v1.15.0...v1.16.0`](https://github.com/juspay/hyperswitch/compare/v1.15.0...v1.16.0)
+
+- - -
+
+
## 1.15.0 (2023-08-03)
### Features
|
chore
|
v1.16.0
|
d0a041c361668d0eff6c9b0dde67351b6ed43d19
|
2024-11-14 01:19:59
|
Sakil Mostak
|
feat(core): add Mobile Payment (Direct Carrier Billing) as a payment method (#6196)
| false
|
diff --git a/.typos.toml b/.typos.toml
index d2ffb8a5b10..109e411884a 100644
--- a/.typos.toml
+++ b/.typos.toml
@@ -41,7 +41,7 @@ ws2ipdef = "ws2ipdef" # WinSock Extension
ws2tcpip = "ws2tcpip" # WinSock Extension
ZAR = "ZAR" # South African Rand currency code
JOD = "JOD" # Jordan currency code
-
+Payed = "Payed" # Paid status for digital virgo
[default.extend-words]
aci = "aci" # Name of a connector
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 0385aa55a20..74a2bb8d2a7 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -5826,6 +5826,7 @@
"cybersource",
"datatrans",
"deutschebank",
+ "digitalvirgo",
"dlocal",
"ebanx",
"fiserv",
@@ -8076,6 +8077,24 @@
"enum": [
"browser_ip"
]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_msisdn"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_client_identifier"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "order_details_product_name"
+ ]
}
],
"description": "Possible field type of required fields in payment_method_data"
@@ -10528,6 +10547,71 @@
"MobilePayRedirection": {
"type": "object"
},
+ "MobilePaymentConsent": {
+ "type": "string",
+ "enum": [
+ "consent_required",
+ "consent_not_required",
+ "consent_optional"
+ ]
+ },
+ "MobilePaymentData": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "direct_carrier_billing"
+ ],
+ "properties": {
+ "direct_carrier_billing": {
+ "type": "object",
+ "required": [
+ "msisdn"
+ ],
+ "properties": {
+ "msisdn": {
+ "type": "string",
+ "description": "The phone number of the user",
+ "example": "1234567890"
+ },
+ "client_uid": {
+ "type": "string",
+ "description": "Unique user id",
+ "example": "02iacdYXGI9CnyJdoN8c7",
+ "nullable": true
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "MobilePaymentNextStepData": {
+ "type": "object",
+ "required": [
+ "consent_data_required"
+ ],
+ "properties": {
+ "consent_data_required": {
+ "$ref": "#/components/schemas/MobilePaymentConsent"
+ }
+ }
+ },
+ "MobilePaymentResponse": {
+ "allOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MobilePaymentData"
+ }
+ ],
+ "nullable": true
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
"MomoRedirection": {
"type": "object"
},
@@ -10828,6 +10912,25 @@
]
}
}
+ },
+ {
+ "type": "object",
+ "description": "Contains consent to collect otp for mobile payment",
+ "required": [
+ "consent_data_required",
+ "type"
+ ],
+ "properties": {
+ "consent_data_required": {
+ "$ref": "#/components/schemas/MobilePaymentConsent"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "collect_otp"
+ ]
+ }
+ }
}
],
"discriminator": {
@@ -10842,7 +10945,8 @@
"invoke_sdk_client",
"trigger_api",
"display_bank_transfer_information",
- "display_wait_screen"
+ "display_wait_screen",
+ "collect_otp"
]
},
"NoThirdPartySdkSessionResponse": {
@@ -11844,7 +11948,8 @@
"one_click",
"link_wallet",
"invoke_payment_app",
- "display_wait_screen"
+ "display_wait_screen",
+ "collect_otp"
]
},
"PaymentLinkConfig": {
@@ -12136,7 +12241,8 @@
"upi",
"voucher",
"gift_card",
- "open_banking"
+ "open_banking",
+ "mobile_payment"
]
},
"PaymentMethodCollectLinkRequest": {
@@ -12543,6 +12649,18 @@
"$ref": "#/components/schemas/OpenBankingData"
}
}
+ },
+ {
+ "type": "object",
+ "title": "MobilePayment",
+ "required": [
+ "mobile_payment"
+ ],
+ "properties": {
+ "mobile_payment": {
+ "$ref": "#/components/schemas/MobilePaymentData"
+ }
+ }
}
]
},
@@ -12749,6 +12867,17 @@
"$ref": "#/components/schemas/OpenBankingResponse"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "mobile_payment"
+ ],
+ "properties": {
+ "mobile_payment": {
+ "$ref": "#/components/schemas/MobilePaymentResponse"
+ }
+ }
}
]
},
@@ -13118,7 +13247,8 @@
"pay_easy",
"local_bank_transfer",
"mifinity",
- "open_banking_pis"
+ "open_banking_pis",
+ "direct_carrier_billing"
]
},
"PaymentMethodUpdate": {
@@ -17921,6 +18051,7 @@
"cybersource",
"datatrans",
"deutschebank",
+ "digitalvirgo",
"dlocal",
"ebanx",
"fiserv",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 733ba96237c..2e4133c473e 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -8651,6 +8651,7 @@
"cybersource",
"datatrans",
"deutschebank",
+ "digitalvirgo",
"dlocal",
"ebanx",
"fiserv",
@@ -10829,6 +10830,24 @@
"enum": [
"browser_ip"
]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_msisdn"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_client_identifier"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "order_details_product_name"
+ ]
}
],
"description": "Possible field type of required fields in payment_method_data"
@@ -13661,6 +13680,71 @@
"MobilePayRedirection": {
"type": "object"
},
+ "MobilePaymentConsent": {
+ "type": "string",
+ "enum": [
+ "consent_required",
+ "consent_not_required",
+ "consent_optional"
+ ]
+ },
+ "MobilePaymentData": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "direct_carrier_billing"
+ ],
+ "properties": {
+ "direct_carrier_billing": {
+ "type": "object",
+ "required": [
+ "msisdn"
+ ],
+ "properties": {
+ "msisdn": {
+ "type": "string",
+ "description": "The phone number of the user",
+ "example": "1234567890"
+ },
+ "client_uid": {
+ "type": "string",
+ "description": "Unique user id",
+ "example": "02iacdYXGI9CnyJdoN8c7",
+ "nullable": true
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "MobilePaymentNextStepData": {
+ "type": "object",
+ "required": [
+ "consent_data_required"
+ ],
+ "properties": {
+ "consent_data_required": {
+ "$ref": "#/components/schemas/MobilePaymentConsent"
+ }
+ }
+ },
+ "MobilePaymentResponse": {
+ "allOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MobilePaymentData"
+ }
+ ],
+ "nullable": true
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
"MomoRedirection": {
"type": "object"
},
@@ -13961,6 +14045,25 @@
]
}
}
+ },
+ {
+ "type": "object",
+ "description": "Contains consent to collect otp for mobile payment",
+ "required": [
+ "consent_data_required",
+ "type"
+ ],
+ "properties": {
+ "consent_data_required": {
+ "$ref": "#/components/schemas/MobilePaymentConsent"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "collect_otp"
+ ]
+ }
+ }
}
],
"discriminator": {
@@ -13975,7 +14078,8 @@
"invoke_sdk_client",
"trigger_api",
"display_bank_transfer_information",
- "display_wait_screen"
+ "display_wait_screen",
+ "collect_otp"
]
},
"NoThirdPartySdkSessionResponse": {
@@ -14970,7 +15074,8 @@
"one_click",
"link_wallet",
"invoke_payment_app",
- "display_wait_screen"
+ "display_wait_screen",
+ "collect_otp"
]
},
"PaymentLinkConfig": {
@@ -15262,7 +15367,8 @@
"upi",
"voucher",
"gift_card",
- "open_banking"
+ "open_banking",
+ "mobile_payment"
]
},
"PaymentMethodCollectLinkRequest": {
@@ -15669,6 +15775,18 @@
"$ref": "#/components/schemas/OpenBankingData"
}
}
+ },
+ {
+ "type": "object",
+ "title": "MobilePayment",
+ "required": [
+ "mobile_payment"
+ ],
+ "properties": {
+ "mobile_payment": {
+ "$ref": "#/components/schemas/MobilePaymentData"
+ }
+ }
}
]
},
@@ -15875,6 +15993,17 @@
"$ref": "#/components/schemas/OpenBankingResponse"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "mobile_payment"
+ ],
+ "properties": {
+ "mobile_payment": {
+ "$ref": "#/components/schemas/MobilePaymentResponse"
+ }
+ }
}
]
},
@@ -16244,7 +16373,8 @@
"pay_easy",
"local_bank_transfer",
"mifinity",
- "open_banking_pis"
+ "open_banking_pis",
+ "direct_carrier_billing"
]
},
"PaymentMethodUpdate": {
@@ -22485,6 +22615,7 @@
"cybersource",
"datatrans",
"deutschebank",
+ "digitalvirgo",
"dlocal",
"ebanx",
"fiserv",
diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs
index b705d88df59..77081f49957 100644
--- a/crates/api_models/src/connector_enums.rs
+++ b/crates/api_models/src/connector_enums.rs
@@ -71,7 +71,7 @@ pub enum Connector {
Cybersource,
Datatrans,
Deutschebank,
- // Digitalvirgo, template code for future usage
+ Digitalvirgo,
Dlocal,
Ebanx,
Fiserv,
@@ -212,6 +212,7 @@ impl Connector {
| Self::Coinbase
| Self::Cryptopay
| Self::Deutschebank
+ | Self::Digitalvirgo
| Self::Dlocal
| Self::Ebanx
| Self::Fiserv
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index e2b2b7fde46..817b047f38c 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -226,6 +226,9 @@ pub enum FieldType {
UserIban,
BrowserLanguage,
BrowserIp,
+ UserMsisdn,
+ UserClientIdentifier,
+ OrderDetailsProductName,
}
impl FieldType {
@@ -316,6 +319,9 @@ impl PartialEq for FieldType {
(Self::UserCpf, Self::UserCpf) => true,
(Self::UserCnpj, Self::UserCnpj) => true,
(Self::LanguagePreference { .. }, Self::LanguagePreference { .. }) => true,
+ (Self::UserMsisdn, Self::UserMsisdn) => true,
+ (Self::UserClientIdentifier, Self::UserClientIdentifier) => true,
+ (Self::OrderDetailsProductName, Self::OrderDetailsProductName) => true,
_unused => false,
}
}
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 567d601c45c..29c1b81df2f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1990,6 +1990,7 @@ mod payment_method_data_serde {
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::GiftCard(_)
@@ -2061,6 +2062,8 @@ pub enum PaymentMethodData {
CardToken(CardToken),
#[schema(title = "OpenBanking")]
OpenBanking(OpenBankingData),
+ #[schema(title = "MobilePayment")]
+ MobilePayment(MobilePaymentData),
}
pub trait GetAddressFromPaymentMethodData {
@@ -2085,7 +2088,8 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData {
| Self::GiftCard(_)
| Self::CardToken(_)
| Self::OpenBanking(_)
- | Self::MandatePayment => None,
+ | Self::MandatePayment
+ | Self::MobilePayment(_) => None,
}
}
}
@@ -2123,6 +2127,7 @@ impl PaymentMethodData {
Self::Voucher(_) => Some(api_enums::PaymentMethod::Voucher),
Self::GiftCard(_) => Some(api_enums::PaymentMethod::GiftCard),
Self::OpenBanking(_) => Some(api_enums::PaymentMethod::OpenBanking),
+ Self::MobilePayment(_) => Some(api_enums::PaymentMethod::MobilePayment),
Self::CardToken(_) | Self::MandatePayment => None,
}
}
@@ -2143,6 +2148,14 @@ impl GetPaymentMethodType for CardRedirectData {
}
}
+impl GetPaymentMethodType for MobilePaymentData {
+ fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
+ match self {
+ Self::DirectCarrierBilling { .. } => api_enums::PaymentMethodType::DirectCarrierBilling,
+ }
+ }
+}
+
impl GetPaymentMethodType for WalletData {
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
@@ -2432,6 +2445,10 @@ pub enum AdditionalPaymentData {
#[serde(flatten)]
details: Option<OpenBankingData>,
},
+ MobilePayment {
+ #[serde(flatten)]
+ details: Option<MobilePaymentData>,
+ },
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
@@ -3232,6 +3249,20 @@ pub enum OpenBankingData {
#[serde(rename = "open_banking_pis")]
OpenBankingPIS {},
}
+
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum MobilePaymentData {
+ DirectCarrierBilling {
+ /// The phone number of the user
+ #[schema(value_type = String, example = "1234567890")]
+ msisdn: String,
+ /// Unique user id
+ #[schema(value_type = Option<String>, example = "02iacdYXGI9CnyJdoN8c7")]
+ client_uid: Option<String>,
+ },
+}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayWalletData {
@@ -3502,6 +3533,7 @@ where
| PaymentMethodDataResponse::GiftCard(_)
| PaymentMethodDataResponse::PayLater(_)
| PaymentMethodDataResponse::RealTimePayment(_)
+ | PaymentMethodDataResponse::MobilePayment(_)
| PaymentMethodDataResponse::Upi(_)
| PaymentMethodDataResponse::Wallet(_)
| PaymentMethodDataResponse::BankTransfer(_)
@@ -3538,6 +3570,7 @@ pub enum PaymentMethodDataResponse {
CardRedirect(Box<CardRedirectResponse>),
CardToken(Box<CardTokenResponse>),
OpenBanking(Box<OpenBankingResponse>),
+ MobilePayment(Box<MobilePaymentResponse>),
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -3597,6 +3630,12 @@ pub struct OpenBankingResponse {
details: Option<OpenBankingData>,
}
+#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct MobilePaymentResponse {
+ #[serde(flatten)]
+ details: Option<MobilePaymentData>,
+}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct RealTimePaymentDataResponse {
#[serde(flatten)]
@@ -3874,6 +3913,7 @@ pub enum NextActionType {
TriggerApi,
DisplayBankTransferInformation,
DisplayWaitScreen,
+ CollectOtp,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]
@@ -3930,6 +3970,10 @@ pub enum NextActionData {
InvokeSdkClient {
next_action_data: SdkNextActionData,
},
+ /// Contains consent to collect otp for mobile payment
+ CollectOtp {
+ consent_data_required: MobilePaymentConsent,
+ },
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]
@@ -4025,6 +4069,20 @@ pub struct VoucherNextStepData {
pub instructions_url: Option<Url>,
}
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct MobilePaymentNextStepData {
+ /// is consent details required to be shown by sdk
+ pub consent_data_required: MobilePaymentConsent,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum MobilePaymentConsent {
+ ConsentRequired,
+ ConsentNotRequired,
+ ConsentOptional,
+}
+
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct QrCodeNextStepsInstruction {
pub image_data_url: Url,
@@ -5134,6 +5192,9 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
AdditionalPaymentData::OpenBanking { details } => {
Self::OpenBanking(Box::new(OpenBankingResponse { details }))
}
+ AdditionalPaymentData::MobilePayment { details } => {
+ Self::MobilePayment(Box::new(MobilePaymentResponse { details }))
+ }
}
}
}
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index fe4b2c52290..9beaed75960 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -68,7 +68,7 @@ pub enum RoutableConnectors {
Cybersource,
Datatrans,
Deutschebank,
- // Digitalvirgo, template code for future usage
+ Digitalvirgo,
Dlocal,
Ebanx,
Fiserv,
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 6ddc47e499f..23dbab77825 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1469,6 +1469,8 @@ pub enum PaymentExperience {
InvokePaymentApp,
/// Contains the data for displaying wait screen
DisplayWaitScreen,
+ /// Represents that otp needs to be collect and contains if consent is required
+ CollectOtp,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display)]
@@ -1597,6 +1599,7 @@ pub enum PaymentMethodType {
Mifinity,
#[serde(rename = "open_banking_pis")]
OpenBankingPIS,
+ DirectCarrierBilling,
}
impl masking::SerializableSecret for PaymentMethodType {}
@@ -1637,6 +1640,7 @@ pub enum PaymentMethod {
Voucher,
GiftCard,
OpenBanking,
+ MobilePayment,
}
/// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow.
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index 77ff9e8e714..f5f7ba3decd 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1887,6 +1887,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Seicomart => Self::Voucher,
PaymentMethodType::PayEasy => Self::Voucher,
PaymentMethodType::OpenBankingPIS => Self::OpenBanking,
+ PaymentMethodType::DirectCarrierBilling => Self::MobilePayment,
}
}
}
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 923edd386de..3634fe730ca 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -342,6 +342,7 @@ impl ConnectorConfig {
Connector::Bambora => Ok(connector_data.bambora),
Connector::Datatrans => Ok(connector_data.datatrans),
Connector::Deutschebank => Ok(connector_data.deutschebank),
+ Connector::Digitalvirgo => Ok(connector_data.digitalvirgo),
Connector::Dlocal => Ok(connector_data.dlocal),
Connector::Ebanx => Ok(connector_data.ebanx_payout),
Connector::Fiserv => Ok(connector_data.fiserv),
diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs
index b6b2e8555e3..8a763b59218 100644
--- a/crates/connector_configs/src/response_modifier.rs
+++ b/crates/connector_configs/src/response_modifier.rs
@@ -20,6 +20,7 @@ impl ConnectorApiIntegrationPayload {
let mut gift_card_details: Vec<Provider> = Vec::new();
let mut card_redirect_details: Vec<Provider> = Vec::new();
let mut open_banking_details: Vec<Provider> = Vec::new();
+ let mut mobile_payment_details: Vec<Provider> = Vec::new();
if let Some(payment_methods_enabled) = response.payment_methods_enabled.clone() {
for methods in payment_methods_enabled {
@@ -221,6 +222,18 @@ impl ConnectorApiIntegrationPayload {
}
}
}
+ api_models::enums::PaymentMethod::MobilePayment => {
+ if let Some(payment_method_types) = methods.payment_method_types {
+ for method_type in payment_method_types {
+ mobile_payment_details.push(Provider {
+ payment_method_type: method_type.payment_method_type,
+ accepted_currencies: method_type.accepted_currencies.clone(),
+ accepted_countries: method_type.accepted_countries.clone(),
+ payment_experience: method_type.payment_experience,
+ })
+ }
+ }
+ }
}
}
}
diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs
index 88997691eb6..160e938ead3 100644
--- a/crates/connector_configs/src/transformer.rs
+++ b/crates/connector_configs/src/transformer.rs
@@ -62,6 +62,9 @@ impl DashboardRequestPayload {
| (_, PaymentMethodType::Paze) => {
Some(api_models::enums::PaymentExperience::InvokeSdkClient)
}
+ (_, PaymentMethodType::DirectCarrierBilling) => {
+ Some(api_models::enums::PaymentExperience::CollectOtp)
+ }
_ => Some(api_models::enums::PaymentExperience::RedirectToUrl),
},
}
@@ -142,7 +145,8 @@ impl DashboardRequestPayload {
| PaymentMethod::Voucher
| PaymentMethod::GiftCard
| PaymentMethod::OpenBanking
- | PaymentMethod::CardRedirect => {
+ | PaymentMethod::CardRedirect
+ | PaymentMethod::MobilePayment => {
if let Some(provider) = payload.provider {
let val = Self::transform_payment_method(
request.connector,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 886b2dd7ee7..5d41efc1a50 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1394,6 +1394,13 @@ api_key="Client ID"
key1="Merchant ID"
api_secret="Client Key"
+[digitalvirgo]
+[[digitalvirgo.mobile_payment]]
+ payment_method_type = "direct_carrier_billing"
+[digitalvirgo.connector_auth.BodyKey]
+api_key="Password"
+key1="Username"
+
[dlocal]
[[dlocal.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index d767417a043..5462c121c37 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1364,6 +1364,13 @@ api_key="Client ID"
key1="Merchant ID"
api_secret="Client Key"
+[digitalvirgo]
+[[digitalvirgo.mobile_payment]]
+ payment_method_type = "direct_carrier_billing"
+[digitalvirgo.connector_auth.BodyKey]
+api_key="Password"
+key1="Username"
+
[dlocal]
[[dlocal.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/euclid/src/dssa/graph.rs b/crates/euclid/src/dssa/graph.rs
index 13e11515382..30d71090f36 100644
--- a/crates/euclid/src/dssa/graph.rs
+++ b/crates/euclid/src/dssa/graph.rs
@@ -70,6 +70,7 @@ impl cgraph::NodeViz for dir::DirValue {
Self::CardRedirectType(crt) => crt.to_string(),
Self::RealTimePaymentType(rtpt) => rtpt.to_string(),
Self::OpenBankingType(ob) => ob.to_string(),
+ Self::MobilePaymentType(mpt) => mpt.to_string(),
}
}
}
diff --git a/crates/euclid/src/frontend/ast/lowering.rs b/crates/euclid/src/frontend/ast/lowering.rs
index 8a8ba695e9f..24fc1e80428 100644
--- a/crates/euclid/src/frontend/ast/lowering.rs
+++ b/crates/euclid/src/frontend/ast/lowering.rs
@@ -274,6 +274,8 @@ fn lower_comparison_inner<O: EuclidDirFilter>(
dir::DirKeyKind::CardRedirectType => lower_enum!(CardRedirectType, value),
+ dir::DirKeyKind::MobilePaymentType => lower_enum!(MobilePaymentType, value),
+
dir::DirKeyKind::RealTimePaymentType => lower_enum!(RealTimePaymentType, value),
dir::DirKeyKind::CardBin => {
diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs
index 9a7134e708a..1bfe1fa16b7 100644
--- a/crates/euclid/src/frontend/dir.rs
+++ b/crates/euclid/src/frontend/dir.rs
@@ -278,6 +278,13 @@ pub enum DirKeyKind {
props(Category = "Payment Method Types")
)]
OpenBankingType,
+ #[serde(rename = "mobile_payment")]
+ #[strum(
+ serialize = "mobile_payment",
+ detailed_message = "Supported types of mobile payment method",
+ props(Category = "Payment Method Types")
+ )]
+ MobilePaymentType,
}
pub trait EuclidDirFilter: Sized
@@ -327,6 +334,7 @@ impl DirKeyKind {
Self::CardRedirectType => types::DataType::EnumVariant,
Self::RealTimePaymentType => types::DataType::EnumVariant,
Self::OpenBankingType => types::DataType::EnumVariant,
+ Self::MobilePaymentType => types::DataType::EnumVariant,
}
}
pub fn get_value_set(&self) -> Option<Vec<DirValue>> {
@@ -459,6 +467,11 @@ impl DirKeyKind {
.map(DirValue::OpenBankingType)
.collect(),
),
+ Self::MobilePaymentType => Some(
+ enums::MobilePaymentType::iter()
+ .map(DirValue::MobilePaymentType)
+ .collect(),
+ ),
}
}
}
@@ -528,6 +541,8 @@ pub enum DirValue {
RealTimePaymentType(enums::RealTimePaymentType),
#[serde(rename = "open_banking")]
OpenBankingType(enums::OpenBankingType),
+ #[serde(rename = "mobile_payment")]
+ MobilePaymentType(enums::MobilePaymentType),
}
impl DirValue {
@@ -563,6 +578,7 @@ impl DirValue {
Self::GiftCardType(_) => (DirKeyKind::GiftCardType, None),
Self::RealTimePaymentType(_) => (DirKeyKind::RealTimePaymentType, None),
Self::OpenBankingType(_) => (DirKeyKind::OpenBankingType, None),
+ Self::MobilePaymentType(_) => (DirKeyKind::MobilePaymentType, None),
};
DirKey::new(kind, data)
@@ -599,6 +615,7 @@ impl DirValue {
Self::CardRedirectType(_) => None,
Self::RealTimePaymentType(_) => None,
Self::OpenBankingType(_) => None,
+ Self::MobilePaymentType(_) => None,
}
}
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index 136cdf4d981..6c96070159b 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -255,6 +255,25 @@ pub enum CardRedirectType {
CardRedirect,
}
+#[derive(
+ Clone,
+ Debug,
+ Hash,
+ PartialEq,
+ Eq,
+ strum::Display,
+ strum::VariantNames,
+ strum::EnumIter,
+ strum::EnumString,
+ serde::Serialize,
+ serde::Deserialize,
+)]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum MobilePaymentType {
+ DirectCarrierBilling,
+}
+
#[derive(
Clone,
Debug,
@@ -372,3 +391,4 @@ collect_variants!(GiftCardType);
collect_variants!(BankTransferType);
collect_variants!(CardRedirectType);
collect_variants!(OpenBankingType);
+collect_variants!(MobilePaymentType);
diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs
index da589ec3748..07ff2c4364e 100644
--- a/crates/euclid/src/frontend/dir/lowering.rs
+++ b/crates/euclid/src/frontend/dir/lowering.rs
@@ -144,6 +144,14 @@ impl From<enums::CardRedirectType> for global_enums::PaymentMethodType {
}
}
+impl From<enums::MobilePaymentType> for global_enums::PaymentMethodType {
+ fn from(value: enums::MobilePaymentType) -> Self {
+ match value {
+ enums::MobilePaymentType::DirectCarrierBilling => Self::DirectCarrierBilling,
+ }
+ }
+}
+
impl From<enums::BankRedirectType> for global_enums::PaymentMethodType {
fn from(value: enums::BankRedirectType) -> Self {
match value {
@@ -248,6 +256,7 @@ fn lower_value(dir_value: dir::DirValue) -> Result<EuclidValue, AnalysisErrorTyp
dir::DirValue::BusinessLabel(bl) => EuclidValue::BusinessLabel(bl),
dir::DirValue::SetupFutureUsage(sfu) => EuclidValue::SetupFutureUsage(sfu),
dir::DirValue::OpenBankingType(ob) => EuclidValue::PaymentMethodType(ob.into()),
+ dir::DirValue::MobilePaymentType(mp) => EuclidValue::PaymentMethodType(mp.into()),
})
}
diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs
index de0b619b120..914a9444918 100644
--- a/crates/euclid/src/frontend/dir/transformers.rs
+++ b/crates/euclid/src/frontend/dir/transformers.rs
@@ -39,6 +39,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
| global_enums::PaymentMethod::Upi
| global_enums::PaymentMethod::Voucher
| global_enums::PaymentMethod::OpenBanking
+ | global_enums::PaymentMethod::MobilePayment
| global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported),
},
global_enums::PaymentMethodType::Bacs => match self.1 {
@@ -55,6 +56,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
| global_enums::PaymentMethod::Upi
| global_enums::PaymentMethod::Voucher
| global_enums::PaymentMethod::OpenBanking
+ | global_enums::PaymentMethod::MobilePayment
| global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported),
},
global_enums::PaymentMethodType::Becs => Ok(dirval!(BankDebitType = Becs)),
@@ -72,6 +74,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
| global_enums::PaymentMethod::Upi
| global_enums::PaymentMethod::Voucher
| global_enums::PaymentMethod::OpenBanking
+ | global_enums::PaymentMethod::MobilePayment
| global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported),
},
global_enums::PaymentMethodType::AliPay => Ok(dirval!(WalletType = AliPay)),
@@ -189,6 +192,9 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
Ok(dirval!(OpenBankingType = OpenBankingPIS))
}
global_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)),
+ global_enums::PaymentMethodType::DirectCarrierBilling => {
+ Ok(dirval!(MobilePaymentType = DirectCarrierBilling))
+ }
}
}
}
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index 4f2e9aa3156..9f610f9e6a3 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -262,6 +262,7 @@ pub fn get_variant_values(key: &str) -> Result<JsValue, JsValue> {
dir::DirKeyKind::BankDebitType => dir_enums::BankDebitType::VARIANTS,
dir::DirKeyKind::RealTimePaymentType => dir_enums::RealTimePaymentType::VARIANTS,
dir::DirKeyKind::OpenBankingType => dir_enums::OpenBankingType::VARIANTS,
+ dir::DirKeyKind::MobilePaymentType => dir_enums::MobilePaymentType::VARIANTS,
dir::DirKeyKind::PaymentAmount
| dir::DirKeyKind::Connector
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
index 5345c550cd1..bb3bc399077 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
@@ -212,6 +212,7 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>>
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
index 567f519d794..f0ea149b0d6 100644
--- a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
@@ -221,6 +221,7 @@ impl TryFrom<BamboraRouterData<&types::PaymentsAuthorizeRouterData>> for Bambora
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
index 798f28d1f0a..05b9abae051 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
@@ -113,6 +113,7 @@ impl TryFrom<&types::TokenizationRouterData> for BillwerkTokenRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
index 1228edcaaea..cf65b9e5dfe 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
@@ -82,6 +82,7 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>>
| PaymentMethodData::Reward {}
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::Upi(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
index 5c59d73356f..af6486f008e 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
@@ -1,52 +1,62 @@
pub mod transformers;
+use base64::Engine;
+use common_enums::enums;
use common_utils::{
+ consts,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
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},
+ payments::{
+ Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, Session,
+ SetupMandate, Void,
+ },
refunds::{Execute, RSync},
},
router_request_types::{
- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
- RefundsData, SetupMandateRequestData,
+ AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
+ PaymentsSyncData, RefundsData, SetupMandateRequestData,
},
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
+ PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
+ RefundsRouterData,
},
};
use hyperswitch_interfaces::{
- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,
+ ConnectorValidation,
+ },
configs::Connectors,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
-use masking::{ExposeInterface, Mask};
+use masking::{Mask, PeekInterface};
use transformers as digitalvirgo;
use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Clone)]
pub struct Digitalvirgo {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Digitalvirgo {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &FloatMajorUnitForConnector,
}
}
}
@@ -63,6 +73,7 @@ impl api::Refund for Digitalvirgo {}
impl api::RefundExecute for Digitalvirgo {}
impl api::RefundSync for Digitalvirgo {}
impl api::PaymentToken for Digitalvirgo {}
+impl api::PaymentsCompleteAuthorize for Digitalvirgo {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Digitalvirgo
@@ -111,9 +122,14 @@ impl ConnectorCommon for Digitalvirgo {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = digitalvirgo::DigitalvirgoAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let encoded_api_key = consts::BASE64_ENGINE.encode(format!(
+ "{}:{}",
+ auth.username.peek(),
+ auth.password.peek()
+ ));
Ok(vec![(
headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
+ format!("Basic {encoded_api_key}").into_masked(),
)])
}
@@ -130,18 +146,68 @@ impl ConnectorCommon for Digitalvirgo {
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+ let error_code = response.cause.or(response.operation_error);
+
Ok(ErrorResponse {
status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
+ code: error_code
+ .clone()
+ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+ message: error_code
+ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+ reason: response.description,
attempt_status: None,
connector_transaction_id: None,
})
}
}
-impl ConnectorValidation for Digitalvirgo {}
+impl ConnectorValidation for Digitalvirgo {
+ fn validate_capture_method(
+ &self,
+ capture_method: Option<enums::CaptureMethod>,
+ _pmt: Option<enums::PaymentMethodType>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let capture_method = capture_method.unwrap_or_default();
+ match capture_method {
+ enums::CaptureMethod::Automatic => Ok(()),
+ enums::CaptureMethod::Manual
+ | enums::CaptureMethod::ManualMultiple
+ | enums::CaptureMethod::Scheduled => Err(utils::construct_not_supported_error_report(
+ capture_method,
+ self.id(),
+ )),
+ }
+ }
+
+ 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> {
+ // in case we dont have transaction id, we can make psync using attempt id
+ Ok(())
+ }
+}
+
+impl ConnectorRedirectResponse for Digitalvirgo {
+ fn get_flow_type(
+ &self,
+ _query_params: &str,
+ _json_payload: Option<serde_json::Value>,
+ action: enums::PaymentAction,
+ ) -> CustomResult<enums::CallConnectorAction, errors::ConnectorError> {
+ match action {
+ enums::PaymentAction::PSync
+ | enums::PaymentAction::CompleteAuthorize
+ | enums::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
+ Ok(enums::CallConnectorAction::Trigger)
+ }
+ }
+ }
+}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Digitalvirgo {}
@@ -168,9 +234,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!("{}/payment", self.base_url(connectors)))
}
fn get_request_body(
@@ -184,7 +250,17 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req.request.currency,
)?;
- let connector_router_data = digitalvirgo::DigitalvirgoRouterData::from((amount, req));
+ let surcharge_amount = req.request.surcharge_details.clone().and_then(|surcharge| {
+ utils::convert_amount(
+ self.amount_converter,
+ surcharge.surcharge_amount,
+ req.request.currency,
+ )
+ .ok()
+ });
+
+ let connector_router_data =
+ digitalvirgo::DigitalvirgoRouterData::from((amount, surcharge_amount, req));
let connector_req =
digitalvirgo::DigitalvirgoPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
@@ -255,10 +331,15 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Dig
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())
+ Ok(format!(
+ "{}{}{}",
+ self.base_url(connectors),
+ "/payment/state?partnerTransactionId=",
+ req.connector_request_reference_id
+ ))
}
fn build_request(
@@ -282,10 +363,14 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Dig
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: digitalvirgo::DigitalvirgoPaymentsResponse = res
+ let response_details: Vec<digitalvirgo::DigitalvirgoPaymentSyncResponse> = res
.response
.parse_struct("digitalvirgo PaymentsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response = response_details
+ .first()
+ .cloned()
+ .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -304,49 +389,54 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Dig
}
}
-impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Digitalvirgo {
+impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
+ for Digitalvirgo
+{
fn get_headers(
&self,
- req: &PaymentsCaptureRouterData,
+ req: &PaymentsCompleteAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
-
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
-
fn get_url(
&self,
- _req: &PaymentsCaptureRouterData,
- _connectors: &Connectors,
+ _req: &PaymentsCompleteAuthorizeRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!(
+ "{}{}",
+ self.base_url(connectors),
+ "/payment/confirmation"
+ ))
}
-
fn get_request_body(
&self,
- _req: &PaymentsCaptureRouterData,
+ req: &PaymentsCompleteAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ let connector_req = digitalvirgo::DigitalvirgoConfirmRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
-
fn build_request(
&self,
- req: &PaymentsCaptureRouterData,
+ req: &PaymentsCompleteAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .url(&types::PaymentsCompleteAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
.attach_default_headers()
- .headers(types::PaymentsCaptureType::get_headers(
+ .headers(types::PaymentsCompleteAuthorizeType::get_headers(
self, req, connectors,
)?)
- .set_body(types::PaymentsCaptureType::get_request_body(
+ .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
@@ -355,13 +445,13 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
fn handle_response(
&self,
- data: &PaymentsCaptureRouterData,
+ data: &PaymentsCompleteAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
- ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
let response: digitalvirgo::DigitalvirgoPaymentsResponse = res
.response
- .parse_struct("Digitalvirgo PaymentsCaptureResponse")
+ .parse_struct("DigitalvirgoPaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -381,158 +471,47 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
}
}
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Digitalvirgo {}
-
-impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Digitalvirgo {
- 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(
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Digitalvirgo {
+ fn build_request(
&self,
- _req: &RefundsRouterData<Execute>,
+ _req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
- ) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::FlowNotSupported {
+ flow: "capture".to_string(),
+ connector: "digitalvirgo".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 =
- digitalvirgo::DigitalvirgoRouterData::from((refund_amount, req));
- let connector_req =
- digitalvirgo::DigitalvirgoRefundRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
- }
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Digitalvirgo {}
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Digitalvirgo {
fn build_request(
&self,
- req: &RefundsRouterData<Execute>,
- connectors: &Connectors,
+ _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: digitalvirgo::RefundResponse = res
- .response
- .parse_struct("digitalvirgo 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)
+ Err(errors::ConnectorError::FlowNotSupported {
+ flow: "refund".to_string(),
+ connector: "digitalvirgo".to_string(),
+ }
+ .into())
}
}
impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Digitalvirgo {
- 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(
+ fn build_request(
&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: digitalvirgo::RefundResponse = res
- .response
- .parse_struct("digitalvirgo 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)
+ Err(errors::ConnectorError::FlowNotSupported {
+ flow: "refund_sync".to_string(),
+ connector: "digitalvirgo".to_string(),
+ }
+ .into())
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
index 856736842f9..a9408e4e1c5 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
@@ -1,49 +1,49 @@
use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::types::FloatMajorUnit;
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
+ payment_method_data::{MobilePaymentData, PaymentMethodData},
router_data::{ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
- types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+ types::{PaymentsAuthorizeRouterData, PaymentsCompleteAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
- utils::PaymentsAuthorizeRequestData,
+ utils::{PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData},
};
pub struct DigitalvirgoRouterData<T> {
- pub amount: StringMinorUnit,
+ pub amount: FloatMajorUnit,
+ pub surcharge_amount: Option<FloatMajorUnit>,
pub router_data: T,
}
-impl<T> From<(StringMinorUnit, T)> for DigitalvirgoRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
+impl<T> From<(FloatMajorUnit, Option<FloatMajorUnit>, T)> for DigitalvirgoRouterData<T> {
+ fn from((amount, surcharge_amount, item): (FloatMajorUnit, Option<FloatMajorUnit>, T)) -> Self {
Self {
amount,
+ surcharge_amount,
router_data: item,
}
}
}
#[derive(Default, Debug, Serialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
pub struct DigitalvirgoPaymentsRequest {
- amount: StringMinorUnit,
- card: DigitalvirgoCard,
-}
-
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct DigitalvirgoCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
+ amount: FloatMajorUnit,
+ amount_surcharge: Option<FloatMajorUnit>,
+ client_uid: Option<String>,
+ msisdn: String,
+ product_name: String,
+ description: Option<String>,
+ partner_transaction_id: String,
}
impl TryFrom<&DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>>
@@ -54,63 +54,80 @@ impl TryFrom<&DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>>
item: &DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = DigitalvirgoCard {
- 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,
- })
- }
+ PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data {
+ MobilePaymentData::DirectCarrierBilling { msisdn, client_uid } => {
+ let order_details = item.router_data.request.get_order_details()?;
+ let product_name = order_details
+ .first()
+ .map(|order| order.product_name.to_owned())
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "product_name",
+ })?;
+
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ amount_surcharge: item.surcharge_amount.to_owned(),
+ client_uid,
+ msisdn,
+ product_name,
+ description: item.router_data.description.to_owned(),
+ partner_transaction_id: item
+ .router_data
+ .connector_request_reference_id
+ .to_owned(),
+ })
+ }
+ },
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
}
pub struct DigitalvirgoAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) username: Secret<String>,
+ pub(super) password: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for DigitalvirgoAuthType {
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 {
+ username: key1.to_owned(),
+ password: api_key.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum DigitalvirgoPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+ Ok,
+ ConfirmPayment,
}
impl From<DigitalvirgoPaymentStatus> for common_enums::AttemptStatus {
fn from(item: DigitalvirgoPaymentStatus) -> Self {
match item {
- DigitalvirgoPaymentStatus::Succeeded => Self::Charged,
- DigitalvirgoPaymentStatus::Failed => Self::Failure,
- DigitalvirgoPaymentStatus::Processing => Self::Authorizing,
+ DigitalvirgoPaymentStatus::Ok => Self::Charged,
+ DigitalvirgoPaymentStatus::ConfirmPayment => Self::AuthenticationPending,
}
}
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct DigitalvirgoPaymentsResponse {
- status: DigitalvirgoPaymentStatus,
- id: String,
+ state: DigitalvirgoPaymentStatus,
+ transaction_id: String,
+ consent: Option<DigitalvirgoConsentStatus>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct DigitalvirgoConsentStatus {
+ required: Option<bool>,
}
impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentsResponse, T, PaymentsResponseData>>
@@ -120,10 +137,86 @@ impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentsResponse, T, Paymen
fn try_from(
item: ResponseRouterData<F, DigitalvirgoPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
+ // show if consent is required in next action
+ let connector_metadata = item
+ .response
+ .consent
+ .and_then(|consent_status| {
+ consent_status.required.map(|consent_required| {
+ if consent_required {
+ serde_json::json!({
+ "consent_data_required": "consent_required",
+ })
+ } else {
+ serde_json::json!({
+ "consent_data_required": "consent_not_required",
+ })
+ }
+ })
+ })
+ .or(Some(serde_json::json!({
+ "consent_data_required": "consent_not_required",
+ })));
Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
+ status: common_enums::AttemptStatus::from(item.response.state),
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum DigitalvirgoPaymentSyncStatus {
+ Accepted,
+ Payed,
+ Pending,
+ Cancelled,
+ Rejected,
+ Locked,
+}
+
+impl From<DigitalvirgoPaymentSyncStatus> for common_enums::AttemptStatus {
+ fn from(item: DigitalvirgoPaymentSyncStatus) -> Self {
+ match item {
+ DigitalvirgoPaymentSyncStatus::Accepted => Self::AuthenticationPending,
+ DigitalvirgoPaymentSyncStatus::Payed => Self::Charged,
+ DigitalvirgoPaymentSyncStatus::Pending | DigitalvirgoPaymentSyncStatus::Locked => {
+ Self::Pending
+ }
+ DigitalvirgoPaymentSyncStatus::Cancelled => Self::Voided,
+ DigitalvirgoPaymentSyncStatus::Rejected => Self::Failure,
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DigitalvirgoPaymentSyncResponse {
+ payment_status: DigitalvirgoPaymentSyncStatus,
+ transaction_id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentSyncResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, DigitalvirgoPaymentSyncResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.payment_status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
@@ -137,9 +230,43 @@ impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentsResponse, T, Paymen
}
}
+#[derive(Default, Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DigitalvirgoConfirmRequest {
+ transaction_id: String,
+ token: Secret<String>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DigitalvirgoRedirectResponseData {
+ otp: Secret<String>,
+}
+
+impl TryFrom<&PaymentsCompleteAuthorizeRouterData> for DigitalvirgoConfirmRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaymentsCompleteAuthorizeRouterData) -> Result<Self, Self::Error> {
+ let payload_data = item.request.get_redirect_response_payload()?.expose();
+
+ let otp_data: DigitalvirgoRedirectResponseData = serde_json::from_value(payload_data)
+ .change_context(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "otp for transaction",
+ })?;
+
+ Ok(Self {
+ transaction_id: item
+ .request
+ .connector_transaction_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
+ token: otp_data.otp,
+ })
+ }
+}
+
#[derive(Default, Debug, Serialize)]
pub struct DigitalvirgoRefundRequest {
- pub amount: StringMinorUnit,
+ pub amount: FloatMajorUnit,
}
impl<F> TryFrom<&DigitalvirgoRouterData<&RefundsRouterData<F>>> for DigitalvirgoRefundRequest {
@@ -166,7 +293,6 @@ impl From<RefundStatus> for enums::RefundStatus {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
}
}
}
@@ -209,8 +335,7 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct DigitalvirgoErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
+ pub cause: Option<String>,
+ pub operation_error: Option<String>,
+ pub description: Option<String>,
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
index f2a6e1b6a6f..d5a7f981a1b 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
@@ -166,6 +166,7 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
index 6f4f303ae8e..07562c3efbf 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
@@ -195,6 +195,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::Upi(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 813ab8beccd..f3c3685b5c1 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -515,6 +515,7 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Reward
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
index 6e67409238d..2583f47058b 100644
--- a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
@@ -140,6 +140,7 @@ impl TryFrom<&ForteRouterData<&types::PaymentsAuthorizeRouterData>> for FortePay
| PaymentMethodData::MandatePayment {}
| PaymentMethodData::Reward {}
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
index 66525d49c63..5d30146293c 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
@@ -96,6 +96,7 @@ impl TryFrom<&GlobepayRouterData<&types::PaymentsAuthorizeRouterData>> for Globe
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
index 427fef3836c..4a8ddf68df9 100644
--- a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
@@ -178,6 +178,7 @@ impl TryFrom<&SetupMandateRouterData> for HelcimVerifyRequest {
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
@@ -274,6 +275,7 @@ impl TryFrom<&HelcimRouterData<&PaymentsAuthorizeRouterData>> for HelcimPayments
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::Upi(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 3048a203d1b..180db626864 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -615,6 +615,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
| PaymentMethodData::Crypto(_)
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
@@ -795,6 +796,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
| PaymentMethodData::Crypto(_)
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
index 4149f740e76..6297b97ee98 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
@@ -618,6 +618,7 @@ fn get_payment_details_and_product(
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index d593864dbfc..b1e9c3015e8 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -408,6 +408,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
@@ -826,6 +827,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsCompleteAuthorizeRouterData>>
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
index 707e34a158c..cda9c6b1952 100644
--- a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
@@ -146,6 +146,7 @@ impl TryFrom<&PayeezyRouterData<&PaymentsAuthorizeRouterData>> for PayeezyPaymen
| PaymentMethod::BankDebit
| PaymentMethod::Reward
| PaymentMethod::RealTimePayment
+ | PaymentMethod::MobilePayment
| PaymentMethod::Upi
| PaymentMethod::Voucher
| PaymentMethod::OpenBanking
@@ -262,6 +263,7 @@ fn get_payment_method_data(
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
index 93ba3425978..74c8d1edb38 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
@@ -121,6 +121,7 @@ impl TryFrom<&PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
index 674f652a933..3b2164dfc97 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
@@ -405,6 +405,7 @@ impl
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index 4fb48938c42..540bcaebaae 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -266,6 +266,7 @@ where
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
@@ -479,6 +480,7 @@ impl<T> TryFrom<&Shift4RouterData<&RouterData<T, CompleteAuthorizeData, Payments
| Some(PaymentMethodData::Voucher(_))
| Some(PaymentMethodData::Reward)
| Some(PaymentMethodData::RealTimePayment(_))
+ | Some(PaymentMethodData::MobilePayment(_))
| Some(PaymentMethodData::Upi(_))
| Some(PaymentMethodData::OpenBanking(_))
| Some(PaymentMethodData::CardToken(_))
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index 0e6d3128b30..08ca9a54fa4 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -173,6 +173,7 @@ impl TryFrom<&types::TokenizationRouterData> for SquareTokenRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::OpenBanking(_)
@@ -293,6 +294,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::OpenBanking(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
index a8e9a7ad829..a675e3040e3 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
@@ -118,6 +118,7 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::CardRedirect(_)
@@ -272,6 +273,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::CardRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
index c867adaa23e..cd9fe63e4a7 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
@@ -102,6 +102,7 @@ impl TryFrom<&TsysRouterData<&types::PaymentsAuthorizeRouterData>> for TsysPayme
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
index b13d029185f..b8e1e99054a 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
@@ -143,6 +143,7 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
index 05986631c67..89ee8d1b29b 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
@@ -240,6 +240,7 @@ impl
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index b69e4bcd97b..fba589a4895 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -177,6 +177,7 @@ fn fetch_payment_instrument(
| PaymentMethodData::Crypto(_)
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::CardRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 166e7130483..7a30a434a5d 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -700,6 +700,7 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
index 8db75fe61aa..81019325113 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
@@ -178,6 +178,7 @@ impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPayment
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 81c079d5d52..6ee8926f8df 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -323,7 +323,6 @@ default_imp_for_complete_authorize!(
connectors::Cashtocode,
connectors::Coinbase,
connectors::Cryptopay,
- connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Elavon,
connectors::Fiserv,
@@ -491,7 +490,6 @@ default_imp_for_connector_redirect_response!(
connectors::Coinbase,
connectors::Cryptopay,
connectors::Deutschebank,
- connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Elavon,
connectors::Fiserv,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 81c9aa6084d..14596c0f2a2 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1985,6 +1985,7 @@ pub enum PaymentMethodDataType {
OpenBanking,
NetworkToken,
NetworkTransactionIdAndCardDetails,
+ DirectCarrierBilling,
}
impl From<PaymentMethodData> for PaymentMethodDataType {
@@ -2171,6 +2172,9 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
PaymentMethodData::OpenBanking(data) => match data {
hyperswitch_domain_models::payment_method_data::OpenBankingData::OpenBankingPIS { } => Self::OpenBanking
},
+ PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data {
+ hyperswitch_domain_models::payment_method_data::MobilePaymentData::DirectCarrierBilling { .. } => Self::DirectCarrierBilling,
+ },
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index e5f5fad9901..9e4d6cfbec5 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -36,6 +36,7 @@ pub enum PaymentMethodData {
CardToken(CardToken),
OpenBanking(OpenBankingData),
NetworkToken(NetworkTokenData),
+ MobilePayment(MobilePaymentData),
}
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -63,6 +64,7 @@ impl PaymentMethodData {
Self::Voucher(_) => Some(common_enums::PaymentMethod::Voucher),
Self::GiftCard(_) => Some(common_enums::PaymentMethod::GiftCard),
Self::OpenBanking(_) => Some(common_enums::PaymentMethod::OpenBanking),
+ Self::MobilePayment(_) => Some(common_enums::PaymentMethod::MobilePayment),
Self::CardToken(_) | Self::MandatePayment => None,
}
}
@@ -598,6 +600,17 @@ pub struct NetworkTokenData {
pub nick_name: Option<Secret<String>>,
}
+#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum MobilePaymentData {
+ DirectCarrierBilling {
+ /// The phone number of the user
+ msisdn: String,
+ /// Unique user identifier
+ client_uid: Option<String>,
+ },
+}
+
impl From<api_models::payments::PaymentMethodData> for PaymentMethodData {
fn from(api_model_payment_method_data: api_models::payments::PaymentMethodData) -> Self {
match api_model_payment_method_data {
@@ -645,6 +658,9 @@ impl From<api_models::payments::PaymentMethodData> for PaymentMethodData {
api_models::payments::PaymentMethodData::OpenBanking(ob_data) => {
Self::OpenBanking(From::from(ob_data))
}
+ api_models::payments::PaymentMethodData::MobilePayment(mobile_payment_data) => {
+ Self::MobilePayment(From::from(mobile_payment_data))
+ }
}
}
}
@@ -1397,6 +1413,27 @@ impl From<OpenBankingData> for api_models::payments::OpenBankingData {
}
}
+impl From<api_models::payments::MobilePaymentData> for MobilePaymentData {
+ fn from(value: api_models::payments::MobilePaymentData) -> Self {
+ match value {
+ api_models::payments::MobilePaymentData::DirectCarrierBilling {
+ msisdn,
+ client_uid,
+ } => Self::DirectCarrierBilling { msisdn, client_uid },
+ }
+ }
+}
+
+impl From<MobilePaymentData> for api_models::payments::MobilePaymentData {
+ fn from(value: MobilePaymentData) -> Self {
+ match value {
+ MobilePaymentData::DirectCarrierBilling { msisdn, client_uid } => {
+ Self::DirectCarrierBilling { msisdn, client_uid }
+ }
+ }
+ }
+}
+
#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TokenizedCardValue1 {
@@ -1647,6 +1684,14 @@ impl GetPaymentMethodType for OpenBankingData {
}
}
+impl GetPaymentMethodType for MobilePaymentData {
+ fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
+ match self {
+ Self::DirectCarrierBilling { .. } => api_enums::PaymentMethodType::DirectCarrierBilling,
+ }
+ }
+}
+
impl From<Card> for ExtendedCardInfo {
fn from(value: Card) -> Self {
Self {
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index e897292d6ff..e35c4672308 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -147,6 +147,9 @@ fn get_dir_value_payment_method(
Ok(dirval!(OpenBankingType = OpenBankingPIS))
}
api_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)),
+ api_enums::PaymentMethodType::DirectCarrierBilling => {
+ Ok(dirval!(MobilePaymentType = DirectCarrierBilling))
+ }
}
}
@@ -421,6 +424,7 @@ fn global_vec_pmt(
global_vector.append(collect_global_variants!(BankTransferType));
global_vector.append(collect_global_variants!(CardRedirectType));
global_vector.append(collect_global_variants!(OpenBankingType));
+ global_vector.append(collect_global_variants!(MobilePaymentType));
global_vector.push(dir::DirValue::PaymentMethod(
dir::enums::PaymentMethod::Card,
));
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index 3aaeb0586d6..89b8c5a34ad 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -104,6 +104,7 @@ impl IntoDirValue for api_enums::PaymentMethod {
Self::GiftCard => Ok(dirval!(PaymentMethod = GiftCard)),
Self::CardRedirect => Ok(dirval!(PaymentMethod = CardRedirect)),
Self::OpenBanking => Ok(dirval!(PaymentMethod = OpenBanking)),
+ Self::MobilePayment => Ok(dirval!(PaymentMethod = MobilePayment)),
}
}
}
@@ -158,6 +159,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
| api_enums::PaymentMethod::Reward
| api_enums::PaymentMethod::RealTimePayment
| api_enums::PaymentMethod::Upi
+ | api_enums::PaymentMethod::MobilePayment
| api_enums::PaymentMethod::Voucher
| api_enums::PaymentMethod::OpenBanking
| api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError(
@@ -176,6 +178,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
| api_enums::PaymentMethod::Reward
| api_enums::PaymentMethod::RealTimePayment
| api_enums::PaymentMethod::Upi
+ | api_enums::PaymentMethod::MobilePayment
| api_enums::PaymentMethod::Voucher
| api_enums::PaymentMethod::OpenBanking
| api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError(
@@ -195,6 +198,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
| api_enums::PaymentMethod::Reward
| api_enums::PaymentMethod::RealTimePayment
| api_enums::PaymentMethod::Upi
+ | api_enums::PaymentMethod::MobilePayment
| api_enums::PaymentMethod::Voucher
| api_enums::PaymentMethod::OpenBanking
| api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError(
@@ -308,6 +312,9 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
Ok(dirval!(OpenBankingType = OpenBankingPIS))
}
api_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)),
+ api_enums::PaymentMethodType::DirectCarrierBilling => {
+ Ok(dirval!(MobilePaymentType = DirectCarrierBilling))
+ }
}
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index c4a57830ae9..dc9274b71ee 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -440,6 +440,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::MultibancoBillingDetails,
api_models::payments::DokuBillingDetails,
api_models::payments::BankTransferInstructions,
+ api_models::payments::MobilePaymentNextStepData,
+ api_models::payments::MobilePaymentConsent,
api_models::payments::ReceiverDetails,
api_models::payments::AchTransfer,
api_models::payments::MultibancoTransferInstructions,
@@ -502,6 +504,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::CustomerDetails,
api_models::payments::GiftCardData,
api_models::payments::GiftCardDetails,
+ api_models::payments::MobilePaymentData,
+ api_models::payments::MobilePaymentResponse,
api_models::payments::Address,
api_models::payouts::CardPayout,
api_models::payouts::Wallet,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 7c09813ca6b..7417466bfd2 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -386,6 +386,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::MultibancoBillingDetails,
api_models::payments::DokuBillingDetails,
api_models::payments::BankTransferInstructions,
+ api_models::payments::MobilePaymentNextStepData,
+ api_models::payments::MobilePaymentConsent,
api_models::payments::ReceiverDetails,
api_models::payments::AchTransfer,
api_models::payments::MultibancoTransferInstructions,
@@ -445,6 +447,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::CustomerDetails,
api_models::payments::GiftCardData,
api_models::payments::GiftCardDetails,
+ api_models::payments::MobilePaymentData,
+ api_models::payments::MobilePaymentResponse,
api_models::payments::Address,
api_models::payouts::CardPayout,
api_models::payouts::Wallet,
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index f0e4b1169c8..55516eeb3bc 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -837,6 +837,9 @@ pub enum StripeNextAction {
InvokeSdkClient {
next_action_data: payments::SdkNextActionData,
},
+ CollectOtp {
+ consent_data_required: payments::MobilePaymentConsent,
+ },
}
pub(crate) fn into_stripe_next_action(
@@ -892,6 +895,11 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::InvokeSdkClient { next_action_data } => {
StripeNextAction::InvokeSdkClient { next_action_data }
}
+ payments::NextActionData::CollectOtp {
+ consent_data_required,
+ } => StripeNextAction::CollectOtp {
+ consent_data_required,
+ },
})
}
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 58a4d95b28f..03cf9742f70 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -391,6 +391,9 @@ pub enum StripeNextAction {
InvokeSdkClient {
next_action_data: payments::SdkNextActionData,
},
+ CollectOtp {
+ consent_data_required: payments::MobilePaymentConsent,
+ },
}
pub(crate) fn into_stripe_next_action(
@@ -446,6 +449,11 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::InvokeSdkClient { next_action_data } => {
StripeNextAction::InvokeSdkClient { next_action_data }
}
+ payments::NextActionData::CollectOtp {
+ consent_data_required,
+ } => StripeNextAction::CollectOtp {
+ consent_data_required,
+ },
})
}
diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
index c6a37729459..452e388c407 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -12903,6 +12903,56 @@ impl Default for settings::RequiredFields {
},
)
]))
+ ),
+ (
+ enums::PaymentMethod::MobilePayment,
+ PaymentMethodType(HashMap::from([
+ (
+ enums::PaymentMethodType::DirectCarrierBilling,
+ ConnectorFields {
+ fields: HashMap::from([
+ (
+ enums::Connector::Digitalvirgo,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from(
+ [
+ (
+ "payment_method_data.mobile_payment.direct_carrier_billing.msisdn".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.mobile_payment.direct_carrier_billing.msisdn".to_string(),
+ display_name: "mobile_number".to_string(),
+ field_type: enums::FieldType::UserMsisdn,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.mobile_payment.direct_carrier_billing.client_uid".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.mobile_payment.direct_carrier_billing.client_uid".to_string(),
+ display_name: "client_identifier".to_string(),
+ field_type: enums::FieldType::UserClientIdentifier,
+ value: None,
+ }
+ ),
+ (
+ "order_details.0.product_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "order_details.0.product_name".to_string(),
+ display_name: "product_name".to_string(),
+ field_type: enums::FieldType::OrderDetailsProductName,
+ value: None,
+ }
+ ),
+ ]
+ ),
+ }
+ ),
+ ])
+ }
+ )
+ ]))
)
]))
}
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index 77598f7be38..3e25799c02e 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -434,6 +434,7 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment
| domain::PaymentMethodData::BankTransfer(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::GiftCard(_)
| domain::PaymentMethodData::CardRedirect(_)
| domain::PaymentMethodData::Upi(_)
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index a82f4603944..7b491674e92 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -209,6 +209,7 @@ impl ConnectorValidation for Adyen {
}
},
PaymentMethodType::CardRedirect
+ | PaymentMethodType::DirectCarrierBilling
| PaymentMethodType::Fps
| PaymentMethodType::DuitNow
| PaymentMethodType::Interac
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 1c00d52a287..ec97b6ebad5 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1597,6 +1597,7 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::OpenBanking(_)
| domain::PaymentMethodData::CardToken(_)
@@ -2658,6 +2659,7 @@ impl<'a>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index c9427683d88..42effdb4b4a 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -339,6 +339,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -526,6 +527,7 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -587,6 +589,7 @@ impl
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index c6490cd6139..1530cbd82f8 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -319,6 +319,7 @@ impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -399,6 +400,7 @@ impl<F, T>
| common_enums::PaymentMethod::BankDebit
| common_enums::PaymentMethod::Reward
| common_enums::PaymentMethod::RealTimePayment
+ | common_enums::PaymentMethod::MobilePayment
| common_enums::PaymentMethod::Upi
| common_enums::PaymentMethod::Voucher
| common_enums::PaymentMethod::OpenBanking
@@ -1094,6 +1096,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -1587,6 +1590,7 @@ impl<F>
| common_enums::PaymentMethod::BankDebit
| common_enums::PaymentMethod::Reward
| common_enums::PaymentMethod::RealTimePayment
+ | common_enums::PaymentMethod::MobilePayment
| common_enums::PaymentMethod::Upi
| common_enums::PaymentMethod::Voucher
| common_enums::PaymentMethod::OpenBanking
@@ -1804,6 +1808,7 @@ impl<F>
| common_enums::PaymentMethod::BankDebit
| common_enums::PaymentMethod::Reward
| common_enums::PaymentMethod::RealTimePayment
+ | common_enums::PaymentMethod::MobilePayment
| common_enums::PaymentMethod::Upi
| common_enums::PaymentMethod::Voucher
| common_enums::PaymentMethod::OpenBanking
diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs
index 6db0ddac49b..022512ea1c1 100644
--- a/crates/router/src/connector/bluesnap/transformers.rs
+++ b/crates/router/src/connector/bluesnap/transformers.rs
@@ -223,6 +223,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::CardRedirect(_)
| domain::PaymentMethodData::Voucher(_)
@@ -391,6 +392,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::CardRedirect(_)
| domain::PaymentMethodData::Voucher(_)
diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs
index 777b795a438..4a947284d79 100644
--- a/crates/router/src/connector/boku/transformers.rs
+++ b/crates/router/src/connector/boku/transformers.rs
@@ -107,6 +107,7 @@ impl TryFrom<&BokuRouterData<&types::PaymentsAuthorizeRouterData>> for BokuPayme
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs
index f606e671a8d..bcef8124c65 100644
--- a/crates/router/src/connector/braintree/transformers.rs
+++ b/crates/router/src/connector/braintree/transformers.rs
@@ -305,6 +305,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -341,6 +342,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
| api_models::enums::PaymentMethod::BankDebit
| api_models::enums::PaymentMethod::Reward
| api_models::enums::PaymentMethod::RealTimePayment
+ | api_models::enums::PaymentMethod::MobilePayment
| api_models::enums::PaymentMethod::Upi
| api_models::enums::PaymentMethod::OpenBanking
| api_models::enums::PaymentMethod::Voucher
@@ -1105,6 +1107,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {
| domain::PaymentMethodData::OpenBanking(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -1717,6 +1720,7 @@ fn get_braintree_redirect_form(
| domain::PaymentMethodData::OpenBanking(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 686a9d57ac3..1f6b737367d 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -129,6 +129,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::CardRedirect(_)
@@ -375,6 +376,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index b99d0cb3283..c9ebba4a10d 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -245,6 +245,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -1970,6 +1971,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -2081,6 +2083,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -2808,6 +2811,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -2923,6 +2927,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/datatrans/transformers.rs b/crates/router/src/connector/datatrans/transformers.rs
index e9dcfd87071..7d52e64b4b7 100644
--- a/crates/router/src/connector/datatrans/transformers.rs
+++ b/crates/router/src/connector/datatrans/transformers.rs
@@ -183,6 +183,7 @@ impl TryFrom<&DatatransRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::CardRedirect(_)
| domain::PaymentMethodData::Voucher(_)
diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs
index 6a8fe01eede..c5c34574433 100644
--- a/crates/router/src/connector/gocardless/transformers.rs
+++ b/crates/router/src/connector/gocardless/transformers.rs
@@ -243,6 +243,7 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -416,6 +417,7 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs
index ec94b322fe7..fa5528eace3 100644
--- a/crates/router/src/connector/iatapay/transformers.rs
+++ b/crates/router/src/connector/iatapay/transformers.rs
@@ -203,6 +203,7 @@ impl
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
| domain::PaymentMethodData::CardToken(_)
diff --git a/crates/router/src/connector/itaubank/transformers.rs b/crates/router/src/connector/itaubank/transformers.rs
index 15dfb1ce240..127f8526afe 100644
--- a/crates/router/src/connector/itaubank/transformers.rs
+++ b/crates/router/src/connector/itaubank/transformers.rs
@@ -115,6 +115,7 @@ impl TryFrom<&ItaubankRouterData<&types::PaymentsAuthorizeRouterData>> for Itaub
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs
index 07bc6bd014c..6aa9b62ed6a 100644
--- a/crates/router/src/connector/klarna.rs
+++ b/crates/router/src/connector/klarna.rs
@@ -548,7 +548,8 @@ impl
| common_enums::PaymentExperience::InvokeSdkClient
| common_enums::PaymentExperience::LinkWallet
| common_enums::PaymentExperience::OneClick
- | common_enums::PaymentExperience::RedirectToUrl,
+ | common_enums::PaymentExperience::RedirectToUrl
+ | common_enums::PaymentExperience::CollectOtp,
common_enums::PaymentMethodType::Ach
| common_enums::PaymentMethodType::Affirm
| common_enums::PaymentMethodType::AfterpayClearpay
@@ -577,6 +578,7 @@ impl
| common_enums::PaymentMethodType::Dana
| common_enums::PaymentMethodType::DanamonVa
| common_enums::PaymentMethodType::Debit
+ | common_enums::PaymentMethodType::DirectCarrierBilling
| common_enums::PaymentMethodType::Efecty
| common_enums::PaymentMethodType::Eps
| common_enums::PaymentMethodType::Evoucher
@@ -661,6 +663,7 @@ impl
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::OpenBanking(_)
diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs
index 6ff52bb7eb1..1e2c420c767 100644
--- a/crates/router/src/connector/mifinity/transformers.rs
+++ b/crates/router/src/connector/mifinity/transformers.rs
@@ -192,6 +192,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 0ec9cc94888..4c33f020017 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -582,6 +582,7 @@ impl
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index 4556121db23..3e75130f575 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -350,6 +350,7 @@ impl TryFrom<&NoonRouterData<&types::PaymentsAuthorizeRouterData>> for NoonPayme
| domain::PaymentMethodData::MandatePayment {}
| domain::PaymentMethodData::Reward {}
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 209d1a7476f..121ec1d7b7c 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -993,6 +993,7 @@ where
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::CardRedirect(_)
@@ -1200,6 +1201,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
| Some(domain::PaymentMethodData::CardRedirect(..))
| Some(domain::PaymentMethodData::Reward)
| Some(domain::PaymentMethodData::RealTimePayment(..))
+ | Some(domain::PaymentMethodData::MobilePayment(..))
| Some(domain::PaymentMethodData::Upi(..))
| Some(domain::PaymentMethodData::OpenBanking(_))
| Some(domain::PaymentMethodData::CardToken(..))
diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs
index 44445a3d7d9..f55aa4325b0 100644
--- a/crates/router/src/connector/opayo/transformers.rs
+++ b/crates/router/src/connector/opayo/transformers.rs
@@ -71,6 +71,7 @@ impl TryFrom<&OpayoRouterData<&types::PaymentsAuthorizeRouterData>> for OpayoPay
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index 2f8b78e281a..7b6b67c8408 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -430,6 +430,7 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::CardRedirect(_)
| PaymentMethodData::Upi(_)
@@ -678,6 +679,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
@@ -745,6 +747,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest {
| Some(PaymentMethodData::MandatePayment)
| Some(PaymentMethodData::Reward)
| Some(PaymentMethodData::RealTimePayment(_))
+ | Some(PaymentMethodData::MobilePayment(_))
| Some(PaymentMethodData::Upi(_))
| Some(PaymentMethodData::Voucher(_))
| Some(PaymentMethodData::GiftCard(_))
@@ -787,6 +790,7 @@ impl TryFrom<&types::TokenizationRouterData> for CaptureBuyerRequest {
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 3e01c614e8e..ed8369607df 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -1010,6 +1010,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
| enums::PaymentMethodType::Dana
| enums::PaymentMethodType::DanamonVa
| enums::PaymentMethodType::Debit
+ | enums::PaymentMethodType::DirectCarrierBilling
| enums::PaymentMethodType::DuitNow
| enums::PaymentMethodType::Efecty
| enums::PaymentMethodType::Eps
@@ -1089,6 +1090,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
}
domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::OpenBanking(_)
diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rs
index 2d1ce4771ca..d809b9e770d 100644
--- a/crates/router/src/connector/placetopay/transformers.rs
+++ b/crates/router/src/connector/placetopay/transformers.rs
@@ -138,6 +138,7 @@ impl TryFrom<&PlacetopayRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index af82bda3e6a..32fa8da0320 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -697,6 +697,7 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::Alma
| enums::PaymentMethodType::ClassicReward
| enums::PaymentMethodType::Dana
+ | enums::PaymentMethodType::DirectCarrierBilling
| enums::PaymentMethodType::Efecty
| enums::PaymentMethodType::Evoucher
| enums::PaymentMethodType::GoPay
@@ -1344,6 +1345,7 @@ fn create_stripe_payment_method(
domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::OpenBanking(_)
| domain::PaymentMethodData::CardToken(_)
@@ -1757,6 +1759,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
| domain::payments::PaymentMethodData::MandatePayment
| domain::payments::PaymentMethodData::Reward
| domain::payments::PaymentMethodData::RealTimePayment(_)
+ | domain::payments::PaymentMethodData::MobilePayment(_)
| domain::payments::PaymentMethodData::Upi(_)
| domain::payments::PaymentMethodData::Voucher(_)
| domain::payments::PaymentMethodData::GiftCard(_)
@@ -3374,6 +3377,7 @@ impl
| Some(domain::PaymentMethodData::Crypto(..))
| Some(domain::PaymentMethodData::Reward)
| Some(domain::PaymentMethodData::RealTimePayment(..))
+ | Some(domain::PaymentMethodData::MobilePayment(..))
| Some(domain::PaymentMethodData::MandatePayment)
| Some(domain::PaymentMethodData::Upi(..))
| Some(domain::PaymentMethodData::GiftCard(..))
@@ -3831,6 +3835,7 @@ impl
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::GiftCard(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index 3b109a7f02e..8312b3e2659 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -430,6 +430,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index a9a5a01eef6..687edd5aa23 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2823,6 +2823,7 @@ pub enum PaymentMethodDataType {
VietQr,
OpenBanking,
NetworkToken,
+ DirectCarrierBilling,
}
impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
@@ -3009,6 +3010,9 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
domain::payments::PaymentMethodData::OpenBanking(data) => match data {
hyperswitch_domain_models::payment_method_data::OpenBankingData::OpenBankingPIS { } => Self::OpenBanking
},
+ domain::payments::PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data {
+ hyperswitch_domain_models::payment_method_data::MobilePaymentData::DirectCarrierBilling { .. } => Self::DirectCarrierBilling,
+ },
}
}
}
diff --git a/crates/router/src/connector/wellsfargo/transformers.rs b/crates/router/src/connector/wellsfargo/transformers.rs
index 1ca6c7bd968..3a2e35190e6 100644
--- a/crates/router/src/connector/wellsfargo/transformers.rs
+++ b/crates/router/src/connector/wellsfargo/transformers.rs
@@ -203,6 +203,7 @@ impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest {
| domain::PaymentMethodData::MandatePayment
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
@@ -1285,6 +1286,7 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>>
| domain::PaymentMethodData::Crypto(_)
| domain::PaymentMethodData::Reward
| domain::PaymentMethodData::RealTimePayment(_)
+ | domain::PaymentMethodData::MobilePayment(_)
| domain::PaymentMethodData::Upi(_)
| domain::PaymentMethodData::Voucher(_)
| domain::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index ba27e8b00db..49b16aaa3f4 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1335,11 +1335,10 @@ impl<'a> ConnectorAuthTypeAndMetadataValidation<'a> {
deutschebank::transformers::DeutschebankAuthType::try_from(self.auth_type)?;
Ok(())
}
- // Template code for future usage
- // api_enums::Connector::Digitalvirgo => {
- // digitalvirgo::transformers::DigitalvirgoAuthType::try_from(self.auth_type)?;
- // Ok(())
- // }
+ api_enums::Connector::Digitalvirgo => {
+ digitalvirgo::transformers::DigitalvirgoAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Dlocal => {
dlocal::transformers::DlocalAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index a765c1feaa9..932a4a26ee0 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -126,6 +126,7 @@ pub async fn retrieve_payment_method_core(
pm @ Some(domain::PaymentMethodData::CardRedirect(_)) => Ok((pm.to_owned(), None)),
pm @ Some(domain::PaymentMethodData::GiftCard(_)) => Ok((pm.to_owned(), None)),
pm @ Some(domain::PaymentMethodData::OpenBanking(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(domain::PaymentMethodData::MobilePayment(_)) => Ok((pm.to_owned(), None)),
pm_opt @ Some(pm @ domain::PaymentMethodData::BankTransfer(_)) => {
let payment_token = payment_helpers::store_payment_method_data_in_vault(
state,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 23cb25a52d5..2d480d71fe7 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1765,6 +1765,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
api_models::payments::NextActionData::WaitScreenInformation{..} => None,
api_models::payments::NextActionData::ThreeDsInvoke{..} => None,
api_models::payments::NextActionData::InvokeSdkClient{..} => None,
+ api_models::payments::NextActionData::CollectOtp{ .. } => None,
})
.ok_or(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index acaccccbb17..478211ec14c 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2821,6 +2821,10 @@ pub fn validate_payment_method_type_against_payment_method(
payment_method_type,
api_enums::PaymentMethodType::OpenBankingPIS
),
+ api_enums::PaymentMethod::MobilePayment => matches!(
+ payment_method_type,
+ api_enums::PaymentMethodType::DirectCarrierBilling
+ ),
}
}
@@ -4696,6 +4700,11 @@ pub async fn get_additional_payment_data(
})))
}
}
+ domain::PaymentMethodData::MobilePayment(mobile_payment) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::MobilePayment {
+ details: Some(mobile_payment.to_owned().into()),
+ },
+ )),
domain::PaymentMethodData::NetworkToken(_) => Ok(None),
}
}
@@ -5390,6 +5399,11 @@ pub fn get_key_params_for_surcharge_details(
ob_data.get_payment_method_type(),
None,
)),
+ domain::PaymentMethodData::MobilePayment(mobile_payment) => Some((
+ common_enums::PaymentMethod::MobilePayment,
+ mobile_payment.get_payment_method_type(),
+ None,
+ )),
domain::PaymentMethodData::CardToken(_)
| domain::PaymentMethodData::NetworkToken(_)
| domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => None,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 42c3c819fef..8fb36764c97 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1277,6 +1277,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
| hyperswitch_domain_models::payment_method_data::PaymentMethodData::RealTimePayment(
_,
)
+ | hyperswitch_domain_models::payment_method_data::PaymentMethodData::MobilePayment(_)
| hyperswitch_domain_models::payment_method_data::PaymentMethodData::Upi(_)
| hyperswitch_domain_models::payment_method_data::PaymentMethodData::Voucher(_)
| hyperswitch_domain_models::payment_method_data::PaymentMethodData::GiftCard(_)
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index ef0c3bd0d5f..8f2280355f9 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1560,6 +1560,8 @@ where
let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?;
+ let next_action_mobile_payment = mobile_payment_next_steps_check(&payment_attempt)?;
+
let next_action_containing_qr_code_url = qr_code_next_steps_check(payment_attempt.clone())?;
let papal_sdk_next_action = paypal_sdk_next_steps_check(payment_attempt.clone())?;
@@ -1590,6 +1592,11 @@ where
voucher_details: voucher_data,
}
}))
+ .or(next_action_mobile_payment.map(|mobile_payment_data| {
+ api_models::payments::NextActionData::CollectOtp {
+ consent_data_required: mobile_payment_data.consent_data_required,
+ }
+ }))
.or(next_action_containing_qr_code_url.map(|qr_code_data| {
api_models::payments::NextActionData::foreign_from(qr_code_data)
}))
@@ -2204,6 +2211,31 @@ pub fn voucher_next_steps_check(
Ok(voucher_next_step)
}
+#[cfg(feature = "v1")]
+pub fn mobile_payment_next_steps_check(
+ payment_attempt: &storage::PaymentAttempt,
+) -> RouterResult<Option<api_models::payments::MobilePaymentNextStepData>> {
+ let mobile_payment_next_step = if let Some(diesel_models::enums::PaymentMethod::MobilePayment) =
+ payment_attempt.payment_method
+ {
+ let mobile_paymebnt_next_steps: Option<api_models::payments::MobilePaymentNextStepData> =
+ payment_attempt
+ .connector_metadata
+ .clone()
+ .map(|metadata| {
+ metadata
+ .parse_value("MobilePaymentNextStepData")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse the Value to NextRequirements struct")
+ })
+ .transpose()?;
+ mobile_paymebnt_next_steps
+ } else {
+ None
+ };
+ Ok(mobile_payment_next_step)
+}
+
pub fn change_order_details_to_new_type(
order_amount: MinorUnit,
order_details: api_models::payments::OrderDetails,
diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs
index b175c8b7c03..31e65e8e0a7 100644
--- a/crates/router/src/core/payout_link.rs
+++ b/crates/router/src/core/payout_link.rs
@@ -418,6 +418,7 @@ pub async fn filter_payout_methods(
| common_enums::PaymentMethod::BankDebit
| common_enums::PaymentMethod::Reward
| common_enums::PaymentMethod::RealTimePayment
+ | common_enums::PaymentMethod::MobilePayment
| common_enums::PaymentMethod::Upi
| common_enums::PaymentMethod::Voucher
| common_enums::PaymentMethod::OpenBanking
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 985a6644524..b432c57c5d1 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -375,10 +375,9 @@ impl ConnectorData {
enums::Connector::Deutschebank => {
Ok(ConnectorEnum::Old(Box::new(connector::Deutschebank::new())))
}
- // tempplate code for future usage
- // enums::Connector::Digitalvirgo => {
- // Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new())))
- // }
+ enums::Connector::Digitalvirgo => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new())))
+ }
enums::Connector::Dlocal => Ok(ConnectorEnum::Old(Box::new(&connector::Dlocal))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector1 => Ok(ConnectorEnum::Old(Box::new(
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index f4d8c4f06b9..c97084a2297 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -231,6 +231,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Cybersource => Self::Cybersource,
api_enums::Connector::Datatrans => Self::Datatrans,
api_enums::Connector::Deutschebank => Self::Deutschebank,
+ api_enums::Connector::Digitalvirgo => Self::Digitalvirgo,
api_enums::Connector::Dlocal => Self::Dlocal,
api_enums::Connector::Ebanx => Self::Ebanx,
// api_enums::Connector::Elavon => Self::Elavon,
@@ -537,6 +538,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::DuitNow
| api_enums::PaymentMethodType::PromptPay
| api_enums::PaymentMethodType::VietQr => Self::RealTimePayment,
+ api_enums::PaymentMethodType::DirectCarrierBilling => Self::MobilePayment,
}
}
}
@@ -563,6 +565,7 @@ impl ForeignTryFrom<payments::PaymentMethodData> for api_enums::PaymentMethod {
payments::PaymentMethodData::GiftCard(..) => Ok(Self::GiftCard),
payments::PaymentMethodData::CardRedirect(..) => Ok(Self::CardRedirect),
payments::PaymentMethodData::OpenBanking(..) => Ok(Self::OpenBanking),
+ payments::PaymentMethodData::MobilePayment(..) => Ok(Self::MobilePayment),
payments::PaymentMethodData::MandatePayment => {
Err(errors::ApiErrorResponse::InvalidRequestData {
message: ("Mandate payments cannot have payment_method_data field".to_string()),
|
feat
|
add Mobile Payment (Direct Carrier Billing) as a payment method (#6196)
|
c05432c0bd70f222c2f898ce2cbb47a46364a490
|
2023-11-29 21:01:36
|
Prasunna Soppa
|
fix(pm_list): [Trustpay] Update Cards, Bank_redirect - blik pm type required field info for Trustpay (#2999)
| false
|
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index a92e63d6763..f5c3b46b27f 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -1910,14 +1910,63 @@ impl Default for super::settings::RequiredFields {
}
),
(
- "payment_method_data.card.card_holder_name".to_string(),
+ "billing.address.first_name".to_string(),
RequiredFieldInfo {
- required_field: "payment_method_data.card.card_holder_name".to_string(),
+ required_field: "billing.address.first_name".to_string(),
display_name: "card_holder_name".to_string(),
- field_type: enums::FieldType::UserFullName,
+ field_type: enums::FieldType::UserBillingName,
value: None,
}
- )
+ ),
+ (
+ "billing.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.last_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
]
),
common: HashMap::new()
@@ -3686,14 +3735,63 @@ impl Default for super::settings::RequiredFields {
}
),
(
- "payment_method_data.card.card_holder_name".to_string(),
+ "billing.address.first_name".to_string(),
RequiredFieldInfo {
- required_field: "payment_method_data.card.card_holder_name".to_string(),
+ required_field: "billing.address.first_name".to_string(),
display_name: "card_holder_name".to_string(),
- field_type: enums::FieldType::UserFullName,
+ field_type: enums::FieldType::UserBillingName,
value: None,
}
- )
+ ),
+ (
+ "billing.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.last_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
]
),
common: HashMap::new()
@@ -4056,6 +4154,64 @@ impl Default for super::settings::RequiredFields {
value: None,
}
),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.first_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.last_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
]),
}
)
|
fix
|
[Trustpay] Update Cards, Bank_redirect - blik pm type required field info for Trustpay (#2999)
|
3df42333566b646e9ca93d612a78ea8d38298df4
|
2024-12-10 16:38:34
|
Sandeep Kumar
|
feat(analytics): add support for multiple emails as input to forward reports (#6776)
| false
|
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 806eb4b6e0e..7f58c6b00d7 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -114,6 +114,7 @@ pub struct RefundDistributionBody {
#[serde(rename_all = "camelCase")]
pub struct ReportRequest {
pub time_range: TimeRange,
+ pub emails: Option<Vec<Secret<String, EmailStrategy>>>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
feat
|
add support for multiple emails as input to forward reports (#6776)
|
cb2000b08856ceb64201d0aff7d81665524665b2
|
2024-04-01 05:36:07
|
github-actions
|
chore(version): 2024.04.01.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f41ba2b094d..3ead87751c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,21 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.04.01.0
+
+### Features
+
+- **mandates:** Allow off-session payments using `payment_method_id` ([#4132](https://github.com/juspay/hyperswitch/pull/4132)) ([`7b337ac`](https://github.com/juspay/hyperswitch/commit/7b337ac39d72f90dd0ebe58133218896ff279313))
+- **payment_method:** API to list countries and currencies supported by a country and payment method type ([#4126](https://github.com/juspay/hyperswitch/pull/4126)) ([`74cd4a7`](https://github.com/juspay/hyperswitch/commit/74cd4a79526eb1a2dead87855e6a39248ec5ccb7))
+
+### Miscellaneous Tasks
+
+- **config:** Add billwerk base URL in deployment configs ([#4243](https://github.com/juspay/hyperswitch/pull/4243)) ([`e8289f0`](https://github.com/juspay/hyperswitch/commit/e8289f061d4735478cb1521de50f696d2412ad33))
+
+**Full Changelog:** [`2024.03.28.0...2024.04.01.0`](https://github.com/juspay/hyperswitch/compare/2024.03.28.0...2024.04.01.0)
+
+- - -
+
## 2024.03.28.0
### Features
|
chore
|
2024.04.01.0
|
fc670ea0dad3dc8ce3549cb8888952070d2f4396
|
2022-12-12 19:11:09
|
Nishant Joshi
|
fix(stripe): make mandate options optional in payment_method_options.… (#123)
| false
|
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 507b7b49fe7..b2f8aac0715 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -375,10 +375,10 @@ impl<F, T>
let mandate_reference =
item.response
.payment_method_options
- .map(|payment_method_options| match payment_method_options {
+ .and_then(|payment_method_options| match payment_method_options {
StripePaymentMethodOptions::Card {
mandate_options, ..
- } => mandate_options.reference,
+ } => mandate_options.map(|mandate_options| mandate_options.reference),
});
Ok(types::RouterData {
@@ -426,10 +426,10 @@ impl<F, T>
let mandate_reference =
item.response
.payment_method_options
- .map(|payment_method_options| match payment_method_options {
+ .and_then(|payment_method_options| match payment_method_options {
StripePaymentMethodOptions::Card {
mandate_options, ..
- } => mandate_options.reference,
+ } => mandate_options.map(|mandate_option| mandate_option.reference),
});
Ok(types::RouterData {
@@ -663,13 +663,14 @@ pub enum CancellationReason {
#[derive(Deserialize, Debug, Clone, Eq, PartialEq)]
#[non_exhaustive]
+#[serde(rename_all = "snake_case")]
pub enum StripePaymentMethodOptions {
Card {
- capture_method: String,
- mandate_options: StripeMandateOptions,
+ mandate_options: Option<StripeMandateOptions>,
},
}
-
+// #[derive(Deserialize, Debug, Clone, Eq, PartialEq)]
+// pub struct Card
#[derive(serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)]
pub struct StripeMandateOptions {
reference: String, // Extendable, But only important field to be captured
|
fix
|
make mandate options optional in payment_method_options.… (#123)
|
171d94f6457df91920597635e8160ff3bcf47369
|
2024-01-10 20:14:11
|
Sanchith Hegde
|
ci: use git commands for pushing commits and tags in nightly release workflows (#3314)
| false
|
diff --git a/.github/workflows/release-nightly-version-reusable.yml b/.github/workflows/release-nightly-version-reusable.yml
index deb8c44cc3c..accd8c12a91 100644
--- a/.github/workflows/release-nightly-version-reusable.yml
+++ b/.github/workflows/release-nightly-version-reusable.yml
@@ -3,11 +3,8 @@ name: Create a nightly tag
on:
workflow_call:
secrets:
- app_id:
- description: App ID for the GitHub app
- required: true
- app_private_key:
- description: Private key for the GitHub app
+ token:
+ description: GitHub token for authenticating with GitHub
required: true
outputs:
tag:
@@ -31,23 +28,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Generate GitHub app token
- id: generate_app_token
- uses: actions/create-github-app-token@v1
- with:
- app-id: ${{ secrets.app_id }}
- private-key: ${{ secrets.app_private_key }}
-
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
+ token: ${{ secrets.token }}
- name: Check if the workflow is run on an allowed branch
shell: bash
run: |
- if [[ "${{github.ref}}" != "refs/heads/${ALLOWED_BRANCH_NAME}" ]]; then
- echo "::error::This workflow is expected to be run from the '${ALLOWED_BRANCH_NAME}' branch. Current branch: '${{github.ref}}'"
+ if [[ "${{ github.ref }}" != "refs/heads/${ALLOWED_BRANCH_NAME}" ]]; then
+ echo "::error::This workflow is expected to be run from the '${ALLOWED_BRANCH_NAME}' branch. Current branch: '${{ github.ref }}'"
exit 1
fi
@@ -139,62 +130,22 @@ jobs:
}' CHANGELOG.md
rm release-notes.md
- # We make use of GitHub API calls to commit and tag the changelog instead of the simpler
- # `git commit`, `git tag` and `git push` commands to have signed commits and tags
- - name: Commit generated changelog and create tag
+ - name: Set git configuration
+ shell: bash
+ run: |
+ git config --local user.name 'github-actions'
+ git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
+
+ - name: Commit, tag and push generated changelog
shell: bash
- env:
- GH_TOKEN: ${{ steps.generate_app_token.outputs.token }}
run: |
- HEAD_COMMIT="$(git rev-parse 'HEAD^{commit}')"
-
- # Create a tree based on the HEAD commit of the current branch and updated changelog file
- TREE_SHA="$(
- gh api \
- --method POST \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- '/repos/{owner}/{repo}/git/trees' \
- --raw-field base_tree="${HEAD_COMMIT}" \
- --raw-field 'tree[][path]=CHANGELOG.md' \
- --raw-field 'tree[][mode]=100644' \
- --raw-field 'tree[][type]=blob' \
- --field 'tree[][content][email protected]' \
- --jq '.sha'
- )"
-
- # Create a commit to point to the above created tree
- NEW_COMMIT_SHA="$(
- gh api \
- --method POST \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- '/repos/{owner}/{repo}/git/commits' \
- --raw-field "message=chore(version): ${NEXT_TAG}" \
- --raw-field "parents[]=${HEAD_COMMIT}" \
- --raw-field "tree=${TREE_SHA}" \
- --jq '.sha'
- )"
-
- # Update the current branch to point to the above created commit
- # We disable forced update so that the workflow will fail if the branch has been updated since the workflow started
- # (for example, new commits were pushed to the branch after the workflow execution started).
- gh api \
- --method PATCH \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- "/repos/{owner}/{repo}/git/refs/heads/${ALLOWED_BRANCH_NAME}" \
- --raw-field "sha=${NEW_COMMIT_SHA}" \
- --field 'force=false'
-
- # Create a lightweight tag to point to the above created commit
- gh api \
- --method POST \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- '/repos/{owner}/{repo}/git/refs' \
- --raw-field "ref=refs/tags/${NEXT_TAG}" \
- --raw-field "sha=${NEW_COMMIT_SHA}"
+ git add CHANGELOG.md
+ git commit --message "chore(version): ${NEXT_TAG}"
+
+ git tag "${NEXT_TAG}" HEAD
+
+ git push origin "${ALLOWED_BRANCH_NAME}"
+ git push origin "${NEXT_TAG}"
- name: Set job outputs
shell: bash
diff --git a/.github/workflows/release-nightly-version.yml b/.github/workflows/release-nightly-version.yml
index 36a843469d0..13e844e7c5d 100644
--- a/.github/workflows/release-nightly-version.yml
+++ b/.github/workflows/release-nightly-version.yml
@@ -27,23 +27,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Generate GitHub app token
- id: generate_app_token
- uses: actions/create-github-app-token@v1
- with:
- app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }}
- private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }}
-
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
+ token: ${{ secrets.AUTO_RELEASE_PAT }}
- name: Check if the workflow is run on an allowed branch
shell: bash
run: |
- if [[ "${{github.ref}}" != "refs/heads/${ALLOWED_BRANCH_NAME}" ]]; then
- echo "::error::This workflow is expected to be run from the '${ALLOWED_BRANCH_NAME}' branch. Current branch: '${{github.ref}}'"
+ if [[ "${{ github.ref }}" != "refs/heads/${ALLOWED_BRANCH_NAME}" ]]; then
+ echo "::error::This workflow is expected to be run from the '${ALLOWED_BRANCH_NAME}' branch. Current branch: '${{ github.ref }}'"
exit 1
fi
@@ -80,66 +74,21 @@ jobs:
echo "Postman collection files have no modifications"
fi
- - name: Commit updated Postman collections if modified
+ - name: Set git configuration
shell: bash
- env:
- GH_TOKEN: ${{ steps.generate_app_token.outputs.token }}
if: ${{ env.POSTMAN_COLLECTION_FILES_UPDATED == 'true' }}
run: |
- # Obtain current HEAD commit SHA and use that as base tree SHA for creating a new tree
- HEAD_COMMIT="$(git rev-parse 'HEAD^{commit}')"
- UPDATED_TREE_SHA="${HEAD_COMMIT}"
-
- # Obtain the flags to be passed to the GitHub CLI.
- # Each line contains the flags to be used corresponding to the file.
- lines="$(
- git ls-files \
- --format '--raw-field tree[][path]=%(path) --raw-field tree[][mode]=%(objectmode) --raw-field tree[][type]=%(objecttype) --field tree[][content]=@%(path)' \
- postman/collection-json
- )"
-
- # Create a tree based on the HEAD commit of the current branch, using the contents of the updated Postman collections directory
- while IFS= read -r line; do
- # Split each line by space to obtain the flags passed to the GitHub CLI as an array
- IFS=' ' read -ra flags <<< "${line}"
-
- # Create a tree by updating each collection JSON file.
- # The SHA of the created tree is used as the base tree SHA for updating the next collection file.
- UPDATED_TREE_SHA="$(
- gh api \
- --method POST \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- '/repos/{owner}/{repo}/git/trees' \
- --raw-field base_tree="${UPDATED_TREE_SHA}" \
- "${flags[@]}" \
- --jq '.sha'
- )"
- done <<< "${lines}"
-
- # Create a commit to point to the tree with all updated collections
- NEW_COMMIT_SHA="$(
- gh api \
- --method POST \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- '/repos/{owner}/{repo}/git/commits' \
- --raw-field "message=chore(postman): update Postman collection files" \
- --raw-field "parents[]=${HEAD_COMMIT}" \
- --raw-field "tree=${UPDATED_TREE_SHA}" \
- --jq '.sha'
- )"
-
- # Update the current branch to point to the above created commit.
- # We disable forced update so that the workflow will fail if the branch has been updated since the workflow started
- # (for example, new commits were pushed to the branch after the workflow execution started).
- gh api \
- --method PATCH \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- "/repos/{owner}/{repo}/git/refs/heads/${ALLOWED_BRANCH_NAME}" \
- --raw-field "sha=${NEW_COMMIT_SHA}" \
- --field 'force=false'
+ git config --local user.name 'github-actions'
+ git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
+
+ - name: Commit and push updated Postman collections if modified
+ shell: bash
+ if: ${{ env.POSTMAN_COLLECTION_FILES_UPDATED == 'true' }}
+ run: |
+ git add postman
+ git commit --message 'chore(postman): update Postman collection files'
+
+ git push origin "${ALLOWED_BRANCH_NAME}"
create-nightly-tag:
name: Create a nightly tag
@@ -147,5 +96,4 @@ jobs:
needs:
- update-postman-collections
secrets:
- app_id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }}
- app_private_key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }}
+ token: ${{ secrets.AUTO_RELEASE_PAT }}
|
ci
|
use git commands for pushing commits and tags in nightly release workflows (#3314)
|
c6a960766d3e68b7d5e3ddf10c2306fa3e9c4786
|
2024-08-07 12:50:18
|
Kiran Kumar
|
refactor(connector): added amount conversion framework for Mifinity (#5460)
| false
|
diff --git a/crates/router/src/connector/mifinity.rs b/crates/router/src/connector/mifinity.rs
index b4a22e38a01..d8ac2d10129 100644
--- a/crates/router/src/connector/mifinity.rs
+++ b/crates/router/src/connector/mifinity.rs
@@ -1,12 +1,12 @@
pub mod transformers;
-use std::fmt::Debug;
-
+use common_utils::types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector};
use error_stack::{report, Report, ResultExt};
use masking::ExposeInterface;
use transformers as mifinity;
use self::transformers::auth_headers;
+use super::utils::convert_amount;
use crate::{
configs::settings,
consts,
@@ -26,8 +26,18 @@ use crate::{
utils::BytesExt,
};
-#[derive(Debug, Clone)]
-pub struct Mifinity;
+#[derive(Clone)]
+pub struct Mifinity {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMajorUnit> + Sync),
+}
+
+impl Mifinity {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMajorUnitForConnector,
+ }
+ }
+}
impl api::Payment for Mifinity {}
impl api::PaymentSession for Mifinity {}
@@ -224,12 +234,13 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
req: &types::PaymentsAuthorizeRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = mifinity::MifinityRouterData::try_from((
- &self.get_currency_unit(),
+ let amount = convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
req.request.currency,
- req.request.amount,
- req,
- ))?;
+ )?;
+
+ let connector_router_data = mifinity::MifinityRouterData::from((amount, req));
let connector_req = mifinity::MifinityPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs
index 20885d08955..7fd34b93698 100644
--- a/crates/router/src/connector/mifinity/transformers.rs
+++ b/crates/router/src/connector/mifinity/transformers.rs
@@ -1,4 +1,7 @@
-use common_utils::pii::{self, Email};
+use common_utils::{
+ pii::{self, Email},
+ types::StringMajorUnit,
+};
use error_stack::ResultExt;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -8,27 +11,22 @@ use crate::{
connector::utils::{self, PaymentsAuthorizeRequestData, PhoneDetailsData, RouterData},
core::errors,
services,
- types::{self, api, domain, storage::enums},
+ types::{self, domain, storage::enums},
};
pub struct MifinityRouterData<T> {
- pub amount: String,
+ pub amount: StringMajorUnit,
pub router_data: T,
}
-impl<T> TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for MifinityRouterData<T> {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(
- (currency_unit, currency, amount, item): (&api::CurrencyUnit, enums::Currency, i64, T),
- ) -> Result<Self, Self::Error> {
- let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
- Ok(Self {
+impl<T> From<(StringMajorUnit, T)> for MifinityRouterData<T> {
+ fn from((amount, router_data): (StringMajorUnit, T)) -> Self {
+ Self {
amount,
- router_data: item,
- })
+ router_data,
+ }
}
}
-
pub mod auth_headers {
pub const API_VERSION: &str = "api-version";
}
@@ -69,7 +67,7 @@ pub struct MifinityPaymentsRequest {
#[derive(Debug, Serialize, PartialEq)]
pub struct Money {
- amount: String,
+ amount: StringMajorUnit,
currency: String,
}
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index fb8dd92cafa..fa04ae2ec14 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -449,7 +449,7 @@ impl ConnectorData {
Ok(ConnectorEnum::Old(Box::new(&connector::Worldpay)))
}
enums::Connector::Mifinity => {
- Ok(ConnectorEnum::Old(Box::new(&connector::Mifinity)))
+ Ok(ConnectorEnum::Old(Box::new(connector::Mifinity::new())))
}
enums::Connector::Multisafepay => {
Ok(ConnectorEnum::Old(Box::new(&connector::Multisafepay)))
diff --git a/crates/router/tests/connectors/mifinity.rs b/crates/router/tests/connectors/mifinity.rs
index 278bbee5089..89349be07bb 100644
--- a/crates/router/tests/connectors/mifinity.rs
+++ b/crates/router/tests/connectors/mifinity.rs
@@ -11,7 +11,7 @@ impl utils::Connector for MifinityTest {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Mifinity;
utils::construct_connector_data_old(
- Box::new(&Mifinity),
+ Box::new(Mifinity::new()),
types::Connector::Mifinity,
types::api::GetToken::Connector,
None,
|
refactor
|
added amount conversion framework for Mifinity (#5460)
|
8954e8a2180d20719b1bb0d4f77081ff03fd9b43
|
2024-12-10 16:05:59
|
Shashank Kumar
|
fix(docs): incorrect description for refund api (#6443)
| false
|
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 3f3ffc17a18..2dced0998e9 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -1116,7 +1116,7 @@
"Refunds"
],
"summary": "Refunds - List",
- "description": "Lists all the refunds associated with the merchant or a payment_id if payment_id is not provided",
+ "description": "Lists all the refunds associated with the merchant, or for a specific payment if payment_id is provided",
"operationId": "List all Refunds",
"requestBody": {
"content": {
diff --git a/crates/openapi/src/routes/refunds.rs b/crates/openapi/src/routes/refunds.rs
index 4e096e243a8..0ff0891ee54 100644
--- a/crates/openapi/src/routes/refunds.rs
+++ b/crates/openapi/src/routes/refunds.rs
@@ -115,7 +115,7 @@ pub async fn refunds_update() {}
/// Refunds - List
///
-/// Lists all the refunds associated with the merchant or a payment_id if payment_id is not provided
+/// Lists all the refunds associated with the merchant, or for a specific payment if payment_id is provided
#[utoipa::path(
post,
path = "/refunds/list",
|
fix
|
incorrect description for refund api (#6443)
|
1f151ba15af7089bc6deaa722fbb4364349634e7
|
2023-04-21 02:51:22
|
Nishant Joshi
|
feat(date_time): add `created_at` and `modified_at` to merchant related tables (#925)
| false
|
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index f9f7ea96d23..cbdd99e2fd5 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -184,6 +184,7 @@ impl CustomerInterface for MockDb {
description: customer_data.description,
created_at: common_utils::date_time::now(),
metadata: customer_data.metadata,
+ modified_at: common_utils::date_time::now(),
};
customers.push(customer.clone());
Ok(customer)
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index f1543fa08c0..65d190448e4 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -199,6 +199,8 @@ impl MerchantAccountInterface for MockDb {
locker_id: merchant_account.locker_id,
metadata: merchant_account.metadata,
primary_business_details: merchant_account.primary_business_details,
+ created_at: common_utils::date_time::now(),
+ modified_at: common_utils::date_time::now(),
};
accounts.push(account.clone());
Ok(account)
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 63413efe5ea..61a1a7f82de 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -295,6 +295,8 @@ impl MerchantConnectorAccountInterface for MockDb {
business_country: t.business_country,
business_label: t.business_label,
business_sub_label: t.business_sub_label,
+ created_at: common_utils::date_time::now(),
+ modified_at: common_utils::date_time::now(),
};
accounts.push(account.clone());
Ok(account)
diff --git a/crates/storage_models/src/customers.rs b/crates/storage_models/src/customers.rs
index 6f5ce70b839..180ecf022e4 100644
--- a/crates/storage_models/src/customers.rs
+++ b/crates/storage_models/src/customers.rs
@@ -31,6 +31,7 @@ pub struct Customer {
pub description: Option<String>,
pub created_at: PrimitiveDateTime,
pub metadata: Option<pii::SecretSerdeValue>,
+ pub modified_at: PrimitiveDateTime,
}
#[derive(Debug)]
@@ -54,6 +55,7 @@ pub struct CustomerUpdateInternal {
description: Option<String>,
phone_country_code: Option<String>,
metadata: Option<pii::SecretSerdeValue>,
+ modified_at: Option<PrimitiveDateTime>,
}
impl From<CustomerUpdate> for CustomerUpdateInternal {
@@ -73,6 +75,7 @@ impl From<CustomerUpdate> for CustomerUpdateInternal {
description,
phone_country_code,
metadata,
+ modified_at: Some(common_utils::date_time::now()),
},
}
}
diff --git a/crates/storage_models/src/merchant_account.rs b/crates/storage_models/src/merchant_account.rs
index f834531d540..09af4a3d01b 100644
--- a/crates/storage_models/src/merchant_account.rs
+++ b/crates/storage_models/src/merchant_account.rs
@@ -35,6 +35,8 @@ pub struct MerchantAccount {
pub routing_algorithm: Option<serde_json::Value>,
pub primary_business_details: serde_json::Value,
pub api_key: Option<StrongSecret<String>>,
+ pub created_at: time::PrimitiveDateTime,
+ pub modified_at: time::PrimitiveDateTime,
}
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
@@ -99,6 +101,7 @@ pub struct MerchantAccountUpdateInternal {
metadata: Option<pii::SecretSerdeValue>,
routing_algorithm: Option<serde_json::Value>,
primary_business_details: Option<serde_json::Value>,
+ modified_at: Option<time::PrimitiveDateTime>,
}
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
@@ -134,6 +137,7 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
locker_id,
metadata,
primary_business_details,
+ modified_at: Some(common_utils::date_time::now()),
..Default::default()
},
MerchantAccountUpdate::StorageSchemeUpdate { storage_scheme } => Self {
diff --git a/crates/storage_models/src/merchant_connector_account.rs b/crates/storage_models/src/merchant_connector_account.rs
index 0d5a93ac2e7..4dbbd8864e7 100644
--- a/crates/storage_models/src/merchant_connector_account.rs
+++ b/crates/storage_models/src/merchant_connector_account.rs
@@ -33,6 +33,8 @@ pub struct MerchantConnectorAccount {
pub business_country: storage_enums::CountryCode,
pub business_label: String,
pub business_sub_label: Option<String>,
+ pub created_at: time::PrimitiveDateTime,
+ pub modified_at: time::PrimitiveDateTime,
}
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
@@ -80,6 +82,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
payment_methods_enabled: Option<Vec<serde_json::Value>>,
metadata: Option<pii::SecretSerdeValue>,
frm_configs: Option<Secret<serde_json::Value>>,
+ modified_at: Option<time::PrimitiveDateTime>,
}
impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInternal {
@@ -105,6 +108,7 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInte
payment_methods_enabled,
metadata,
frm_configs,
+ modified_at: Some(common_utils::date_time::now()),
},
}
}
diff --git a/crates/storage_models/src/schema.rs b/crates/storage_models/src/schema.rs
index 603f2945d67..a1d9ec2fd0e 100644
--- a/crates/storage_models/src/schema.rs
+++ b/crates/storage_models/src/schema.rs
@@ -106,6 +106,7 @@ diesel::table! {
description -> Nullable<Varchar>,
created_at -> Timestamp,
metadata -> Nullable<Json>,
+ modified_at -> Timestamp,
}
}
@@ -228,6 +229,8 @@ diesel::table! {
routing_algorithm -> Nullable<Json>,
primary_business_details -> Json,
api_key -> Nullable<Varchar>,
+ created_at -> Timestamp,
+ modified_at -> Timestamp,
}
}
@@ -251,6 +254,8 @@ diesel::table! {
business_country -> CountryCode,
business_label -> Varchar,
business_sub_label -> Nullable<Varchar>,
+ created_at -> Timestamp,
+ modified_at -> Timestamp,
}
}
diff --git a/migrations/2023-04-19-120735_add_time_for_tables/down.sql b/migrations/2023-04-19-120735_add_time_for_tables/down.sql
new file mode 100644
index 00000000000..82499e8504a
--- /dev/null
+++ b/migrations/2023-04-19-120735_add_time_for_tables/down.sql
@@ -0,0 +1,12 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE merchant_account
+DROP COLUMN IF EXISTS created_at,
+DROP COLUMN IF EXISTS modified_at;
+
+
+ALTER TABLE merchant_connector_account
+DROP COLUMN IF EXISTS created_at,
+DROP COLUMN IF EXISTS modified_at;
+
+ALTER TABLE customers
+DROP COLUMN IF EXISTS modified_at;
diff --git a/migrations/2023-04-19-120735_add_time_for_tables/up.sql b/migrations/2023-04-19-120735_add_time_for_tables/up.sql
new file mode 100644
index 00000000000..af8dfb2fccc
--- /dev/null
+++ b/migrations/2023-04-19-120735_add_time_for_tables/up.sql
@@ -0,0 +1,12 @@
+-- Your SQL goes here
+ALTER TABLE merchant_account
+ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NOT NULL DEFAULT now(),
+ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
+
+ALTER TABLE merchant_connector_account
+ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NOT NULL DEFAULT now(),
+ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
+
+
+ALTER TABLE customers
+ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
|
feat
|
add `created_at` and `modified_at` to merchant related tables (#925)
|
4838a86ebcb5000e65293e0d095e5de95e3a64a0
|
2024-07-22 16:10:20
|
Swangi Kumari
|
refactor(connector): Add billing_country in klarna dynamic fields (#5373)
| false
|
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 8d19fe3ebcc..6121d8e503f 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -8569,6 +8569,40 @@ impl Default for super::settings::RequiredFields {
value: None,
}
),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "AU".to_string(),
+ "AT".to_string(),
+ "BE".to_string(),
+ "CA".to_string(),
+ "CZ".to_string(),
+ "DK".to_string(),
+ "FI".to_string(),
+ "FR".to_string(),
+ "DE".to_string(),
+ "GR".to_string(),
+ "IE".to_string(),
+ "IT".to_string(),
+ "NL".to_string(),
+ "NZ".to_string(),
+ "NO".to_string(),
+ "PL".to_string(),
+ "PT".to_string(),
+ "ES".to_string(),
+ "SE".to_string(),
+ "CH".to_string(),
+ "GB".to_string(),
+ "US".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
]),
}
)
|
refactor
|
Add billing_country in klarna dynamic fields (#5373)
|
00f9ed4cae6022708f5c46544e4bbec5deafbc7d
|
2024-07-05 11:55:27
|
ShivanshMathurJuspay
|
refactor: Adding millisecond to Kafka timestamp (#5202)
| false
|
diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs
index d1abda2105d..baa78339d91 100644
--- a/crates/router/src/services/kafka.rs
+++ b/crates/router/src/services/kafka.rs
@@ -319,11 +319,15 @@ impl KafkaProducer {
BaseRecord::to(topic)
.key(&event.key())
.payload(&event.value()?)
- .timestamp(
- event
- .creation_timestamp()
- .unwrap_or_else(|| OffsetDateTime::now_utc().unix_timestamp() * 1_000),
- ),
+ .timestamp(event.creation_timestamp().unwrap_or_else(|| {
+ (OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000)
+ .try_into()
+ .unwrap_or_else(|_| {
+ // kafka producer accepts milliseconds
+ // try converting nanos to millis if that fails convert seconds to millis
+ OffsetDateTime::now_utc().unix_timestamp() * 1_000
+ })
+ })),
)
.map_err(|(error, record)| report!(error).attach_printable(format!("{record:?}")))
.change_context(KafkaError::GenericError)
|
refactor
|
Adding millisecond to Kafka timestamp (#5202)
|
d283053e5eb2dab6cfdaacc3012d50199fb03175
|
2024-02-02 15:19:08
|
Kartikeya Hegde
|
fix: add outgoing checks for scheduler (#3526)
| false
|
diff --git a/crates/api_models/src/health_check.rs b/crates/api_models/src/health_check.rs
index e4611f43bcf..2c65c7b6d50 100644
--- a/crates/api_models/src/health_check.rs
+++ b/crates/api_models/src/health_check.rs
@@ -13,6 +13,7 @@ impl common_utils::events::ApiEventMetric for RouterHealthCheckResponse {}
pub struct SchedulerHealthCheckResponse {
pub database: bool,
pub redis: bool,
+ pub outgoing_request: bool,
}
impl common_utils::events::ApiEventMetric for SchedulerHealthCheckResponse {}
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 5f98cd88014..59a108ef5e6 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -187,11 +187,23 @@ pub async fn deep_health_check_func(
})
})?;
+ let outgoing_req_check = state
+ .health_check_outgoing()
+ .await
+ .map(|_| true)
+ .map_err(|err| {
+ error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
+ component: "Outgoing Request",
+ message: err.to_string()
+ })
+ })?;
+
logger::debug!("Redis health check end");
let response = SchedulerHealthCheckResponse {
database: db_status,
redis: redis_status,
+ outgoing_request: outgoing_req_check,
};
Ok(response)
|
fix
|
add outgoing checks for scheduler (#3526)
|
86f679abc1549b59239ece4a1123b60e40c26b96
|
2023-06-09 19:02:45
|
Narayan Bhat
|
fix: update customer data if passed in payments (#1402)
| false
|
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3723799e232..659401fb3c5 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -36,7 +36,7 @@ use crate::{
self,
types::{self, AsyncLift},
},
- storage::{self, enums as storage_enums, ephemeral_key},
+ storage::{self, enums as storage_enums, ephemeral_key, CustomerUpdate::Update},
transformers::ForeignInto,
ErrorResponse, RouterData,
},
@@ -828,11 +828,11 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
req: Option<CustomerDetails>,
merchant_id: &str,
) -> CustomResult<(BoxedOperation<'a, F, R>, Option<domain::Customer>), errors::StorageError> {
- let req = req
+ let request_customer_details = req
.get_required_value("customer")
.change_context(errors::StorageError::ValueNotFound("customer".to_owned()))?;
- let customer_id = req
+ let customer_id = request_customer_details
.customer_id
.or(payment_data.payment_intent.customer_id.clone());
@@ -841,31 +841,80 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
let customer_data = db
.find_customer_optional_by_customer_id_merchant_id(&customer_id, merchant_id)
.await?;
+
Some(match customer_data {
- Some(c) => Ok(c),
+ Some(c) => {
+ // Update the customer data if new data is passed in the request
+ if request_customer_details.email.is_some()
+ | request_customer_details.name.is_some()
+ | request_customer_details.phone.is_some()
+ | request_customer_details.phone_country_code.is_some()
+ {
+ let key = types::get_merchant_enc_key(db, merchant_id.to_string()).await?;
+ let customer_update = async {
+ Ok(Update {
+ name: request_customer_details
+ .name
+ .async_lift(|inner| types::encrypt_optional(inner, &key))
+ .await?,
+ email: request_customer_details
+ .email
+ .clone()
+ .async_lift(|inner| {
+ types::encrypt_optional(
+ inner.map(|inner| inner.expose()),
+ &key,
+ )
+ })
+ .await?,
+ phone: request_customer_details
+ .phone
+ .clone()
+ .async_lift(|inner| types::encrypt_optional(inner, &key))
+ .await?,
+ phone_country_code: request_customer_details.phone_country_code,
+ description: None,
+ connector_customer: None,
+ metadata: None,
+ })
+ }
+ .await
+ .change_context(errors::StorageError::SerializationFailed)
+ .attach_printable("Failed while encrypting Customer while Update")?;
+
+ db.update_customer_by_customer_id_merchant_id(
+ customer_id,
+ merchant_id.to_string(),
+ customer_update,
+ )
+ .await
+ } else {
+ Ok(c)
+ }
+ }
None => {
let key = types::get_merchant_enc_key(db, merchant_id.to_string()).await?;
let new_customer = async {
Ok(domain::Customer {
customer_id: customer_id.to_string(),
merchant_id: merchant_id.to_string(),
- name: req
+ name: request_customer_details
.name
.async_lift(|inner| types::encrypt_optional(inner, &key))
.await?,
- email: req
+ email: request_customer_details
.email
.clone()
.async_lift(|inner| {
types::encrypt_optional(inner.map(|inner| inner.expose()), &key)
})
.await?,
- phone: req
+ phone: request_customer_details
.phone
.clone()
.async_lift(|inner| types::encrypt_optional(inner, &key))
.await?,
- phone_country_code: req.phone_country_code.clone(),
+ phone_country_code: request_customer_details.phone_country_code.clone(),
description: None,
created_at: common_utils::date_time::now(),
id: None,
|
fix
|
update customer data if passed in payments (#1402)
|
23a2a0cf27d87fade674f342550a3ade4a2174ce
|
2025-03-20 12:34:48
|
Pa1NarK
|
chore: update payment method configs for globalpay (#7512)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 7ae8e5d547c..7338055dbc9 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -617,6 +617,14 @@ direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY,
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[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/integration_test.toml b/config/deployments/integration_test.toml
index 39d6f8037a2..d7716f4709b 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -324,6 +324,14 @@ debit.currency = "USD"
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[pm_filters.globepay]
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index e2ffbcd3d0c..e193253e5ac 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -374,6 +374,14 @@ debit.currency = "USD"
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC"}
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC"}
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[pm_filters.globepay]
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index a6e0088876c..1846c9d9507 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -376,6 +376,14 @@ debit.currency = "USD"
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC"}
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[pm_filters.globepay]
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
diff --git a/config/development.toml b/config/development.toml
index d0dbbeae0eb..67e5e142c02 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -590,6 +590,14 @@ paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,N
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[pm_filters.jpmorgan]
debit = { country = "CA, GB, US, AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE", currency = "USD, EUR, GBP, AUD, NZD, SGD, CAD, JPY, HKD, KRW, TWD, MXN, BRL, DKK, NOK, ZAR, SEK, CHF, CZK, PLN, TRY, AFN, ALL, DZD, AOA, ARS, AMD, AWG, AZN, BSD, BDT, BBD, BYN, BZD, BMD, BOB, BAM, BWP, BND, BGN, BIF, BTN, XOF, XAF, XPF, KHR, CVE, KYD, CLP, CNY, COP, KMF, CDF, CRC, HRK, DJF, DOP, XCD, EGP, ETB, FKP, FJD, GMD, GEL, GHS, GIP, GTQ, GYD, HTG, HNL, HUF, ISK, INR, IDR, ILS, JMD, KZT, KES, LAK, LBP, LSL, LRD, MOP, MKD, MGA, MWK, MYR, MVR, MRU, MUR, MDL, MNT, MAD, MZN, MMK, NAD, NPR, ANG, PGK, NIO, NGN, PKR, PAB, PYG, PEN, PHP, QAR, RON, RWF, SHP, WST, STN, SAR, RSD, SCR, SLL, SBD, SOS, LKR, SRD, SZL, TJS, TZS, THB, TOP, TTD, UGX, UAH, AED, UYU, UZS, VUV, VND, YER, ZMW" }
credit = { country = "CA, GB, US, AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE", currency = "USD, EUR, GBP, AUD, NZD, SGD, CAD, JPY, HKD, KRW, TWD, MXN, BRL, DKK, NOK, ZAR, SEK, CHF, CZK, PLN, TRY, AFN, ALL, DZD, AOA, ARS, AMD, AWG, AZN, BSD, BDT, BBD, BYN, BZD, BMD, BOB, BAM, BWP, BND, BGN, BIF, BTN, XOF, XAF, XPF, KHR, CVE, KYD, CLP, CNY, COP, KMF, CDF, CRC, HRK, DJF, DOP, XCD, EGP, ETB, FKP, FJD, GMD, GEL, GHS, GIP, GTQ, GYD, HTG, HNL, HUF, ISK, INR, IDR, ILS, JMD, KZT, KES, LAK, LBP, LSL, LRD, MOP, MKD, MGA, MWK, MYR, MVR, MRU, MUR, MDL, MNT, MAD, MZN, MMK, NAD, NPR, ANG, PGK, NIO, NGN, PKR, PAB, PYG, PEN, PHP, QAR, RON, RWF, SHP, WST, STN, SAR, RSD, SCR, SLL, SBD, SOS, LKR, SRD, SZL, TJS, TZS, THB, TOP, TTD, UGX, UAH, AED, UYU, UZS, VUV, VND, YER, ZMW" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index da58ab45dbd..57ec81a607b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -561,6 +561,14 @@ paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,B
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[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/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 1add1f4f16b..bd155777af4 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -501,10 +501,12 @@ pub enum Currency {
CAD,
CDF,
CHF,
+ CLF,
CLP,
CNY,
COP,
CRC,
+ CUC,
CUP,
CVE,
CZK,
@@ -600,6 +602,7 @@ pub enum Currency {
SOS,
SRD,
SSP,
+ STD,
STN,
SVC,
SYP,
@@ -711,9 +714,11 @@ impl Currency {
Self::CAD => "124",
Self::CDF => "976",
Self::CHF => "756",
+ Self::CLF => "990",
Self::CLP => "152",
Self::COP => "170",
Self::CRC => "188",
+ Self::CUC => "931",
Self::CUP => "192",
Self::CVE => "132",
Self::CZK => "203",
@@ -810,6 +815,7 @@ impl Currency {
Self::SOS => "706",
Self::SRD => "968",
Self::SSP => "728",
+ Self::STD => "678",
Self::STN => "930",
Self::SVC => "222",
Self::SYP => "760",
@@ -889,9 +895,11 @@ impl Currency {
| Self::CAD
| Self::CDF
| Self::CHF
+ | Self::CLF
| Self::CNY
| Self::COP
| Self::CRC
+ | Self::CUC
| Self::CUP
| Self::CVE
| Self::CZK
@@ -978,6 +986,7 @@ impl Currency {
| Self::SOS
| Self::SRD
| Self::SSP
+ | Self::STD
| Self::STN
| Self::SVC
| Self::SYP
@@ -1037,10 +1046,12 @@ impl Currency {
| Self::CAD
| Self::CDF
| Self::CHF
+ | Self::CLF
| Self::CLP
| Self::CNY
| Self::COP
| Self::CRC
+ | Self::CUC
| Self::CUP
| Self::CVE
| Self::CZK
@@ -1131,6 +1142,7 @@ impl Currency {
| Self::SOS
| Self::SRD
| Self::SSP
+ | Self::STD
| Self::STN
| Self::SVC
| Self::SYP
@@ -1163,11 +1175,178 @@ impl Currency {
}
}
+ pub fn is_four_decimal_currency(self) -> bool {
+ match self {
+ Self::CLF => true,
+ Self::AED
+ | Self::AFN
+ | Self::ALL
+ | Self::AMD
+ | Self::AOA
+ | Self::ANG
+ | Self::ARS
+ | Self::AUD
+ | Self::AWG
+ | Self::AZN
+ | Self::BAM
+ | Self::BBD
+ | Self::BDT
+ | Self::BGN
+ | Self::BHD
+ | Self::BIF
+ | Self::BMD
+ | Self::BND
+ | Self::BOB
+ | Self::BRL
+ | Self::BSD
+ | Self::BTN
+ | Self::BWP
+ | Self::BYN
+ | Self::BZD
+ | Self::CAD
+ | Self::CDF
+ | Self::CHF
+ | Self::CLP
+ | Self::CNY
+ | Self::COP
+ | Self::CRC
+ | Self::CUC
+ | Self::CUP
+ | Self::CVE
+ | Self::CZK
+ | Self::DJF
+ | Self::DKK
+ | Self::DOP
+ | Self::DZD
+ | Self::EGP
+ | Self::ERN
+ | Self::ETB
+ | Self::EUR
+ | Self::FJD
+ | Self::FKP
+ | Self::GBP
+ | Self::GEL
+ | Self::GHS
+ | Self::GIP
+ | Self::GMD
+ | Self::GNF
+ | Self::GTQ
+ | Self::GYD
+ | Self::HKD
+ | Self::HNL
+ | Self::HRK
+ | Self::HTG
+ | Self::HUF
+ | Self::IDR
+ | Self::ILS
+ | Self::INR
+ | Self::IQD
+ | Self::IRR
+ | Self::ISK
+ | Self::JMD
+ | Self::JOD
+ | Self::JPY
+ | Self::KES
+ | Self::KGS
+ | Self::KHR
+ | Self::KMF
+ | Self::KPW
+ | Self::KRW
+ | Self::KWD
+ | Self::KYD
+ | Self::KZT
+ | Self::LAK
+ | Self::LBP
+ | Self::LKR
+ | Self::LRD
+ | Self::LSL
+ | Self::LYD
+ | Self::MAD
+ | Self::MDL
+ | Self::MGA
+ | Self::MKD
+ | Self::MMK
+ | Self::MNT
+ | Self::MOP
+ | Self::MRU
+ | Self::MUR
+ | Self::MVR
+ | Self::MWK
+ | Self::MXN
+ | Self::MYR
+ | Self::MZN
+ | Self::NAD
+ | Self::NGN
+ | Self::NIO
+ | Self::NOK
+ | Self::NPR
+ | Self::NZD
+ | Self::OMR
+ | Self::PAB
+ | Self::PEN
+ | Self::PGK
+ | Self::PHP
+ | Self::PKR
+ | Self::PLN
+ | Self::PYG
+ | Self::QAR
+ | Self::RON
+ | Self::RSD
+ | Self::RUB
+ | Self::RWF
+ | Self::SAR
+ | Self::SBD
+ | Self::SCR
+ | Self::SDG
+ | Self::SEK
+ | Self::SGD
+ | Self::SHP
+ | Self::SLE
+ | Self::SLL
+ | Self::SOS
+ | Self::SRD
+ | Self::SSP
+ | Self::STD
+ | Self::STN
+ | Self::SVC
+ | Self::SYP
+ | Self::SZL
+ | Self::THB
+ | Self::TJS
+ | Self::TMT
+ | Self::TND
+ | Self::TOP
+ | Self::TRY
+ | Self::TTD
+ | Self::TWD
+ | Self::TZS
+ | Self::UAH
+ | Self::UGX
+ | Self::USD
+ | Self::UYU
+ | Self::UZS
+ | Self::VES
+ | Self::VND
+ | Self::VUV
+ | Self::WST
+ | Self::XAF
+ | Self::XCD
+ | Self::XPF
+ | Self::XOF
+ | Self::YER
+ | Self::ZAR
+ | Self::ZMW
+ | Self::ZWL => false,
+ }
+ }
+
pub fn number_of_digits_after_decimal_point(self) -> u8 {
if self.is_zero_decimal_currency() {
0
} else if self.is_three_decimal_currency() {
3
+ } else if self.is_four_decimal_currency() {
+ 4
} else {
2
}
diff --git a/crates/currency_conversion/src/types.rs b/crates/currency_conversion/src/types.rs
index 2001495b2db..587c36ffe6c 100644
--- a/crates/currency_conversion/src/types.rs
+++ b/crates/currency_conversion/src/types.rs
@@ -105,10 +105,12 @@ pub fn currency_match(currency: Currency) -> &'static iso::Currency {
Currency::CAD => iso::CAD,
Currency::CDF => iso::CDF,
Currency::CHF => iso::CHF,
+ Currency::CLF => iso::CLF,
Currency::CLP => iso::CLP,
Currency::CNY => iso::CNY,
Currency::COP => iso::COP,
Currency::CRC => iso::CRC,
+ Currency::CUC => iso::CUC,
Currency::CUP => iso::CUP,
Currency::CVE => iso::CVE,
Currency::CZK => iso::CZK,
@@ -204,6 +206,7 @@ pub fn currency_match(currency: Currency) -> &'static iso::Currency {
Currency::SOS => iso::SOS,
Currency::SRD => iso::SRD,
Currency::SSP => iso::SSP,
+ Currency::STD => iso::STD,
Currency::STN => iso::STN,
Currency::SVC => iso::SVC,
Currency::SYP => iso::SYP,
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index 0479753d8d0..94faa4847df 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -370,10 +370,12 @@ impl IntoDirValue for api_enums::Currency {
Self::CAD => Ok(dirval!(PaymentCurrency = CAD)),
Self::CDF => Ok(dirval!(PaymentCurrency = CDF)),
Self::CHF => Ok(dirval!(PaymentCurrency = CHF)),
+ Self::CLF => Ok(dirval!(PaymentCurrency = CLF)),
Self::CLP => Ok(dirval!(PaymentCurrency = CLP)),
Self::CNY => Ok(dirval!(PaymentCurrency = CNY)),
Self::COP => Ok(dirval!(PaymentCurrency = COP)),
Self::CRC => Ok(dirval!(PaymentCurrency = CRC)),
+ Self::CUC => Ok(dirval!(PaymentCurrency = CUC)),
Self::CUP => Ok(dirval!(PaymentCurrency = CUP)),
Self::CVE => Ok(dirval!(PaymentCurrency = CVE)),
Self::CZK => Ok(dirval!(PaymentCurrency = CZK)),
@@ -469,6 +471,7 @@ impl IntoDirValue for api_enums::Currency {
Self::SOS => Ok(dirval!(PaymentCurrency = SOS)),
Self::SRD => Ok(dirval!(PaymentCurrency = SRD)),
Self::SSP => Ok(dirval!(PaymentCurrency = SSP)),
+ Self::STD => Ok(dirval!(PaymentCurrency = STD)),
Self::STN => Ok(dirval!(PaymentCurrency = STN)),
Self::SVC => Ok(dirval!(PaymentCurrency = SVC)),
Self::SYP => Ok(dirval!(PaymentCurrency = SYP)),
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index b589fcc7c73..1b875840d41 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1107,7 +1107,7 @@ export const connectorDetails = {
error: {
error_type: "invalid_request",
message:
- "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`",
+ "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLF`, `CLP`, `CNY`, `COP`, `CRC`, `CUC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STD`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`",
code: "IR_06",
},
},
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 7844f9a6970..c36ba6747ba 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -345,6 +345,14 @@ pix = { country = "BR", currency = "BRL" }
red_compra = { country = "CL", currency = "CLP" }
red_pagos = { country = "UY", currency = "UYU" }
+[pm_filters.globalpay]
+credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
+eps = { country = "AT", currency = "EUR" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+sofort = { country = "AT,BE,DE,ES,IT,NL", currency = "EUR" }
+
[pm_filters.rapyd]
apple_pay = { country = "AL,AS,AD,AR,AM,AU,AT,AZ,BH,BE,BM,BA,BR,BG,CA,KH,KY,CL,CO,CR,HR,CY,CZ,DK,DO,EC,SV,EE,FO,FI,FR,GE,DE,GI,GR,GL,GU,GT,GG,HN,HK,HU,IS,IE,IM,IL,IT,JP,KZ,KG,KW,LV,LI,LT,LU,MO,MY,MT,MX,MD,MC,ME,MA,NL,NZ,NI,MK,MP,NO,PA,PY,PR,PE,PL,PT,QA,RO,SM,RS,SG,SK,SI,ZA,ES,SE,CH,TW,TJ,TH,UA,AE,GB,US,UY,VI,VN", currency = "EUR,GBP,ISK,USD" }
google_pay = { country = "AM,AT,AU,AZ,BA,BE,BG,BY,CA,CH,CL,CN,CO,CR,CY,CZ,DE,DK,DO,EC,EE,EG,ES,FI,FR,GB,GE,GL,GR,GT,HK,HN,HR,HU,IE,IL,IM,IS,IT,JE,JP,JO,KZ,KW,LA,LI,LT,LU,LV,MA,MC,MD,ME,MO,MN,MT,MX,MY,NC,NL,NO,NZ,OM,PA,PE,PL,PR,PT,QA,RO,RS,SA,SE,SG,SI,SK,SM,SV,TH,TW,UA,US,UY,VA,VN,ZA", currency = "EUR,GBP,ISK,USD" }
|
chore
|
update payment method configs for globalpay (#7512)
|
92ee1db107ac41326ecfb31b4565664a29a4b80a
|
2023-10-16 14:47:43
|
Sai Harsha Vardhan
|
feat(connector): add surcharge support in paypal connector (#2568)
| false
|
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index fd104ac4aa5..a0a787269e3 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -370,7 +370,10 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
let connector_router_data = paypal::PaypalRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
- req.request.amount,
+ req.request
+ .surcharge_details
+ .as_ref()
+ .map_or(req.request.amount, |surcharge| surcharge.final_amount),
req,
))?;
let req_obj = paypal::PaypalPaymentsRequest::try_from(&connector_router_data)?;
|
feat
|
add surcharge support in paypal connector (#2568)
|
38aa9eab3f2453593e7b0c3fa63b37f7f2609514
|
2023-05-09 20:10:54
|
Sai Harsha Vardhan
|
feat(router): added retrieval flow for connector file uploads and added support for stripe connector (#990)
| false
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index b39aab94f13..4bf857edb76 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -313,3 +313,25 @@ pub enum Country {
Zambia,
Zimbabwe,
}
+
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ PartialEq,
+ Default,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum FileUploadProvider {
+ #[default]
+ Router,
+ Stripe,
+ Checkout,
+}
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index 900428e78f7..aba85566260 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -118,6 +118,7 @@ impl api::ConnectorAccessToken for Checkout {}
impl api::AcceptDispute for Checkout {}
impl api::PaymentToken for Checkout {}
impl api::Dispute for Checkout {}
+impl api::RetrieveFile for Checkout {}
impl api::DefendDispute for Checkout {}
impl
@@ -773,6 +774,12 @@ impl
impl api::UploadFile for Checkout {}
+impl
+ ConnectorIntegration<api::Retrieve, types::RetrieveFileRequestData, types::RetrieveFileResponse>
+ for Checkout
+{
+}
+
#[async_trait::async_trait]
impl api::FileUpload for Checkout {
fn validate_file_upload(
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 60630f595dd..02cf8345498 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -1199,6 +1199,98 @@ impl
}
}
+impl api::RetrieveFile for Stripe {}
+
+impl
+ services::ConnectorIntegration<
+ api::Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+ > for Stripe
+{
+ fn get_headers(
+ &self,
+ req: &types::RouterData<
+ api::Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+ >,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.get_auth_header(&req.connector_auth_type)
+ }
+
+ fn get_url(
+ &self,
+ req: &types::RetrieveFileRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!(
+ "{}v1/files/{}/contents",
+ connectors.stripe.base_url_file_upload, req.request.provider_file_id
+ ))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::RetrieveFileRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Get)
+ .url(&types::RetrieveFileType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RetrieveFileType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ #[instrument(skip_all)]
+ fn handle_response(
+ &self,
+ data: &types::RetrieveFileRouterData,
+ res: types::Response,
+ ) -> CustomResult<
+ types::RouterData<
+ api::Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+ >,
+ errors::ConnectorError,
+ > {
+ let response = res.response;
+ Ok(types::RetrieveFileRouterData {
+ response: Ok(types::RetrieveFileResponse {
+ file_data: response.to_vec(),
+ }),
+ ..data.clone()
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ let response: stripe::ErrorResponse = res
+ .response
+ .parse_struct("ErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ Ok(types::ErrorResponse {
+ status_code: res.status_code,
+ code: response
+ .error
+ .code
+ .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
+ message: response
+ .error
+ .message
+ .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
+ reason: None,
+ })
+ }
+}
+
impl api::SubmitEvidence for Stripe {}
impl
diff --git a/crates/router/src/core/disputes/transformers.rs b/crates/router/src/core/disputes/transformers.rs
index 63a3697413a..25c69571a0a 100644
--- a/crates/router/src/core/disputes/transformers.rs
+++ b/crates/router/src/core/disputes/transformers.rs
@@ -3,7 +3,7 @@ use common_utils::errors::CustomResult;
use crate::{
core::{errors, files::helpers::retrieve_file_and_provider_file_id_from_file_id},
routes::AppState,
- types::SubmitEvidenceRequestData,
+ types::{api, SubmitEvidenceRequestData},
};
pub async fn get_evidence_request_data(
@@ -17,6 +17,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.cancellation_policy,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (customer_communication, customer_communication_provider_file_id) =
@@ -24,6 +25,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.customer_communication,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (customer_signature, customer_signature_provider_file_id) =
@@ -31,12 +33,14 @@ pub async fn get_evidence_request_data(
state,
evidence_request.customer_signature,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (receipt, receipt_provider_file_id) = retrieve_file_and_provider_file_id_from_file_id(
state,
evidence_request.receipt,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (refund_policy, refund_policy_provider_file_id) =
@@ -44,6 +48,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.refund_policy,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (service_documentation, service_documentation_provider_file_id) =
@@ -51,6 +56,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.service_documentation,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (shipping_documentation, shipping_documentation_provider_file_id) =
@@ -58,6 +64,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.shipping_documentation,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (
@@ -67,6 +74,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.invoice_showing_distinct_transactions,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (recurring_transaction_agreement, recurring_transaction_agreement_provider_file_id) =
@@ -74,6 +82,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.recurring_transaction_agreement,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
let (uncategorized_file, uncategorized_file_provider_file_id) =
@@ -81,6 +90,7 @@ pub async fn get_evidence_request_data(
state,
evidence_request.uncategorized_file,
merchant_account,
+ api::FileDataRequired::NotRequired,
)
.await?;
Ok(SubmitEvidenceRequestData {
diff --git a/crates/router/src/core/files.rs b/crates/router/src/core/files.rs
index 718f5f2923b..32ff6f84b36 100644
--- a/crates/router/src/core/files.rs
+++ b/crates/router/src/core/files.rs
@@ -13,7 +13,7 @@ use crate::{
consts,
routes::AppState,
services::{self, ApplicationResponse},
- types::{api, storage, transformers::ForeignInto},
+ types::{api, storage},
};
pub async fn files_create_core(
@@ -37,6 +37,7 @@ pub async fn files_create_core(
provider_file_id: None,
file_upload_provider: None,
available: false,
+ connector_label: None,
};
let file_metadata_object = state
.store
@@ -44,8 +45,8 @@ pub async fn files_create_core(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to insert file_metadata")?;
- let (provider_file_id, file_upload_provider) =
- helpers::upload_and_get_provider_provider_file_id(
+ let (provider_file_id, file_upload_provider, connector_label) =
+ helpers::upload_and_get_provider_provider_file_id_connector_label(
state,
&merchant_account,
&create_file_request,
@@ -55,8 +56,9 @@ pub async fn files_create_core(
//Update file metadata
let update_file_metadata = storage_models::file::FileMetadataUpdate::Update {
provider_file_id: Some(provider_file_id),
- file_upload_provider: Some(file_upload_provider.foreign_into()),
+ file_upload_provider: Some(file_upload_provider),
available: true,
+ connector_label,
};
state
.store
@@ -102,6 +104,7 @@ pub async fn files_retrieve_core(
state,
Some(req.file_id),
&merchant_account,
+ api::FileDataRequired::Required,
)
.await?;
let content_type = file_metadata_object
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index a6a01fe09b4..71a50d7fdc0 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -6,11 +6,13 @@ use futures::TryStreamExt;
use crate::{
core::{
errors::{self, StorageErrorExt},
- files, payments, utils,
+ files,
+ payments::{self, helpers as payments_helpers},
+ utils,
},
routes::AppState,
services,
- types::{self, api, storage},
+ types::{self, api, storage, transformers::ForeignTryFrom},
};
pub async fn read_string(field: &mut Field) -> Option<String> {
@@ -144,10 +146,66 @@ pub async fn delete_file_using_file_id(
}
}
+pub async fn retrieve_file_from_connector(
+ state: &AppState,
+ file_metadata: storage_models::file::FileMetadata,
+ merchant_account: &storage_models::merchant_account::MerchantAccount,
+) -> CustomResult<Vec<u8>, errors::ApiErrorResponse> {
+ let connector = &types::Connector::foreign_try_from(
+ file_metadata
+ .file_upload_provider
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Missing file upload provider")?,
+ )?
+ .to_string();
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ &state.conf.connectors,
+ connector,
+ api::GetToken::Connector,
+ )?;
+ let connector_integration: services::BoxedConnectorIntegration<
+ '_,
+ api::Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+ > = connector_data.connector.get_connector_integration();
+ let router_data = utils::construct_retrieve_file_router_data(
+ state,
+ merchant_account,
+ &file_metadata,
+ connector,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed constructing the retrieve file router data")?;
+ let response = services::execute_connector_processing_step(
+ state,
+ connector_integration,
+ &router_data,
+ payments::CallConnectorAction::Trigger,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while calling retrieve file connector api")?;
+ let retrieve_file_response =
+ response
+ .response
+ .map_err(|err| errors::ApiErrorResponse::ExternalConnectorError {
+ code: err.code,
+ message: err.message,
+ connector: connector.to_string(),
+ status_code: err.status_code,
+ reason: err.reason,
+ })?;
+ Ok(retrieve_file_response.file_data)
+}
+
pub async fn retrieve_file_and_provider_file_id_from_file_id(
state: &AppState,
file_id: Option<String>,
merchant_account: &storage_models::merchant_account::MerchantAccount,
+ is_connector_file_data_required: api::FileDataRequired,
) -> CustomResult<(Option<Vec<u8>>, Option<String>), errors::ApiErrorResponse> {
match file_id {
None => Ok((None, None)),
@@ -159,10 +217,13 @@ pub async fn retrieve_file_and_provider_file_id_from_file_id(
.change_context(errors::ApiErrorResponse::FileNotFound)?;
let (provider, provider_file_id) = match (
file_metadata_object.file_upload_provider,
- file_metadata_object.provider_file_id,
+ file_metadata_object.provider_file_id.clone(),
+ file_metadata_object.available,
) {
- (Some(provider), Some(provider_file_id)) => (provider, provider_file_id),
- _ => Err(errors::ApiErrorResponse::FileNotFound)?,
+ (Some(provider), Some(provider_file_id), true) => (provider, provider_file_id),
+ _ => Err(errors::ApiErrorResponse::FileNotAvailable)
+ .into_report()
+ .attach_printable("File not available")?,
};
match provider {
storage_models::enums::FileUploadProvider::Router => Ok((
@@ -176,20 +237,39 @@ pub async fn retrieve_file_and_provider_file_id_from_file_id(
),
Some(provider_file_id),
)),
- //TODO: Handle Retrieve for other providers
- _ => Ok((None, Some(provider_file_id))),
+ _ => {
+ let connector_file_data = match is_connector_file_data_required {
+ api::FileDataRequired::Required => Some(
+ retrieve_file_from_connector(
+ state,
+ file_metadata_object,
+ merchant_account,
+ )
+ .await?,
+ ),
+ api::FileDataRequired::NotRequired => None,
+ };
+ Ok((connector_file_data, Some(provider_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(
+pub async fn upload_and_get_provider_provider_file_id_connector_label(
state: &AppState,
merchant_account: &storage::merchant_account::MerchantAccount,
create_file_request: &api::CreateFileRequest,
file_key: String,
-) -> CustomResult<(String, api::FileUploadProvider), errors::ApiErrorResponse> {
+) -> CustomResult<
+ (
+ String,
+ api_models::enums::FileUploadProvider,
+ Option<String>,
+ ),
+ errors::ApiErrorResponse,
+> {
match create_file_request.purpose {
api::FilePurpose::DisputeEvidence => {
let dispute_id = create_file_request
@@ -225,6 +305,12 @@ pub async fn upload_and_get_provider_provider_file_id(
)
.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,
@@ -239,6 +325,7 @@ pub async fn upload_and_get_provider_provider_file_id(
create_file_request,
&dispute.connector,
file_key,
+ connector_label.clone(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -263,7 +350,10 @@ pub async fn upload_and_get_provider_provider_file_id(
})?;
Ok((
upload_file_response.provider_file_id,
- api::FileUploadProvider::try_from(&connector_data.connector_name)?,
+ api_models::enums::FileUploadProvider::foreign_try_from(
+ &connector_data.connector_name,
+ )?,
+ Some(connector_label),
))
} else {
upload_file(
@@ -273,7 +363,11 @@ pub async fn upload_and_get_provider_provider_file_id(
create_file_request.file.clone(),
)
.await?;
- Ok((file_key, api::FileUploadProvider::Router))
+ Ok((
+ file_key,
+ api_models::enums::FileUploadProvider::Router,
+ None,
+ ))
}
}
}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 03d578daeaf..0ec52df1f3f 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -324,6 +324,14 @@ macro_rules! default_imp_for_file_upload{
types::UploadFileResponse,
> for $path::$connector
{}
+ impl api::RetrieveFile for $path::$connector {}
+ impl
+ services::ConnectorIntegration<
+ api::Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+ > for $path::$connector
+ {}
)*
};
}
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 4611cc3ebc7..5b5f6e8ba2a 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -2,7 +2,7 @@ use std::marker::PhantomData;
use api_models::enums::{DisputeStage, DisputeStatus};
use common_utils::errors::CustomResult;
-use error_stack::ResultExt;
+use error_stack::{IntoReport, ResultExt};
use router_env::{instrument, tracing};
use super::payments::{helpers, PaymentAddress};
@@ -343,6 +343,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
}
#[instrument(skip_all)]
+#[allow(clippy::too_many_arguments)]
pub async fn construct_upload_file_router_data<'a>(
state: &'a AppState,
payment_intent: &'a storage::PaymentIntent,
@@ -351,13 +352,8 @@ 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 connector_label = helpers::get_connector_label(
- payment_intent.business_country,
- &payment_intent.business_label,
- payment_attempt.business_sub_label.as_ref(),
- connector_id,
- );
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
@@ -465,3 +461,62 @@ pub async fn construct_defend_dispute_router_data<'a>(
};
Ok(router_data)
}
+
+#[instrument(skip_all)]
+pub async fn construct_retrieve_file_router_data<'a>(
+ state: &'a AppState,
+ merchant_account: &storage::MerchantAccount,
+ file_metadata: &storage_models::file::FileMetadata,
+ connector_id: &str,
+) -> RouterResult<types::RetrieveFileRouterData> {
+ let connector_label = file_metadata
+ .connector_label
+ .clone()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Missing connector label")?;
+ let merchant_connector_account = helpers::get_merchant_connector_account(
+ state,
+ merchant_account.merchant_id.as_str(),
+ &connector_label,
+ None,
+ )
+ .await?;
+ let auth_type: types::ConnectorAuthType = merchant_connector_account
+ .get_connector_account_details()
+ .parse_value("ConnectorAuthType")
+ .change_context(errors::ApiErrorResponse::InternalServerError)?;
+ let router_data = types::RouterData {
+ flow: PhantomData,
+ merchant_id: merchant_account.merchant_id.clone(),
+ connector: connector_id.to_string(),
+ customer_id: None,
+ connector_customer: None,
+ payment_id: "irrelevant_payment_id_in_dispute_flow".to_string(),
+ attempt_id: "irrelevant_attempt_id_in_dispute_flow".to_string(),
+ status: storage_models::enums::AttemptStatus::default(),
+ payment_method: storage_models::enums::PaymentMethod::default(),
+ connector_auth_type: auth_type,
+ description: None,
+ return_url: None,
+ payment_method_id: None,
+ address: PaymentAddress::default(),
+ auth_type: storage_models::enums::AuthenticationType::default(),
+ connector_meta_data: merchant_connector_account.get_metadata(),
+ amount_captured: None,
+ request: types::RetrieveFileRequestData {
+ provider_file_id: file_metadata
+ .provider_file_id
+ .clone()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Missing provider file id")?,
+ },
+ response: Err(types::ErrorResponse::default()),
+ access_token: None,
+ session_token: None,
+ reference_id: None,
+ payment_method_token: None,
+ };
+ Ok(router_data)
+}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index d0750db413b..aa01bf5ba77 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -136,6 +136,12 @@ pub type SubmitEvidenceType = dyn services::ConnectorIntegration<
pub type UploadFileType =
dyn services::ConnectorIntegration<api::Upload, UploadFileRequestData, UploadFileResponse>;
+pub type RetrieveFileType = dyn services::ConnectorIntegration<
+ api::Retrieve,
+ RetrieveFileRequestData,
+ RetrieveFileResponse,
+>;
+
pub type DefendDisputeType = dyn services::ConnectorIntegration<
api::Defend,
DefendDisputeRequestData,
@@ -152,6 +158,9 @@ pub type SubmitEvidenceRouterData =
pub type UploadFileRouterData = RouterData<api::Upload, UploadFileRequestData, UploadFileResponse>;
+pub type RetrieveFileRouterData =
+ RouterData<api::Retrieve, RetrieveFileRequestData, RetrieveFileResponse>;
+
pub type DefendDisputeRouterData =
RouterData<api::Defend, DefendDisputeRequestData, DefendDisputeResponse>;
@@ -516,6 +525,16 @@ pub struct UploadFileResponse {
pub provider_file_id: String,
}
+#[derive(Clone, Debug)]
+pub struct RetrieveFileRequestData {
+ pub provider_file_id: String,
+}
+
+#[derive(Clone, Debug)]
+pub struct RetrieveFileResponse {
+ pub file_data: Vec<u8>,
+}
+
#[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)]
pub struct ConnectorResponse {
pub merchant_id: String,
diff --git a/crates/router/src/types/api/files.rs b/crates/router/src/types/api/files.rs
index eaf4015ccda..1e78708c818 100644
--- a/crates/router/src/types/api/files.rs
+++ b/crates/router/src/types/api/files.rs
@@ -1,23 +1,41 @@
+use api_models::enums::FileUploadProvider;
use masking::{Deserialize, Serialize};
use super::ConnectorCommon;
-use crate::{core::errors, services, types};
+use crate::{
+ core::errors,
+ services,
+ types::{self, transformers::ForeignTryFrom},
+};
#[derive(Default, Debug, Deserialize, Serialize)]
pub struct FileId {
pub file_id: String,
}
-#[derive(Debug, Clone, frunk::LabelledGeneric)]
-pub enum FileUploadProvider {
- Router,
- Stripe,
- Checkout,
+#[derive(Debug)]
+pub enum FileDataRequired {
+ Required,
+ NotRequired,
}
-impl TryFrom<&types::Connector> for FileUploadProvider {
+impl ForeignTryFrom<FileUploadProvider> for types::Connector {
type Error = error_stack::Report<errors::ApiErrorResponse>;
- fn try_from(item: &types::Connector) -> Result<Self, Self::Error> {
+ fn foreign_try_from(item: FileUploadProvider) -> Result<Self, Self::Error> {
+ match item {
+ FileUploadProvider::Stripe => Ok(Self::Stripe),
+ FileUploadProvider::Checkout => Ok(Self::Checkout),
+ FileUploadProvider::Router => Err(errors::ApiErrorResponse::NotSupported {
+ message: "File upload provider is not a connector".to_owned(),
+ }
+ .into()),
+ }
+ }
+}
+
+impl ForeignTryFrom<&types::Connector> for FileUploadProvider {
+ type Error = error_stack::Report<errors::ApiErrorResponse>;
+ fn foreign_try_from(item: &types::Connector) -> Result<Self, Self::Error> {
match *item {
types::Connector::Stripe => Ok(Self::Stripe),
types::Connector::Checkout => Ok(Self::Checkout),
@@ -54,7 +72,19 @@ pub trait UploadFile:
{
}
-pub trait FileUpload: ConnectorCommon + Sync + UploadFile {
+#[derive(Debug, Clone)]
+pub struct Retrieve;
+
+pub trait RetrieveFile:
+ services::ConnectorIntegration<
+ Retrieve,
+ types::RetrieveFileRequestData,
+ types::RetrieveFileResponse,
+>
+{
+}
+
+pub trait FileUpload: ConnectorCommon + Sync + UploadFile + RetrieveFile {
fn validate_file_upload(
&self,
_purpose: FilePurpose,
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index e57ee3a662a..2b7b393783f 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -457,12 +457,6 @@ impl ForeignFrom<storage_enums::DisputeStatus> for api_enums::DisputeStatus {
}
}
-impl ForeignFrom<api_types::FileUploadProvider> for storage_enums::FileUploadProvider {
- fn foreign_from(provider: api_types::FileUploadProvider) -> Self {
- frunk::labelled_convert_from(provider)
- }
-}
-
impl ForeignTryFrom<api_models::webhooks::IncomingWebhookEvent> for storage_enums::DisputeStatus {
type Error = errors::ValidationError;
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index d197369f691..fea5949a435 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -796,26 +796,3 @@ pub enum DisputeStatus {
DisputeWon,
DisputeLost,
}
-
-#[derive(
- Clone,
- Copy,
- Debug,
- Eq,
- PartialEq,
- Default,
- serde::Deserialize,
- serde::Serialize,
- strum::Display,
- strum::EnumString,
- frunk::LabelledGeneric,
-)]
-#[router_derive::diesel_enum(storage_type = "text")]
-#[serde(rename_all = "snake_case")]
-#[strum(serialize_all = "snake_case")]
-pub enum FileUploadProvider {
- #[default]
- Router,
- Stripe,
- Checkout,
-}
diff --git a/crates/storage_models/src/file.rs b/crates/storage_models/src/file.rs
index 08363c2cbf2..baa37507e99 100644
--- a/crates/storage_models/src/file.rs
+++ b/crates/storage_models/src/file.rs
@@ -2,7 +2,7 @@ use common_utils::custom_serde;
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use masking::{Deserialize, Serialize};
-use crate::{enums as storage_enums, schema::file_metadata};
+use crate::schema::file_metadata;
#[derive(Clone, Debug, Deserialize, Insertable, Serialize, router_derive::DebugAsDisplay)]
#[diesel(table_name = file_metadata)]
@@ -14,8 +14,9 @@ pub struct FileMetadataNew {
pub file_size: i32,
pub file_type: String,
pub provider_file_id: Option<String>,
- pub file_upload_provider: Option<storage_enums::FileUploadProvider>,
+ pub file_upload_provider: Option<common_enums::FileUploadProvider>,
pub available: bool,
+ pub connector_label: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable)]
@@ -28,18 +29,20 @@ pub struct FileMetadata {
pub file_size: i32,
pub file_type: String,
pub provider_file_id: Option<String>,
- pub file_upload_provider: Option<storage_enums::FileUploadProvider>,
+ pub file_upload_provider: Option<common_enums::FileUploadProvider>,
pub available: bool,
#[serde(with = "custom_serde::iso8601")]
pub created_at: time::PrimitiveDateTime,
+ pub connector_label: Option<String>,
}
#[derive(Debug)]
pub enum FileMetadataUpdate {
Update {
provider_file_id: Option<String>,
- file_upload_provider: Option<storage_enums::FileUploadProvider>,
+ file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
+ connector_label: Option<String>,
},
}
@@ -47,8 +50,9 @@ pub enum FileMetadataUpdate {
#[diesel(table_name = file_metadata)]
pub struct FileMetadataUpdateInternal {
provider_file_id: Option<String>,
- file_upload_provider: Option<storage_enums::FileUploadProvider>,
+ file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
+ connector_label: Option<String>,
}
impl From<FileMetadataUpdate> for FileMetadataUpdateInternal {
@@ -58,10 +62,12 @@ impl From<FileMetadataUpdate> for FileMetadataUpdateInternal {
provider_file_id,
file_upload_provider,
available,
+ connector_label,
} => Self {
provider_file_id,
file_upload_provider,
available,
+ connector_label,
},
}
}
diff --git a/crates/storage_models/src/schema.rs b/crates/storage_models/src/schema.rs
index 3ab3793d8d5..2aadb280e11 100644
--- a/crates/storage_models/src/schema.rs
+++ b/crates/storage_models/src/schema.rs
@@ -169,6 +169,7 @@ diesel::table! {
file_upload_provider -> Nullable<Varchar>,
available -> Bool,
created_at -> Timestamp,
+ connector_label -> Nullable<Varchar>,
}
}
diff --git a/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/down.sql b/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/down.sql
new file mode 100644
index 00000000000..33e2ddaad1a
--- /dev/null
+++ b/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/down.sql
@@ -0,0 +1 @@
+ALTER TABLE file_metadata DROP COLUMN connector_label;
\ No newline at end of file
diff --git a/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/up.sql b/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/up.sql
new file mode 100644
index 00000000000..9db889b9002
--- /dev/null
+++ b/migrations/2023-04-25-141011_add_connector_label_col_in_file_metadata/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE file_metadata
+ADD COLUMN connector_label VARCHAR(255);
\ No newline at end of file
|
feat
|
added retrieval flow for connector file uploads and added support for stripe connector (#990)
|
1828ea6187c46d9c18dc8a0b5224387403b998e2
|
2024-02-01 18:37:44
|
Tejas Mate
|
refactor(connector): [CYBERSOURCE] Remove default case for Cybersource (#2705)
| false
|
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 9b0bf61c545..324fe77d0bc 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -193,9 +193,22 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
utils::get_unimplemented_payment_method_error_message("Cybersource"),
))?,
},
- _ => Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Cybersource"),
- ))?,
+ payments::PaymentMethodData::CardRedirect(_)
+ | payments::PaymentMethodData::PayLater(_)
+ | payments::PaymentMethodData::BankRedirect(_)
+ | payments::PaymentMethodData::BankDebit(_)
+ | payments::PaymentMethodData::BankTransfer(_)
+ | payments::PaymentMethodData::Crypto(_)
+ | payments::PaymentMethodData::MandatePayment
+ | payments::PaymentMethodData::Reward
+ | payments::PaymentMethodData::Upi(_)
+ | payments::PaymentMethodData::Voucher(_)
+ | payments::PaymentMethodData::GiftCard(_)
+ | payments::PaymentMethodData::CardToken(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Cybersource"),
+ ))?
+ }
};
let processing_information = ProcessingInformation {
|
refactor
|
[CYBERSOURCE] Remove default case for Cybersource (#2705)
|
aa2f5d147561f6e996228d269e6a54c5d1f53a60
|
2024-09-09 05:55:09
|
github-actions
|
chore(version): 2024.09.09.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79457071a52..7acd184f175 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,18 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.09.09.0
+
+### Features
+
+- **core:** Add Support for Payments Dynamic Tax Calculation Based on Shipping Address ([#5619](https://github.com/juspay/hyperswitch/pull/5619)) ([`a03ad53`](https://github.com/juspay/hyperswitch/commit/a03ad53e437efa30528c9b28f0d0328b6d0d1bc2))
+- **recon:** Add merchant and profile IDs in auth tokens ([#5643](https://github.com/juspay/hyperswitch/pull/5643)) ([`d9485a5`](https://github.com/juspay/hyperswitch/commit/d9485a5f360f78f308f4e70c361f33873c63b686))
+- Add support to forward x-request-id to keymanager service ([#5803](https://github.com/juspay/hyperswitch/pull/5803)) ([`36cd5c1`](https://github.com/juspay/hyperswitch/commit/36cd5c1c41ff4948d52f1b8f1dbe21af200fc618))
+
+**Full Changelog:** [`2024.09.06.0...2024.09.09.0`](https://github.com/juspay/hyperswitch/compare/2024.09.06.0...2024.09.09.0)
+
+- - -
+
## 2024.09.06.0
### Features
|
chore
|
2024.09.09.0
|
8fd353d3abd8d26c14e4804678db0942c7ca2df9
|
2023-08-17 19:56:47
|
Gnanasundari24
|
ci(postman): Update Postman collections (#1959)
| false
|
diff --git a/postman/adyen_uk.postman_collection.json b/postman/adyen_uk.postman_collection.json
index d7c8c1530e8..bac2c37171c 100644
--- a/postman/adyen_uk.postman_collection.json
+++ b/postman/adyen_uk.postman_collection.json
@@ -1,10 +1,9 @@
{
"info": {
- "_postman_id": "7785a328-20b2-4a66-a996-32b7e457ab5e",
+ "_postman_id": "de5a144d-d247-4751-a8f3-ecfa9832641c",
"name": "Adyen UK Collection",
"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": "25737662"
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
@@ -8224,13 +8223,6 @@
" pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
"})};",
"",
- "// Response body should have value \"invalid_request\" for \"error type\"",
- "if (jsonData?.error?.message) {",
- "pm.test(\"[POST]::/payments - Content check if value for 'error.message' matches 'This Payment could not be captured because it has a payment.status of requires_customer_action. The expected state is requires_capture, partially captured'\", function() {",
- " pm.expect(jsonData.error.message).to.eql(\"This Payment could not be captured because it has a payment.status of requires_customer_action. The expected state is requires_capture, partially captured\");",
- "})};",
- "",
- "",
"",
""
],
diff --git a/postman/checkout.postman_collection.json b/postman/checkout.postman_collection.json
index 5f3f6230931..7d82338dd79 100644
--- a/postman/checkout.postman_collection.json
+++ b/postman/checkout.postman_collection.json
@@ -1,10 +1,9 @@
{
"info": {
- "_postman_id": "6b42c00f-ab7f-4047-b983-43ba32f3580b",
+ "_postman_id": "fd9655ad-8732-423a-aee0-3617ee955246",
"name": "Checkout Collection",
"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": "25737662"
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
@@ -5600,14 +5599,6 @@
" pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
"})};",
"",
- "// Response body should have value \"This Payment could not be captured because it has a payment.status of succeeded. The expected state is requires_capture\" for \"error message\"",
- "if (jsonData?.error?.message) {",
- "pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\", function() {",
- " pm.expect(jsonData.error.message).to.eql(\"This Payment could not be captured because it has a payment.status of succeeded. The expected state is requires_capture, partially captured\");",
- "})};",
- "",
- "",
- "",
""
],
"type": "text/javascript"
diff --git a/postman/payme.postman_collection.json b/postman/payme.postman_collection.json
index 79f7c32516b..45ef74307a7 100644
--- a/postman/payme.postman_collection.json
+++ b/postman/payme.postman_collection.json
@@ -1,6 +1,6 @@
{
"info": {
- "_postman_id": "0e53f151-a783-4e88-9596-e357283126f3",
+ "_postman_id": "40ff041e-f465-4003-9479-71854a45563a",
"name": "Payme Collection",
"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"
@@ -4433,4 +4433,4 @@
"type": "string"
}
]
-}
\ No newline at end of file
+}
diff --git a/postman/trustpay.postman_collection.json b/postman/trustpay.postman_collection.json
index a6179dabaa2..d772a2f423f 100644
--- a/postman/trustpay.postman_collection.json
+++ b/postman/trustpay.postman_collection.json
@@ -1,10 +1,9 @@
{
"info": {
- "_postman_id": "f4235e58-af9a-453e-9fca-8d29c8356016",
+ "_postman_id": "79d4c0d8-454e-45a4-a4ae-749bd9bccb22",
"name": "Trustpay Collection",
"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": "25737662"
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
@@ -2685,330 +2684,6 @@
}
]
},
- {
- "name": "Scenario10-Bank Redirect-eps",
- "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_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\");",
- "})};",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{\n \"amount\": 1000,\n \"currency\": \"EUR\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": 1000,\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"three_ds\",\n \"return_url\": \"https://duck.com\",\n \"billing\": {\n \"address\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"DE\"\n }\n },\n \"browser_info\": {\n \"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\",\n \"accept_header\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\n \"language\": \"nl-NL\",\n \"color_depth\": 24,\n \"screen_height\": 723,\n \"screen_width\": 1536,\n \"time_zone\": 0,\n \"java_enabled\": true,\n \"java_script_enabled\": true,\n \"ip_address\": \"127.0.0.1\"\n },\n \"shipping\": {\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\": \"John\",\n \"last_name\": \"Doe\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "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 - Confirm",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// 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 \"requires_customer_action\" for \"status\"",
- "if (jsonData?.status) {",
- "pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
- "})};",
- "",
- "",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(\"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\", function() {",
- " pm.expect((typeof jsonData.next_action.redirect_to_url !== \"undefined\")).to.be.true;",
- "});",
- "",
- "// Response body should have value \"eps\" for \"payment_method_type\"",
- "if (jsonData?.payment_method_type) {",
- "pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'eps'\", function() {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"eps\");",
- "})};",
- "",
- "",
- "// Response body should have value \"stripe\" for \"connector\"",
- "if (jsonData?.connector) {",
- "pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'trustpay'\", function() {",
- " pm.expect(jsonData.connector).to.eql(\"trustpay\");",
- "})};"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{\n \"payment_method\": \"bank_redirect\",\n \"payment_method_type\": \"eps\",\n \"payment_method_data\": {\n \"bank_redirect\": {\n \"eps\": {\n \"billing_details\": {\n \"billing_name\": \"John Doe\"\n },\n \"bank_name\": \"hypo_oberosterreich_salzburg_steiermark\",\n \"preferred_language\": \"en\",\n \"country\": \"DE\"\n }\n }\n }\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "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"
- },
- "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 \"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\");",
- "})};"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true",
- "disabled": 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": "Scenario11-Bank Redirect-giropay",
"item": [
|
ci
|
Update Postman collections (#1959)
|
9787a2becf1bc9eceee6a1fec0a4edb5c3e6473b
|
2024-11-20 01:00:49
|
Debarati Ghatak
|
feat(connector): [Novalnet] Add minimal customer data feature (#6570)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 1888511e9ba..f9bbe8398cb 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -68,11 +68,11 @@ pub struct NovalnetPaymentsRequestMerchant {
#[derive(Default, Debug, Serialize, Clone)]
pub struct NovalnetPaymentsRequestBilling {
- house_no: Secret<String>,
- street: Secret<String>,
- city: Secret<String>,
- zip: Secret<String>,
- country_code: api_enums::CountryAlpha2,
+ house_no: Option<Secret<String>>,
+ street: Option<Secret<String>>,
+ city: Option<Secret<String>>,
+ zip: Option<Secret<String>>,
+ country_code: Option<api_enums::CountryAlpha2>,
}
#[derive(Default, Debug, Serialize, Clone)]
@@ -81,8 +81,9 @@ pub struct NovalnetPaymentsRequestCustomer {
last_name: Secret<String>,
email: Email,
mobile: Option<Secret<String>>,
- billing: NovalnetPaymentsRequestBilling,
- customer_ip: Secret<String, IpAddress>,
+ billing: Option<NovalnetPaymentsRequestBilling>,
+ customer_ip: Option<Secret<String, IpAddress>>,
+ no_nc: i64,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
@@ -183,26 +184,32 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
};
let billing = NovalnetPaymentsRequestBilling {
- house_no: item.router_data.get_billing_line1()?,
- street: item.router_data.get_billing_line2()?,
- city: Secret::new(item.router_data.get_billing_city()?),
- zip: item.router_data.get_billing_zip()?,
- country_code: item.router_data.get_billing_country()?,
+ house_no: item.router_data.get_optional_billing_line1(),
+ street: item.router_data.get_optional_billing_line2(),
+ city: item
+ .router_data
+ .get_optional_billing_city()
+ .map(Secret::new),
+ zip: item.router_data.get_optional_billing_zip(),
+ country_code: item.router_data.get_optional_billing_country(),
};
let customer_ip = item
.router_data
.request
.get_browser_info()?
- .get_ip_address()?;
+ .get_ip_address()
+ .ok();
let customer = NovalnetPaymentsRequestCustomer {
first_name: item.router_data.get_billing_first_name()?,
last_name: item.router_data.get_billing_last_name()?,
email: item.router_data.get_billing_email()?,
mobile: item.router_data.get_optional_billing_phone_number(),
- billing,
+ billing: Some(billing),
customer_ip,
+ // no_nc is used to indicate if minimal customer data is passed or not
+ no_nc: 1,
};
let lang = item
@@ -637,11 +644,11 @@ pub struct NovalnetResponseCustomer {
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct NovalnetResponseBilling {
- pub city: Secret<String>,
- pub country_code: Secret<String>,
+ pub city: Option<Secret<String>>,
+ pub country_code: Option<Secret<String>>,
pub house_no: Option<Secret<String>>,
- pub street: Secret<String>,
- pub zip: Secret<String>,
+ pub street: Option<Secret<String>>,
+ pub zip: Option<Secret<String>>,
pub state: Option<Secret<String>>,
}
diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
index fc37d937d00..8d5a4fe89b9 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -2041,42 +2041,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "billing.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserAddressLine2,
- value: None,
- }
- ),
- (
- "billing.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserAddressCity,
- value: None,
- }
- ),
- (
- "billing.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserAddressPincode,
- value: None,
- }
- ),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -2104,19 +2068,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "billing.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
]
),
}
@@ -5226,42 +5177,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "billing.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserAddressLine2,
- value: None,
- }
- ),
- (
- "billing.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserAddressCity,
- value: None,
- }
- ),
- (
- "billing.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserAddressPincode,
- value: None,
- }
- ),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -5289,19 +5204,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "billing.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
]
),
}
@@ -8203,42 +8105,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "billing.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserAddressLine2,
- value: None,
- }
- ),
- (
- "billing.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserAddressCity,
- value: None,
- }
- ),
- (
- "billing.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserAddressPincode,
- value: None,
- }
- ),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -8266,19 +8132,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "billing.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
]
),
}
@@ -8563,42 +8416,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "billing.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserAddressLine2,
- value: None,
- }
- ),
- (
- "billing.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserAddressCity,
- value: None,
- }
- ),
- (
- "billing.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserAddressPincode,
- value: None,
- }
- ),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -8626,19 +8443,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "billing.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
]
),
}
@@ -9313,42 +9117,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "billing.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserAddressLine2,
- value: None,
- }
- ),
- (
- "billing.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserAddressCity,
- value: None,
- }
- ),
- (
- "billing.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserAddressPincode,
- value: None,
- }
- ),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -9376,19 +9144,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "billing.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
]
),
}
|
feat
|
[Novalnet] Add minimal customer data feature (#6570)
|
99bbc3982fa30f6ffd43334b1fa5da963975fe93
|
2024-05-07 15:21:20
|
Shankar Singh C
|
refactor: remove `configs/pg_agnostic_mit` api as it will not be used (#4486)
| false
|
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 723e6eccc36..f3d966f3d9d 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -299,13 +299,6 @@ impl From<RoutableConnectorChoice> for ast::ConnectorChoice {
}
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
-pub struct DetailedConnectorChoice {
- pub enabled: bool,
-}
-
-impl common_utils::events::ApiEventMetric for DetailedConnectorChoice {}
-
#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, strum::Display, ToSchema)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 815c604a0e3..07bceefb0f9 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -314,6 +314,7 @@ where
&merchant_account,
&key_store,
&mut payment_data,
+ &business_profile,
)
.await?;
@@ -415,6 +416,7 @@ where
&merchant_account,
&key_store,
&mut payment_data,
+ &business_profile,
)
.await?;
@@ -3320,6 +3322,7 @@ where
routing_data,
connector_data,
mandate_type,
+ business_profile.is_connector_agnostic_mit_enabled,
)
.await;
}
@@ -3377,6 +3380,7 @@ where
routing_data,
connector_data,
mandate_type,
+ business_profile.is_connector_agnostic_mit_enabled,
)
.await;
}
@@ -3400,6 +3404,7 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment<F: Clone
routing_data: &mut storage::RoutingData,
connectors: Vec<api::ConnectorData>,
mandate_type: Option<api::MandateTransactionType>,
+ is_connector_agnostic_mit_enabled: Option<bool>,
) -> RouterResult<ConnectorCallType> {
match (
payment_data.payment_intent.setup_future_usage,
@@ -3442,22 +3447,6 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment<F: Clone
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("unable to deserialize connector mandate details")?;
- let profile_id = payment_data
- .payment_intent
- .profile_id
- .as_ref()
- .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?;
-
- let pg_agnostic = state
- .store
- .find_config_by_key_unwrap_or(
- &format!("pg_agnostic_mandate_{}", profile_id),
- Some("false".to_string()),
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("The pg_agnostic config was not found in the DB")?;
-
let mut connector_choice = None;
for connector_data in connectors {
@@ -3468,7 +3457,7 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment<F: Clone
if is_network_transaction_id_flow(
state,
- &pg_agnostic.config,
+ is_connector_agnostic_mit_enabled,
connector_data.connector_name,
payment_method_info,
) {
@@ -3588,7 +3577,7 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment<F: Clone
pub fn is_network_transaction_id_flow(
state: &AppState,
- pg_agnostic: &String,
+ is_connector_agnostic_mit_enabled: Option<bool>,
connector: enums::Connector,
payment_method_info: &storage::PaymentMethod,
) -> bool {
@@ -3597,7 +3586,7 @@ pub fn is_network_transaction_id_flow(
.network_transaction_id_supported_connectors
.connector_list;
- pg_agnostic == "true"
+ is_connector_agnostic_mit_enabled == Some(true)
&& payment_method_info.payment_method == Some(storage_enums::PaymentMethod::Card)
&& ntid_supported_connectors.contains(&connector)
&& payment_method_info.network_transaction_id.is_some()
@@ -3827,6 +3816,7 @@ where
routing_data,
connector_data,
mandate_type,
+ business_profile.is_connector_agnostic_mit_enabled,
)
.await
}
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index c214decb0b4..da9a2108691 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -241,6 +241,7 @@ pub trait PostUpdateTracker<F, D, R: Send>: Send {
_merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &storage::business_profile::BusinessProfile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index f4408749fd3..b40ee8e5c9c 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -89,13 +89,13 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
payment_data: &mut PaymentData<F>,
+ business_profile: &storage::business_profile::BusinessProfile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
{
let customer_id = payment_data.payment_intent.customer_id.clone();
let save_payment_data = tokenization::SavePaymentMethodData::from(resp);
- let profile_id = payment_data.payment_intent.profile_id.clone();
let connector_name = payment_data
.payment_attempt
@@ -125,8 +125,8 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
key_store,
Some(resp.request.amount),
Some(resp.request.currency),
- profile_id,
billing_name.clone(),
+ business_profile,
));
let is_connector_mandate = resp.request.customer_acceptance.is_some()
@@ -169,11 +169,12 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
let key_store = key_store.clone();
let state = state.clone();
let customer_id = payment_data.payment_intent.customer_id.clone();
- let profile_id = payment_data.payment_intent.profile_id.clone();
let merchant_connector_id = payment_data.payment_attempt.merchant_connector_id.clone();
let payment_attempt = payment_data.payment_attempt.clone();
+ let business_profile = business_profile.clone();
+
let amount = resp.request.amount;
let currency = resp.request.currency;
let payment_method_type = resp.request.payment_method_type;
@@ -195,8 +196,8 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
&key_store,
Some(amount),
Some(currency),
- profile_id,
billing_name,
+ &business_profile,
))
.await;
@@ -388,6 +389,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
payment_data: &mut PaymentData<F>,
+ business_profile: &storage::business_profile::BusinessProfile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
@@ -398,6 +400,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
resp.status,
resp.response.clone(),
merchant_account.storage_scheme,
+ business_profile.is_connector_agnostic_mit_enabled,
)
.await?;
Ok(())
@@ -587,6 +590,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
payment_data: &mut PaymentData<F>,
+ business_profile: &storage::business_profile::BusinessProfile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
@@ -598,7 +602,6 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
.and_then(|address| address.get_optional_full_name());
let save_payment_data = tokenization::SavePaymentMethodData::from(resp);
let customer_id = payment_data.payment_intent.customer_id.clone();
- let profile_id = payment_data.payment_intent.profile_id.clone();
let connector_name = payment_data
.payment_attempt
.connector
@@ -622,8 +625,8 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
key_store,
resp.request.amount,
Some(resp.request.currency),
- profile_id,
billing_name,
+ business_profile,
))
.await?;
@@ -674,6 +677,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
payment_data: &mut PaymentData<F>,
+ business_profile: &storage::business_profile::BusinessProfile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
@@ -684,6 +688,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
resp.status,
resp.response.clone(),
merchant_account.storage_scheme,
+ business_profile.is_connector_agnostic_mit_enabled,
)
.await?;
Ok(())
@@ -1224,6 +1229,7 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
attempt_status: common_enums::AttemptStatus,
payment_response: Result<types::PaymentsResponseData, ErrorResponse>,
storage_scheme: enums::MerchantStorageScheme,
+ is_connector_agnostic_mit_enabled: Option<bool>,
) -> RouterResult<()> {
if let Some(id) = &payment_data.payment_attempt.payment_method_id {
let pm = state
@@ -1244,23 +1250,7 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
let network_transaction_id =
if let Some(network_transaction_id) = pm_resp_network_transaction_id {
- let profile_id = payment_data
- .payment_intent
- .profile_id
- .as_ref()
- .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?;
-
- let pg_agnostic = state
- .store
- .find_config_by_key_unwrap_or(
- &format!("pg_agnostic_mandate_{}", profile_id),
- Some("false".to_string()),
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("The pg_agnostic config was not found in the DB")?;
-
- if &pg_agnostic.config == "true"
+ if is_connector_agnostic_mit_enabled == Some(true)
&& payment_data.payment_intent.setup_future_usage
== Some(diesel_models::enums::FutureUsage::OffSession)
{
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 304e6edd62e..958c3f4362f 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -64,8 +64,8 @@ pub async fn save_payment_method<FData>(
key_store: &domain::MerchantKeyStore,
amount: Option<i64>,
currency: Option<storage_enums::Currency>,
- profile_id: Option<String>,
billing_name: Option<masking::Secret<String>>,
+ business_profile: &storage::business_profile::BusinessProfile,
) -> RouterResult<(Option<String>, Option<common_enums::PaymentMethodStatus>)>
where
FData: mandate::MandateBehaviour + Clone,
@@ -91,21 +91,7 @@ where
let network_transaction_id =
if let Some(network_transaction_id) = network_transaction_id {
- let profile_id = profile_id
- .as_ref()
- .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?;
-
- let pg_agnostic = state
- .store
- .find_config_by_key_unwrap_or(
- &format!("pg_agnostic_mandate_{}", profile_id),
- Some("false".to_string()),
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("The pg_agnostic config was not found in the DB")?;
-
- if &pg_agnostic.config == "true"
+ if business_profile.is_connector_agnostic_mit_enabled == Some(true)
&& save_payment_method_data.request.get_setup_future_usage()
== Some(storage_enums::FutureUsage::OffSession)
{
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index bec90c51e9c..31825617398 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -9,6 +9,7 @@ use api_models::{
};
#[cfg(not(feature = "business_profile_routing"))]
use common_utils::ext_traits::{Encode, StringExt};
+#[cfg(not(feature = "business_profile_routing"))]
use diesel_models::configs;
#[cfg(feature = "business_profile_routing")]
use diesel_models::routing_algorithm::RoutingAlgorithm;
@@ -806,37 +807,6 @@ pub async fn retrieve_linked_routing_config(
}
}
-pub async fn upsert_connector_agnostic_mandate_config(
- state: AppState,
- business_profile_id: &str,
- mandate_config: routing_types::DetailedConnectorChoice,
-) -> RouterResponse<routing_types::DetailedConnectorChoice> {
- let key = helpers::get_pg_agnostic_mandate_config_key(business_profile_id);
-
- let mandate_config_str = mandate_config.enabled.to_string();
-
- let find_config = state
- .store
- .find_config_by_key_unwrap_or(&key, Some(mandate_config_str.clone()))
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error saving pg agnostic mandate config to db")?;
-
- if find_config.config != mandate_config_str {
- let config_update = configs::ConfigUpdate::Update {
- config: Some(mandate_config_str),
- };
- state
- .store
- .update_config_by_key(&key, config_update)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error saving pg agnostic mandate config to db")?;
- }
-
- Ok(service_api::ApplicationResponse::Json(mandate_config))
-}
-
pub async fn retrieve_default_routing_config_for_profiles(
state: AppState,
merchant_account: domain::MerchantAccount,
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index fb86ba5a87b..3702498767a 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -272,47 +272,6 @@ pub async fn update_business_profile_active_algorithm_ref(
Ok(())
}
-pub async fn get_merchant_connector_agnostic_mandate_config(
- db: &dyn StorageInterface,
- business_profile_id: &str,
-) -> RouterResult<Vec<routing_types::DetailedConnectorChoice>> {
- let key = get_pg_agnostic_mandate_config_key(business_profile_id);
- let maybe_config = db.find_config_by_key(&key).await;
-
- match maybe_config {
- Ok(config) => config
- .config
- .parse_struct("Vec<DetailedConnectorChoice>")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("pg agnostic mandate config has invalid structure"),
-
- Err(e) if e.current_context().is_db_not_found() => {
- let new_mandate_config: Vec<routing_types::DetailedConnectorChoice> = Vec::new();
-
- let serialized = new_mandate_config
- .encode_to_string_of_json()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error serializing newly created pg agnostic mandate config")?;
-
- let new_config = configs::ConfigNew {
- key,
- config: serialized,
- };
-
- db.insert_config(new_config)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error inserting new pg agnostic mandate config in db")?;
-
- Ok(new_mandate_config)
- }
-
- Err(e) => Err(e)
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error fetching pg agnostic mandate config for merchant from db"),
- }
-}
-
pub async fn validate_connectors_in_routing_config(
db: &dyn StorageInterface,
key_store: &domain::MerchantKeyStore,
@@ -441,12 +400,6 @@ pub fn get_routing_dictionary_key(merchant_id: &str) -> String {
format!("routing_dict_{merchant_id}")
}
-/// Provides the identifier for the specific merchant's agnostic_mandate_config
-#[inline(always)]
-pub fn get_pg_agnostic_mandate_config_key(business_profile_id: &str) -> String {
- format!("pg_agnostic_mandate_{business_profile_id}")
-}
-
/// Provides the identifier for the specific merchant's default_config
#[inline(always)]
pub fn get_default_config_key(
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 6a8a4ee5e03..0ee44429756 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -466,10 +466,6 @@ impl Routing {
)
})),
)
- .service(
- web::resource("/business_profile/{business_profile_id}/configs/pg_agnostic_mit")
- .route(web::post().to(cloud_routing::upsert_connector_agnostic_mandate_config)),
- )
.service(
web::resource("/default")
.route(web::get().to(|state, req| {
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index bf91f8055d1..1e301b069ae 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -231,7 +231,6 @@ impl From<Flow> for ApiIdentifier {
| Flow::ReconTokenRequest
| Flow::ReconServiceRequest
| Flow::ReconVerifyToken => Self::Recon,
- Flow::CreateConnectorAgnosticMandateConfig => Self::Routing,
Flow::RetrievePollStatus => Self::Poll,
}
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 8438424546c..556e91d8694 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -566,41 +566,6 @@ pub async fn routing_retrieve_linked_config(
}
}
-#[cfg(feature = "olap")]
-#[instrument(skip_all)]
-pub async fn upsert_connector_agnostic_mandate_config(
- state: web::Data<AppState>,
- req: HttpRequest,
- json_payload: web::Json<routing_types::DetailedConnectorChoice>,
- path: web::Path<String>,
-) -> impl Responder {
- use crate::services::authentication::AuthenticationData;
-
- let flow = Flow::CreateConnectorAgnosticMandateConfig;
- let business_profile_id = path.into_inner();
-
- Box::pin(oss_api::server_wrap(
- flow,
- state,
- &req,
- json_payload.into_inner(),
- |state, _auth: AuthenticationData, mandate_config, _| {
- Box::pin(routing::upsert_connector_agnostic_mandate_config(
- state,
- &business_profile_id,
- mandate_config,
- ))
- },
- auth::auth_type(
- &auth::ApiKeyAuth,
- &auth::JWTAuth(Permission::RoutingWrite),
- req.headers(),
- ),
- api_locking::LockAction::NotApplicable,
- ))
- .await
-}
-
#[cfg(feature = "olap")]
#[instrument(skip_all)]
pub async fn routing_retrieve_default_config_for_profiles(
diff --git a/crates/router/src/types/api/routing.rs b/crates/router/src/types/api/routing.rs
index faafac76e3d..4f982d543df 100644
--- a/crates/router/src/types/api/routing.rs
+++ b/crates/router/src/types/api/routing.rs
@@ -3,9 +3,9 @@ pub use api_models::routing::RoutableChoiceKind;
pub use api_models::{
enums as api_enums,
routing::{
- ConnectorVolumeSplit, DetailedConnectorChoice, RoutableConnectorChoice, RoutingAlgorithm,
- RoutingAlgorithmKind, RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary,
- RoutingDictionaryRecord, StraightThroughAlgorithm,
+ ConnectorVolumeSplit, RoutableConnectorChoice, RoutingAlgorithm, RoutingAlgorithmKind,
+ RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary, RoutingDictionaryRecord,
+ StraightThroughAlgorithm,
},
};
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index e8ffe0685b2..14b235eadb2 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -210,8 +210,6 @@ pub enum Flow {
RoutingRetrieveConfig,
/// Routing retrieve active config
RoutingRetrieveActiveConfig,
- /// Update connector agnostic mandate config
- CreateConnectorAgnosticMandateConfig,
/// Routing retrieve default config
RoutingRetrieveDefaultConfig,
/// Routing retrieve dictionary
|
refactor
|
remove `configs/pg_agnostic_mit` api as it will not be used (#4486)
|
25245b965371d93449f4584667adeb38ab7e0e59
|
2023-11-05 18:52:35
|
Adarsh Jha
|
feat(connector): [Payeezy] Currency Unit Conversion (#2710)
| false
|
diff --git a/crates/router/src/connector/payeezy.rs b/crates/router/src/connector/payeezy.rs
index da712605437..03e76af907c 100644
--- a/crates/router/src/connector/payeezy.rs
+++ b/crates/router/src/connector/payeezy.rs
@@ -90,6 +90,10 @@ impl ConnectorCommon for Payeezy {
"payeezy"
}
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Base
+ }
+
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
@@ -292,12 +296,19 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
&self,
req: &types::PaymentsCaptureRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let connector_req = payeezy::PayeezyCaptureOrVoidRequest::try_from(req)?;
+ let router_obj = payeezy::PayeezyRouterData::try_from((
+ &self.get_currency_unit(),
+ req.request.currency,
+ req.request.amount_to_capture,
+ req,
+ ))?;
+ let req_obj = payeezy::PayeezyCaptureOrVoidRequest::try_from(&router_obj)?;
let payeezy_req = types::RequestBody::log_and_get_request_body(
- &connector_req,
+ &req_obj,
utils::Encode::<payeezy::PayeezyCaptureOrVoidRequest>::encode_to_string_of_json,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
Ok(Some(payeezy_req))
}
@@ -380,9 +391,16 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
&self,
req: &types::PaymentsAuthorizeRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let connector_req = payeezy::PayeezyPaymentsRequest::try_from(req)?;
+ let router_obj = payeezy::PayeezyRouterData::try_from((
+ &self.get_currency_unit(),
+ req.request.currency,
+ req.request.amount,
+ req,
+ ))?;
+ let req_obj = payeezy::PayeezyPaymentsRequest::try_from(&router_obj)?;
+
let payeezy_req = types::RequestBody::log_and_get_request_body(
- &connector_req,
+ &req_obj,
utils::Encode::<payeezy::PayeezyPaymentsRequest>::encode_to_string_of_json,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
@@ -469,10 +487,16 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
&self,
req: &types::RefundsRouterData<api::Execute>,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let connector_req = payeezy::PayeezyRefundRequest::try_from(req)?;
+ let router_obj = payeezy::PayeezyRouterData::try_from((
+ &self.get_currency_unit(),
+ req.request.currency,
+ req.request.refund_amount,
+ req,
+ ))?;
+ let req_obj = payeezy::PayeezyRefundRequest::try_from(&router_obj)?;
let payeezy_req = types::RequestBody::log_and_get_request_body(
- &connector_req,
- utils::Encode::<payeezy::PayeezyCaptureOrVoidRequest>::encode_to_string_of_json,
+ &req_obj,
+ utils::Encode::<payeezy::PayeezyRefundRequest>::encode_to_string_of_json,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(payeezy_req))
@@ -499,16 +523,22 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
data: &types::RefundsRouterData<api::Execute>,
res: Response,
) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
+ // Parse the response into a payeezy::RefundResponse
let response: payeezy::RefundResponse = res
.response
.parse_struct("payeezy RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- types::RefundsRouterData::try_from(types::ResponseRouterData {
+
+ // Create a new instance of types::RefundsRouterData based on the response, input data, and HTTP code
+ let response_data = types::ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
- })
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ };
+ let router_data = types::RefundsRouterData::try_from(response_data)
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+
+ Ok(router_data)
}
fn get_error_response(
diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs
index efcd1b36d5b..3a859b32530 100644
--- a/crates/router/src/connector/payeezy/transformers.rs
+++ b/crates/router/src/connector/payeezy/transformers.rs
@@ -9,6 +9,37 @@ use crate::{
core::errors,
types::{self, api, storage::enums, transformers::ForeignFrom},
};
+#[derive(Debug, Serialize)]
+pub struct PayeezyRouterData<T> {
+ pub amount: String,
+ pub router_data: T,
+}
+
+impl<T>
+ TryFrom<(
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ )> for PayeezyRouterData<T>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(
+ (currency_unit, currency, amount, router_data): (
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
+ Ok(Self {
+ amount,
+ router_data,
+ })
+ }
+}
#[derive(Serialize, Debug)]
pub struct PayeezyCard {
@@ -66,7 +97,7 @@ pub struct PayeezyPaymentsRequest {
pub merchant_ref: String,
pub transaction_type: PayeezyTransactionType,
pub method: PayeezyPaymentMethodType,
- pub amount: i64,
+ pub amount: String,
pub currency_code: String,
pub credit_card: PayeezyPaymentMethod,
pub stored_credentials: Option<StoredCredentials>,
@@ -95,10 +126,12 @@ pub enum Initiator {
CardHolder,
}
-impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayeezyPaymentsRequest {
+impl TryFrom<&PayeezyRouterData<&types::PaymentsAuthorizeRouterData>> for PayeezyPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
- match item.payment_method {
+ fn try_from(
+ item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.payment_method {
diesel_models::enums::PaymentMethod::Card => get_card_specific_payment_data(item),
diesel_models::enums::PaymentMethod::CardRedirect
@@ -119,14 +152,15 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayeezyPaymentsRequest {
}
fn get_card_specific_payment_data(
- item: &types::PaymentsAuthorizeRouterData,
+ item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<PayeezyPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
- let merchant_ref = item.attempt_id.to_string();
+ let merchant_ref = item.router_data.attempt_id.to_string();
let method = PayeezyPaymentMethodType::CreditCard;
- let amount = item.request.amount;
- let currency_code = item.request.currency.to_string();
+ let amount = item.amount.clone();
+ let currency_code = item.router_data.request.currency.to_string();
let credit_card = get_payment_method_data(item)?;
- let (transaction_type, stored_credentials) = get_transaction_type_and_stored_creds(item)?;
+ let (transaction_type, stored_credentials) =
+ get_transaction_type_and_stored_creds(item.router_data)?;
Ok(PayeezyPaymentsRequest {
merchant_ref,
transaction_type,
@@ -135,7 +169,7 @@ fn get_card_specific_payment_data(
currency_code,
credit_card,
stored_credentials,
- reference: item.connector_request_reference_id.clone(),
+ reference: item.router_data.connector_request_reference_id.clone(),
})
}
fn get_transaction_type_and_stored_creds(
@@ -201,9 +235,9 @@ fn is_mandate_payment(
}
fn get_payment_method_data(
- item: &types::PaymentsAuthorizeRouterData,
+ item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<PayeezyPaymentMethod, error_stack::Report<errors::ConnectorError>> {
- match item.request.payment_method_data {
+ match item.router_data.request.payment_method_data {
api::PaymentMethodData::Card(ref card) => {
let card_type = PayeezyCardType::try_from(card.get_card_issuer()?)?;
let payeezy_card = PayeezyCard {
@@ -305,16 +339,20 @@ pub struct PayeezyCaptureOrVoidRequest {
currency_code: String,
}
-impl TryFrom<&types::PaymentsCaptureRouterData> for PayeezyCaptureOrVoidRequest {
+impl TryFrom<&PayeezyRouterData<&types::PaymentsCaptureRouterData>>
+ for PayeezyCaptureOrVoidRequest
+{
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &PayeezyRouterData<&types::PaymentsCaptureRouterData>,
+ ) -> Result<Self, Self::Error> {
let metadata: PayeezyPaymentsMetadata =
- utils::to_connector_meta(item.request.connector_meta.clone())
+ utils::to_connector_meta(item.router_data.request.connector_meta.clone())
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Self {
transaction_type: PayeezyTransactionType::Capture,
- amount: item.request.amount_to_capture.to_string(),
- currency_code: item.request.currency.to_string(),
+ amount: item.amount.clone(),
+ currency_code: item.router_data.request.currency.to_string(),
transaction_tag: metadata.transaction_tag,
})
}
@@ -338,6 +376,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for PayeezyCaptureOrVoidRequest {
})
}
}
+
#[derive(Debug, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum PayeezyTransactionType {
@@ -442,16 +481,18 @@ pub struct PayeezyRefundRequest {
currency_code: String,
}
-impl<F> TryFrom<&types::RefundsRouterData<F>> for PayeezyRefundRequest {
+impl<F> TryFrom<&PayeezyRouterData<&types::RefundsRouterData<F>>> for PayeezyRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &PayeezyRouterData<&types::RefundsRouterData<F>>,
+ ) -> Result<Self, Self::Error> {
let metadata: PayeezyPaymentsMetadata =
- utils::to_connector_meta(item.request.connector_metadata.clone())
+ utils::to_connector_meta(item.router_data.request.connector_metadata.clone())
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Self {
transaction_type: PayeezyTransactionType::Refund,
- amount: item.request.refund_amount.to_string(),
- currency_code: item.request.currency.to_string(),
+ amount: item.amount.clone(),
+ currency_code: item.router_data.request.currency.to_string(),
transaction_tag: metadata.transaction_tag,
})
}
|
feat
|
[Payeezy] Currency Unit Conversion (#2710)
|
c5717a8147899e0c690e234dbf9b4fd425a7bb71
|
2024-12-24 16:56:38
|
Swangi Kumari
|
refactor(core): remove merchant return url from `router_data` (#6895)
| false
|
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 20c14d0dd10..4cb48f6c36e 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -397,7 +397,6 @@ pub enum PaymentIntentUpdate {
status: storage_enums::IntentStatus,
amount_captured: Option<MinorUnit>,
fingerprint_id: Option<String>,
- return_url: Option<String>,
updated_by: String,
incremental_authorization_allowed: Option<bool>,
},
@@ -925,7 +924,6 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
amount_captured,
fingerprint_id,
// customer_id,
- return_url,
updated_by,
incremental_authorization_allowed,
} => Self {
@@ -935,7 +933,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
amount_captured,
fingerprint_id,
// customer_id,
- return_url,
+ return_url: None,
modified_at: common_utils::date_time::now(),
updated_by,
incremental_authorization_allowed,
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
index 333398dfa90..4071b58a880 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
@@ -267,7 +267,7 @@ fn get_crypto_specific_payment_data(
) -> Result<BitpayPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
let price = item.amount;
let currency = item.router_data.request.currency.to_string();
- let redirect_url = item.router_data.request.get_return_url()?;
+ let redirect_url = item.router_data.request.get_router_return_url()?;
let notification_url = item.router_data.request.get_webhook_url()?;
let transaction_speed = TransactionSpeed::Medium;
let auth_type = item.router_data.connector_auth_type.clone();
diff --git a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
index df133175037..da5f775489c 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
@@ -499,7 +499,8 @@ pub struct BokuErrorResponse {
}
fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
- item.return_url
+ item.request
+ .router_return_url
.clone()
.map(|url| BokuHostedData { forward_url: url })
}
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
index 41a5306527c..8ac5f86247c 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
@@ -278,8 +278,8 @@ fn get_crypto_specific_payment_data(
})?;
let pricing_type = connector_meta.pricing_type;
let local_price = get_local_price(item);
- let redirect_url = item.request.get_return_url()?;
- let cancel_url = item.request.get_return_url()?;
+ let redirect_url = item.request.get_router_return_url()?;
+ let cancel_url = item.request.get_router_return_url()?;
Ok(CoinbasePaymentsRequest {
name,
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
index 5257df672f4..5a641327c96 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
@@ -152,7 +152,7 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP
value: item.amount.clone(),
};
let description = item.router_data.get_description()?;
- let redirect_url = item.router_data.request.get_return_url()?;
+ let redirect_url = item.router_data.request.get_router_return_url()?;
let payment_method_data = match item.router_data.request.capture_method.unwrap_or_default()
{
enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => {
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 18783c64a01..0a70393a13c 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -207,7 +207,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
.unwrap_or(consts::DEFAULT_LOCALE.to_string().to_string());
let custom = NovalnetCustom { lang };
let hook_url = item.router_data.request.get_webhook_url()?;
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let create_token = if item.router_data.request.is_mandate_payment() {
Some(1)
} else {
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
index 23f861bfa3a..778fe31978c 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
@@ -162,7 +162,7 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay
.change_context(errors::ConnectorError::NotImplemented(
"payment_method".to_owned(),
))?;
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
Ok(Self {
amount: item.amount,
currency: item.router_data.request.currency,
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 41dc60f8248..cc6795f157a 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -523,7 +523,7 @@ impl
amount,
terminal_uuid: Secret::new(terminal_uuid),
signature: None,
- url_redirect: item.router_data.request.get_return_url()?,
+ url_redirect: item.router_data.request.get_router_return_url()?,
};
checkout_request.signature =
Some(get_checkout_signature(&checkout_request, &session_data)?);
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index d1205dd8bb8..9061a758bea 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -358,7 +358,6 @@ pub trait RouterData {
fn get_billing_country(&self) -> Result<api_models::enums::CountryAlpha2, Error>;
fn get_billing_phone(&self) -> Result<&PhoneDetails, Error>;
fn get_description(&self) -> Result<String, Error>;
- fn get_return_url(&self) -> Result<String, Error>;
fn get_billing_address(&self) -> Result<&AddressDetails, Error>;
fn get_shipping_address(&self) -> Result<&AddressDetails, Error>;
fn get_shipping_address_with_phone_number(&self) -> Result<&Address, Error>;
@@ -547,11 +546,6 @@ impl<Flow, Request, Response> RouterData
.clone()
.ok_or_else(missing_field_err("description"))
}
- fn get_return_url(&self) -> Result<String, Error> {
- self.return_url
- .clone()
- .ok_or_else(missing_field_err("return_url"))
- }
fn get_billing_address(&self) -> Result<&AddressDetails, Error> {
self.address
.get_payment_method_billing()
@@ -1261,7 +1255,6 @@ pub trait PaymentsAuthorizeRequestData {
fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;
fn get_card(&self) -> Result<Card, Error>;
- fn get_return_url(&self) -> Result<String, Error>;
fn connector_mandate_id(&self) -> Option<String>;
fn is_mandate_payment(&self) -> bool;
fn is_customer_initiated_mandate_payment(&self) -> bool;
@@ -1324,11 +1317,6 @@ impl PaymentsAuthorizeRequestData for PaymentsAuthorizeData {
_ => Err(missing_field_err("card")()),
}
}
- fn get_return_url(&self) -> Result<String, Error> {
- self.router_return_url
- .clone()
- .ok_or_else(missing_field_err("return_url"))
- }
fn get_complete_authorize_url(&self) -> Result<String, Error> {
self.complete_authorize_url
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 953d39c131a..0afefbab9a4 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -204,7 +204,6 @@ pub enum PaymentIntentUpdate {
ResponseUpdate {
status: common_enums::IntentStatus,
amount_captured: Option<MinorUnit>,
- return_url: Option<String>,
updated_by: String,
fingerprint_id: Option<String>,
incremental_authorization_allowed: Option<bool>,
@@ -694,7 +693,6 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
amount_captured,
fingerprint_id,
// customer_id,
- return_url,
updated_by,
incremental_authorization_allowed,
} => Self {
@@ -704,7 +702,6 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
amount_captured,
fingerprint_id,
// customer_id,
- return_url,
modified_at: Some(common_utils::date_time::now()),
updated_by,
incremental_authorization_allowed,
@@ -827,14 +824,12 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
status,
amount_captured,
fingerprint_id,
- return_url,
updated_by,
incremental_authorization_allowed,
} => Self::ResponseUpdate {
status,
amount_captured,
fingerprint_id,
- return_url,
updated_by,
incremental_authorization_allowed,
},
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index f69c1db0e10..2970ac127ed 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -26,7 +26,6 @@ pub struct RouterData<Flow, Request, Response> {
pub payment_method: common_enums::enums::PaymentMethod,
pub connector_auth_type: ConnectorAuthType,
pub description: Option<String>,
- pub return_url: Option<String>,
pub address: PaymentAddress,
pub auth_type: common_enums::enums::AuthenticationType,
pub connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 85028a3bd7f..47b2134bc19 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -19,7 +19,6 @@ pub struct PaymentFlowData {
pub status: common_enums::AttemptStatus,
pub payment_method: common_enums::PaymentMethod,
pub description: Option<String>,
- pub return_url: Option<String>,
pub address: PaymentAddress,
pub auth_type: common_enums::AuthenticationType,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
@@ -59,7 +58,6 @@ pub struct RefundFlowData {
pub attempt_id: String,
pub status: common_enums::AttemptStatus,
pub payment_method: common_enums::PaymentMethod,
- pub return_url: Option<String>,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
pub amount_captured: Option<i64>,
// minor amount for amount framework
@@ -75,7 +73,6 @@ pub struct PayoutFlowData {
pub merchant_id: common_utils::id_type::MerchantId,
pub customer_id: Option<common_utils::id_type::CustomerId>,
pub connector_customer: Option<String>,
- pub return_url: Option<String>,
pub address: PaymentAddress,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
pub connector_wallets_details: Option<pii::SecretSerdeValue>,
@@ -93,7 +90,6 @@ pub struct FrmFlowData {
pub attempt_id: String,
pub payment_method: common_enums::enums::PaymentMethod,
pub connector_request_reference_id: String,
- pub return_url: Option<String>,
pub auth_type: common_enums::enums::AuthenticationType,
pub connector_wallets_details: Option<pii::SecretSerdeValue>,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
@@ -115,7 +111,6 @@ pub struct DisputesFlowData {
pub payment_id: String,
pub attempt_id: String,
pub payment_method: common_enums::enums::PaymentMethod,
- pub return_url: Option<String>,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
pub amount_captured: Option<i64>,
// minor amount for amount framework
@@ -145,7 +140,6 @@ pub struct FilesFlowData {
pub merchant_id: common_utils::id_type::MerchantId,
pub payment_id: String,
pub attempt_id: String,
- pub return_url: Option<String>,
pub connector_meta_data: Option<pii::SecretSerdeValue>,
pub connector_request_reference_id: String,
}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index aece1df6546..394652c33e1 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2629,7 +2629,7 @@ impl
get_recurring_processing_model(item.router_data)?;
let browser_info = None;
let additional_data = get_additional_data(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let payment_method_type = item.router_data.request.payment_method_type;
let payment_method = match mandate_ref_id {
payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids) => {
@@ -2812,7 +2812,7 @@ impl
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
let country_code = get_country_code(item.router_data.get_optional_billing());
let additional_data = get_additional_data(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let card_holder_name = item.router_data.get_optional_billing_full_name();
let payment_method = AdyenPaymentMethod::try_from((card_data, card_holder_name))?;
let shopper_email = item.router_data.get_optional_billing_email();
@@ -2871,7 +2871,7 @@ impl
get_recurring_processing_model(item.router_data)?;
let browser_info = get_browser_info(item.router_data)?;
let additional_data = get_additional_data(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let payment_method = AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?;
let country_code = get_country_code(item.router_data.get_optional_billing());
let request = AdyenPaymentRequest {
@@ -2928,7 +2928,7 @@ impl
let browser_info = get_browser_info(item.router_data)?;
let additional_data = get_additional_data(item.router_data);
let payment_method = AdyenPaymentMethod::try_from((voucher_data, item.router_data))?;
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let social_security_number = get_social_security_number(voucher_data);
let billing_address =
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
@@ -2985,7 +2985,7 @@ impl
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let payment_method = AdyenPaymentMethod::try_from((bank_transfer_data, item.router_data))?;
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let request = AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3091,7 +3091,7 @@ impl
get_recurring_processing_model(item.router_data)?;
let browser_info = get_browser_info(item.router_data)?;
let additional_data = get_additional_data(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let payment_method = AdyenPaymentMethod::try_from((
bank_redirect_data,
item.router_data.test_mode,
@@ -3276,7 +3276,7 @@ impl
);
let (recurring_processing_model, store_payment_method, _) =
get_recurring_processing_model(item.router_data)?;
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
let shopper_email = item.router_data.get_optional_billing_email();
let billing_address =
@@ -3344,7 +3344,7 @@ impl
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
let payment_method = AdyenPaymentMethod::try_from(card_redirect_data)?;
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
let shopper_email = item.router_data.get_optional_billing_email();
let telephone_number = item
@@ -5444,7 +5444,7 @@ impl
get_address_info(item.router_data.get_optional_billing()).transpose()?;
let country_code = get_country_code(item.router_data.get_optional_billing());
let additional_data = get_additional_data(item.router_data);
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let card_holder_name = item.router_data.get_optional_billing_full_name();
let payment_method = AdyenPaymentMethod::try_from((token_data, card_holder_name))?;
let shopper_email = item.router_data.request.email.clone();
diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs
index fa5528eace3..641505780b4 100644
--- a/crates/router/src/connector/iatapay/transformers.rs
+++ b/crates/router/src/connector/iatapay/transformers.rs
@@ -6,9 +6,7 @@ use masking::{Secret, SwitchStrategy};
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::{
- self as connector_util, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData,
- },
+ connector::utils::{self as connector_util, PaymentsAuthorizeRequestData, RefundsRequestData},
consts,
core::errors,
services,
@@ -128,7 +126,7 @@ impl
>,
>,
) -> Result<Self, Self::Error> {
- let return_url = item.router_data.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
// Iatapay processes transactions through the payment method selected based on the country
let (country, payer_info, preferred_checkout_method) =
match item.router_data.request.payment_method_data.clone() {
diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rs
index 0826b0f2665..3cefa4ec6c9 100644
--- a/crates/router/src/connector/klarna/transformers.rs
+++ b/crates/router/src/connector/klarna/transformers.rs
@@ -236,7 +236,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaP
) -> Result<Self, Self::Error> {
let request = &item.router_data.request;
let payment_method_data = request.payment_method_data.clone();
- let return_url = item.router_data.request.get_return_url()?;
+ let return_url = item.router_data.request.get_router_return_url()?;
let webhook_url = item.router_data.request.get_webhook_url()?;
match payment_method_data {
domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaSdk { .. }) => {
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index a4195655ed3..c98a0647778 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -71,7 +71,7 @@ impl NuveiAuthorizePreprocessingCommon for types::PaymentsAuthorizeData {
fn get_return_url_required(
&self,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
- self.get_return_url()
+ self.get_router_return_url()
}
fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
@@ -122,7 +122,7 @@ impl NuveiAuthorizePreprocessingCommon for types::PaymentsPreProcessingData {
fn get_return_url_required(
&self,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
- self.get_return_url()
+ self.get_router_return_url()
}
fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
@@ -1130,7 +1130,7 @@ where
browser_details,
v2_additional_params: additional_params,
notification_url: item.request.get_complete_authorize_url().clone(),
- merchant_url: item.return_url.clone(),
+ merchant_url: Some(item.request.get_return_url_required()?),
platform_type: Some(PlatformType::Browser),
method_completion_ind: Some(MethodCompletion::Unavailable),
..Default::default()
diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rs
index 1e8239d377b..44315ac42fa 100644
--- a/crates/router/src/connector/opennode/transformers.rs
+++ b/crates/router/src/connector/opennode/transformers.rs
@@ -258,7 +258,7 @@ fn get_crypto_specific_payment_data(
let currency = item.router_data.request.currency.to_string();
let description = item.router_data.get_description()?;
let auto_settle = true;
- let success_url = item.router_data.get_return_url()?;
+ let success_url = item.router_data.request.get_router_return_url()?;
let callback_url = item.router_data.request.get_webhook_url()?;
let order_id = item.router_data.connector_request_reference_id.clone();
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index 0e88ae23665..cd8ba814eb7 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -375,7 +375,7 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsPreProcessingRouterData>> for Gene
sale_payment_method: SalePaymentMethod::try_from(&pmd)?,
sale_type,
transaction_id: item.router_data.payment_id.clone(),
- sale_return_url: item.router_data.request.get_return_url()?,
+ sale_return_url: item.router_data.request.get_router_return_url()?,
sale_callback_url: item.router_data.request.get_webhook_url()?,
language: LANGUAGE.to_string(),
services,
@@ -635,7 +635,7 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsAuthorizeRouterData>> for MandateR
sale_price: item.amount.to_owned(),
transaction_id: item.router_data.payment_id.clone(),
product_name,
- sale_return_url: item.router_data.request.get_return_url()?,
+ sale_return_url: item.router_data.request.get_router_return_url()?,
seller_payme_id,
sale_callback_url: item.router_data.request.get_webhook_url()?,
buyer_key: Secret::new(item.router_data.request.get_connector_mandate_id()?),
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 67204d9673c..8f739792a0c 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -614,7 +614,6 @@ impl<F, T>
};
Ok(Self {
status,
- return_url: None,
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()),
redirection_data: Box::new(None),
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index cb6c04c601f..48736c00e7d 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -3362,7 +3362,7 @@ impl
email: item.get_billing_email().or(item.request.get_email())?,
},
amount: Some(amount),
- return_url: Some(item.get_return_url()?),
+ return_url: Some(item.request.get_router_return_url()?),
}),
),
domain::BankTransferData::AchBankTransfer { .. } => {
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index 3006a73a3ee..83587609b3f 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -350,7 +350,7 @@ fn get_bank_redirection_request_data(
auth: TrustpayAuthType,
) -> Result<TrustpayPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
let pm = TrustpayPaymentMethod::try_from(bank_redirection_data)?;
- let return_url = item.request.get_return_url()?;
+ let return_url = item.request.get_router_return_url()?;
let payment_request =
TrustpayPaymentsRequest::BankRedirectPaymentRequest(Box::new(PaymentRequestBankRedirect {
payment_method: pm.clone(),
@@ -413,7 +413,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust
params,
amount,
ccard,
- item.router_data.request.get_return_url()?,
+ item.router_data.request.get_router_return_url()?,
)?),
domain::PaymentMethodData::BankRedirect(ref bank_redirection_data) => {
get_bank_redirection_request_data(
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 171f19bc70a..85b1dd221f7 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -84,7 +84,6 @@ pub trait RouterData {
fn get_billing_phone(&self)
-> Result<&hyperswitch_domain_models::address::PhoneDetails, Error>;
fn get_description(&self) -> Result<String, Error>;
- fn get_return_url(&self) -> Result<String, Error>;
fn get_billing_address(
&self,
) -> Result<&hyperswitch_domain_models::address::AddressDetails, Error>;
@@ -321,11 +320,6 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
.clone()
.ok_or_else(missing_field_err("description"))
}
- fn get_return_url(&self) -> Result<String, Error> {
- self.return_url
- .clone()
- .ok_or_else(missing_field_err("return_url"))
- }
fn get_billing_address(
&self,
) -> Result<&hyperswitch_domain_models::address::AddressDetails, Error> {
@@ -653,7 +647,7 @@ pub trait PaymentsPreProcessingData {
fn is_auto_capture(&self) -> Result<bool, Error>;
fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;
fn get_webhook_url(&self) -> Result<String, Error>;
- fn get_return_url(&self) -> Result<String, Error>;
+ fn get_router_return_url(&self) -> Result<String, Error>;
fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
fn get_complete_authorize_url(&self) -> Result<String, Error>;
fn connector_mandate_id(&self) -> Option<String>;
@@ -699,7 +693,7 @@ impl PaymentsPreProcessingData for types::PaymentsPreProcessingData {
.clone()
.ok_or_else(missing_field_err("webhook_url"))
}
- fn get_return_url(&self) -> Result<String, Error> {
+ fn get_router_return_url(&self) -> Result<String, Error> {
self.router_return_url
.clone()
.ok_or_else(missing_field_err("return_url"))
@@ -797,7 +791,6 @@ pub trait PaymentsAuthorizeRequestData {
fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;
fn get_card(&self) -> Result<domain::Card, Error>;
- fn get_return_url(&self) -> Result<String, Error>;
fn connector_mandate_id(&self) -> Option<String>;
fn get_optional_network_transaction_id(&self) -> Option<String>;
fn is_mandate_payment(&self) -> bool;
@@ -865,11 +858,6 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
_ => Err(missing_field_err("card")()),
}
}
- fn get_return_url(&self) -> Result<String, Error> {
- self.router_return_url
- .clone()
- .ok_or_else(missing_field_err("return_url"))
- }
fn get_complete_authorize_url(&self) -> Result<String, Error> {
self.complete_authorize_url
diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs
index da6252d5429..30373d1408f 100644
--- a/crates/router/src/core/authentication/transformers.rs
+++ b/crates/router/src/core/authentication/transformers.rs
@@ -154,7 +154,6 @@ pub fn construct_router_data<F: Clone, Req, Res>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: None,
address,
auth_type: common_enums::AuthenticationType::NoThreeDs,
connector_meta_data: merchant_connector_account.get_metadata(),
diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
index b07268ae666..c413208b208 100644
--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
@@ -85,7 +85,6 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
.ok_or(errors::ApiErrorResponse::PaymentMethodNotFound)?,
connector_auth_type: auth_type,
description: None,
- return_url: None,
payment_method_status: None,
address: self.address.clone(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
index 8b837d7b22e..640e808d546 100644
--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
@@ -78,7 +78,6 @@ pub async fn construct_fulfillment_router_data<'a>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs
index d05f7280024..5e354031185 100644
--- a/crates/router/src/core/fraud_check/flows/record_return.rs
+++ b/crates/router/src/core/fraud_check/flows/record_return.rs
@@ -80,7 +80,6 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
)?,
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: self.address.clone(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
connector_meta_data: None,
diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs
index 683a153ff1a..dde9ba52a2a 100644
--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs
@@ -76,7 +76,6 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
.ok_or(errors::ApiErrorResponse::PaymentMethodNotFound)?,
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: self.address.clone(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
connector_meta_data: None,
diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
index da73267bd0b..673753ce4ef 100644
--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
@@ -88,7 +88,6 @@ impl
.ok_or(errors::ApiErrorResponse::PaymentMethodNotFound)?,
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: self.address.clone(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
connector_meta_data: None,
diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs
index f2db3228db9..5418d7b7a70 100644
--- a/crates/router/src/core/mandate/utils.rs
+++ b/crates/router/src/core/mandate/utils.rs
@@ -42,7 +42,6 @@ pub async fn construct_mandate_revoke_router_data(
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: PaymentAddress::default(),
auth_type: diesel_models::enums::AuthenticationType::default(),
connector_meta_data: None,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index eda869c3a6c..b2c90e03b58 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4045,7 +4045,6 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(
description: router_data.description,
payment_id: router_data.payment_id,
payment_method: router_data.payment_method,
- return_url: router_data.return_url,
status: router_data.status,
attempt_id: router_data.attempt_id,
access_token: router_data.access_token,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 988429a0eec..91fdfae63fa 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1902,7 +1902,6 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
status: api_models::enums::IntentStatus::foreign_from(
payment_data.payment_attempt.status,
),
- return_url: router_data.return_url.clone(),
amount_captured,
updated_by: storage_scheme.to_string(),
fingerprint_id: payment_data.payment_attempt.fingerprint_id.clone(),
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index d4c3877e5d9..e532abaa7ea 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -127,7 +127,6 @@ where
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: payment_data.address.clone(),
auth_type: payment_data
.payment_attempt
@@ -326,14 +325,6 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
- // TODO: evaluate why we need to send merchant's return url here
- // This should be the return url of application, since application takes care of the redirection
- return_url: payment_data
- .payment_intent
- .return_url
- .as_ref()
- .map(|description| description.get_string_repr())
- .map(ToOwned::to_owned),
// TODO: Create unified address
address: payment_data.payment_address.clone(),
auth_type: payment_data.payment_attempt.authentication_type,
@@ -494,14 +485,6 @@ pub async fn construct_payment_router_data_for_capture<'a>(
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
- // TODO: evaluate why we need to send merchant's return url here
- // This should be the return url of application, since application takes care of the redirection
- return_url: payment_data
- .payment_intent
- .return_url
- .as_ref()
- .map(|description| description.get_string_repr())
- .map(ToOwned::to_owned),
// TODO: Create unified address
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: payment_data.payment_attempt.authentication_type,
@@ -629,13 +612,6 @@ pub async fn construct_router_data_for_psync<'a>(
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
- // TODO: evaluate why we need to send merchant's return url here
- // This should be the return url of application, since application takes care of the redirection
- return_url: payment_intent
- .return_url
- .as_ref()
- .map(|description| description.get_string_repr())
- .map(ToOwned::to_owned),
// TODO: Create unified address
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: attempt.authentication_type,
@@ -793,14 +769,6 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
- // TODO: evaluate why we need to send merchant's return url here
- // This should be the return url of application, since application takes care of the redirection
- return_url: payment_data
- .payment_intent
- .return_url
- .as_ref()
- .map(|description| description.get_string_repr())
- .map(ToOwned::to_owned),
// TODO: Create unified address
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: payment_data.payment_intent.authentication_type,
@@ -987,7 +955,6 @@ where
payment_method,
connector_auth_type: auth_type,
description: payment_data.payment_intent.description.clone(),
- return_url: payment_data.payment_intent.return_url.clone(),
address: unified_address,
auth_type: payment_data
.payment_attempt
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index 0753be1ec43..946f8df7d64 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -78,7 +78,6 @@ pub async fn construct_relay_refund_router_data<'a, F>(
payment_method: common_enums::PaymentMethod::default(),
connector_auth_type,
description: None,
- return_url: None,
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: common_enums::AuthenticationType::default(),
connector_meta_data: None,
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
index e0d10251049..fe4f864604e 100644
--- a/crates/router/src/core/unified_authentication_service/utils.rs
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -130,7 +130,6 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: address.unwrap_or_default(),
auth_type: common_enums::AuthenticationType::default(),
connector_meta_data: merchant_connector_account.get_metadata(),
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 951d3c003fd..c441e32581e 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -162,7 +162,6 @@ pub async fn construct_payout_router_data<'a, F>(
payment_method: enums::PaymentMethod::default(),
connector_auth_type,
description: None,
- return_url: payouts.return_url.to_owned(),
address,
auth_type: enums::AuthenticationType::default(),
connector_meta_data: merchant_connector_account.get_metadata(),
@@ -338,7 +337,6 @@ pub async fn construct_refund_router_data<'a, F>(
payment_method: payment_method_type,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
// Does refund need shipping/billing address ?
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
@@ -660,7 +658,6 @@ pub async fn construct_accept_dispute_router_data<'a>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
@@ -761,7 +758,6 @@ pub async fn construct_submit_evidence_router_data<'a>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
@@ -860,7 +856,6 @@ pub async fn construct_upload_file_router_data<'a>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
@@ -987,7 +982,6 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type,
description: None,
- return_url: None,
address: payment_data.address.clone(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: None,
@@ -1087,7 +1081,6 @@ pub async fn construct_defend_dispute_router_data<'a>(
payment_method,
connector_auth_type: auth_type,
description: None,
- return_url: payment_intent.return_url.clone(),
address: PaymentAddress::default(),
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
@@ -1186,7 +1179,6 @@ pub async fn construct_retrieve_file_router_data<'a>(
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: PaymentAddress::default(),
auth_type: diesel_models::enums::AuthenticationType::default(),
connector_meta_data: merchant_connector_account.get_metadata(),
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index f86ed910e46..b21ec0056c1 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -82,7 +82,6 @@ pub async fn construct_webhook_router_data<'a>(
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type: auth_type,
description: None,
- return_url: None,
address: PaymentAddress::default(),
auth_type: diesel_models::enums::AuthenticationType::default(),
connector_meta_data: None,
diff --git a/crates/router/src/services/conversion_impls.rs b/crates/router/src/services/conversion_impls.rs
index 3902ef624da..9bb88cf4ecc 100644
--- a/crates/router/src/services/conversion_impls.rs
+++ b/crates/router/src/services/conversion_impls.rs
@@ -41,7 +41,6 @@ fn get_default_router_data<F, Req, Resp>(
payment_method: common_enums::PaymentMethod::default(),
connector_auth_type: router_data::ConnectorAuthType::default(),
description: None,
- return_url: None,
address: PaymentAddress::default(),
auth_type: common_enums::AuthenticationType::default(),
connector_meta_data: None,
@@ -131,7 +130,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
status: old_router_data.status,
payment_method: old_router_data.payment_method,
description: old_router_data.description.clone(),
- return_url: old_router_data.return_url.clone(),
address: old_router_data.address.clone(),
auth_type: old_router_data.auth_type,
connector_meta_data: old_router_data.connector_meta_data.clone(),
@@ -177,7 +175,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
status,
payment_method,
description,
- return_url,
address,
auth_type,
connector_meta_data,
@@ -209,7 +206,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
router_data.status = status;
router_data.payment_method = payment_method;
router_data.description = description;
- router_data.return_url = return_url;
router_data.address = address;
router_data.auth_type = auth_type;
router_data.connector_meta_data = connector_meta_data;
@@ -248,7 +244,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for RefundFl
attempt_id: old_router_data.attempt_id.clone(),
status: old_router_data.status,
payment_method: old_router_data.payment_method,
- return_url: old_router_data.return_url.clone(),
connector_meta_data: old_router_data.connector_meta_data.clone(),
amount_captured: old_router_data.amount_captured,
minor_amount_captured: old_router_data.minor_amount_captured,
@@ -281,7 +276,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for RefundFl
attempt_id,
status,
payment_method,
- return_url,
connector_meta_data,
amount_captured,
minor_amount_captured,
@@ -296,7 +290,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for RefundFl
router_data.attempt_id = attempt_id;
router_data.status = status;
router_data.payment_method = payment_method;
- router_data.return_url = return_url;
router_data.connector_meta_data = connector_meta_data;
router_data.amount_captured = amount_captured;
router_data.minor_amount_captured = minor_amount_captured;
@@ -318,7 +311,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for Disputes
payment_id: old_router_data.payment_id.clone(),
attempt_id: old_router_data.attempt_id.clone(),
payment_method: old_router_data.payment_method,
- return_url: old_router_data.return_url.clone(),
connector_meta_data: old_router_data.connector_meta_data.clone(),
amount_captured: old_router_data.amount_captured,
minor_amount_captured: old_router_data.minor_amount_captured,
@@ -349,7 +341,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for Disputes
payment_id,
attempt_id,
payment_method,
- return_url,
connector_meta_data,
amount_captured,
minor_amount_captured,
@@ -365,7 +356,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for Disputes
router_data.payment_id = payment_id;
router_data.attempt_id = attempt_id;
router_data.payment_method = payment_method;
- router_data.return_url = return_url;
router_data.connector_meta_data = connector_meta_data;
router_data.amount_captured = amount_captured;
router_data.minor_amount_captured = minor_amount_captured;
@@ -389,7 +379,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FrmFlowD
attempt_id: old_router_data.attempt_id.clone(),
payment_method: old_router_data.payment_method,
connector_request_reference_id: old_router_data.connector_request_reference_id.clone(),
- return_url: old_router_data.return_url.clone(),
auth_type: old_router_data.auth_type,
connector_wallets_details: old_router_data.connector_wallets_details.clone(),
connector_meta_data: old_router_data.connector_meta_data.clone(),
@@ -417,7 +406,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FrmFlowD
attempt_id,
payment_method,
connector_request_reference_id,
- return_url,
auth_type,
connector_wallets_details,
connector_meta_data,
@@ -432,7 +420,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FrmFlowD
router_data.attempt_id = attempt_id;
router_data.payment_method = payment_method;
router_data.connector_request_reference_id = connector_request_reference_id;
- router_data.return_url = return_url;
router_data.auth_type = auth_type;
router_data.connector_wallets_details = connector_wallets_details;
router_data.connector_meta_data = connector_meta_data;
@@ -454,7 +441,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FilesFlo
merchant_id: old_router_data.merchant_id.clone(),
payment_id: old_router_data.payment_id.clone(),
attempt_id: old_router_data.attempt_id.clone(),
- return_url: old_router_data.return_url.clone(),
connector_meta_data: old_router_data.connector_meta_data.clone(),
connector_request_reference_id: old_router_data.connector_request_reference_id.clone(),
};
@@ -477,7 +463,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FilesFlo
merchant_id,
payment_id,
attempt_id,
- return_url,
connector_meta_data,
connector_request_reference_id,
} = new_router_data.resource_common_data;
@@ -486,7 +471,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FilesFlo
router_data.merchant_id = merchant_id;
router_data.payment_id = payment_id;
router_data.attempt_id = attempt_id;
- router_data.return_url = return_url;
router_data.connector_meta_data = connector_meta_data;
router_data.connector_request_reference_id = connector_request_reference_id;
@@ -596,7 +580,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PayoutFl
merchant_id: old_router_data.merchant_id.clone(),
customer_id: old_router_data.customer_id.clone(),
connector_customer: old_router_data.connector_customer.clone(),
- return_url: old_router_data.return_url.clone(),
address: old_router_data.address.clone(),
connector_meta_data: old_router_data.connector_meta_data.clone(),
connector_wallets_details: old_router_data.connector_wallets_details.clone(),
@@ -623,7 +606,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PayoutFl
merchant_id,
customer_id,
connector_customer,
- return_url,
address,
connector_meta_data,
connector_wallets_details,
@@ -636,7 +618,6 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PayoutFl
router_data.merchant_id = merchant_id;
router_data.customer_id = customer_id;
router_data.connector_customer = connector_customer;
- router_data.return_url = return_url;
router_data.address = address;
router_data.connector_meta_data = connector_meta_data;
router_data.connector_wallets_details = connector_wallets_details;
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 5ee7094700c..f9c9e6edb26 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -918,7 +918,6 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)
payment_method: data.payment_method,
connector_auth_type: data.connector_auth_type.clone(),
description: data.description.clone(),
- return_url: data.return_url.clone(),
address: data.address.clone(),
auth_type: data.auth_type,
connector_meta_data: data.connector_meta_data.clone(),
@@ -988,7 +987,6 @@ impl<F1, F2>
payment_method: data.payment_method,
connector_auth_type: data.connector_auth_type.clone(),
description: data.description.clone(),
- return_url: data.return_url.clone(),
address: data.address.clone(),
auth_type: data.auth_type,
connector_meta_data: data.connector_meta_data.clone(),
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index bd55bd96b96..47d8add58c3 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -78,7 +78,6 @@ impl VerifyConnectorData {
connector: self.connector.id().to_string(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
test_mode: None,
- return_url: None,
attempt_id: attempt_id.clone(),
description: None,
customer_id: None,
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index e3fd2bc1ee9..18e9c43ed6a 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -35,7 +35,6 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
payment_method: enums::PaymentMethod::Card,
connector_auth_type: utils::to_connector_auth_type(auth.into()),
description: Some("This is a test".to_string()),
- return_url: None,
payment_method_status: None,
request: types::PaymentsAuthorizeData {
amount: 1000,
@@ -155,7 +154,6 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
auth_type: enums::AuthenticationType::NoThreeDs,
connector_auth_type: utils::to_connector_auth_type(auth.into()),
description: Some("This is a test".to_string()),
- return_url: None,
request: types::RefundsData {
payment_amount: 1000,
currency: enums::Currency::USD,
diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs
index 50c93f05a6b..84caf9ad765 100644
--- a/crates/router/tests/connectors/cashtocode.rs
+++ b/crates/router/tests/connectors/cashtocode.rs
@@ -93,7 +93,6 @@ impl CashtocodeTest {
None,
None,
)),
- return_url: Some("https://google.com".to_owned()),
..Default::default()
})
}
diff --git a/crates/router/tests/connectors/cryptopay.rs b/crates/router/tests/connectors/cryptopay.rs
index 2ecc7869bcd..58fcdc6dae2 100644
--- a/crates/router/tests/connectors/cryptopay.rs
+++ b/crates/router/tests/connectors/cryptopay.rs
@@ -61,7 +61,6 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None,
None,
)),
- return_url: Some(String::from("https://google.com")),
..Default::default()
})
}
diff --git a/crates/router/tests/connectors/iatapay.rs b/crates/router/tests/connectors/iatapay.rs
index d216f6063f6..89fc270e6a2 100644
--- a/crates/router/tests/connectors/iatapay.rs
+++ b/crates/router/tests/connectors/iatapay.rs
@@ -79,7 +79,6 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None,
)),
access_token: get_access_token(),
- return_url: Some(String::from("https://hyperswitch.io")),
..Default::default()
})
}
diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs
index d2629e287ca..6605ea46c32 100644
--- a/crates/router/tests/connectors/opennode.rs
+++ b/crates/router/tests/connectors/opennode.rs
@@ -61,7 +61,6 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None,
None,
)),
- return_url: Some(String::from("https://google.com")),
..Default::default()
})
}
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index 15f980e242e..b56e1ec83de 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -66,7 +66,6 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
auth_type: None,
access_token: None,
connector_meta_data: None,
- return_url: None,
connector_customer: None,
payment_method_token: None,
#[cfg(feature = "payouts")]
diff --git a/crates/router/tests/connectors/square.rs b/crates/router/tests/connectors/square.rs
index f7b633e8a15..8f5fa4a32c7 100644
--- a/crates/router/tests/connectors/square.rs
+++ b/crates/router/tests/connectors/square.rs
@@ -42,7 +42,6 @@ fn get_default_payment_info(payment_method_token: Option<String>) -> Option<util
auth_type: None,
access_token: None,
connector_meta_data: None,
- return_url: None,
connector_customer: None,
payment_method_token,
#[cfg(feature = "payouts")]
diff --git a/crates/router/tests/connectors/stax.rs b/crates/router/tests/connectors/stax.rs
index f3d0f06ec1b..4bc76d1290c 100644
--- a/crates/router/tests/connectors/stax.rs
+++ b/crates/router/tests/connectors/stax.rs
@@ -45,7 +45,6 @@ fn get_default_payment_info(
auth_type: None,
access_token: None,
connector_meta_data: None,
- return_url: None,
connector_customer,
payment_method_token,
#[cfg(feature = "payouts")]
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 361cda63a9f..305b11fe5b3 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -63,7 +63,6 @@ pub struct PaymentInfo {
pub auth_type: Option<enums::AuthenticationType>,
pub access_token: Option<AccessToken>,
pub connector_meta_data: Option<serde_json::Value>,
- pub return_url: Option<String>,
pub connector_customer: Option<String>,
pub payment_method_token: Option<String>,
#[cfg(feature = "payouts")]
@@ -503,7 +502,6 @@ pub trait ConnectorActions: Connector {
payment_method: enums::PaymentMethod::Card,
connector_auth_type: self.get_auth_token(),
description: Some("This is a test".to_string()),
- return_url: info.clone().and_then(|a| a.return_url),
payment_method_status: None,
request: req,
response: Err(types::ErrorResponse::default()),
|
refactor
|
remove merchant return url from `router_data` (#6895)
|
f39c420623bd05147aeb92ed255f84d74e9370cd
|
2024-06-05 12:37:12
|
AkshayaFoiger
|
fix(connector): [ZSL] capture connector transaction ID (#4863)
| false
|
diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs
index e6483c6f7d1..83aa2189950 100644
--- a/crates/router/src/connector/zsl/transformers.rs
+++ b/crates/router/src/connector/zsl/transformers.rs
@@ -323,9 +323,7 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::AuthenticationPending, // Redirect is always expected after success response
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.mer_ref.clone(),
- ),
+ resource_id: types::ResponseId::NoResponseId,
redirection_data: Some(services::RedirectForm::Form {
endpoint: redirect_url,
method: services::Method::Get,
@@ -383,10 +381,10 @@ pub struct ZslWebhookResponse {
pub txn_date: String,
pub paid_ccy: api_models::enums::Currency,
pub paid_amt: String,
- pub consr_paid_ccy: api_models::enums::Currency,
- pub consr_paid_amt: String,
- pub service_fee_ccy: api_models::enums::Currency,
- pub service_fee: String,
+ pub consr_paid_ccy: Option<api_models::enums::Currency>,
+ pub consr_paid_amt: Option<String>,
+ pub service_fee_ccy: Option<api_models::enums::Currency>,
+ pub service_fee: Option<String>,
pub txn_amt: String,
pub ccy: String,
pub mer_ref: String,
@@ -447,7 +445,7 @@ impl<F>
amount_captured: Some(paid_amount),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.mer_ref.clone(),
+ item.response.txn_id.clone(),
),
redirection_data: None,
mandate_reference: None,
|
fix
|
[ZSL] capture connector transaction ID (#4863)
|
5e84855496d80959c1fc43c1efc9bb2a4d802d5a
|
2024-05-20 05:44:36
|
github-actions
|
chore(version): 2024.05.20.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3bf7c5e24c..0a9c0e9c530 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,25 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.05.20.0
+
+### Features
+
+- Added client_source, client_version in payment_attempt from payments confirm request headers ([#4657](https://github.com/juspay/hyperswitch/pull/4657)) ([`7e44bbc`](https://github.com/juspay/hyperswitch/commit/7e44bbca63c1818c0fabdf2734d9b0ae5d639fe1))
+
+### Bug Fixes
+
+- **docker:** Fix stack overflow for docker images ([#4660](https://github.com/juspay/hyperswitch/pull/4660)) ([`a62f69d`](https://github.com/juspay/hyperswitch/commit/a62f69d447245273c73611309055d2341a47b783))
+- Address non-digit character cases in card number validation ([#4649](https://github.com/juspay/hyperswitch/pull/4649)) ([`8c0d72e`](https://github.com/juspay/hyperswitch/commit/8c0d72e225c56b7bece733d9565fc8774deaa490))
+
+### Refactors
+
+- **FRM:** Refactor frm configs ([#4581](https://github.com/juspay/hyperswitch/pull/4581)) ([`853f3b4`](https://github.com/juspay/hyperswitch/commit/853f3b4854ff9ec1e169b7633f1e9bf8259e9ceb))
+
+**Full Changelog:** [`2024.05.17.0...2024.05.20.0`](https://github.com/juspay/hyperswitch/compare/2024.05.17.0...2024.05.20.0)
+
+- - -
+
## 2024.05.17.0
### Bug Fixes
|
chore
|
2024.05.20.0
|
fe3f1de184e12f4951727408cacaaaf4f6759820
|
2023-01-22 20:02:29
|
Nishant Joshi
|
doc: add `React demo` app link (#452)
| false
|
diff --git a/README.md b/README.md
index 97746fdd6eb..efef63ca3fc 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,12 @@ You have two options to try out HyperSwitch:
1. [Try it in our Sandbox Environment](/docs/try_sandbox.md): Fast and easy to
start.
No code or setup required in your system.
-2. [Install in your local system](/docs/try_local_system.md): Configurations and
+2. Try our React Demo App: A simple demo of integrating Hyperswitch with your React app.
+
+ <a href="https://github.com/aashu331998/hyperswitch-react-demo-app/archive/refs/heads/main.zip">
+ <img src= "./docs/imgs/download-button.png" alt="Download Now" width="190rem" />
+ </a>
+3. [Install in your local system](/docs/try_local_system.md): Configurations and
setup required in your system.
Suitable if you like to customize the core offering.
diff --git a/docs/imgs/download-button.png b/docs/imgs/download-button.png
new file mode 100644
index 00000000000..e2e3ee0413b
Binary files /dev/null and b/docs/imgs/download-button.png differ
|
doc
|
add `React demo` app link (#452)
|
b2364414edab6d44e276f2133bc988610693f155
|
2024-09-18 13:04:27
|
likhinbopanna
|
ci(postman): Add browser info for adyen postman collection (#5927)
| false
|
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json
index 6e38554431e..8bfdb580671 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json
@@ -7,18 +7,18 @@
"Scenario5-Void the payment",
"Scenario6-Create 3DS payment",
"Scenario7-Create 3DS payment with confirm false",
- "Scenario9-Refund full payment",
- "Scenario10-Create a mandate and recurring payment",
- "Scenario11-Partial refund",
- "Scenario12-Bank Redirect-sofort",
- "Scenario13-Bank Redirect-eps",
- "Scenario14-Refund recurring payment",
- "Scenario15-Bank Redirect-giropay",
- "Scenario16-Bank debit-ach",
- "Scenario17-Bank debit-Bacs",
- "Scenario18-Bank Redirect-Trustly",
- "Scenario19-Add card flow",
- "Scenario20-Pass Invalid CVV for save card flow and verify failed payment",
- "Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy"
+ "Scenario8-Refund full payment",
+ "Scenario9-Create a mandate and recurring payment",
+ "Scenario10-Partial refund",
+ "Scenario11-Bank Redirect-sofort",
+ "Scenario12-Bank Redirect-eps",
+ "Scenario13-Refund recurring payment",
+ "Scenario14-Bank debit-ach",
+ "Scenario15-Bank debit-Bacs",
+ "Scenario16-Bank Redirect-Trustly",
+ "Scenario17-Add card flow",
+ "Scenario18-Pass Invalid CVV for save card flow and verify failed payment",
+ "Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy",
+ "Scenario20-Create Gift Card payment"
]
}
\ No newline at end of file
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index ad2b0902947..e6fe8306704 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,6 +73,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json
similarity index 80%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json
index ad2b0902947..e6fe8306704 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,6 +73,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Refunds - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/event.test.js
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/Scenario13-Refund recurring payment/Payments - Create/request.json
similarity index 82%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/request.json
index dc5f34024bb..1719e207ade 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/Scenario13-Refund recurring payment/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"setup_future_usage": "off_session",
@@ -78,7 +78,7 @@
"zip": "94122",
"country": "US",
"first_name": "Joseph",
- "last_name":"Doe"
+ "last_name": "Doe"
}
},
"billing": {
@@ -91,7 +91,7 @@
"zip": "94122",
"country": "US",
"first_name": "Joseph",
- "last_name":"Doe"
+ "last_name": "Doe"
}
},
"statement_descriptor_name": "joseph",
@@ -100,6 +100,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-sofort/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/event.test.js
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/Scenario13-Refund recurring payment/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank Redirect-eps/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/event.test.js
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/Scenario14-Bank debit-ach/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Create Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/event.test.js
deleted file mode 100644
index 924d98f8f9d..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/event.test.js
+++ /dev/null
@@ -1,103 +0,0 @@
-// 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 "requires_customer_action" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'",
- function () {
- pm.expect(jsonData.status).to.eql("requires_customer_action");
- },
- );
-}
-
-// Response body should have "next_action.redirect_to_url"
-pm.test(
- "[POST]::/payments - Content check if 'next_action.redirect_to_url' exists",
- function () {
- pm.expect(typeof jsonData.next_action.redirect_to_url !== "undefined").to.be
- .true;
- },
-);
-
-// Response body should have value "giropay" for "payment_method_type"
-if (jsonData?.payment_method_type) {
- pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'giropay'",
- function () {
- pm.expect(jsonData.payment_method_type).to.eql("giropay");
- },
- );
-}
-
-// Response body should have value "stripe" for "connector"
-if (jsonData?.connector) {
- pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'adyen'",
- function () {
- pm.expect(jsonData.connector).to.eql("adyen");
- },
- );
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/request.json
deleted file mode 100644
index 384d0bfc486..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/request.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "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": "bank_redirect",
- "payment_method_type": "giropay",
- "payment_method_data": {
- "bank_redirect": {
- "giropay": {
- "billing_details": {
- "billing_name": "John Doe"
- },
- "bank_name": "ing",
- "preferred_language": "en",
- "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"
- }
- }
- },
- "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/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/request.json
deleted file mode 100644
index 8f091a4238b..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/request.json
+++ /dev/null
@@ -1,88 +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": 1000,
- "currency": "EUR",
- "confirm": false,
- "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://duck.com",
- "billing": {
- "address": {
- "first_name": "John",
- "last_name": "Doe",
- "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": "DE",
- "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"
- }
- }
- },
- "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/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/request.json
similarity index 80%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/request.json
index 0d66f04b260..6640fa64176 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/request.json
@@ -63,6 +63,17 @@
"reference": "daslvcgbaieh"
}
}
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Refunds - Retrieve Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/event.test.js
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/Scenario15-Bank debit-Bacs/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-giropay/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/event.test.js
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/Scenario17-Add card flow/Payments - Create/request.json
similarity index 83%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/request.json
index 7b15b0ee871..aee22fa4add 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/Scenario17-Add card flow/Payments - Create/request.json
@@ -45,11 +45,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -92,6 +92,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/request.json
similarity index 67%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/request.json
index 68ba9ce708f..7db274d3426 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/request.json
@@ -41,19 +41,24 @@
"client_secret": "{{client_secret}}",
"payment_method": "card",
"payment_token": "{{payment_token}}",
- "card_cvc": "737"
+ "card_cvc": "737",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"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/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/.meta.json
deleted file mode 100644
index 57d3f8e2bc7..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/.meta.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "childrenOrder": [
- "Payments - Create",
- "Payments - Confirm",
- "Payments - Retrieve"
- ]
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/event.test.js
deleted file mode 100644
index 0444324000a..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/event.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
deleted file mode 100644
index 9053ddab13b..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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_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");
- },
- );
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/List payment methods for a Customer/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/response.json
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/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/.event.meta.json
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/event.prerequest.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js
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/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.test.js
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/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
similarity index 83%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
index 7b15b0ee871..aee22fa4add 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/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
@@ -45,11 +45,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -92,6 +92,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/response.json
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 - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/.event.meta.json
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 - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/event.test.js
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 - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Retrieve Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/event.test.js
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/Save card payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
similarity index 65%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
index a1442beda71..10102b27394 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/Save card payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
@@ -40,19 +40,25 @@
"raw_json_formatted": {
"client_secret": "{{client_secret}}",
"payment_method": "card",
- "payment_token": "{{payment_token}}"
+ "payment_token": "{{payment_token}}",
+ "card_cvc": "123",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"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/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Refunds - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/response.json
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/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/.meta.json
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/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/.event.meta.json
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/List payment methods for a Customer/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/event.test.js
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/List payment methods for a Customer/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/response.json
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/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/.event.meta.json
similarity index 100%
rename from 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/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/.event.meta.json
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/event.prerequest.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/event.prerequest.js
similarity index 100%
rename from 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/event.prerequest.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/event.prerequest.js
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/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/event.test.js
similarity index 100%
rename from 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/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/event.test.js
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-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
similarity index 83%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
index 7b15b0ee871..aee22fa4add 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-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
@@ -45,11 +45,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -92,6 +92,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/response.json
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 - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/.event.meta.json
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 - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/event.test.js
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 - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/List payment methods for a Customer/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/response.json
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/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/.event.meta.json
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/Save card payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
similarity index 68%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
index 5d78ead7de9..a2a47cc1156 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Save card payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
@@ -41,19 +41,23 @@
"client_secret": "{{client_secret}}",
"payment_method": "card",
"payment_token": "{{payment_token}}",
- "card_cvc": "7373"
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"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/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/response.json
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/Save card payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/.event.meta.json
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/Save card payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/event.test.js
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/Save card payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/request.json
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 - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
index ec45ef29bb6..4b1bd40ca34 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
@@ -38,7 +38,18 @@
}
},
"raw_json_formatted": {
- "client_secret": "{{client_secret}}"
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"url": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
index 6a90dc1f517..101aa618814 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/request.json
similarity index 77%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/request.json
index f8e5000d314..e00c0bcf3d5 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/request.json
@@ -35,12 +35,12 @@
"payment_method": "gift_card",
"payment_method_type": "givex",
"payment_method_data": {
- "gift_card": {
- "givex": {
- "number": "6364530000000000",
- "cvc": "122222"
- }
+ "gift_card": {
+ "givex": {
+ "number": "6364530000000000",
+ "cvc": "122222"
}
+ }
},
"billing": {
"address": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
index 770b7326827..316f33ad0b9 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
@@ -43,12 +43,23 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json
index 3f21848a011..e792688d1ba 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,6 +73,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json
index 3f21848a011..e792688d1ba 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,6 +73,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/request.json
similarity index 78%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/request.json
index 08c88256395..e6fe8306704 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Partial refund/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,17 +73,24 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
"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/List payment methods for a Customer/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/List payment methods for a Customer/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/request.json
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/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/response.json
similarity index 100%
rename from 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/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/request.json
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 - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/request.json
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/Save card payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario8-Refund full payment/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/event.test.js
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/Scenario9-Create a mandate and recurring payment/Payments - Create/request.json
similarity index 83%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/request.json
index 0bf892efdf5..7c7a9539be2 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/Scenario9-Create a mandate and recurring payment/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"setup_future_usage": "off_session",
@@ -98,6 +98,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
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/Save card payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-Trustly/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Create a mandate and recurring payment/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full 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/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Refunds - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json
index 8ac3ed14b0a..b259b51fafb 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -36,11 +36,11 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -73,6 +73,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json
index b994c6bfef1..4081d208e52 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json
index 9f409826257..c3f3dae00ec 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json
index c7ad4cb2749..47a19f70643 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json
@@ -70,6 +70,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json
index 1ae83751a40..063cd44d7a6 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json
index 923cb4aae78..ea9ecd82436 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json
@@ -35,12 +35,12 @@
"payment_method": "gift_card",
"payment_method_type": "givex",
"payment_method_data": {
- "gift_card": {
- "givex": {
- "number": "6364530000000000",
- "cvc": "122222"
- }
+ "gift_card": {
+ "givex": {
+ "number": "6364530000000000",
+ "cvc": "122222"
}
+ }
},
"billing": {
"address": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/ACH Payouts - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/ACH Payouts - Create/request.json
index 451f18f195b..da4cd865e31 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/ACH Payouts - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/ACH Payouts - Create/request.json
@@ -87,7 +87,18 @@
}
},
"confirm": true,
- "auto_fulfill": true
+ "auto_fulfill": true,
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"url": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/Bacs Payouts - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/Bacs Payouts - Create/request.json
index e639b9e3bc6..ea4da2248c6 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/Bacs Payouts - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create payouts using unsupported methods/Bacs Payouts - Create/request.json
@@ -62,7 +62,18 @@
"auto_fulfill": true,
"connector": ["adyen"],
"business_label": "abcd",
- "business_country": "US"
+ "business_country": "US",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"url": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json
index ec45ef29bb6..4b1bd40ca34 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json
@@ -38,7 +38,18 @@
}
},
"raw_json_formatted": {
- "client_secret": "{{client_secret}}"
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
}
},
"url": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json
index c029e72ab46..320bb4ed34c 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json
index e05de78af19..7a1f00b0c34 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json
index e05de78af19..7a1f00b0c34 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
index e05de78af19..7a1f00b0c34 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
index 19e3369a340..5ef8dd0c38d 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"billing": {
@@ -72,6 +72,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
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 40a78911a9a..ec2d9c7a7d7 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
@@ -35,11 +35,11 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "371449635398431",
+ "card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
- "card_cvc": "7373"
+ "card_cvc": "737"
}
},
"setup_future_usage": "off_session",
@@ -97,6 +97,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
+ "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
+ "language": "en-GB",
+ "color_depth": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
}
}
},
diff --git a/postman/collection-json/adyen_uk.postman_collection.json b/postman/collection-json/adyen_uk.postman_collection.json
index 522ff2084ac..512f84c6a4b 100644
--- a/postman/collection-json/adyen_uk.postman_collection.json
+++ b/postman/collection-json/adyen_uk.postman_collection.json
@@ -728,7 +728,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\":\"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_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\":\"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\"}}"
+ "raw": "{\"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_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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -1207,248 +1207,6 @@
{
"name": "Happy Cases",
"item": [
- {
- "name": "Scenario22-Create Gift Card payment",
- "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 \"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\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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\":1100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":1100,\"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\":\"gift_card\",\"payment_method_type\":\"givex\",\"payment_method_data\":{\"gift_card\":{\"givex\":{\"number\":\"6364530000000000\",\"cvc\":\"122222\"}}},\"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"
- },
- "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/:id - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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": [
@@ -1555,7 +1313,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\":\"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_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\":\"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\"}}"
+ "raw": "{\"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\":\"+65\",\"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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -1797,7 +1555,7 @@
"language": "json"
}
},
- "raw": "{\"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\",\"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\":\"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\"}}"
+ "raw": "{\"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\",\"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\":\"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",
@@ -1938,7 +1696,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -2330,7 +2088,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"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\"}}}"
+ "raw": "{\"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\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -2581,7 +2339,7 @@
"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_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\":\"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\"}}"
+ "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_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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -2967,7 +2725,7 @@
"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_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\":\"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\"}}"
+ "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_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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -3873,7 +3631,7 @@
]
},
{
- "name": "Scenario9-Refund full payment",
+ "name": "Scenario8-Refund full payment",
"item": [
{
"name": "Payments - Create",
@@ -3978,7 +3736,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\":\"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_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\":\"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\"}}"
+ "raw": "{\"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\":\"+65\",\"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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -4304,7 +4062,7 @@
]
},
{
- "name": "Scenario10-Create a mandate and recurring payment",
+ "name": "Scenario9-Create a mandate and recurring payment",
"item": [
{
"name": "Payments - Create",
@@ -4435,7 +4193,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\":\"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_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\"}},\"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\"}}},\"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\",\"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\"}}"
+ "raw": "{\"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\":\"+65\",\"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\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"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\"}}},\"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\",\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -4865,7 +4623,7 @@
]
},
{
- "name": "Scenario11-Partial refund",
+ "name": "Scenario10-Partial refund",
"item": [
{
"name": "Payments - Create",
@@ -4970,7 +4728,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\":\"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_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\":\"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\"}}"
+ "raw": "{\"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\":\"+65\",\"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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -5609,7 +5367,7 @@
]
},
{
- "name": "Scenario12-Bank Redirect-sofort",
+ "name": "Scenario11-Bank Redirect-sofort",
"item": [
{
"name": "Payments - Create",
@@ -6030,7 +5788,7 @@
]
},
{
- "name": "Scenario13-Bank Redirect-eps",
+ "name": "Scenario12-Bank Redirect-eps",
"item": [
{
"name": "Payments - Create",
@@ -6451,7 +6209,7 @@
]
},
{
- "name": "Scenario14-Refund recurring payment",
+ "name": "Scenario13-Refund recurring payment",
"item": [
{
"name": "Payments - Create",
@@ -6582,7 +6340,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\":\"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_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\"}},\"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\"}}},\"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\":\"Joseph\",\"last_name\":\"Doe\"}},\"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\"}},\"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\":\"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_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\":\"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\"}}},\"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\":\"Joseph\",\"last_name\":\"Doe\"}},\"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\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -7211,7 +6969,7 @@
]
},
{
- "name": "Scenario15-Bank Redirect-giropay",
+ "name": "Scenario14-Bank debit-ach",
"item": [
{
"name": "Payments - Create",
@@ -7316,7 +7074,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":1000,\"currency\":\"EUR\",\"confirm\":false,\"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://duck.com\",\"billing\":{\"address\":{\"first_name\":\"John\",\"last_name\":\"Doe\",\"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\":\"DE\",\"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\"}}"
+ "raw": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":false,\"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://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\",\"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\"},\"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\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -7403,433 +7161,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" for \"status\"",
- "if (jsonData?.status) {",
+ "// Response body should have value \"ach\" for \"payment_method_type\"",
+ "if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ach'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- "",
- "// Response body should have value \"giropay\" for \"payment_method_type\"",
- "if (jsonData?.payment_method_type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'giropay'\",",
- " function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"giropay\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"stripe\" for \"connector\"",
- "if (jsonData?.connector) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'adyen'\",",
- " function () {",
- " pm.expect(jsonData.connector).to.eql(\"adyen\");",
- " },",
- " );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "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": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\",\"preferred_language\":\"en\",\"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\"}}"
- },
- "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"
- },
- "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 \"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\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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": "Scenario16-Bank debit-ach",
- "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_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\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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\":10000,\"currency\":\"USD\",\"confirm\":false,\"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://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\",\"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\"},\"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\"}}"
- },
- "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 - Confirm",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// 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 \"ach\" for \"payment_method_type\"",
- "if (jsonData?.payment_method_type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ach'\",",
- " function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"ach\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"ach\");",
" },",
" );",
"}",
@@ -8044,7 +7381,7 @@
]
},
{
- "name": "Scenario17-Bank debit-Bacs",
+ "name": "Scenario15-Bank debit-Bacs",
"item": [
{
"name": "Payments - Create",
@@ -8310,7 +7647,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"bacs\",\"payment_method_data\":{\"bank_debit\":{\"bacs_bank_debit\":{\"account_number\":\"40308669\",\"routing_number\":\"121000358\",\"sort_code\":\"560036\",\"shopper_email\":\"[email protected]\",\"card_holder_name\":\"joseph Doe\",\"bank_account_holder_name\":\"David Archer\",\"billing_details\":{\"houseNumberOrName\":\"50\",\"street\":\"Test Street\",\"city\":\"Amsterdam\",\"stateOrProvince\":\"NY\",\"postalCode\":\"12010\",\"country\":\"GB\",\"name\":\"A. Klaassen\",\"email\":\"[email protected]\"},\"reference\":\"daslvcgbaieh\"}}}}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"bacs\",\"payment_method_data\":{\"bank_debit\":{\"bacs_bank_debit\":{\"account_number\":\"40308669\",\"routing_number\":\"121000358\",\"sort_code\":\"560036\",\"shopper_email\":\"[email protected]\",\"card_holder_name\":\"joseph Doe\",\"bank_account_holder_name\":\"David Archer\",\"billing_details\":{\"houseNumberOrName\":\"50\",\"street\":\"Test Street\",\"city\":\"Amsterdam\",\"stateOrProvince\":\"NY\",\"postalCode\":\"12010\",\"country\":\"GB\",\"name\":\"A. Klaassen\",\"email\":\"[email protected]\"},\"reference\":\"daslvcgbaieh\"}}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -8456,7 +7793,7 @@
]
},
{
- "name": "Scenario18-Bank Redirect-Trustly",
+ "name": "Scenario16-Bank Redirect-Trustly",
"item": [
{
"name": "Payments - Create",
@@ -8877,7 +8214,7 @@
]
},
{
- "name": "Scenario19-Add card flow",
+ "name": "Scenario17-Add card flow",
"item": [
{
"name": "Payments - Create",
@@ -8960,7 +8297,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\",\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"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\":\"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\":\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -9312,7 +8649,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"7373\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"737\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -9687,7 +9024,7 @@
]
},
{
- "name": "Scenario20-Pass Invalid CVV for save card flow and verify failed payment",
+ "name": "Scenario18-Pass Invalid CVV for save card flow and verify failed payment",
"item": [
{
"name": "Payments - Create",
@@ -9780,7 +9117,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\",\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"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\":\"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\":\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -10149,7 +9486,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"737\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"123\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -10330,7 +9667,7 @@
]
},
{
- "name": "Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy",
+ "name": "Scenario19-Don't Pass CVV for save card flow and verify failed payment Copy",
"item": [
{
"name": "Payments - Create",
@@ -10423,7 +9760,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\",\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"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\":\"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\":\"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\":\"9123456789\",\"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\":\"9123456789\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -10792,7 +10129,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -10971,6 +10308,248 @@
"response": []
}
]
+ },
+ {
+ "name": "Scenario20-Create Gift Card payment",
+ "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 \"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\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":1100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":1100,\"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\":\"gift_card\",\"payment_method_type\":\"givex\",\"payment_method_data\":{\"gift_card\":{\"givex\":{\"number\":\"6364530000000000\",\"cvc\":\"122222\"}}},\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
+ },
+ "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 - 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/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": []
+ }
+ ]
}
]
},
@@ -11093,7 +10672,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":14100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":14100,\"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\":\"gift_card\",\"payment_method_type\":\"givex\",\"payment_method_data\":{\"gift_card\":{\"givex\":{\"number\":\"6364530000000000\",\"cvc\":\"122222\"}}},\"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\"}}"
+ "raw": "{\"amount\":14100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":14100,\"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\":\"gift_card\",\"payment_method_type\":\"givex\",\"payment_method_data\":{\"gift_card\":{\"givex\":{\"number\":\"6364530000000000\",\"cvc\":\"122222\"}}},\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -11340,7 +10919,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\":\"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\":\"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\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"united states\"}},\"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\":\"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\":\"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\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"united states\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -11473,7 +11052,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\":\"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\":\"371449635398431\",\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"371449635398431\",\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -11606,7 +11185,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\":\"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\":\"371449635398431\",\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"371449635398431\",\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -11739,7 +11318,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\":\"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\":\"371449635398431\",\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"371449635398431\",\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -12011,7 +11590,7 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -12143,7 +11722,7 @@
"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\":\"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\":\"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\"}}"
+ "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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -12523,7 +12102,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\":\"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\":\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -12784,7 +12363,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\":\"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\":\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -13430,7 +13009,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\":\"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\":\"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\":\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -13779,7 +13358,7 @@
"language": "json"
}
},
- "raw": "{\"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\",\"payment_method\":\"card\",\"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\":\"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\"}}"
+ "raw": "{\"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\",\"payment_method\":\"card\",\"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\":\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -14154,7 +13733,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\":\"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\":\"371449635398431\",\"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\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"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\",\"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\"}}"
+ "raw": "{\"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\":\"+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\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"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\"}}},\"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\",\"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\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -14534,7 +14113,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":10000,\"currency\":\"USD\",\"customer_id\":\"payout_customer\",\"email\":\"[email protected]\",\"name\":\"Doest John\",\"phone\":\"9123456789\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payout request\",\"connector\":[\"adyen\"],\"payout_type\":\"bank\",\"payout_method_data\":{\"bank\":{\"bank_routing_number\":\"110000000\",\"bank_account_number\":\"000123456789\",\"bank_name\":\"Stripe Test Bank\",\"bank_country_code\":\"US\",\"bank_city\":\"California\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Doest\",\"last_name\":\"John\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"1\"}},\"entity_type\":\"Individual\",\"recurring\":false,\"metadata\":{\"ref\":\"123\",\"vendor_details\":{\"account_type\":\"custom\",\"business_type\":\"individual\",\"business_profile_mcc\":5045,\"business_profile_url\":\"https://www.pastebin.com\",\"business_profile_name\":\"pT\",\"company_address_line1\":\"address_full_match\",\"company_address_line2\":\"Kimberly Way\",\"company_address_postal_code\":\"31062\",\"company_address_city\":\"Milledgeville\",\"company_address_state\":\"GA\",\"company_phone\":\"+16168205366\",\"company_tax_id\":\"000000000\",\"company_owners_provided\":false,\"capabilities_card_payments\":true,\"capabilities_transfers\":true},\"individual_details\":{\"tos_acceptance_date\":1680581051,\"tos_acceptance_ip\":\"103.159.11.202\",\"individual_dob_day\":\"01\",\"individual_dob_month\":\"01\",\"individual_dob_year\":\"1901\",\"individual_id_number\":\"000000000\",\"individual_ssn_last_4\":\"0000\",\"external_account_account_holder_type\":\"individual\"}},\"confirm\":true,\"auto_fulfill\":true}"
+ "raw": "{\"amount\":10000,\"currency\":\"USD\",\"customer_id\":\"payout_customer\",\"email\":\"[email protected]\",\"name\":\"Doest John\",\"phone\":\"9123456789\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payout request\",\"connector\":[\"adyen\"],\"payout_type\":\"bank\",\"payout_method_data\":{\"bank\":{\"bank_routing_number\":\"110000000\",\"bank_account_number\":\"000123456789\",\"bank_name\":\"Stripe Test Bank\",\"bank_country_code\":\"US\",\"bank_city\":\"California\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Doest\",\"last_name\":\"John\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"1\"}},\"entity_type\":\"Individual\",\"recurring\":false,\"metadata\":{\"ref\":\"123\",\"vendor_details\":{\"account_type\":\"custom\",\"business_type\":\"individual\",\"business_profile_mcc\":5045,\"business_profile_url\":\"https://www.pastebin.com\",\"business_profile_name\":\"pT\",\"company_address_line1\":\"address_full_match\",\"company_address_line2\":\"Kimberly Way\",\"company_address_postal_code\":\"31062\",\"company_address_city\":\"Milledgeville\",\"company_address_state\":\"GA\",\"company_phone\":\"+16168205366\",\"company_tax_id\":\"000000000\",\"company_owners_provided\":false,\"capabilities_card_payments\":true,\"capabilities_transfers\":true},\"individual_details\":{\"tos_acceptance_date\":1680581051,\"tos_acceptance_ip\":\"103.159.11.202\",\"individual_dob_day\":\"01\",\"individual_dob_month\":\"01\",\"individual_dob_year\":\"1901\",\"individual_id_number\":\"000000000\",\"individual_ssn_last_4\":\"0000\",\"external_account_account_holder_type\":\"individual\"}},\"confirm\":true,\"auto_fulfill\":true,\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payouts/create",
@@ -14639,7 +14218,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":1,\"currency\":\"GBP\",\"customer_id\":\"payout_customer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payout request\",\"payout_type\":\"bank\",\"payout_method_data\":{\"bank\":{\"bank_sort_code\":\"231470\",\"bank_account_number\":\"28821822\",\"bank_name\":\"Deutsche Bank\",\"bank_country_code\":\"NL\",\"bank_city\":\"Amsterdam\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"entity_type\":\"Individual\",\"recurring\":true,\"metadata\":{\"ref\":\"123\"},\"confirm\":true,\"auto_fulfill\":true,\"connector\":[\"adyen\"],\"business_label\":\"abcd\",\"business_country\":\"US\"}"
+ "raw": "{\"amount\":1,\"currency\":\"GBP\",\"customer_id\":\"payout_customer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payout request\",\"payout_type\":\"bank\",\"payout_method_data\":{\"bank\":{\"bank_sort_code\":\"231470\",\"bank_account_number\":\"28821822\",\"bank_name\":\"Deutsche Bank\",\"bank_country_code\":\"NL\",\"bank_city\":\"Amsterdam\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"CA\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"9123456789\",\"country_code\":\"+91\"}},\"entity_type\":\"Individual\",\"recurring\":true,\"metadata\":{\"ref\":\"123\"},\"confirm\":true,\"auto_fulfill\":true,\"connector\":[\"adyen\"],\"business_label\":\"abcd\",\"business_country\":\"US\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\",\"accept_header\":\"text\\\\/html,application\\\\/xhtml+xml,application\\\\/xml;q=0.9,image\\\\/webp,image\\\\/apng,*\\\\/*;q=0.8\",\"language\":\"en-GB\",\"color_depth\":30,\"screen_height\":1117,\"screen_width\":1728,\"time_zone\":-330,\"java_enabled\":true,\"java_script_enabled\":true}}"
},
"url": {
"raw": "{{baseUrl}}/payouts/create",
|
ci
|
Add browser info for adyen postman collection (#5927)
|
ee11723b602111c328769d9990d1790669139226
|
2024-06-06 05:44:50
|
github-actions
|
chore(version): 2024.06.06.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff445d36849..254f7d7709a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,39 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.06.06.0
+
+### Features
+
+- **connector:** Add payouts integration for AdyenPlatform ([#4874](https://github.com/juspay/hyperswitch/pull/4874)) ([`32cf06c`](https://github.com/juspay/hyperswitch/commit/32cf06c73611554d263d9bb44d7dbe940d56dd59))
+- **core:** Create Payout Webhook Flow ([#4696](https://github.com/juspay/hyperswitch/pull/4696)) ([`a3183a0`](https://github.com/juspay/hyperswitch/commit/a3183a0c5ba75c9ebf2335b81f7e4ccadd87e7d2))
+- **multitenancy:** Move users and tenants to global schema ([#4781](https://github.com/juspay/hyperswitch/pull/4781)) ([`c5e28f2`](https://github.com/juspay/hyperswitch/commit/c5e28f2670d51bf6529eb729167c97ad301217ef))
+
+### Bug Fixes
+
+- **connector:**
+ - [ZSL] capture connector transaction ID ([#4863](https://github.com/juspay/hyperswitch/pull/4863)) ([`f39c420`](https://github.com/juspay/hyperswitch/commit/f39c420623bd05147aeb92ed255f84d74e9370cd))
+ - [Adyen]add configs for afterpay adyen ([#4885](https://github.com/juspay/hyperswitch/pull/4885)) ([`a8b57ea`](https://github.com/juspay/hyperswitch/commit/a8b57eaf2318d43ee2533622de94123af593c4b6))
+- **users:** Populate correct `org_id` for Internal Signup ([#4888](https://github.com/juspay/hyperswitch/pull/4888)) ([`76ec5e1`](https://github.com/juspay/hyperswitch/commit/76ec5e1e02380efc86cae93923f2a7b2bd0d58a0))
+
+### Refactors
+
+- **business_profile:** Add `collect_shipping_details_from_wallet_connector` in the business profile response ([#4892](https://github.com/juspay/hyperswitch/pull/4892)) ([`377d6ea`](https://github.com/juspay/hyperswitch/commit/377d6eacd308aca7048c7af071e0d0f121475888))
+- **connector:**
+ - Move AuthorizeSessionToken flow to core from execute_pretasks for nuvei and square ([#4854](https://github.com/juspay/hyperswitch/pull/4854)) ([`32f0fae`](https://github.com/juspay/hyperswitch/commit/32f0fae27de6bd0ab2a8e6de3b93c97205e14151))
+ - [BOA/CYBS] add customer token for mandates and refactor psync ([#4815](https://github.com/juspay/hyperswitch/pull/4815)) ([`3d53fd0`](https://github.com/juspay/hyperswitch/commit/3d53fd018a2b14465bf3cc1557a483e98da07f9b))
+ - [KLARNA] Add dynamic fields for klarna payment method ([#4891](https://github.com/juspay/hyperswitch/pull/4891)) ([`dae1413`](https://github.com/juspay/hyperswitch/commit/dae14139604b52e11f84c1341bfcb2e58c62a884))
+- **core:** Inclusion of constraint graph for merchant Payment Method list ([#4845](https://github.com/juspay/hyperswitch/pull/4845)) ([`4df84e9`](https://github.com/juspay/hyperswitch/commit/4df84e913f5724491c948c283a022931c617f46f))
+
+### Miscellaneous Tasks
+
+- **eulid_wasm:** Allow merchant to select different paypal paymentmenthod type ([#4882](https://github.com/juspay/hyperswitch/pull/4882)) ([`326b6b5`](https://github.com/juspay/hyperswitch/commit/326b6b52324ae60128a1b1fbcff85ab3b99a500a))
+- **users:** Email templates updated ([#4562](https://github.com/juspay/hyperswitch/pull/4562)) ([`7ab65ac`](https://github.com/juspay/hyperswitch/commit/7ab65ac8834f47c4448b64899ce3e3656132fb63))
+
+**Full Changelog:** [`2024.06.05.0...2024.06.06.0`](https://github.com/juspay/hyperswitch/compare/2024.06.05.0...2024.06.06.0)
+
+- - -
+
## 2024.06.05.0
### Features
|
chore
|
2024.06.06.0
|
4337860363578f0c86928a43e2e1baa2afaaba38
|
2024-02-15 05:48:41
|
github-actions
|
chore(version): 2024.02.15.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2767f7c175f..20d5e24610e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,33 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.02.15.0
+
+### Features
+
+- **connector:** [Adyen] add PMD validation in validate_capture_method method for all the implemented PM’s ([#3584](https://github.com/juspay/hyperswitch/pull/3584)) ([`0c46f39`](https://github.com/juspay/hyperswitch/commit/0c46f39b9e1a397cecde1de9438c65cc7b93766b))
+- **events:** Connector response masking in clickhouse ([#3566](https://github.com/juspay/hyperswitch/pull/3566)) ([`5fb3c00`](https://github.com/juspay/hyperswitch/commit/5fb3c001b5dc371f81fe1708fd9a6c6978fb726e))
+- Add cors rules to actix ([#3646](https://github.com/juspay/hyperswitch/pull/3646)) ([`e702341`](https://github.com/juspay/hyperswitch/commit/e702341c64f5a6f542de9d413a6aa2b2e731eea6))
+- Noon payme cryptopay error mapping ([#3258](https://github.com/juspay/hyperswitch/pull/3258)) ([`702e945`](https://github.com/juspay/hyperswitch/commit/702e945be93645f9260663dd456e08c510c2f1fc))
+
+### Bug Fixes
+
+- **router:** Store connector_mandate_id in complete auth ([#3576](https://github.com/juspay/hyperswitch/pull/3576)) ([`91cd70a`](https://github.com/juspay/hyperswitch/commit/91cd70a60b89b1c4e868e359a75f4088854562ef))
+
+### Refactors
+
+- **router:** Added payment_method to golden log line ([#3620](https://github.com/juspay/hyperswitch/pull/3620)) ([`c5343df`](https://github.com/juspay/hyperswitch/commit/c5343dfcc20f1000e319c62fa0341c46701595ff))
+- Incorporate `hyperswitch_interface` into drainer ([#3629](https://github.com/juspay/hyperswitch/pull/3629)) ([`7b1c65b`](https://github.com/juspay/hyperswitch/commit/7b1c65b60d3874262867f77c8c28ebfa410b89a3))
+- Adding connector_name into logs ( Logging Changes ) ([#3581](https://github.com/juspay/hyperswitch/pull/3581)) ([`de12ba7`](https://github.com/juspay/hyperswitch/commit/de12ba779a229966c292caa05976883dafb4996e))
+
+### Documentation
+
+- **connector:** Add wasm docs in connector integration docs ([#3641](https://github.com/juspay/hyperswitch/pull/3641)) ([`1236741`](https://github.com/juspay/hyperswitch/commit/1236741a14befd7472b0db0060315bb6efe720e0))
+
+**Full Changelog:** [`2024.02.14.0...2024.02.15.0`](https://github.com/juspay/hyperswitch/compare/2024.02.14.0...2024.02.15.0)
+
+- - -
+
## 2024.02.14.0
### Features
|
chore
|
2024.02.15.0
|
a3ff2e8d4f2a88603d5334cac783a81be715dfbb
|
2023-03-15 21:53:38
|
Sanchith Hegde
|
refactor(kms): share a KMS client for all KMS operations (#744)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 0e65c9cad5b..7ef8eca00e4 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -111,10 +111,6 @@ outgoing_enabled = true
validity = 1
[api_keys]
-# Key ID for the KMS managed key used to decrypt the API key hashing key
-aws_key_id = ""
-# The AWS region for the KMS managed key used to decrypt the API key hashing key
-aws_region = ""
# Base64-encoded (KMS encrypted) ciphertext of the API key hashing key
kms_encrypted_hash_key = ""
# Hex-encoded 32-byte long (64 characters long when hex-encoded) key used for calculating hashes of API keys
@@ -190,10 +186,15 @@ max_read_count = 100 # Specifies the maximum number of entries that wo
shutdown_interval = 1000 # Specifies how much time to wait, while waiting for threads to complete execution (in milliseconds)
loop_interval = 500 # Specifies how much time to wait after checking all the possible streams in completed (in milliseconds)
-# Filteration logic for list payment method, allowing use to limit payment methods based on the requirement country and currency
+# Filtration logic for list payment method, allowing use to limit payment methods based on the requirement country and currency
[pm_filters.stripe]
# ^--- This can be any connector (can be multiple)
paypal = { currency = "USD,INR", country = "US" }
# ^ ^------- comma-separated values
# ^------------------------------- any valid payment method type (can be multiple) (for cards this should be card_network)
# If either currency or country isn't provided then, all possible values are accepted
+
+# KMS configuration. Only applicable when the `kms` feature flag is enabled.
+[kms]
+key_id = "" # The AWS key ID used by the KMS SDK for decrypting data.
+region = "" # The AWS region used by the KMS SDK for decrypting data.
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 824ecce9302..c66378d5b58 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -58,6 +58,8 @@ pub struct Settings {
pub pm_filters: ConnectorFilters,
pub bank_config: BankRedirectConfig,
pub api_keys: ApiKeys,
+ #[cfg(feature = "kms")]
+ pub kms: Kms,
}
#[derive(Debug, Deserialize, Clone, Default)]
@@ -187,10 +189,6 @@ pub struct EphemeralConfig {
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(default)]
pub struct Jwekey {
- #[cfg(feature = "kms")]
- pub aws_key_id: String,
- #[cfg(feature = "kms")]
- pub aws_region: String,
pub locker_key_identifier1: String,
pub locker_key_identifier2: String,
pub locker_encryption_key1: String,
@@ -327,12 +325,6 @@ pub struct WebhooksSettings {
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(default)]
pub struct ApiKeys {
- #[cfg(feature = "kms")]
- pub aws_key_id: String,
-
- #[cfg(feature = "kms")]
- pub aws_region: String,
-
/// Base64-encoded (KMS encrypted) ciphertext of the key used for calculating hashes of API
/// keys
#[cfg(feature = "kms")]
@@ -344,6 +336,14 @@ pub struct ApiKeys {
pub hash_key: String,
}
+#[cfg(feature = "kms")]
+#[derive(Debug, Deserialize, Clone, Default)]
+#[serde(default)]
+pub struct Kms {
+ pub key_id: String,
+ pub region: String,
+}
+
impl Settings {
pub fn new() -> ApplicationResult<Self> {
Self::with_config_path(None)
@@ -417,8 +417,9 @@ impl Settings {
.transpose()?;
#[cfg(feature = "kv_store")]
self.drainer.validate()?;
- self.jwekey.validate()?;
self.api_keys.validate()?;
+ #[cfg(feature = "kms")]
+ self.kms.validate()?;
Ok(())
}
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index f3643c3b069..74552c5ef28 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -41,26 +41,6 @@ impl super::settings::Locker {
}
}
-impl super::settings::Jwekey {
- 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(
- "AWS key ID must not be empty when KMS feature is enabled".into(),
- ))
- })?;
-
- #[cfg(feature = "kms")]
- common_utils::fp_utils::when(self.aws_region.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "AWS region must not be empty when KMS feature is enabled".into(),
- ))
- })?;
-
- Ok(())
- }
-}
-
impl super::settings::Server {
pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.host.is_default_or_empty(), || {
@@ -190,25 +170,11 @@ impl super::settings::ApiKeys {
use common_utils::fp_utils::when;
#[cfg(feature = "kms")]
- {
- when(self.aws_key_id.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "API key AWS key ID must not be empty when KMS feature is enabled".into(),
- ))
- })?;
-
- when(self.aws_region.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "API key AWS region must not be empty when KMS feature is enabled".into(),
- ))
- })?;
-
- when(self.kms_encrypted_hash_key.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "API key hashing key must not be empty when KMS feature is enabled".into(),
- ))
- })
- }
+ return when(self.kms_encrypted_hash_key.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "API key hashing key must not be empty when KMS feature is enabled".into(),
+ ))
+ });
#[cfg(not(feature = "kms"))]
when(self.hash_key.is_empty(), || {
@@ -218,3 +184,22 @@ impl super::settings::ApiKeys {
})
}
}
+
+#[cfg(feature = "kms")]
+impl super::settings::Kms {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
+ use common_utils::fp_utils::when;
+
+ when(self.key_id.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "KMS AWS key ID must not be empty".into(),
+ ))
+ })?;
+
+ when(self.region.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "KMS AWS region must not be empty".into(),
+ ))
+ })
+ }
+}
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index 9cda9e9562f..f7cdfc6149d 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -3,6 +3,8 @@ use error_stack::{report, IntoReport, ResultExt};
use masking::{PeekInterface, StrongSecret};
use router_env::{instrument, tracing};
+#[cfg(feature = "kms")]
+use crate::services::kms;
use crate::{
configs::settings,
consts,
@@ -12,43 +14,40 @@ use crate::{
types::{api, storage, transformers::ForeignInto},
utils,
};
-#[cfg(feature = "kms")]
-use crate::{routes::metrics, services::kms};
-pub static HASH_KEY: tokio::sync::OnceCell<StrongSecret<[u8; PlaintextApiKey::HASH_KEY_LEN]>> =
+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,
-) -> errors::RouterResult<StrongSecret<[u8; PlaintextApiKey::HASH_KEY_LEN]>> {
- #[cfg(feature = "kms")]
- let hash_key = kms::KeyHandler::get_kms_decrypted_key(
- &api_key_config.aws_region,
- &api_key_config.aws_key_id,
- api_key_config.kms_encrypted_hash_key.clone(),
- )
- .await
- .map_err(|error| {
- metrics::AWS_KMS_FAILURES.add(&metrics::CONTEXT, 1, &[]);
- error
- })
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to KMS decrypt API key hashing key")?;
-
- #[cfg(not(feature = "kms"))]
- let hash_key = &api_key_config.hash_key;
-
- <[u8; PlaintextApiKey::HASH_KEY_LEN]>::try_from(
- hex::decode(hash_key)
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
+) -> 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)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to KMS decrypt API key hashing key")?;
+
+ #[cfg(not(feature = "kms"))]
+ let hash_key = &api_key_config.hash_key;
+
+ <[u8; PlaintextApiKey::HASH_KEY_LEN]>::try_from(
+ hex::decode(hash_key)
+ .into_report()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("API key hash key has invalid hexadecimal data")?
+ .as_slice(),
+ )
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("API key hash key has invalid hexadecimal data")?
- .as_slice(),
- )
- .into_report()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("The API hashing key has incorrect length")
- .map(StrongSecret::new)
+ .attach_printable("The API hashing key has incorrect length")
+ .map(StrongSecret::new)
+ })
+ .await
}
// Defining new types `PlaintextApiKey` and `HashedApiKey` in the hopes of reducing the possibility
@@ -119,12 +118,16 @@ impl PlaintextApiKey {
pub async fn create_api_key(
store: &dyn StorageInterface,
api_key_config: &settings::ApiKeys,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
api_key: api::CreateApiKeyRequest,
merchant_id: String,
) -> RouterResponse<api::CreateApiKeyResponse> {
- let hash_key = HASH_KEY
- .get_or_try_init(|| get_hash_key(api_key_config))
- .await?;
+ let hash_key = get_hash_key(
+ api_key_config,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await?;
let plaintext_api_key = PlaintextApiKey::new(consts::API_KEY_LENGTH);
let api_key = storage::ApiKeyNew {
key_id: PlaintextApiKey::new_key_id(),
@@ -248,10 +251,13 @@ mod tests {
let settings = settings::Settings::new().expect("invalid settings");
let plaintext_api_key = PlaintextApiKey::new(consts::API_KEY_LENGTH);
- let hash_key = HASH_KEY
- .get_or_try_init(|| get_hash_key(&settings.api_keys))
- .await
- .unwrap();
+ let hash_key = get_hash_key(
+ &settings.api_keys,
+ #[cfg(feature = "kms")]
+ &settings.kms,
+ )
+ .await
+ .unwrap();
let hashed_api_key = plaintext_api_key.keyed_hash(hash_key.peek());
assert_ne!(
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index e72d87cf57f..add5af5fc50 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -313,6 +313,18 @@ pub enum VaultError {
UnexpectedResponseError(bytes::Bytes),
}
+#[derive(Debug, thiserror::Error)]
+pub enum KmsError {
+ #[error("Failed to base64 decode input data")]
+ Base64DecodingFailed,
+ #[error("Failed to KMS decrypt input data")]
+ DecryptionFailed,
+ #[error("Missing plaintext KMS decryption output")]
+ MissingPlaintextDecryptionOutput,
+ #[error("Failed to UTF-8 decode decryption output")]
+ Utf8DecodingFailed,
+}
+
#[derive(Debug, thiserror::Error)]
pub enum ProcessTrackerError {
#[error("An unexpected flow was specified")]
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 9929059d8ca..b6669c2b67e 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -220,10 +220,14 @@ pub async fn add_card_hs(
) -> errors::CustomResult<api::PaymentMethodResponse, errors::VaultError> {
let locker = &state.conf.locker;
let jwekey = &state.conf.jwekey;
+
+ #[cfg(feature = "kms")]
+ let kms_config = &state.conf.kms;
+
let db = &*state.store;
let merchant_id = &merchant_account.merchant_id;
- let locker_id = merchant_account
+ let _ = merchant_account
.locker_id
.to_owned()
.get_required_value("locker_id")
@@ -234,9 +238,9 @@ pub async fn add_card_hs(
locker,
&card,
&customer_id,
- &req,
- &locker_id,
merchant_id,
+ #[cfg(feature = "kms")]
+ kms_config,
)
.await?;
@@ -249,10 +253,15 @@ pub async fn add_card_hs(
.get_response_inner("JweBody")
.change_context(errors::VaultError::FetchCardFailed)?;
- let decrypted_payload = payment_methods::get_decrypted_response_payload(jwekey, jwe_body)
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting decrypted response payload")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting decrypted response payload")?;
let stored_card_resp: payment_methods::StoreCardResp = decrypted_payload
.parse_struct("StoreCardResp")
.change_context(errors::VaultError::ResponseDeserializationFailed)?;
@@ -363,12 +372,18 @@ pub async fn get_card_from_hs_locker<'a>(
) -> errors::CustomResult<payment_methods::Card, errors::VaultError> {
let locker = &state.conf.locker;
let jwekey = &state.conf.jwekey;
+
+ #[cfg(feature = "kms")]
+ let kms_config = &state.conf.kms;
+
let request = payment_methods::mk_get_card_request_hs(
jwekey,
locker,
customer_id,
merchant_id,
card_reference,
+ #[cfg(feature = "kms")]
+ kms_config,
)
.await
.change_context(errors::VaultError::FetchCardFailed)
@@ -381,10 +396,15 @@ pub async fn get_card_from_hs_locker<'a>(
let jwe_body: services::JweBody = response
.get_response_inner("JweBody")
.change_context(errors::VaultError::FetchCardFailed)?;
- let decrypted_payload = payment_methods::get_decrypted_response_payload(jwekey, jwe_body)
- .await
- .change_context(errors::VaultError::FetchCardFailed)
- .attach_printable("Error getting decrypted response payload for get card")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await
+ .change_context(errors::VaultError::FetchCardFailed)
+ .attach_printable("Error getting decrypted response payload for get card")?;
let get_card_resp: payment_methods::RetrieveCardResp = decrypted_payload
.parse_struct("RetrieveCardResp")
.change_context(errors::VaultError::FetchCardFailed)?;
@@ -441,12 +461,18 @@ pub async fn delete_card_from_hs_locker<'a>(
) -> errors::RouterResult<payment_methods::DeleteCardResp> {
let locker = &state.conf.locker;
let jwekey = &state.conf.jwekey;
+
+ #[cfg(feature = "kms")]
+ let kms_config = &state.conf.kms;
+
let request = payment_methods::mk_delete_card_request_hs(
jwekey,
locker,
customer_id,
merchant_id,
card_reference,
+ #[cfg(feature = "kms")]
+ kms_config,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -458,10 +484,15 @@ pub async fn delete_card_from_hs_locker<'a>(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while executing call_connector_api for delete card");
let jwe_body: services::JweBody = response.get_response_inner("JweBody")?;
- let decrypted_payload = payment_methods::get_decrypted_response_payload(jwekey, jwe_body)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error getting decrypted response payload for delete card")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error getting decrypted response payload for delete card")?;
let delete_card_resp: payment_methods::DeleteCardResp = decrypted_payload
.parse_struct("DeleteCardResp")
.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 5a16129d55d..a84e5c8b310 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
#[cfg(feature = "kms")]
use crate::services::kms;
use crate::{
- configs::settings::{Jwekey, Locker},
+ configs::settings,
core::errors::{self, CustomResult},
headers,
pii::{self, prelude::*, Secret},
@@ -147,35 +147,34 @@ pub fn get_dotted_jws(jws: encryption::JwsBody) -> String {
}
pub async fn get_decrypted_response_payload(
- jwekey: &Jwekey,
+ jwekey: &settings::Jwekey,
jwe_body: encryption::JweBody,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
) -> CustomResult<String, errors::VaultError> {
#[cfg(feature = "kms")]
- let public_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_encryption_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Fails to get public key of vault")?;
+ let public_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_encryption_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Fails to get public key of vault")?;
+ #[cfg(feature = "kms")]
+ let private_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_private_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting private key for signing jws")?;
+
#[cfg(not(feature = "kms"))]
let public_key = jwekey.vault_encryption_key.to_owned();
- #[cfg(feature = "kms")]
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_private_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting private key for signing jws")?;
#[cfg(not(feature = "kms"))]
let private_key = jwekey.vault_private_key.to_owned();
+
let jwt = get_dotted_jwe(jwe_body);
let key_id = basilisk_hs_key_id();
let alg = jwe::RSA_OAEP;
- let jwe_decrypted = encryption::decrypt_jwe(jwekey, &jwt, key_id, key_id, private_key, alg)
+ let jwe_decrypted = encryption::decrypt_jwe(&jwt, key_id, key_id, private_key, alg)
.await
.change_context(errors::VaultError::SaveCardFailed)
.attach_printable("Jwe Decryption failed for JweBody for vault")?;
@@ -191,8 +190,9 @@ pub async fn get_decrypted_response_payload(
}
pub async fn mk_basilisk_req(
- jwekey: &Jwekey,
+ jwekey: &settings::Jwekey,
jws: &str,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
) -> CustomResult<encryption::JweBody, errors::VaultError> {
let jws_payload: Vec<&str> = jws.split('.').collect();
@@ -208,19 +208,19 @@ pub async fn mk_basilisk_req(
let payload = utils::Encode::<encryption::JwsBody>::encode_to_vec(&jws_body)
.change_context(errors::VaultError::SaveCardFailed)?;
+
#[cfg(feature = "kms")]
- let public_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_encryption_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Fails to get encryption key of vault")?;
+ let public_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_encryption_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Fails to get encryption key of vault")?;
+
#[cfg(not(feature = "kms"))]
let public_key = jwekey.vault_encryption_key.to_owned();
- let jwe_encrypted = encryption::encrypt_jwe(jwekey, &payload, public_key)
+ let jwe_encrypted = encryption::encrypt_jwe(&payload, public_key)
.await
.change_context(errors::VaultError::SaveCardFailed)
.attach_printable("Error on jwe encrypt")?;
@@ -242,13 +242,12 @@ pub async fn mk_basilisk_req(
}
pub async fn mk_add_card_request_hs(
- jwekey: &Jwekey,
- locker: &Locker,
+ jwekey: &settings::Jwekey,
+ locker: &settings::Locker,
card: &api::CardDetail,
customer_id: &str,
- _req: &api::PaymentMethodCreate,
- _locker_id: &str,
merchant_id: &str,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
@@ -271,15 +270,15 @@ pub async fn mk_add_card_request_hs(
};
let payload = utils::Encode::<StoreCardReq<'_>>::encode_to_vec(&store_card_req)
.change_context(errors::VaultError::RequestEncodingFailed)?;
+
#[cfg(feature = "kms")]
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_private_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting private key for signing jws")?;
+ let private_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_private_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting private key for signing jws")?;
+
#[cfg(not(feature = "kms"))]
let private_key = jwekey.vault_private_key.to_owned();
@@ -287,7 +286,13 @@ pub async fn mk_add_card_request_hs(
.await
.change_context(errors::VaultError::RequestEncodingFailed)?;
- let jwe_payload = mk_basilisk_req(jwekey, &jws).await?;
+ let jwe_payload = mk_basilisk_req(
+ jwekey,
+ &jws,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await?;
let body = utils::Encode::<encryption::JweBody>::encode_to_value(&jwe_payload)
.change_context(errors::VaultError::RequestEncodingFailed)?;
@@ -366,7 +371,7 @@ pub fn mk_add_card_response(
}
pub fn mk_add_card_request(
- locker: &Locker,
+ locker: &settings::Locker,
card: &api::CardDetail,
customer_id: &str,
_req: &api::PaymentMethodCreate,
@@ -399,11 +404,12 @@ pub fn mk_add_card_request(
}
pub async fn mk_get_card_request_hs(
- jwekey: &Jwekey,
- locker: &Locker,
+ jwekey: &settings::Jwekey,
+ locker: &settings::Locker,
customer_id: &str,
merchant_id: &str,
card_reference: &str,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
@@ -417,15 +423,15 @@ pub async fn mk_get_card_request_hs(
};
let payload = utils::Encode::<CardReqBody<'_>>::encode_to_vec(&card_req_body)
.change_context(errors::VaultError::RequestEncodingFailed)?;
+
#[cfg(feature = "kms")]
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_private_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting private key for signing jws")?;
+ let private_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_private_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting private key for signing jws")?;
+
#[cfg(not(feature = "kms"))]
let private_key = jwekey.vault_private_key.to_owned();
@@ -433,7 +439,13 @@ pub async fn mk_get_card_request_hs(
.await
.change_context(errors::VaultError::RequestEncodingFailed)?;
- let jwe_payload = mk_basilisk_req(jwekey, &jws).await?;
+ let jwe_payload = mk_basilisk_req(
+ jwekey,
+ &jws,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await?;
let body = utils::Encode::<encryption::JweBody>::encode_to_value(&jwe_payload)
.change_context(errors::VaultError::RequestEncodingFailed)?;
@@ -446,7 +458,7 @@ pub async fn mk_get_card_request_hs(
}
pub fn mk_get_card_request<'a>(
- locker: &Locker,
+ locker: &settings::Locker,
locker_id: &'a str,
card_id: &'a str,
) -> CustomResult<services::Request, errors::VaultError> {
@@ -484,11 +496,12 @@ pub fn mk_get_card_response(card: GetCardResponse) -> errors::RouterResult<Card>
}
pub async fn mk_delete_card_request_hs(
- jwekey: &Jwekey,
- locker: &Locker,
+ jwekey: &settings::Jwekey,
+ locker: &settings::Locker,
customer_id: &str,
merchant_id: &str,
card_reference: &str,
+ #[cfg(feature = "kms")] kms_config: &settings::Kms,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
@@ -502,15 +515,14 @@ pub async fn mk_delete_card_request_hs(
};
let payload = utils::Encode::<CardReqBody<'_>>::encode_to_vec(&card_req_body)
.change_context(errors::VaultError::RequestEncodingFailed)?;
+
#[cfg(feature = "kms")]
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &jwekey.aws_region,
- &jwekey.aws_key_id,
- jwekey.vault_private_key.to_string(),
- )
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting private key for signing jws")?;
+ let private_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&jwekey.vault_private_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting private key for signing jws")?;
#[cfg(not(feature = "kms"))]
let private_key = jwekey.vault_private_key.to_owned();
@@ -519,7 +531,13 @@ pub async fn mk_delete_card_request_hs(
.await
.change_context(errors::VaultError::RequestEncodingFailed)?;
- let jwe_payload = mk_basilisk_req(jwekey, &jws).await?;
+ let jwe_payload = mk_basilisk_req(
+ jwekey,
+ &jws,
+ #[cfg(feature = "kms")]
+ kms_config,
+ )
+ .await?;
let body = utils::Encode::<encryption::JweBody>::encode_to_value(&jwe_payload)
.change_context(errors::VaultError::RequestEncodingFailed)?;
@@ -532,7 +550,7 @@ pub async fn mk_delete_card_request_hs(
}
pub fn mk_delete_card_request<'a>(
- locker: &Locker,
+ locker: &settings::Locker,
merchant_id: &'a str,
card_id: &'a str,
) -> CustomResult<services::Request, errors::VaultError> {
@@ -584,7 +602,7 @@ pub fn get_card_detail(
//------------------------------------------------TokenizeService------------------------------------------------
pub fn mk_crud_locker_request(
- locker: &Locker,
+ locker: &settings::Locker,
path: &str,
req: api::TokenizePayloadEncrypted,
) -> CustomResult<services::Request, errors::VaultError> {
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 0c994dc20e3..6e809a0f684 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -6,7 +6,7 @@ use masking::PeekInterface;
use router_env::{instrument, tracing};
use crate::{
- configs::settings::Jwekey,
+ configs::settings,
core::errors::{self, CustomResult, RouterResult},
logger, routes,
types::{
@@ -393,7 +393,7 @@ impl Vault {
}
//------------------------------------------------TokenizeService------------------------------------------------
-pub fn get_key_id(keys: &Jwekey) -> &str {
+pub fn get_key_id(keys: &settings::Jwekey) -> &str {
let key_identifier = "1"; // [#46]: Fetch this value from redis or external sources
if key_identifier == "1" {
&keys.locker_key_identifier1
@@ -404,40 +404,30 @@ pub fn get_key_id(keys: &Jwekey) -> &str {
#[cfg(feature = "basilisk")]
async fn get_locker_jwe_keys(
- keys: &Jwekey,
+ keys: &settings::Jwekey,
+ kms_config: &settings::Kms,
) -> CustomResult<(String, String), errors::EncryptionError> {
let key_id = get_key_id(keys);
- if key_id == keys.locker_key_identifier1 {
- let public_key = kms::KeyHandler::get_kms_decrypted_key(
- &keys.aws_region,
- &keys.aws_key_id,
- keys.locker_encryption_key1.to_string(),
- )
- .await?;
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &keys.aws_region,
- &keys.aws_key_id,
- keys.locker_decryption_key1.to_string(),
- )
- .await?;
- Ok((public_key, private_key))
+ let (encryption_key, decryption_key) = if key_id == keys.locker_key_identifier1 {
+ (&keys.locker_encryption_key1, &keys.locker_decryption_key1)
} else if key_id == keys.locker_key_identifier2 {
- let public_key = kms::KeyHandler::get_kms_decrypted_key(
- &keys.aws_region,
- &keys.aws_key_id,
- keys.locker_encryption_key2.to_string(),
- )
- .await?;
- let private_key = kms::KeyHandler::get_kms_decrypted_key(
- &keys.aws_region,
- &keys.aws_key_id,
- keys.locker_decryption_key2.to_string(),
- )
- .await?;
- Ok((public_key, private_key))
+ (&keys.locker_encryption_key2, &keys.locker_decryption_key2)
} else {
- Err(errors::EncryptionError.into())
- }
+ return Err(errors::EncryptionError.into());
+ };
+
+ let public_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(encryption_key)
+ .await
+ .change_context(errors::EncryptionError)?;
+ let private_key = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(decryption_key)
+ .await
+ .change_context(errors::EncryptionError)?;
+
+ Ok((public_key, private_key))
}
#[cfg(feature = "basilisk")]
@@ -458,15 +448,14 @@ pub async fn create_tokenize(
)
.change_context(errors::ApiErrorResponse::InternalServerError)?;
- let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey)
+ let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey, &state.conf.kms)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error getting Encryption key")?;
- let encrypted_payload =
- services::encrypt_jwe(&state.conf.jwekey, payload.as_bytes(), public_key)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error getting Encrypt JWE response")?;
+ let encrypted_payload = services::encrypt_jwe(payload.as_bytes(), public_key)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error getting Encrypt JWE response")?;
let create_tokenize_request = api::TokenizePayloadEncrypted {
payload: encrypted_payload,
@@ -493,7 +482,6 @@ pub async fn create_tokenize(
.attach_printable("Decoding Failed for TokenizePayloadEncrypted")?;
let alg = jwe::RSA_OAEP_256;
let decrypted_payload = services::decrypt_jwe(
- &state.conf.jwekey,
&resp.payload,
get_key_id(&state.conf.jwekey),
&resp.key_id,
@@ -531,15 +519,14 @@ pub async fn get_tokenized_data(
let payload = serde_json::to_string(&payload_to_be_encrypted)
.map_err(|_x| errors::ApiErrorResponse::InternalServerError)?;
- let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey)
+ let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey, &state.conf.kms)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error getting Encryption key")?;
- let encrypted_payload =
- services::encrypt_jwe(&state.conf.jwekey, payload.as_bytes(), public_key)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error getting Encrypt JWE response")?;
+ let encrypted_payload = services::encrypt_jwe(payload.as_bytes(), public_key)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error getting Encrypt JWE response")?;
let create_tokenize_request = api::TokenizePayloadEncrypted {
payload: encrypted_payload,
key_id: get_key_id(&state.conf.jwekey).to_string(),
@@ -564,7 +551,6 @@ pub async fn get_tokenized_data(
.attach_printable("Decoding Failed for TokenizePayloadEncrypted")?;
let alg = jwe::RSA_OAEP_256;
let decrypted_payload = services::decrypt_jwe(
- &state.conf.jwekey,
&resp.payload,
get_key_id(&state.conf.jwekey),
&resp.key_id,
@@ -598,15 +584,14 @@ pub async fn delete_tokenized_data(
let payload = serde_json::to_string(&payload_to_be_encrypted)
.map_err(|_x| errors::ApiErrorResponse::InternalServerError)?;
- let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey)
+ let (public_key, private_key) = get_locker_jwe_keys(&state.conf.jwekey, &state.conf.kms)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error getting Encryption key")?;
- let encrypted_payload =
- services::encrypt_jwe(&state.conf.jwekey, payload.as_bytes(), public_key)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error getting Encrypt JWE response")?;
+ let encrypted_payload = services::encrypt_jwe(payload.as_bytes(), public_key)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error getting Encrypt JWE response")?;
let create_tokenize_request = api::TokenizePayloadEncrypted {
payload: encrypted_payload,
key_id: get_key_id(&state.conf.jwekey).to_string(),
@@ -631,7 +616,6 @@ pub async fn delete_tokenized_data(
.attach_printable("Decoding Failed for TokenizePayloadEncrypted")?;
let alg = jwe::RSA_OAEP_256;
let decrypted_payload = services::decrypt_jwe(
- &state.conf.jwekey,
&resp.payload,
get_key_id(&state.conf.jwekey),
&resp.key_id,
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 1ebb0928971..700c44a1511 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -43,6 +43,8 @@ pub async fn api_key_create(
api_keys::create_api_key(
&*state.store,
&state.conf.api_keys,
+ #[cfg(feature = "kms")]
+ &state.conf.kms,
payload,
merchant_id.clone(),
)
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 7f5c08133cd..dee7235f65f 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -55,7 +55,6 @@ impl AppState {
}
}
- #[allow(unused_variables)]
pub async fn new(conf: Settings) -> Self {
Self::with_storage(conf, StorageImpl::Postgresql).await
}
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index 222c58476e6..4173beb59a1 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -1,6 +1,7 @@
pub mod api;
pub mod authentication;
pub mod encryption;
+#[cfg(feature = "kms")]
pub mod kms;
pub mod logger;
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 15e5fe2ff9f..de437df04dc 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -55,9 +55,12 @@ where
let api_key = api_keys::PlaintextApiKey::from(api_key);
let hash_key = {
let config = state.conf();
- api_keys::HASH_KEY
- .get_or_try_init(|| api_keys::get_hash_key(&config.api_keys))
- .await?
+ api_keys::get_hash_key(
+ &config.api_keys,
+ #[cfg(feature = "kms")]
+ &config.kms,
+ )
+ .await?
};
let hashed_api_key = api_key.keyed_hash(hash_key.peek());
diff --git a/crates/router/src/services/encryption.rs b/crates/router/src/services/encryption.rs
index 7d74281a0c1..fe328abe08b 100644
--- a/crates/router/src/services/encryption.rs
+++ b/crates/router/src/services/encryption.rs
@@ -7,7 +7,6 @@ use ring::{aead::*, error::Unspecified};
use serde::{Deserialize, Serialize};
use crate::{
- configs::settings::Jwekey,
core::errors::{self, CustomResult},
utils,
};
@@ -119,7 +118,6 @@ pub fn decrypt(mut data: Vec<u8>, key: &[u8]) -> CustomResult<String, errors::En
}
pub async fn encrypt_jwe(
- _keys: &Jwekey,
payload: &[u8],
public_key: String,
) -> CustomResult<String, errors::EncryptionError> {
@@ -133,15 +131,14 @@ pub async fn encrypt_jwe(
.into_report()
.change_context(errors::EncryptionError)
.attach_printable("Error getting JweEncryptor")?;
- let jwt = jwe::serialize_compact(payload, &src_header, &encrypter)
+
+ jwe::serialize_compact(payload, &src_header, &encrypter)
.into_report()
.change_context(errors::EncryptionError)
- .attach_printable("Error getting jwt string")?;
- Ok(jwt)
+ .attach_printable("Error getting jwt string")
}
pub async fn decrypt_jwe(
- _keys: &Jwekey,
jwt: &str,
key_id: &str,
resp_key_id: &str,
@@ -162,11 +159,11 @@ pub async fn decrypt_jwe(
Err(report!(errors::EncryptionError).attach_printable("Missing ciphertext blob"))
.attach_printable("key_id mismatch, Error authenticating response")
})?;
- let resp = String::from_utf8(dst_payload)
+
+ String::from_utf8(dst_payload)
.into_report()
.change_context(errors::EncryptionError)
- .attach_printable("Could not convert to UTF-8")?;
- Ok(resp)
+ .attach_printable("Could not decode JWE payload from UTF-8")
}
pub async fn jws_sign_payload(
@@ -240,7 +237,6 @@ mod tests {
async fn test_jwe() {
let conf = settings::Settings::new().unwrap();
let jwt = encrypt_jwe(
- &conf.jwekey,
"request_payload".as_bytes(),
conf.jwekey.locker_encryption_key1.to_owned(),
)
@@ -248,7 +244,6 @@ mod tests {
.unwrap();
let alg = jwe::RSA_OAEP_256;
let payload = decrypt_jwe(
- &conf.jwekey,
&jwt,
&conf.jwekey.locker_key_identifier1,
&conf.jwekey.locker_key_identifier1,
diff --git a/crates/router/src/services/kms.rs b/crates/router/src/services/kms.rs
index e5887a98409..30965aa7ed0 100644
--- a/crates/router/src/services/kms.rs
+++ b/crates/router/src/services/kms.rs
@@ -1,73 +1,76 @@
-use crate::core::errors::{self, CustomResult};
+use aws_config::meta::region::RegionProviderChain;
+use aws_sdk_kms::{types::Blob, Client, Region};
+use base64::Engine;
+use error_stack::{IntoReport, ResultExt};
-pub struct KeyHandler;
+use crate::{
+ configs::settings,
+ consts,
+ core::errors::{self, CustomResult},
+ logger,
+ routes::metrics,
+};
-#[cfg(feature = "kms")]
-mod aws_kms {
- use aws_config::meta::region::RegionProviderChain;
- use aws_sdk_kms::{types::Blob, Client, Region};
- use base64::Engine;
- use error_stack::{report, IntoReport, ResultExt};
+static KMS_CLIENT: tokio::sync::OnceCell<KmsClient> = tokio::sync::OnceCell::const_new();
- use super::*;
- use crate::{consts, logger};
+#[inline]
+pub async fn get_kms_client(config: &settings::Kms) -> &KmsClient {
+ KMS_CLIENT.get_or_init(|| KmsClient::new(config)).await
+}
+
+pub struct KmsClient {
+ inner_client: Client,
+ key_id: String,
+}
+
+impl KmsClient {
+ /// Constructs a new KMS client.
+ pub async fn new(config: &settings::Kms) -> Self {
+ let region_provider = RegionProviderChain::first_try(Region::new(config.region.clone()));
+ let sdk_config = aws_config::from_env().region(region_provider).load().await;
- impl KeyHandler {
- // Fetching KMS decrypted key
- // | Amazon KMS decryption
- // This expect a base64 encoded input but we values are set via aws cli in env than cli
- // already does that so we don't need to
- pub async fn get_kms_decrypted_key(
- aws_region: &str,
- aws_key_id: &str,
- kms_enc_key: String,
- ) -> CustomResult<String, errors::EncryptionError> {
- let region_provider =
- RegionProviderChain::first_try(Region::new(aws_region.to_owned()));
- let shared_config = aws_config::from_env().region(region_provider).load().await;
- let client = Client::new(&shared_config);
- let data = consts::BASE64_ENGINE
- .decode(kms_enc_key)
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Error decoding from base64")?;
- let blob = Blob::new(data);
- let resp = client
- .decrypt()
- .key_id(aws_key_id)
- .ciphertext_blob(blob)
- .send()
- .await
- .map_err(|error| {
- logger::error!(kms_sdk_error=?error, "Failed to KMS decrypt data");
- error
- })
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Error decrypting kms encrypted data")?;
- match resp.plaintext() {
- Some(inner) => {
- let bytes = inner.as_ref().to_vec();
- let res = String::from_utf8(bytes)
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Could not convert to UTF-8")?;
- Ok(res)
- }
- None => Err(report!(errors::EncryptionError)
- .attach_printable("Missing plaintext in response")),
- }
+ Self {
+ inner_client: Client::new(&sdk_config),
+ key_id: config.key_id.clone(),
}
}
-}
-#[cfg(not(feature = "kms"))]
-impl KeyHandler {
- pub async fn get_kms_decrypted_key(
- _aws_region: &str,
- _aws_key_id: &str,
- key: String,
- ) -> CustomResult<String, errors::EncryptionError> {
- Ok(key)
+ /// Decrypts the provided base64-encoded encrypted data using the AWS KMS SDK. We assume that
+ /// the SDK has the values required to interact with the AWS KMS APIs (`AWS_ACCESS_KEY_ID` and
+ /// `AWS_SECRET_ACCESS_KEY`) either set in environment variables, or that the SDK is running in
+ /// a machine that is able to assume an IAM role.
+ pub async fn decrypt(&self, data: impl AsRef<[u8]>) -> CustomResult<String, errors::KmsError> {
+ let data = consts::BASE64_ENGINE
+ .decode(data)
+ .into_report()
+ .change_context(errors::KmsError::Base64DecodingFailed)?;
+ let ciphertext_blob = Blob::new(data);
+
+ let decrypt_output = self
+ .inner_client
+ .decrypt()
+ .key_id(&self.key_id)
+ .ciphertext_blob(ciphertext_blob)
+ .send()
+ .await
+ .map_err(|error| {
+ // Logging using `Debug` representation of the error as the `Display`
+ // representation does not hold sufficient information.
+ logger::error!(kms_sdk_error=?error, "Failed to KMS decrypt data");
+ metrics::AWS_KMS_FAILURES.add(&metrics::CONTEXT, 1, &[]);
+ error
+ })
+ .into_report()
+ .change_context(errors::KmsError::DecryptionFailed)?;
+
+ decrypt_output
+ .plaintext
+ .ok_or(errors::KmsError::MissingPlaintextDecryptionOutput)
+ .into_report()
+ .and_then(|blob| {
+ String::from_utf8(blob.into_inner())
+ .into_report()
+ .change_context(errors::KmsError::Utf8DecodingFailed)
+ })
}
}
|
refactor
|
share a KMS client for all KMS operations (#744)
|
1b2841be5997083cd2e414fc698d3d39f9c24c04
|
2023-06-19 12:27:20
|
Shankar Singh C
|
fix(connector): [Airwallex] Fix refunds (#1468)
| false
|
diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs
index 371fd19c60c..13a4db9b243 100644
--- a/crates/router/src/connector/airwallex/transformers.rs
+++ b/crates/router/src/connector/airwallex/transformers.rs
@@ -427,6 +427,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for AirwallexRefundRequest {
// Type definition for Refund Response
#[allow(dead_code)]
#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum RefundStatus {
Succeeded,
Failed,
@@ -448,7 +449,7 @@ impl From<RefundStatus> for enums::RefundStatus {
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
//A unique number that tags a credit or debit card transaction when it goes from the merchant's bank through to the cardholder's bank.
- acquirer_reference_number: String,
+ acquirer_reference_number: Option<String>,
amount: f32,
//Unique identifier for the Refund
id: String,
|
fix
|
[Airwallex] Fix refunds (#1468)
|
c3c9b2740b8e47ad75c74c886c30472a747e7119
|
2024-08-27 12:23:30
|
dg-212
|
feat(connector): [NOVALNET] Add template code (#5670)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 4397d4d3ef6..a8cc36b4dc5 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -224,6 +224,7 @@ netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netce
nexinets.base_url = "https://apitest.payengine.de/v1"
nmi.base_url = "https://secure.nmi.com/"
noon.base_url = "https://api-test.noonpayments.com/"
+novalnet.base_url = "https://payport.novalnet.de/v2"
noon.key_mode = "Test"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index e0b4ee65976..2ceac401b92 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -47,6 +47,7 @@ dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox/ipp/payments-gateway/v2"
+novalnet.base_url = "https://payport.novalnet.de/v2"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 67d1ced4e56..aa214d04007 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -51,6 +51,7 @@ dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/ipp/payments-gateway/v2"
+novalnet.base_url = "https://payport.novalnet.de/v2"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 14505f5815e..b6a235a0018 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -51,6 +51,7 @@ dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox/ipp/payments-gateway/v2"
+novalnet.base_url = "https://payport.novalnet.de/v2"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
diff --git a/config/development.toml b/config/development.toml
index 18cf9ca85a0..902c3ed3ad6 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -133,6 +133,7 @@ cards = [
"nexinets",
"nmi",
"noon",
+ "novalnet",
"nuvei",
"opayo",
"opennode",
@@ -228,6 +229,7 @@ netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netce
nexinets.base_url = "https://apitest.payengine.de/v1"
nmi.base_url = "https://secure.nmi.com/"
noon.base_url = "https://api-test.noonpayments.com/"
+novalnet.base_url = "https://payport.novalnet.de/v2"
noon.key_mode = "Test"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index cf92e9c02a8..e8d564ac66b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -153,6 +153,7 @@ netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netce
nexinets.base_url = "https://apitest.payengine.de/v1"
nmi.base_url = "https://secure.nmi.com/"
noon.base_url = "https://api-test.noonpayments.com/"
+novalnet.base_url = "https://payport.novalnet.de/v2"
noon.key_mode = "Test"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
@@ -237,6 +238,7 @@ cards = [
"nexinets",
"nmi",
"noon",
+ "novalnet",
"nuvei",
"opayo",
"opennode",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index a7738133ca0..86d6421c3e2 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -46,6 +46,7 @@ pub enum RoutingAlgorithm {
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum Connector {
+ // Novalnet,
// Fiservemea,
Adyenplatform,
#[cfg(feature = "dummy_connector")]
@@ -209,6 +210,7 @@ impl Connector {
| Self::DummyConnector7 => false,
Self::Aci
// Add Separate authentication support for connectors
+ // | Self::Novalnet
// | Self::Taxjar
// | Self::Fiservemea
| Self::Adyen
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 8df5885e7b6..617d121c63c 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -225,6 +225,7 @@ pub enum RoutableConnectors {
Nexinets,
Nmi,
Noon,
+ // Novalnet,
Nuvei,
// Opayo, added as template code for future usage
Opennode,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index ae0fa945799..dfaffd02662 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -3,10 +3,11 @@ pub mod bitpay;
pub mod fiserv;
pub mod fiservemea;
pub mod helcim;
+pub mod novalnet;
pub mod stax;
pub mod taxjar;
pub use self::{
bambora::Bambora, bitpay::Bitpay, fiserv::Fiserv, fiservemea::Fiservemea, helcim::Helcim,
- stax::Stax, taxjar::Taxjar,
+ novalnet::Novalnet, stax::Stax, taxjar::Taxjar,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
new file mode 100644
index 00000000000..83a8015e73c
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -0,0 +1,566 @@
+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 novalnet;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Novalnet {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Novalnet {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Novalnet {}
+impl api::PaymentSession for Novalnet {}
+impl api::ConnectorAccessToken for Novalnet {}
+impl api::MandateSetup for Novalnet {}
+impl api::PaymentAuthorize for Novalnet {}
+impl api::PaymentSync for Novalnet {}
+impl api::PaymentCapture for Novalnet {}
+impl api::PaymentVoid for Novalnet {}
+impl api::Refund for Novalnet {}
+impl api::RefundExecute for Novalnet {}
+impl api::RefundSync for Novalnet {}
+impl api::PaymentToken for Novalnet {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Novalnet
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Novalnet
+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 Novalnet {
+ fn id(&self) -> &'static str {
+ "novalnet"
+ }
+
+ 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.novalnet.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = novalnet::NovalnetAuthType::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: novalnet::NovalnetErrorResponse = res
+ .response
+ .parse_struct("NovalnetErrorResponse")
+ .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 Novalnet {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Novalnet {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Novalnet {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
+ for Novalnet
+{
+}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Novalnet {
+ 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 = novalnet::NovalnetRouterData::from((amount, req));
+ let connector_req = novalnet::NovalnetPaymentsRequest::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: novalnet::NovalnetPaymentsResponse = res
+ .response
+ .parse_struct("Novalnet 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 Novalnet {
+ 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: novalnet::NovalnetPaymentsResponse = res
+ .response
+ .parse_struct("novalnet 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 Novalnet {
+ 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: novalnet::NovalnetPaymentsResponse = res
+ .response
+ .parse_struct("Novalnet 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 Novalnet {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Novalnet {
+ 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 = novalnet::NovalnetRouterData::from((refund_amount, req));
+ let connector_req = novalnet::NovalnetRefundRequest::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: novalnet::RefundResponse = res
+ .response
+ .parse_struct("novalnet 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 Novalnet {
+ 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: novalnet::RefundResponse = res
+ .response
+ .parse_struct("novalnet 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 Novalnet {
+ 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/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
new file mode 100644
index 00000000000..de63e9b48c0
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/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 NovalnetRouterData<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 NovalnetRouterData<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 NovalnetPaymentsRequest {
+ amount: StringMinorUnit,
+ card: NovalnetCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct NovalnetCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &NovalnetRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = NovalnetCard {
+ 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 NovalnetAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for NovalnetAuthType {
+ 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 NovalnetPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<NovalnetPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: NovalnetPaymentStatus) -> Self {
+ match item {
+ NovalnetPaymentStatus::Succeeded => Self::Charged,
+ NovalnetPaymentStatus::Failed => Self::Failure,
+ NovalnetPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct NovalnetPaymentsResponse {
+ status: NovalnetPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, NovalnetPaymentsResponse, 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: None,
+ mandate_reference: 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 NovalnetRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&NovalnetRouterData<&RefundsRouterData<F>>> for NovalnetRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &NovalnetRouterData<&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 NovalnetErrorResponse {
+ 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 9165a1cba53..8da17ae28b0 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -91,6 +91,7 @@ default_imp_for_authorize_session_token!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -116,6 +117,7 @@ default_imp_for_complete_authorize!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -141,6 +143,7 @@ default_imp_for_incremental_authorization!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -166,6 +169,7 @@ default_imp_for_create_customer!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Taxjar
);
@@ -191,6 +195,7 @@ default_imp_for_connector_redirect_response!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -216,6 +221,7 @@ default_imp_for_pre_processing_steps!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -241,6 +247,7 @@ default_imp_for_post_processing_steps!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -266,6 +273,7 @@ default_imp_for_approve!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -291,6 +299,7 @@ default_imp_for_reject!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -316,6 +325,7 @@ default_imp_for_webhook_source_verification!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -342,6 +352,7 @@ default_imp_for_accept_dispute!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -367,6 +378,7 @@ default_imp_for_submit_evidence!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -392,6 +404,7 @@ default_imp_for_defend_dispute!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -426,6 +439,7 @@ default_imp_for_file_upload!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -453,6 +467,7 @@ default_imp_for_payouts_create!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -480,6 +495,7 @@ default_imp_for_payouts_retrieve!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -507,6 +523,7 @@ default_imp_for_payouts_eligibility!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -534,6 +551,7 @@ default_imp_for_payouts_fulfill!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -561,6 +579,7 @@ default_imp_for_payouts_cancel!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -588,6 +607,7 @@ default_imp_for_payouts_quote!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -615,6 +635,7 @@ default_imp_for_payouts_recipient!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -642,6 +663,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -669,6 +691,7 @@ default_imp_for_frm_sale!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -696,6 +719,7 @@ default_imp_for_frm_checkout!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -723,6 +747,7 @@ default_imp_for_frm_transaction!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -750,6 +775,7 @@ default_imp_for_frm_fulfillment!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -777,6 +803,7 @@ default_imp_for_frm_record_return!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -801,6 +828,7 @@ default_imp_for_revoking_mandates!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index c9a1cfde745..4ebd335ce8f 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -186,6 +186,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -212,6 +213,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -233,6 +235,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -260,6 +263,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -286,6 +290,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -312,6 +317,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -348,6 +354,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -376,6 +383,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -404,6 +412,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -432,6 +441,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -460,6 +470,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -488,6 +499,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -516,6 +528,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -544,6 +557,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -572,6 +586,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -598,6 +613,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -626,6 +642,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -654,6 +671,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -682,6 +700,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -710,6 +729,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -738,6 +758,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
@@ -763,6 +784,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Helcim,
+ connectors::Novalnet,
connectors::Stax,
connectors::Taxjar
);
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 19448d6542a..bc59bd037d7 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -51,6 +51,7 @@ pub struct Connectors {
pub nexinets: ConnectorParams,
pub nmi: ConnectorParams,
pub noon: ConnectorParamsWithModeType,
+ pub novalnet: ConnectorParams,
pub nuvei: ConnectorParams,
pub opayo: ConnectorParams,
pub opennode: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index eb83e2c4ba6..5da8f3a8578 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -69,7 +69,8 @@ pub mod zsl;
pub use hyperswitch_connectors::connectors::{
bambora, bambora::Bambora, bitpay, bitpay::Bitpay, fiserv, fiserv::Fiserv, fiservemea,
- fiservemea::Fiservemea, helcim, helcim::Helcim, stax, stax::Stax, taxjar, taxjar::Taxjar,
+ fiservemea::Fiservemea, helcim, helcim::Helcim, novalnet, novalnet::Novalnet, stax, stax::Stax,
+ taxjar, taxjar::Taxjar,
};
#[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 3ccd5f2577a..bed63c10a8a 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1251,6 +1251,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
@@ -2096,6 +2097,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
@@ -2720,6 +2722,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 9e724da9feb..aea8748ac67 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -556,6 +556,7 @@ default_imp_for_connector_request_id!(
connector::Netcetera,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
@@ -1210,6 +1211,7 @@ default_imp_for_payouts!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
@@ -2229,6 +2231,7 @@ default_imp_for_fraud_check!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
@@ -3043,6 +3046,7 @@ default_imp_for_connector_authentication!(
connector::Nexinets,
connector::Nmi,
connector::Noon,
+ connector::Novalnet,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 513e4fa1ee2..0637b98163d 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -416,6 +416,7 @@ impl ConnectorData {
enums::Connector::Mollie => Ok(ConnectorEnum::Old(Box::new(&connector::Mollie))),
enums::Connector::Nmi => Ok(ConnectorEnum::Old(Box::new(connector::Nmi::new()))),
enums::Connector::Noon => Ok(ConnectorEnum::Old(Box::new(connector::Noon::new()))),
+ // enums::Connector::Novalnet => Ok(ConnectorEnum::Old(Box::new(connector::Novalnet))),
enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))),
enums::Connector::Opennode => {
Ok(ConnectorEnum::Old(Box::new(&connector::Opennode)))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 2cc95281f03..11254c5f29a 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -303,6 +303,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Nexinets => Self::Nexinets,
api_enums::Connector::Nmi => Self::Nmi,
api_enums::Connector::Noon => Self::Noon,
+ // api_enums::Connector::Novalnet => Self::Novalnet,
api_enums::Connector::Nuvei => Self::Nuvei,
api_enums::Connector::Opennode => Self::Opennode,
api_enums::Connector::Paybox => Self::Paybox,
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index e0fa3964b27..2a400b947dc 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -47,6 +47,7 @@ mod netcetera;
mod nexinets;
mod nmi;
mod noon;
+mod novalnet;
mod nuvei;
#[cfg(feature = "dummy_connector")]
mod opayo;
diff --git a/crates/router/tests/connectors/novalnet.rs b/crates/router/tests/connectors/novalnet.rs
new file mode 100644
index 00000000000..2337cae383c
--- /dev/null
+++ b/crates/router/tests/connectors/novalnet.rs
@@ -0,0 +1,420 @@
+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 NovalnetTest;
+impl ConnectorActions for NovalnetTest {}
+impl utils::Connector for NovalnetTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Novalnet;
+ utils::construct_connector_data_old(
+ Box::new(Novalnet::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .novalnet
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "novalnet".to_string()
+ }
+}
+
+static CONNECTOR: NovalnetTest = NovalnetTest {};
+
+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 0bf4d96d19f..6134d1ae036 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -267,4 +267,7 @@ key1 = "Gateway Entity Id"
api_secret = "Consumer Secret"
[taxjar]
-api_key = "API Key"
\ No newline at end of file
+api_key = "API Key"
+
+[novalnet]
+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 b13be3075aa..0848b9a9f57 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -51,6 +51,7 @@ pub struct ConnectorAuthentication {
pub netcetera: Option<HeaderKey>,
pub nexinets: Option<BodyKey>,
pub noon: Option<SignatureKey>,
+ pub novalnet: Option<HeaderKey>,
pub nmi: Option<HeaderKey>,
pub nuvei: Option<SignatureKey>,
pub opayo: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 43eaf4e905a..347d587014d 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -118,6 +118,7 @@ netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netce
nexinets.base_url = "https://apitest.payengine.de/v1"
nmi.base_url = "https://secure.nmi.com/"
noon.base_url = "https://api-test.noonpayments.com/"
+novalnet.base_url = "https://payport.novalnet.de/v2"
noon.key_mode = "Test"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
@@ -202,6 +203,7 @@ cards = [
"nexinets",
"nmi",
"noon",
+ "novalnet",
"nuvei",
"opayo",
"opennode",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 3e5fc1c3d9d..362d0577c69 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 dlocal dummyconnector ebanx fiserv fiservemea forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio 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 dlocal dummyconnector ebanx fiserv fiservemea forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio 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
|
[NOVALNET] Add template code (#5670)
|
c124511052ed8911a2ccfcf648c0793b5c1ca690
|
2023-11-13 15:58:29
|
harsh-sharma-juspay
|
feat(apievent): added hs latency to api event (#2734)
| false
|
diff --git a/crates/router/src/events/api_logs.rs b/crates/router/src/events/api_logs.rs
index 873102e81ec..27a90028ba6 100644
--- a/crates/router/src/events/api_logs.rs
+++ b/crates/router/src/events/api_logs.rs
@@ -38,6 +38,7 @@ pub struct ApiEvent {
response: Option<serde_json::Value>,
#[serde(flatten)]
event_type: ApiEventsType,
+ hs_latency: Option<u128>,
}
impl ApiEvent {
@@ -49,6 +50,7 @@ impl ApiEvent {
status_code: i64,
request: serde_json::Value,
response: Option<serde_json::Value>,
+ hs_latency: Option<u128>,
auth_type: AuthenticationType,
event_type: ApiEventsType,
http_req: &HttpRequest,
@@ -72,6 +74,7 @@ impl ApiEvent {
.and_then(|user_agent_value| user_agent_value.to_str().ok().map(ToOwned::to_owned)),
url_path: http_req.path().to_string(),
event_type,
+ hs_latency,
}
}
}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index bb0e70b4b27..321bf909ea0 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -830,6 +830,7 @@ where
.as_millis();
let mut serialized_response = None;
+ let mut overhead_latency = None;
let status_code = match output.as_ref() {
Ok(res) => {
if let ApplicationResponse::Json(data) = res {
@@ -839,6 +840,19 @@ where
.attach_printable("Failed to serialize json response")
.change_context(errors::ApiErrorResponse::InternalServerError.switch())?,
);
+ } else if let ApplicationResponse::JsonWithHeaders((data, headers)) = res {
+ serialized_response.replace(
+ masking::masked_serialize(&data)
+ .into_report()
+ .attach_printable("Failed to serialize json response")
+ .change_context(errors::ApiErrorResponse::InternalServerError.switch())?,
+ );
+
+ if let Some((_, value)) = headers.iter().find(|(key, _)| key == X_HS_LATENCY) {
+ if let Ok(external_latency) = value.parse::<u128>() {
+ overhead_latency.replace(external_latency);
+ }
+ }
}
event_type = res.get_api_event_type().or(event_type);
@@ -854,6 +868,7 @@ where
status_code,
serialized_request,
serialized_response,
+ overhead_latency,
auth_type,
event_type.unwrap_or(ApiEventsType::Miscellaneous),
request,
|
feat
|
added hs latency to api event (#2734)
|
9fc525d49849e160345902beecac01d3a2f4c70f
|
2024-07-01 17:45:46
|
Sandeep Kumar
|
feat(analytics): Add v2 payment analytics (payment-intents analytics) (#5150)
| false
|
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index ab47397b8af..b455e79b253 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -10,6 +10,7 @@ use super::{
active_payments::metrics::ActivePaymentsMetricRow,
auth_events::metrics::AuthEventMetricRow,
health_check::HealthCheck,
+ payment_intents::{filters::PaymentIntentFilterRow, metrics::PaymentIntentMetricRow},
payments::{
distribution::PaymentDistributionRow, filters::FilterRow, metrics::PaymentMetricRow,
},
@@ -157,6 +158,8 @@ where
impl super::payments::filters::PaymentFilterAnalytics for ClickhouseClient {}
impl super::payments::metrics::PaymentMetricAnalytics for ClickhouseClient {}
impl super::payments::distribution::PaymentDistributionAnalytics for ClickhouseClient {}
+impl super::payment_intents::filters::PaymentIntentFilterAnalytics for ClickhouseClient {}
+impl super::payment_intents::metrics::PaymentIntentMetricAnalytics for ClickhouseClient {}
impl super::refunds::metrics::RefundMetricAnalytics for ClickhouseClient {}
impl super::refunds::filters::RefundFilterAnalytics for ClickhouseClient {}
impl super::sdk_events::filters::SdkEventFilterAnalytics for ClickhouseClient {}
@@ -247,6 +250,26 @@ impl TryInto<FilterRow> for serde_json::Value {
}
}
+impl TryInto<PaymentIntentMetricRow> for serde_json::Value {
+ type Error = Report<ParsingError>;
+
+ fn try_into(self) -> Result<PaymentIntentMetricRow, Self::Error> {
+ serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
+ "Failed to parse PaymentIntentMetricRow in clickhouse results",
+ ))
+ }
+}
+
+impl TryInto<PaymentIntentFilterRow> for serde_json::Value {
+ type Error = Report<ParsingError>;
+
+ fn try_into(self) -> Result<PaymentIntentFilterRow, Self::Error> {
+ serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
+ "Failed to parse PaymentIntentFilterRow in clickhouse results",
+ ))
+ }
+}
+
impl TryInto<RefundMetricRow> for serde_json::Value {
type Error = Report<ParsingError>;
diff --git a/crates/analytics/src/core.rs b/crates/analytics/src/core.rs
index f3278349748..2c5945f75b5 100644
--- a/crates/analytics/src/core.rs
+++ b/crates/analytics/src/core.rs
@@ -11,6 +11,11 @@ pub async fn get_domain_info(
download_dimensions: None,
dimensions: utils::get_payment_dimensions(),
},
+ AnalyticsDomain::PaymentIntents => GetInfoResponse {
+ metrics: utils::get_payment_intent_metrics_info(),
+ download_dimensions: None,
+ dimensions: utils::get_payment_intent_dimensions(),
+ },
AnalyticsDomain::Refunds => GetInfoResponse {
metrics: utils::get_refund_metrics_info(),
download_dimensions: None,
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index d3db03a6977..10e628475e8 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -3,6 +3,7 @@ pub mod core;
pub mod disputes;
pub mod errors;
pub mod metrics;
+pub mod payment_intents;
pub mod payments;
mod query;
pub mod refunds;
@@ -39,6 +40,10 @@ use api_models::analytics::{
},
auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
disputes::{DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier},
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetrics,
+ PaymentIntentMetricsBucketIdentifier,
+ },
payments::{PaymentDimensions, PaymentFilters, PaymentMetrics, PaymentMetricsBucketIdentifier},
refunds::{RefundDimensions, RefundFilters, RefundMetrics, RefundMetricsBucketIdentifier},
sdk_events::{
@@ -60,6 +65,7 @@ use strum::Display;
use self::{
active_payments::metrics::{ActivePaymentsMetric, ActivePaymentsMetricRow},
auth_events::metrics::{AuthEventMetric, AuthEventMetricRow},
+ payment_intents::metrics::{PaymentIntentMetric, PaymentIntentMetricRow},
payments::{
distribution::{PaymentDistribution, PaymentDistributionRow},
metrics::{PaymentMetric, PaymentMetricRow},
@@ -313,6 +319,111 @@ impl AnalyticsProvider {
.await
}
+ pub async fn get_payment_intent_metrics(
+ &self,
+ metric: &PaymentIntentMetrics,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ ) -> types::MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>
+ {
+ // Metrics to get the fetch time for each payment intent metric
+ metrics::request::record_operation_time(
+ async {
+ match self {
+ Self::Sqlx(pool) => {
+ metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::Clickhouse(pool) => {
+ metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::CombinedCkh(sqlx_pool, ckh_pool) => {
+ let (ckh_result, sqlx_result) = tokio::join!(metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ ckh_pool,
+ ),
+ metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ sqlx_pool,
+ ));
+ match (&sqlx_result, &ckh_result) {
+ (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => {
+ router_env::logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres payment intents analytics metrics")
+ },
+ _ => {}
+
+ };
+
+ ckh_result
+ }
+ Self::CombinedSqlx(sqlx_pool, ckh_pool) => {
+ let (ckh_result, sqlx_result) = tokio::join!(metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ ckh_pool,
+ ),
+ metric
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ sqlx_pool,
+ ));
+ match (&sqlx_result, &ckh_result) {
+ (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => {
+ router_env::logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres payment intents analytics metrics")
+ },
+ _ => {}
+
+ };
+
+ sqlx_result
+ }
+ }
+ },
+ &metrics::METRIC_FETCH_TIME,
+ metric,
+ self,
+ )
+ .await
+ }
+
pub async fn get_refund_metrics(
&self,
metric: &RefundMetrics,
@@ -756,11 +867,13 @@ pub struct ReportConfig {
pub enum AnalyticsFlow {
GetInfo,
GetPaymentMetrics,
+ GetPaymentIntentMetrics,
GetRefundsMetrics,
GetSdkMetrics,
GetAuthMetrics,
GetActivePaymentsMetrics,
GetPaymentFilters,
+ GetPaymentIntentFilters,
GetRefundFilters,
GetSdkEventFilters,
GetApiEvents,
diff --git a/crates/analytics/src/payment_intents.rs b/crates/analytics/src/payment_intents.rs
new file mode 100644
index 00000000000..449dd94788c
--- /dev/null
+++ b/crates/analytics/src/payment_intents.rs
@@ -0,0 +1,13 @@
+pub mod accumulator;
+mod core;
+pub mod filters;
+pub mod metrics;
+pub mod types;
+pub use accumulator::{PaymentIntentMetricAccumulator, PaymentIntentMetricsAccumulator};
+
+pub trait PaymentIntentAnalytics:
+ metrics::PaymentIntentMetricAnalytics + filters::PaymentIntentFilterAnalytics
+{
+}
+
+pub use self::core::{get_filters, get_metrics};
diff --git a/crates/analytics/src/payment_intents/accumulator.rs b/crates/analytics/src/payment_intents/accumulator.rs
new file mode 100644
index 00000000000..8fd98a1e73c
--- /dev/null
+++ b/crates/analytics/src/payment_intents/accumulator.rs
@@ -0,0 +1,90 @@
+use api_models::analytics::payment_intents::PaymentIntentMetricsBucketValue;
+use bigdecimal::ToPrimitive;
+
+use super::metrics::PaymentIntentMetricRow;
+
+#[derive(Debug, Default)]
+pub struct PaymentIntentMetricsAccumulator {
+ pub successful_smart_retries: CountAccumulator,
+ pub total_smart_retries: CountAccumulator,
+ pub smart_retried_amount: SumAccumulator,
+ pub payment_intent_count: CountAccumulator,
+}
+
+#[derive(Debug, Default)]
+pub struct ErrorDistributionRow {
+ pub count: i64,
+ pub total: i64,
+ pub error_message: String,
+}
+
+#[derive(Debug, Default)]
+pub struct ErrorDistributionAccumulator {
+ pub error_vec: Vec<ErrorDistributionRow>,
+}
+
+#[derive(Debug, Default)]
+#[repr(transparent)]
+pub struct CountAccumulator {
+ pub count: Option<i64>,
+}
+
+pub trait PaymentIntentMetricAccumulator {
+ type MetricOutput;
+
+ fn add_metrics_bucket(&mut self, metrics: &PaymentIntentMetricRow);
+
+ fn collect(self) -> Self::MetricOutput;
+}
+
+#[derive(Debug, Default)]
+#[repr(transparent)]
+pub struct SumAccumulator {
+ pub total: Option<i64>,
+}
+
+impl PaymentIntentMetricAccumulator for CountAccumulator {
+ type MetricOutput = Option<u64>;
+ #[inline]
+ fn add_metrics_bucket(&mut self, metrics: &PaymentIntentMetricRow) {
+ self.count = match (self.count, metrics.count) {
+ (None, None) => None,
+ (None, i @ Some(_)) | (i @ Some(_), None) => i,
+ (Some(a), Some(b)) => Some(a + b),
+ }
+ }
+ #[inline]
+ fn collect(self) -> Self::MetricOutput {
+ self.count.and_then(|i| u64::try_from(i).ok())
+ }
+}
+
+impl PaymentIntentMetricAccumulator for SumAccumulator {
+ type MetricOutput = Option<u64>;
+ #[inline]
+ fn add_metrics_bucket(&mut self, metrics: &PaymentIntentMetricRow) {
+ self.total = match (
+ self.total,
+ metrics.total.as_ref().and_then(ToPrimitive::to_i64),
+ ) {
+ (None, None) => None,
+ (None, i @ Some(_)) | (i @ Some(_), None) => i,
+ (Some(a), Some(b)) => Some(a + b),
+ }
+ }
+ #[inline]
+ fn collect(self) -> Self::MetricOutput {
+ self.total.and_then(|i| u64::try_from(i).ok())
+ }
+}
+
+impl PaymentIntentMetricsAccumulator {
+ pub fn collect(self) -> PaymentIntentMetricsBucketValue {
+ PaymentIntentMetricsBucketValue {
+ successful_smart_retries: self.successful_smart_retries.collect(),
+ total_smart_retries: self.total_smart_retries.collect(),
+ smart_retried_amount: self.smart_retried_amount.collect(),
+ payment_intent_count: self.payment_intent_count.collect(),
+ }
+ }
+}
diff --git a/crates/analytics/src/payment_intents/core.rs b/crates/analytics/src/payment_intents/core.rs
new file mode 100644
index 00000000000..e3932baaf07
--- /dev/null
+++ b/crates/analytics/src/payment_intents/core.rs
@@ -0,0 +1,226 @@
+#![allow(dead_code)]
+use std::collections::HashMap;
+
+use api_models::analytics::{
+ payment_intents::{
+ MetricsBucketResponse, PaymentIntentDimensions, PaymentIntentMetrics,
+ PaymentIntentMetricsBucketIdentifier,
+ },
+ AnalyticsMetadata, GetPaymentIntentFiltersRequest, GetPaymentIntentMetricRequest,
+ MetricsResponse, PaymentIntentFilterValue, PaymentIntentFiltersResponse,
+};
+use common_utils::errors::CustomResult;
+use error_stack::ResultExt;
+use router_env::{
+ instrument, logger,
+ metrics::add_attributes,
+ tracing::{self, Instrument},
+};
+
+use super::{
+ filters::{get_payment_intent_filter_for_dimension, PaymentIntentFilterRow},
+ metrics::PaymentIntentMetricRow,
+ PaymentIntentMetricsAccumulator,
+};
+use crate::{
+ errors::{AnalyticsError, AnalyticsResult},
+ metrics,
+ payment_intents::PaymentIntentMetricAccumulator,
+ AnalyticsProvider,
+};
+
+#[derive(Debug)]
+pub enum TaskType {
+ MetricTask(
+ PaymentIntentMetrics,
+ CustomResult<
+ Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>,
+ AnalyticsError,
+ >,
+ ),
+}
+
+#[instrument(skip_all)]
+pub async fn get_metrics(
+ pool: &AnalyticsProvider,
+ merchant_id: &str,
+ req: GetPaymentIntentMetricRequest,
+) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
+ let mut metrics_accumulator: HashMap<
+ PaymentIntentMetricsBucketIdentifier,
+ PaymentIntentMetricsAccumulator,
+ > = HashMap::new();
+
+ let mut set = tokio::task::JoinSet::new();
+ for metric_type in req.metrics.iter().cloned() {
+ let req = req.clone();
+ let pool = pool.clone();
+ let task_span = tracing::debug_span!(
+ "analytics_payment_intents_metrics_query",
+ payment_metric = metric_type.as_ref()
+ );
+
+ // TODO: lifetime issues with joinset,
+ // can be optimized away if joinset lifetime requirements are relaxed
+ let merchant_id_scoped = merchant_id.to_owned();
+ set.spawn(
+ async move {
+ let data = pool
+ .get_payment_intent_metrics(
+ &metric_type,
+ &req.group_by_names.clone(),
+ &merchant_id_scoped,
+ &req.filters,
+ &req.time_series.map(|t| t.granularity),
+ &req.time_range,
+ )
+ .await
+ .change_context(AnalyticsError::UnknownError);
+ TaskType::MetricTask(metric_type, data)
+ }
+ .instrument(task_span),
+ );
+ }
+
+ while let Some(task_type) = set
+ .join_next()
+ .await
+ .transpose()
+ .change_context(AnalyticsError::UnknownError)?
+ {
+ match task_type {
+ TaskType::MetricTask(metric, data) => {
+ let data = data?;
+ let attributes = &add_attributes([
+ ("metric_type", metric.to_string()),
+ ("source", pool.to_string()),
+ ]);
+
+ let value = u64::try_from(data.len());
+ if let Ok(val) = value {
+ metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
+ logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
+ }
+
+ for (id, value) in data {
+ logger::debug!(bucket_id=?id, bucket_value=?value, "Bucket row for metric {metric}");
+ let metrics_builder = metrics_accumulator.entry(id).or_default();
+ match metric {
+ PaymentIntentMetrics::SuccessfulSmartRetries => metrics_builder
+ .successful_smart_retries
+ .add_metrics_bucket(&value),
+ PaymentIntentMetrics::TotalSmartRetries => metrics_builder
+ .total_smart_retries
+ .add_metrics_bucket(&value),
+ PaymentIntentMetrics::SmartRetriedAmount => metrics_builder
+ .smart_retried_amount
+ .add_metrics_bucket(&value),
+ PaymentIntentMetrics::PaymentIntentCount => metrics_builder
+ .payment_intent_count
+ .add_metrics_bucket(&value),
+ }
+ }
+
+ logger::debug!(
+ "Analytics Accumulated Results: metric: {}, results: {:#?}",
+ metric,
+ metrics_accumulator
+ );
+ }
+ }
+ }
+
+ let query_data: Vec<MetricsBucketResponse> = metrics_accumulator
+ .into_iter()
+ .map(|(id, val)| MetricsBucketResponse {
+ values: val.collect(),
+ dimensions: id,
+ })
+ .collect();
+
+ Ok(MetricsResponse {
+ query_data,
+ meta_data: [AnalyticsMetadata {
+ current_time_range: req.time_range,
+ }],
+ })
+}
+
+pub async fn get_filters(
+ pool: &AnalyticsProvider,
+ req: GetPaymentIntentFiltersRequest,
+ merchant_id: &String,
+) -> AnalyticsResult<PaymentIntentFiltersResponse> {
+ let mut res = PaymentIntentFiltersResponse::default();
+
+ for dim in req.group_by_names {
+ let values = match pool {
+ AnalyticsProvider::Sqlx(pool) => {
+ get_payment_intent_filter_for_dimension(dim, merchant_id, &req.time_range, pool)
+ .await
+ }
+ AnalyticsProvider::Clickhouse(pool) => {
+ get_payment_intent_filter_for_dimension(dim, merchant_id, &req.time_range, pool)
+ .await
+ }
+ AnalyticsProvider::CombinedCkh(sqlx_poll, ckh_pool) => {
+ let ckh_result = get_payment_intent_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ ckh_pool,
+ )
+ .await;
+ let sqlx_result = get_payment_intent_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ sqlx_poll,
+ )
+ .await;
+ match (&sqlx_result, &ckh_result) {
+ (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => {
+ router_env::logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres payment intents analytics filters")
+ },
+ _ => {}
+ };
+ ckh_result
+ }
+ AnalyticsProvider::CombinedSqlx(sqlx_poll, ckh_pool) => {
+ let ckh_result = get_payment_intent_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ ckh_pool,
+ )
+ .await;
+ let sqlx_result = get_payment_intent_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ sqlx_poll,
+ )
+ .await;
+ match (&sqlx_result, &ckh_result) {
+ (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => {
+ router_env::logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres payment intents analytics filters")
+ },
+ _ => {}
+ };
+ sqlx_result
+ }
+ }
+ .change_context(AnalyticsError::UnknownError)?
+ .into_iter()
+ .filter_map(|fil: PaymentIntentFilterRow| match dim {
+ PaymentIntentDimensions::PaymentIntentStatus => fil.status.map(|i| i.as_ref().to_string()),
+ PaymentIntentDimensions::Currency => fil.currency.map(|i| i.as_ref().to_string()),
+ })
+ .collect::<Vec<String>>();
+ res.query_data.push(PaymentIntentFilterValue {
+ dimension: dim,
+ values,
+ })
+ }
+ Ok(res)
+}
diff --git a/crates/analytics/src/payment_intents/filters.rs b/crates/analytics/src/payment_intents/filters.rs
new file mode 100644
index 00000000000..1a74cfd510e
--- /dev/null
+++ b/crates/analytics/src/payment_intents/filters.rs
@@ -0,0 +1,56 @@
+use api_models::analytics::{payment_intents::PaymentIntentDimensions, Granularity, TimeRange};
+use common_utils::errors::ReportSwitchExt;
+use diesel_models::enums::{Currency, IntentStatus};
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use crate::{
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ types::{
+ AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, FiltersError, FiltersResult,
+ LoadRow,
+ },
+};
+
+pub trait PaymentIntentFilterAnalytics: LoadRow<PaymentIntentFilterRow> {}
+
+pub async fn get_payment_intent_filter_for_dimension<T>(
+ dimension: PaymentIntentDimensions,
+ merchant: &String,
+ time_range: &TimeRange,
+ pool: &T,
+) -> FiltersResult<Vec<PaymentIntentFilterRow>>
+where
+ T: AnalyticsDataSource + PaymentIntentFilterAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::PaymentIntent);
+
+ query_builder.add_select_column(dimension).switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant)
+ .switch()?;
+
+ query_builder.set_distinct();
+
+ query_builder
+ .execute_query::<PaymentIntentFilterRow, _>(pool)
+ .await
+ .change_context(FiltersError::QueryBuildingError)?
+ .change_context(FiltersError::QueryExecutionFailure)
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq, serde::Deserialize)]
+pub struct PaymentIntentFilterRow {
+ pub status: Option<DBEnumWrapper<IntentStatus>>,
+ pub currency: Option<DBEnumWrapper<Currency>>,
+}
diff --git a/crates/analytics/src/payment_intents/metrics.rs b/crates/analytics/src/payment_intents/metrics.rs
new file mode 100644
index 00000000000..3a0cbbc85db
--- /dev/null
+++ b/crates/analytics/src/payment_intents/metrics.rs
@@ -0,0 +1,126 @@
+use api_models::analytics::{
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetrics,
+ PaymentIntentMetricsBucketIdentifier,
+ },
+ Granularity, TimeRange,
+};
+use diesel_models::enums as storage_enums;
+use time::PrimitiveDateTime;
+
+use crate::{
+ query::{Aggregate, GroupByClause, ToSql, Window},
+ types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
+};
+
+mod payment_intent_count;
+mod smart_retried_amount;
+mod successful_smart_retries;
+mod total_smart_retries;
+
+use payment_intent_count::PaymentIntentCount;
+use smart_retried_amount::SmartRetriedAmount;
+use successful_smart_retries::SuccessfulSmartRetries;
+use total_smart_retries::TotalSmartRetries;
+
+#[derive(Debug, PartialEq, Eq, serde::Deserialize)]
+pub struct PaymentIntentMetricRow {
+ pub status: Option<DBEnumWrapper<storage_enums::IntentStatus>>,
+ pub currency: Option<DBEnumWrapper<storage_enums::Currency>>,
+ pub total: Option<bigdecimal::BigDecimal>,
+ pub count: Option<i64>,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
+ pub start_bucket: Option<PrimitiveDateTime>,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
+ pub end_bucket: Option<PrimitiveDateTime>,
+}
+
+pub trait PaymentIntentMetricAnalytics: LoadRow<PaymentIntentMetricRow> {}
+
+#[async_trait::async_trait]
+pub trait PaymentIntentMetric<T>
+where
+ T: AnalyticsDataSource + PaymentIntentMetricAnalytics,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>>;
+}
+
+#[async_trait::async_trait]
+impl<T> PaymentIntentMetric<T> for PaymentIntentMetrics
+where
+ T: AnalyticsDataSource + PaymentIntentMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>> {
+ match self {
+ Self::SuccessfulSmartRetries => {
+ SuccessfulSmartRetries
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::TotalSmartRetries => {
+ TotalSmartRetries
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::SmartRetriedAmount => {
+ SmartRetriedAmount
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::PaymentIntentCount => {
+ PaymentIntentCount
+ .load_metrics(
+ dimensions,
+ merchant_id,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ }
+ }
+}
diff --git a/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs b/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs
new file mode 100644
index 00000000000..0f235375c4f
--- /dev/null
+++ b/crates/analytics/src/payment_intents/metrics/payment_intent_count.rs
@@ -0,0 +1,121 @@
+use api_models::analytics::{
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetricsBucketIdentifier,
+ },
+ Granularity, TimeRange,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::PaymentIntentMetricRow;
+use crate::{
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct PaymentIntentCount;
+
+#[async_trait::async_trait]
+impl<T> super::PaymentIntentMetric<T> for PaymentIntentCount
+where
+ T: AnalyticsDataSource + super::PaymentIntentMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::PaymentIntent);
+
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+
+ query_builder
+ .add_select_column(Aggregate::Count {
+ field: None,
+ alias: Some("count"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ filters.set_filter_clause(&mut query_builder).switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
+ if let Some(granularity) = granularity.as_ref() {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<PaymentIntentMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ PaymentIntentMetricsBucketIdentifier::new(
+ i.status.as_ref().map(|i| i.0),
+ i.currency.as_ref().map(|i| i.0),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs b/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs
new file mode 100644
index 00000000000..470a0e66867
--- /dev/null
+++ b/crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs
@@ -0,0 +1,131 @@
+use api_models::{
+ analytics::{
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetricsBucketIdentifier,
+ },
+ Granularity, TimeRange,
+ },
+ enums::IntentStatus,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::PaymentIntentMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct SmartRetriedAmount;
+
+#[async_trait::async_trait]
+impl<T> super::PaymentIntentMetric<T> for SmartRetriedAmount
+where
+ T: AnalyticsDataSource + super::PaymentIntentMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::PaymentIntent);
+
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+ query_builder
+ .add_select_column(Aggregate::Sum {
+ field: "amount",
+ alias: Some("total"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ filters.set_filter_clause(&mut query_builder).switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+ query_builder
+ .add_custom_filter_clause("attempt_count", "1", FilterTypes::Gt)
+ .switch()?;
+ query_builder
+ .add_custom_filter_clause("status", IntentStatus::Succeeded, FilterTypes::Equal)
+ .switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
+ if let Some(granularity) = granularity.as_ref() {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<PaymentIntentMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ PaymentIntentMetricsBucketIdentifier::new(
+ i.status.as_ref().map(|i| i.0),
+ i.currency.as_ref().map(|i| i.0),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs
new file mode 100644
index 00000000000..292062d1e10
--- /dev/null
+++ b/crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs
@@ -0,0 +1,130 @@
+use api_models::{
+ analytics::{
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetricsBucketIdentifier,
+ },
+ Granularity, TimeRange,
+ },
+ enums::IntentStatus,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::PaymentIntentMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct SuccessfulSmartRetries;
+
+#[async_trait::async_trait]
+impl<T> super::PaymentIntentMetric<T> for SuccessfulSmartRetries
+where
+ T: AnalyticsDataSource + super::PaymentIntentMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::PaymentIntent);
+
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+ query_builder
+ .add_select_column(Aggregate::Count {
+ field: None,
+ alias: Some("count"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ filters.set_filter_clause(&mut query_builder).switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+ query_builder
+ .add_custom_filter_clause("attempt_count", "1", FilterTypes::Gt)
+ .switch()?;
+ query_builder
+ .add_custom_filter_clause("status", IntentStatus::Succeeded, FilterTypes::Equal)
+ .switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+ if let Some(granularity) = granularity.as_ref() {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<PaymentIntentMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ PaymentIntentMetricsBucketIdentifier::new(
+ i.status.as_ref().map(|i| i.0),
+ i.currency.as_ref().map(|i| i.0),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs b/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs
new file mode 100644
index 00000000000..d5a3d142baf
--- /dev/null
+++ b/crates/analytics/src/payment_intents/metrics/total_smart_retries.rs
@@ -0,0 +1,125 @@
+use api_models::analytics::{
+ payment_intents::{
+ PaymentIntentDimensions, PaymentIntentFilters, PaymentIntentMetricsBucketIdentifier,
+ },
+ Granularity, TimeRange,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::PaymentIntentMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct TotalSmartRetries;
+
+#[async_trait::async_trait]
+impl<T> super::PaymentIntentMetric<T> for TotalSmartRetries
+where
+ T: AnalyticsDataSource + super::PaymentIntentMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ dimensions: &[PaymentIntentDimensions],
+ merchant_id: &str,
+ filters: &PaymentIntentFilters,
+ granularity: &Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::PaymentIntent);
+
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+ query_builder
+ .add_select_column(Aggregate::Count {
+ field: None,
+ alias: Some("count"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ filters.set_filter_clause(&mut query_builder).switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+ query_builder
+ .add_custom_filter_clause("attempt_count", "1", FilterTypes::Gt)
+ .switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
+ if let Some(granularity) = granularity.as_ref() {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<PaymentIntentMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ PaymentIntentMetricsBucketIdentifier::new(
+ i.status.as_ref().map(|i| i.0),
+ i.currency.as_ref().map(|i| i.0),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ Vec<(PaymentIntentMetricsBucketIdentifier, PaymentIntentMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/payment_intents/types.rs b/crates/analytics/src/payment_intents/types.rs
new file mode 100644
index 00000000000..9b1e7b8674d
--- /dev/null
+++ b/crates/analytics/src/payment_intents/types.rs
@@ -0,0 +1,30 @@
+use api_models::analytics::payment_intents::{PaymentIntentDimensions, PaymentIntentFilters};
+use error_stack::ResultExt;
+
+use crate::{
+ query::{QueryBuilder, QueryFilter, QueryResult, ToSql},
+ types::{AnalyticsCollection, AnalyticsDataSource},
+};
+
+impl<T> QueryFilter<T> for PaymentIntentFilters
+where
+ T: AnalyticsDataSource,
+ AnalyticsCollection: ToSql<T>,
+{
+ fn set_filter_clause(&self, builder: &mut QueryBuilder<T>) -> QueryResult<()> {
+ if !self.status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ PaymentIntentDimensions::PaymentIntentStatus,
+ &self.status,
+ )
+ .attach_printable("Error adding payment intent status filter")?;
+ }
+ if !self.currency.is_empty() {
+ builder
+ .add_filter_in_range_clause(PaymentIntentDimensions::Currency, &self.currency)
+ .attach_printable("Error adding currency filter")?;
+ }
+ Ok(())
+ }
+}
diff --git a/crates/analytics/src/payments/metrics/retries_count.rs b/crates/analytics/src/payments/metrics/retries_count.rs
index 87d80c87fb4..3c4580d37a7 100644
--- a/crates/analytics/src/payments/metrics/retries_count.rs
+++ b/crates/analytics/src/payments/metrics/retries_count.rs
@@ -1,6 +1,9 @@
-use api_models::analytics::{
- payments::{PaymentDimensions, PaymentFilters, PaymentMetricsBucketIdentifier},
- Granularity, TimeRange,
+use api_models::{
+ analytics::{
+ payments::{PaymentDimensions, PaymentFilters, PaymentMetricsBucketIdentifier},
+ Granularity, TimeRange,
+ },
+ enums::IntentStatus,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -70,7 +73,7 @@ where
.add_custom_filter_clause("attempt_count", "1", FilterTypes::Gt)
.switch()?;
query_builder
- .add_custom_filter_clause("status", "succeeded", FilterTypes::Equal)
+ .add_custom_filter_clause("status", IntentStatus::Succeeded, FilterTypes::Equal)
.switch()?;
time_range
.set_filter_clause(&mut query_builder)
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index 2fda8fc57cd..a257fedc09d 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -6,14 +6,15 @@ use api_models::{
api_event::ApiEventDimensions,
auth_events::AuthEventFlows,
disputes::DisputeDimensions,
+ payment_intents::PaymentIntentDimensions,
payments::{PaymentDimensions, PaymentDistributions},
refunds::{RefundDimensions, RefundType},
sdk_events::{SdkEventDimensions, SdkEventNames},
Granularity,
},
enums::{
- AttemptStatus, AuthenticationType, Connector, Currency, DisputeStage, PaymentMethod,
- PaymentMethodType,
+ AttemptStatus, AuthenticationType, Connector, Currency, DisputeStage, IntentStatus,
+ PaymentMethod, PaymentMethodType,
},
refunds::RefundStatus,
};
@@ -369,8 +370,10 @@ impl_to_sql_for_to_string!(
String,
&str,
&PaymentDimensions,
+ &PaymentIntentDimensions,
&RefundDimensions,
PaymentDimensions,
+ PaymentIntentDimensions,
&PaymentDistributions,
RefundDimensions,
PaymentMethod,
@@ -378,6 +381,7 @@ impl_to_sql_for_to_string!(
AuthenticationType,
Connector,
AttemptStatus,
+ IntentStatus,
RefundStatus,
storage_enums::RefundStatus,
Currency,
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 76ad9c254be..6a4faf50eb8 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -9,7 +9,7 @@ use common_utils::{
DbConnectionParams,
};
use diesel_models::enums::{
- AttemptStatus, AuthenticationType, Currency, PaymentMethod, RefundStatus,
+ AttemptStatus, AuthenticationType, Currency, IntentStatus, PaymentMethod, RefundStatus,
};
use error_stack::ResultExt;
use sqlx::{
@@ -87,6 +87,7 @@ macro_rules! db_type {
db_type!(Currency);
db_type!(AuthenticationType);
db_type!(AttemptStatus);
+db_type!(IntentStatus);
db_type!(PaymentMethod, TEXT);
db_type!(RefundStatus);
db_type!(RefundType);
@@ -143,6 +144,8 @@ where
impl super::payments::filters::PaymentFilterAnalytics for SqlxClient {}
impl super::payments::metrics::PaymentMetricAnalytics for SqlxClient {}
impl super::payments::distribution::PaymentDistributionAnalytics for SqlxClient {}
+impl super::payment_intents::filters::PaymentIntentFilterAnalytics for SqlxClient {}
+impl super::payment_intents::metrics::PaymentIntentMetricAnalytics for SqlxClient {}
impl super::refunds::metrics::RefundMetricAnalytics for SqlxClient {}
impl super::refunds::filters::RefundFilterAnalytics for SqlxClient {}
impl super::disputes::filters::DisputeFilterAnalytics for SqlxClient {}
@@ -429,6 +432,60 @@ impl<'a> FromRow<'a, PgRow> for super::payments::filters::FilterRow {
}
}
+impl<'a> FromRow<'a, PgRow> for super::payment_intents::metrics::PaymentIntentMetricRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let status: Option<DBEnumWrapper<IntentStatus>> =
+ row.try_get("status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let currency: Option<DBEnumWrapper<Currency>> =
+ row.try_get("currency").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let count: Option<i64> = row.try_get("count").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ // Removing millisecond precision to get accurate diffs against clickhouse
+ let start_bucket: Option<PrimitiveDateTime> = row
+ .try_get::<Option<PrimitiveDateTime>, _>("start_bucket")?
+ .and_then(|dt| dt.replace_millisecond(0).ok());
+ let end_bucket: Option<PrimitiveDateTime> = row
+ .try_get::<Option<PrimitiveDateTime>, _>("end_bucket")?
+ .and_then(|dt| dt.replace_millisecond(0).ok());
+ Ok(Self {
+ status,
+ currency,
+ total,
+ count,
+ start_bucket,
+ end_bucket,
+ })
+ }
+}
+
+impl<'a> FromRow<'a, PgRow> for super::payment_intents::filters::PaymentIntentFilterRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let status: Option<DBEnumWrapper<IntentStatus>> =
+ row.try_get("status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let currency: Option<DBEnumWrapper<Currency>> =
+ row.try_get("currency").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ Ok(Self { status, currency })
+ }
+}
+
impl<'a> FromRow<'a, PgRow> for super::refunds::filters::RefundFilterRow {
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
let currency: Option<DBEnumWrapper<Currency>> =
diff --git a/crates/analytics/src/types.rs b/crates/analytics/src/types.rs
index 5370fbc25ac..816c77fd304 100644
--- a/crates/analytics/src/types.rs
+++ b/crates/analytics/src/types.rs
@@ -15,6 +15,7 @@ use crate::errors::AnalyticsError;
pub enum AnalyticsDomain {
Payments,
Refunds,
+ PaymentIntents,
AuthEvents,
SdkEvents,
ApiEvents,
diff --git a/crates/analytics/src/utils.rs b/crates/analytics/src/utils.rs
index 0afe9bd6c5e..3955a8c1dfe 100644
--- a/crates/analytics/src/utils.rs
+++ b/crates/analytics/src/utils.rs
@@ -2,6 +2,7 @@ use api_models::analytics::{
api_event::{ApiEventDimensions, ApiEventMetrics},
auth_events::AuthEventMetrics,
disputes::{DisputeDimensions, DisputeMetrics},
+ payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
payments::{PaymentDimensions, PaymentMetrics},
refunds::{RefundDimensions, RefundMetrics},
sdk_events::{SdkEventDimensions, SdkEventMetrics},
@@ -13,6 +14,10 @@ pub fn get_payment_dimensions() -> Vec<NameDescription> {
PaymentDimensions::iter().map(Into::into).collect()
}
+pub fn get_payment_intent_dimensions() -> Vec<NameDescription> {
+ PaymentIntentDimensions::iter().map(Into::into).collect()
+}
+
pub fn get_refund_dimensions() -> Vec<NameDescription> {
RefundDimensions::iter().map(Into::into).collect()
}
@@ -29,6 +34,10 @@ pub fn get_payment_metrics_info() -> Vec<NameDescription> {
PaymentMetrics::iter().map(Into::into).collect()
}
+pub fn get_payment_intent_metrics_info() -> Vec<NameDescription> {
+ PaymentIntentMetrics::iter().map(Into::into).collect()
+}
+
pub fn get_refund_metrics_info() -> Vec<NameDescription> {
RefundMetrics::iter().map(Into::into).collect()
}
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 491420cfc02..85a9c3ded09 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -8,6 +8,7 @@ use self::{
api_event::{ApiEventDimensions, ApiEventMetrics},
auth_events::AuthEventMetrics,
disputes::{DisputeDimensions, DisputeMetrics},
+ payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
payments::{PaymentDimensions, PaymentDistributions, PaymentMetrics},
refunds::{RefundDimensions, RefundMetrics},
sdk_events::{SdkEventDimensions, SdkEventMetrics},
@@ -20,6 +21,7 @@ pub mod auth_events;
pub mod connector_events;
pub mod disputes;
pub mod outgoing_webhook_event;
+pub mod payment_intents;
pub mod payments;
pub mod refunds;
pub mod sdk_events;
@@ -114,6 +116,20 @@ pub struct GenerateReportRequest {
pub email: Secret<String, EmailStrategy>,
}
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GetPaymentIntentMetricRequest {
+ pub time_series: Option<TimeSeries>,
+ pub time_range: TimeRange,
+ #[serde(default)]
+ pub group_by_names: Vec<PaymentIntentDimensions>,
+ #[serde(default)]
+ pub filters: payment_intents::PaymentIntentFilters,
+ pub metrics: HashSet<PaymentIntentMetrics>,
+ #[serde(default)]
+ pub delta: bool,
+}
+
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GetRefundMetricRequest {
@@ -187,6 +203,27 @@ pub struct FilterValue {
pub values: Vec<String>,
}
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GetPaymentIntentFiltersRequest {
+ pub time_range: TimeRange,
+ #[serde(default)]
+ pub group_by_names: Vec<PaymentIntentDimensions>,
+}
+
+#[derive(Debug, Default, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentIntentFiltersResponse {
+ pub query_data: Vec<PaymentIntentFilterValue>,
+}
+
+#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentIntentFilterValue {
+ pub dimension: PaymentIntentDimensions,
+ pub values: Vec<String>,
+}
+
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
diff --git a/crates/api_models/src/analytics/payment_intents.rs b/crates/api_models/src/analytics/payment_intents.rs
new file mode 100644
index 00000000000..232c1719047
--- /dev/null
+++ b/crates/api_models/src/analytics/payment_intents.rs
@@ -0,0 +1,151 @@
+use std::{
+ collections::hash_map::DefaultHasher,
+ hash::{Hash, Hasher},
+};
+
+use super::{NameDescription, TimeRange};
+use crate::enums::{Currency, IntentStatus};
+
+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
+pub struct PaymentIntentFilters {
+ #[serde(default)]
+ pub status: Vec<IntentStatus>,
+ pub currency: Vec<Currency>,
+}
+
+#[derive(
+ Debug,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::AsRefStr,
+ PartialEq,
+ PartialOrd,
+ Eq,
+ Ord,
+ strum::Display,
+ strum::EnumIter,
+ Clone,
+ Copy,
+)]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum PaymentIntentDimensions {
+ #[strum(serialize = "status")]
+ #[serde(rename = "status")]
+ PaymentIntentStatus,
+ Currency,
+}
+
+#[derive(
+ Clone,
+ Debug,
+ Hash,
+ PartialEq,
+ Eq,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::Display,
+ strum::EnumIter,
+ strum::AsRefStr,
+)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum PaymentIntentMetrics {
+ SuccessfulSmartRetries,
+ TotalSmartRetries,
+ SmartRetriedAmount,
+ PaymentIntentCount,
+}
+
+#[derive(Debug, Default, serde::Serialize)]
+pub struct ErrorResult {
+ pub reason: String,
+ pub count: i64,
+ pub percentage: f64,
+}
+
+pub mod metric_behaviour {
+ pub struct SuccessfulSmartRetries;
+ pub struct TotalSmartRetries;
+ pub struct SmartRetriedAmount;
+ pub struct PaymentIntentCount;
+}
+
+impl From<PaymentIntentMetrics> for NameDescription {
+ fn from(value: PaymentIntentMetrics) -> Self {
+ Self {
+ name: value.to_string(),
+ desc: String::new(),
+ }
+ }
+}
+
+impl From<PaymentIntentDimensions> for NameDescription {
+ fn from(value: PaymentIntentDimensions) -> Self {
+ Self {
+ name: value.to_string(),
+ desc: String::new(),
+ }
+ }
+}
+
+#[derive(Debug, serde::Serialize, Eq)]
+pub struct PaymentIntentMetricsBucketIdentifier {
+ pub status: Option<IntentStatus>,
+ pub currency: Option<Currency>,
+ #[serde(rename = "time_range")]
+ pub time_bucket: TimeRange,
+ #[serde(rename = "time_bucket")]
+ #[serde(with = "common_utils::custom_serde::iso8601custom")]
+ pub start_time: time::PrimitiveDateTime,
+}
+
+impl PaymentIntentMetricsBucketIdentifier {
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ status: Option<IntentStatus>,
+ currency: Option<Currency>,
+ normalized_time_range: TimeRange,
+ ) -> Self {
+ Self {
+ status,
+ currency,
+ time_bucket: normalized_time_range,
+ start_time: normalized_time_range.start_time,
+ }
+ }
+}
+
+impl Hash for PaymentIntentMetricsBucketIdentifier {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.status.map(|i| i.to_string()).hash(state);
+ self.currency.hash(state);
+ self.time_bucket.hash(state);
+ }
+}
+
+impl PartialEq for PaymentIntentMetricsBucketIdentifier {
+ fn eq(&self, other: &Self) -> bool {
+ let mut left = DefaultHasher::new();
+ self.hash(&mut left);
+ let mut right = DefaultHasher::new();
+ other.hash(&mut right);
+ left.finish() == right.finish()
+ }
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct PaymentIntentMetricsBucketValue {
+ pub successful_smart_retries: Option<u64>,
+ pub total_smart_retries: Option<u64>,
+ pub smart_retried_amount: Option<u64>,
+ pub payment_intent_count: Option<u64>,
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct MetricsBucketResponse {
+ #[serde(flatten)]
+ pub values: PaymentIntentMetricsBucketValue,
+ #[serde(flatten)]
+ pub dimensions: PaymentIntentMetricsBucketIdentifier,
+}
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index bed46f01f19..346fc06f20a 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -38,6 +38,24 @@ use crate::{
impl ApiEventMetric for TimeRange {}
+impl ApiEventMetric for GetPaymentIntentFiltersRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Analytics)
+ }
+}
+
+impl ApiEventMetric for GetPaymentIntentMetricRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Analytics)
+ }
+}
+
+impl ApiEventMetric for PaymentIntentFiltersResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Analytics)
+ }
+}
+
impl_misc_api_event_type!(
PaymentMethodId,
PaymentsSessionResponse,
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 0ef8a6a8bfc..3e3a0da4cab 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -65,6 +65,7 @@ pub enum ApiEventsType {
Poll {
poll_id: String,
},
+ Analytics,
}
impl ApiEventMetric for serde_json::Value {}
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 8d8910f7b2c..64f62f48762 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -14,8 +14,9 @@ pub mod routes {
},
GenerateReportRequest, GetActivePaymentsMetricRequest, GetApiEventFiltersRequest,
GetApiEventMetricRequest, GetAuthEventMetricRequest, GetDisputeMetricRequest,
- GetPaymentFiltersRequest, GetPaymentMetricRequest, GetRefundFilterRequest,
- GetRefundMetricRequest, GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
+ GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest, GetPaymentIntentMetricRequest,
+ GetPaymentMetricRequest, GetRefundFilterRequest, GetRefundMetricRequest,
+ GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
};
use error_stack::ResultExt;
@@ -37,86 +38,105 @@ pub mod routes {
impl Analytics {
pub fn server(state: AppState) -> Scope {
- let mut route = web::scope("/analytics/v1").app_data(web::Data::new(state));
- {
- route = route
- .service(
- web::resource("metrics/payments")
- .route(web::post().to(get_payment_metrics)),
- )
- .service(
- web::resource("metrics/refunds").route(web::post().to(get_refunds_metrics)),
- )
- .service(
- web::resource("filters/payments")
- .route(web::post().to(get_payment_filters)),
- )
- .service(
- web::resource("filters/refunds").route(web::post().to(get_refund_filters)),
- )
- .service(web::resource("{domain}/info").route(web::get().to(get_info)))
- .service(
- web::resource("report/dispute")
- .route(web::post().to(generate_dispute_report)),
- )
- .service(
- web::resource("report/refunds")
- .route(web::post().to(generate_refund_report)),
- )
- .service(
- web::resource("report/payments")
- .route(web::post().to(generate_payment_report)),
- )
- .service(
- web::resource("metrics/sdk_events")
- .route(web::post().to(get_sdk_event_metrics)),
- )
- .service(
- web::resource("metrics/active_payments")
- .route(web::post().to(get_active_payments_metrics)),
- )
- .service(
- web::resource("filters/sdk_events")
- .route(web::post().to(get_sdk_event_filters)),
- )
- .service(
- web::resource("metrics/auth_events")
- .route(web::post().to(get_auth_event_metrics)),
- )
- .service(web::resource("api_event_logs").route(web::get().to(get_api_events)))
- .service(web::resource("sdk_event_logs").route(web::post().to(get_sdk_events)))
- .service(
- web::resource("connector_event_logs")
- .route(web::get().to(get_connector_events)),
- )
- .service(
- web::resource("outgoing_webhook_event_logs")
- .route(web::get().to(get_outgoing_webhook_events)),
- )
- .service(
- web::resource("filters/api_events")
- .route(web::post().to(get_api_event_filters)),
- )
- .service(
- web::resource("metrics/api_events")
- .route(web::post().to(get_api_events_metrics)),
- )
- .service(
- web::resource("search").route(web::post().to(get_global_search_results)),
- )
- .service(
- web::resource("search/{domain}").route(web::post().to(get_search_results)),
- )
- .service(
- web::resource("filters/disputes")
- .route(web::post().to(get_dispute_filters)),
- )
- .service(
- web::resource("metrics/disputes")
- .route(web::post().to(get_dispute_metrics)),
- )
- }
- route
+ web::scope("/analytics")
+ .app_data(web::Data::new(state))
+ .service(
+ web::scope("/v1")
+ .service(
+ web::resource("metrics/payments")
+ .route(web::post().to(get_payment_metrics)),
+ )
+ .service(
+ web::resource("metrics/refunds")
+ .route(web::post().to(get_refunds_metrics)),
+ )
+ .service(
+ web::resource("filters/payments")
+ .route(web::post().to(get_payment_filters)),
+ )
+ .service(
+ web::resource("filters/refunds")
+ .route(web::post().to(get_refund_filters)),
+ )
+ .service(web::resource("{domain}/info").route(web::get().to(get_info)))
+ .service(
+ web::resource("report/dispute")
+ .route(web::post().to(generate_dispute_report)),
+ )
+ .service(
+ web::resource("report/refunds")
+ .route(web::post().to(generate_refund_report)),
+ )
+ .service(
+ web::resource("report/payments")
+ .route(web::post().to(generate_payment_report)),
+ )
+ .service(
+ web::resource("metrics/sdk_events")
+ .route(web::post().to(get_sdk_event_metrics)),
+ )
+ .service(
+ web::resource("metrics/active_payments")
+ .route(web::post().to(get_active_payments_metrics)),
+ )
+ .service(
+ web::resource("filters/sdk_events")
+ .route(web::post().to(get_sdk_event_filters)),
+ )
+ .service(
+ web::resource("metrics/auth_events")
+ .route(web::post().to(get_auth_event_metrics)),
+ )
+ .service(
+ web::resource("api_event_logs").route(web::get().to(get_api_events)),
+ )
+ .service(
+ web::resource("sdk_event_logs").route(web::post().to(get_sdk_events)),
+ )
+ .service(
+ web::resource("connector_event_logs")
+ .route(web::get().to(get_connector_events)),
+ )
+ .service(
+ web::resource("outgoing_webhook_event_logs")
+ .route(web::get().to(get_outgoing_webhook_events)),
+ )
+ .service(
+ web::resource("filters/api_events")
+ .route(web::post().to(get_api_event_filters)),
+ )
+ .service(
+ web::resource("metrics/api_events")
+ .route(web::post().to(get_api_events_metrics)),
+ )
+ .service(
+ web::resource("search")
+ .route(web::post().to(get_global_search_results)),
+ )
+ .service(
+ web::resource("search/{domain}")
+ .route(web::post().to(get_search_results)),
+ )
+ .service(
+ web::resource("filters/disputes")
+ .route(web::post().to(get_dispute_filters)),
+ )
+ .service(
+ web::resource("metrics/disputes")
+ .route(web::post().to(get_dispute_metrics)),
+ ),
+ )
+ .service(
+ web::scope("/v2")
+ .service(
+ web::resource("/metrics/payments")
+ .route(web::post().to(get_payment_intents_metrics)),
+ )
+ .service(
+ web::resource("/filters/payments")
+ .route(web::post().to(get_payment_intents_filters)),
+ ),
+ )
}
}
@@ -178,6 +198,42 @@ pub mod routes {
.await
}
+ /// # Panics
+ ///
+ /// Panics if `json_payload` array does not contain one `GetPaymentIntentMetricRequest` element.
+ pub async fn get_payment_intents_metrics(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<[GetPaymentIntentMetricRequest; 1]>,
+ ) -> impl Responder {
+ // safety: This shouldn't panic owing to the data type
+ #[allow(clippy::expect_used)]
+ let payload = json_payload
+ .into_inner()
+ .to_vec()
+ .pop()
+ .expect("Couldn't get GetPaymentIntentMetricRequest");
+ let flow = AnalyticsFlow::GetPaymentIntentMetrics;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, auth: AuthenticationData, req, _| async move {
+ analytics::payment_intents::get_metrics(
+ &state.pool,
+ &auth.merchant_account.merchant_id,
+ req,
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth(Permission::Analytics),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
/// # Panics
///
/// Panics if `json_payload` array does not contain one `GetRefundMetricRequest` element.
@@ -350,6 +406,32 @@ pub mod routes {
.await
}
+ pub async fn get_payment_intents_filters(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<GetPaymentIntentFiltersRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GetPaymentIntentFilters;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, auth: AuthenticationData, req, _| async move {
+ analytics::payment_intents::get_filters(
+ &state.pool,
+ req,
+ &auth.merchant_account.merchant_id,
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth(Permission::Analytics),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
pub async fn get_refund_filters(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
|
feat
|
Add v2 payment analytics (payment-intents analytics) (#5150)
|
e9e8df222c90661493ba974374d70438ce0ffa6f
|
2024-11-19 21:52:58
|
Rajnish
|
fix(docker-compose): address "role root does not exist" errors arising from postgres health check (#6582)
| false
|
diff --git a/docker-compose-development.yml b/docker-compose-development.yml
index 07a2131c6d4..d7a0e365c36 100644
--- a/docker-compose-development.yml
+++ b/docker-compose-development.yml
@@ -26,7 +26,7 @@ services:
- POSTGRES_PASSWORD=db_pass
- POSTGRES_DB=hyperswitch_db
healthcheck:
- test: ["CMD-SHELL", "pg_isready"]
+ test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 5s
retries: 3
start_period: 5s
diff --git a/docker-compose.yml b/docker-compose.yml
index f766ff91053..7450a650119 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -21,7 +21,7 @@ services:
- POSTGRES_PASSWORD=db_pass
- POSTGRES_DB=hyperswitch_db
healthcheck:
- test: ["CMD-SHELL", "pg_isready"]
+ test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 5s
retries: 3
start_period: 5s
|
fix
|
address "role root does not exist" errors arising from postgres health check (#6582)
|
c0e31ed1df6cd1f17727c9ebf9d308ede02f2228
|
2024-02-07 14:49:20
|
Ravi Kiran
|
fix(router): added validation check to number of workers in config (#3533)
| false
|
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index a4eb3f3c66e..655dca33384 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -68,10 +68,18 @@ impl super::settings::Locker {
impl super::settings::Server {
pub fn validate(&self) -> Result<(), ApplicationError> {
- common_utils::fp_utils::when(self.host.is_default_or_empty(), || {
+ use common_utils::fp_utils::when;
+
+ when(self.host.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"server host must not be empty".into(),
))
+ })?;
+
+ when(self.workers == 0, || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "number of workers must be greater than 0".into(),
+ ))
})
}
}
|
fix
|
added validation check to number of workers in config (#3533)
|
d2d317ce61c0c00ca38af9774bd1b45247d30c82
|
2024-05-31 15:01:12
|
Sanchith Hegde
|
chore: enable `clippy::large_futures` lint (#4822)
| false
|
diff --git a/.cargo/config.toml b/.cargo/config.toml
index 852384da785..e643b41ec05 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -6,6 +6,7 @@ rustflags = [
"-Wclippy::expect_used",
"-Wclippy::index_refutable_slice",
"-Wclippy::indexing_slicing",
+ "-Wclippy::large_futures",
"-Wclippy::match_on_vec_items",
"-Wclippy::missing_panics_doc",
"-Wclippy::out_of_bounds_indexing",
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index 4928dc949dc..f608100c08a 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -358,12 +358,12 @@ pub async fn attach_evidence(
})
},
)?;
- let create_file_response = files::files_create_core(
+ let create_file_response = Box::pin(files::files_create_core(
state.clone(),
merchant_account,
key_store,
attach_evidence_request.create_file_request,
- )
+ ))
.await?;
let file_id = match &create_file_response {
services::ApplicationResponse::Json(res) => res.file_id.clone(),
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 63bf80bac02..dddcf581296 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -563,7 +563,7 @@ where
frm_routing_algorithm.zip(frm_connector_label)
{
if let Some(frm_configs) = frm_configs.clone() {
- let mut updated_frm_info = make_frm_data_and_fraud_check_operation(
+ let mut updated_frm_info = Box::pin(make_frm_data_and_fraud_check_operation(
db,
state,
merchant_account,
@@ -572,7 +572,7 @@ where
profile_id,
frm_configs.clone(),
customer,
- )
+ ))
.await?;
if is_frm_enabled {
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 33103b7a901..02e29f24a67 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -286,7 +286,7 @@ pub async fn get_client_secret_or_add_payment_method(
let condition = req.card.is_some() || req.bank_transfer.is_some() || req.wallet.is_some();
if condition {
- add_payment_method(state, req, merchant_account, key_store).await
+ Box::pin(add_payment_method(state, req, merchant_account, key_store)).await
} else {
let payment_method_id = generate_id(consts::ID_LENGTH, "pm");
@@ -393,14 +393,14 @@ pub async fn add_payment_method_data(
match pmd {
api_models::payment_methods::PaymentMethodCreateData::Card(card) => {
helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?;
- let resp = add_card_to_locker(
+ let resp = Box::pin(add_card_to_locker(
&state,
req.clone(),
&card,
&customer_id,
&merchant_account,
None,
- )
+ ))
.await
.change_context(errors::ApiErrorResponse::InternalServerError);
@@ -555,14 +555,14 @@ pub async fn add_payment_method(
api_enums::PaymentMethod::Card => match req.card.clone() {
Some(card) => {
helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?;
- add_card_to_locker(
+ Box::pin(add_card_to_locker(
&state,
req.clone(),
&card,
&customer_id,
merchant_account,
None,
- )
+ ))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card Failed")
@@ -888,14 +888,14 @@ pub async fn update_customer_payment_method(
.await?;
// Add the updated payment method data to locker
- let (mut add_card_resp, _) = add_card_to_locker(
+ let (mut add_card_resp, _) = Box::pin(add_card_to_locker(
&state,
new_pm.clone(),
&updated_card_details,
&pm.customer_id,
&merchant_account,
Some(pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id)),
- )
+ ))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to add updated payment method to locker")?;
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 3341011bb5d..c19c8c45753 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -660,14 +660,14 @@ pub async fn save_in_locker(
.clone()
.get_required_value("customer_id")?;
match payment_method_request.card.clone() {
- Some(card) => payment_methods::cards::add_card_to_locker(
+ Some(card) => Box::pin(payment_methods::cards::add_card_to_locker(
state,
payment_method_request,
&card,
&customer_id,
merchant_account,
None,
- )
+ ))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card Failed"),
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 9ab1ec0eb88..d2d2db71ef3 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -726,7 +726,7 @@ pub async fn validate_and_create_refund(
.await
{
Ok(refund) => {
- schedule_refund_execution(
+ Box::pin(schedule_refund_execution(
state,
refund.clone(),
refund_type,
@@ -736,7 +736,7 @@ pub async fn validate_and_create_refund(
payment_intent,
creds_identifier,
charges,
- )
+ ))
.await?
}
Err(err) => {
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 7e29036c40f..c5055d4c8c2 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -1070,7 +1070,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
// may have an actix arbiter
tokio::spawn(
async move {
- trigger_webhook_and_raise_event(
+ Box::pin(trigger_webhook_and_raise_event(
state,
business_profile,
&cloned_key_store,
@@ -1079,7 +1079,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
delivery_attempt,
Some(content),
process_tracker,
- )
+ ))
.await;
}
.in_current_span(),
diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs
index 6db214c2b05..f248edd652b 100644
--- a/crates/router/src/core/webhooks/webhook_events.rs
+++ b/crates/router/src/core/webhooks/webhook_events.rs
@@ -231,7 +231,7 @@ pub async fn retry_delivery_attempt(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to parse webhook event request information")?;
- super::trigger_webhook_and_raise_event(
+ Box::pin(super::trigger_webhook_and_raise_event(
state.clone(),
business_profile,
&key_store,
@@ -240,7 +240,7 @@ pub async fn retry_delivery_attempt(
delivery_attempt,
None,
None,
- )
+ ))
.await;
let updated_event = store
diff --git a/crates/router/src/routes/cards_info.rs b/crates/router/src/routes/cards_info.rs
index 4d65fc72036..ca59e072a90 100644
--- a/crates/router/src/routes/cards_info.rs
+++ b/crates/router/src/routes/cards_info.rs
@@ -41,7 +41,7 @@ pub async fn card_iin_info(
Err(e) => return api::log_and_return_error_response(e),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
Flow::CardsInfo,
state,
&req,
@@ -49,6 +49,6 @@ pub async fn card_iin_info(
|state, auth, req, _| cards_info::retrieve_card_info(state, auth.merchant_account, req),
&*auth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index b97cfc3fa0d..4d86ae829e0 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -53,7 +53,7 @@ pub async fn customers_retrieve(
}
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -61,7 +61,7 @@ pub async fn customers_retrieve(
|state, auth, req, _| retrieve_customer(state, auth.merchant_account, auth.key_store, req),
&*auth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index a4a6c7507a4..4c7199f2f29 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -38,7 +38,7 @@ pub async fn retrieve_dispute(
let dispute_id = dispute_types::DisputeId {
dispute_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -50,7 +50,7 @@ pub async fn retrieve_dispute(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Disputes - List Disputes
@@ -85,7 +85,7 @@ pub async fn retrieve_disputes_list(
) -> HttpResponse {
let flow = Flow::DisputesList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -97,7 +97,7 @@ pub async fn retrieve_disputes_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Disputes - Accept Dispute
diff --git a/crates/router/src/routes/mandates.rs b/crates/router/src/routes/mandates.rs
index 365f9a43248..c2ed58ae40b 100644
--- a/crates/router/src/routes/mandates.rs
+++ b/crates/router/src/routes/mandates.rs
@@ -36,7 +36,7 @@ pub async fn get_mandate(
let mandate_id = mandates::MandateId {
mandate_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -46,7 +46,7 @@ pub async fn get_mandate(
},
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Mandates - Revoke Mandate
diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs
index 7742f6c1c0e..f375a18ab61 100644
--- a/crates/router/src/routes/payment_link.rs
+++ b/crates/router/src/routes/payment_link.rs
@@ -112,7 +112,7 @@ pub async fn payments_link_list(
) -> impl Responder {
let flow = Flow::PaymentLinkList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -120,7 +120,7 @@ pub async fn payments_link_list(
|state, auth, payload, _| list_payment_link(state, auth.merchant_account, payload),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index f28cad89004..ab6b0f450db 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -949,7 +949,7 @@ pub async fn payments_list(
) -> impl Responder {
let flow = Flow::PaymentsList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -961,7 +961,7 @@ pub async fn payments_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
@@ -973,7 +973,7 @@ pub async fn payments_list_by_filter(
) -> impl Responder {
let flow = Flow::PaymentsList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -983,7 +983,7 @@ pub async fn payments_list_by_filter(
},
&auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
@@ -995,7 +995,7 @@ pub async fn get_filters_for_payments(
) -> impl Responder {
let flow = Flow::PaymentsList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -1005,7 +1005,7 @@ pub async fn get_filters_for_payments(
},
&auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -1016,7 +1016,7 @@ pub async fn get_payment_filters(
req: actix_web::HttpRequest,
) -> impl Responder {
let flow = Flow::PaymentsFilters;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -1026,7 +1026,7 @@ pub async fn get_payment_filters(
},
&auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/poll.rs b/crates/router/src/routes/poll.rs
index 39bb63832a9..e4591b40327 100644
--- a/crates/router/src/routes/poll.rs
+++ b/crates/router/src/routes/poll.rs
@@ -33,7 +33,7 @@ pub async fn retrieve_poll_status(
let poll_id = PollId {
poll_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -41,6 +41,6 @@ pub async fn retrieve_poll_status(
|state, auth, req, _| poll::retrieve_poll_status(state, req, auth.merchant_account),
&auth::PublishableKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 3df6c871668..50e0c0c917f 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -182,7 +182,7 @@ pub async fn refunds_update(
let flow = Flow::RefundsUpdate;
let mut refund_update_req = json_payload.into_inner();
refund_update_req.refund_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -190,7 +190,7 @@ pub async fn refunds_update(
|state, auth, req, _| refund_update_core(state, auth.merchant_account, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Refunds - List
@@ -215,7 +215,7 @@ pub async fn refunds_list(
payload: web::Json<api_models::refunds::RefundListRequest>,
) -> HttpResponse {
let flow = Flow::RefundsList;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -227,7 +227,7 @@ pub async fn refunds_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -253,7 +253,7 @@ pub async fn refunds_filter_list(
payload: web::Json<api_models::payments::TimeRange>,
) -> HttpResponse {
let flow = Flow::RefundsList;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -265,7 +265,7 @@ pub async fn refunds_filter_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -286,7 +286,7 @@ pub async fn refunds_filter_list(
#[cfg(feature = "olap")]
pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
let flow = Flow::RefundsFilters;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -298,6 +298,6 @@ pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 556e91d8694..74bd61765b0 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -259,7 +259,7 @@ pub async fn routing_update_default_config(
json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
- oss_api::server_wrap(
+ Box::pin(oss_api::server_wrap(
Flow::RoutingUpdateDefaultConfig,
state,
&req,
@@ -281,7 +281,7 @@ pub async fn routing_update_default_config(
#[cfg(feature = "release")]
&auth::JWTAuth(Permission::RoutingWrite),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -292,7 +292,7 @@ pub async fn routing_retrieve_default_config(
req: HttpRequest,
transaction_type: &enums::TransactionType,
) -> impl Responder {
- oss_api::server_wrap(
+ Box::pin(oss_api::server_wrap(
Flow::RoutingRetrieveDefaultConfig,
state,
&req,
@@ -309,7 +309,7 @@ pub async fn routing_retrieve_default_config(
#[cfg(feature = "release")]
&auth::JWTAuth(Permission::RoutingRead),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -573,7 +573,7 @@ pub async fn routing_retrieve_default_config_for_profiles(
req: HttpRequest,
transaction_type: &enums::TransactionType,
) -> impl Responder {
- oss_api::server_wrap(
+ Box::pin(oss_api::server_wrap(
Flow::RoutingRetrieveDefaultConfig,
state,
&req,
@@ -598,7 +598,7 @@ pub async fn routing_retrieve_default_config_for_profiles(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -615,7 +615,7 @@ pub async fn routing_update_default_config_for_profile(
updated_config: json_payload.into_inner(),
profile_id: path.into_inner(),
};
- oss_api::server_wrap(
+ Box::pin(oss_api::server_wrap(
Flow::RoutingUpdateDefaultConfig,
state,
&req,
@@ -638,6 +638,6 @@ pub async fn routing_update_default_config_for_profile(
#[cfg(feature = "release")]
&auth::JWTAuth(Permission::RoutingWrite),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/webhook_events.rs b/crates/router/src/routes/webhook_events.rs
index ef1d64f54e9..b4839f5bd07 100644
--- a/crates/router/src/routes/webhook_events.rs
+++ b/crates/router/src/routes/webhook_events.rs
@@ -27,7 +27,7 @@ pub async fn list_initial_webhook_delivery_attempts(
constraints,
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -48,7 +48,7 @@ pub async fn list_initial_webhook_delivery_attempts(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -66,7 +66,7 @@ pub async fn list_webhook_delivery_attempts(
initial_attempt_id,
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -87,7 +87,7 @@ pub async fn list_webhook_delivery_attempts(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -105,7 +105,7 @@ pub async fn retry_webhook_delivery_attempt(
event_id,
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -126,6 +126,6 @@ pub async fn retry_webhook_delivery_attempt(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/workflows/outgoing_webhook_retry.rs b/crates/router/src/workflows/outgoing_webhook_retry.rs
index 726cbf9de09..63bdb7ec989 100644
--- a/crates/router/src/workflows/outgoing_webhook_retry.rs
+++ b/crates/router/src/workflows/outgoing_webhook_retry.rs
@@ -114,7 +114,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
.peek()
.parse_struct("OutgoingWebhookRequestContent")?;
- webhooks_core::trigger_webhook_and_raise_event(
+ Box::pin(webhooks_core::trigger_webhook_and_raise_event(
state.clone(),
business_profile,
&key_store,
@@ -123,7 +123,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
delivery_attempt,
None,
Some(process),
- )
+ ))
.await;
}
@@ -168,7 +168,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
errors::ProcessTrackerError::EApiErrorResponse
})?;
- webhooks_core::trigger_webhook_and_raise_event(
+ Box::pin(webhooks_core::trigger_webhook_and_raise_event(
state.clone(),
business_profile,
&key_store,
@@ -177,7 +177,7 @@ impl ProcessTrackerWorkflow<AppState> for OutgoingWebhookRetryWorkflow {
delivery_attempt,
Some(content),
Some(process),
- )
+ ))
.await;
}
// Resource status has changed since the event was created, finish task
|
chore
|
enable `clippy::large_futures` lint (#4822)
|
dfd1e5e254686b31b7e1a1ce55dad580d9eccba2
|
2023-02-06 18:20:24
|
Sanchith Hegde
|
fix(storage_models): fix inconsistent field order for merchant account types (#503)
| false
|
diff --git a/crates/storage_models/src/merchant_account.rs b/crates/storage_models/src/merchant_account.rs
index 777e1ba349c..5147b1077a9 100644
--- a/crates/storage_models/src/merchant_account.rs
+++ b/crates/storage_models/src/merchant_account.rs
@@ -21,8 +21,8 @@ pub struct MerchantAccount {
pub publishable_key: Option<String>,
pub storage_scheme: storage_enums::MerchantStorageScheme,
pub locker_id: Option<String>,
- pub routing_algorithm: Option<serde_json::Value>,
pub metadata: Option<serde_json::Value>,
+ pub routing_algorithm: Option<serde_json::Value>,
}
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
@@ -41,8 +41,8 @@ pub struct MerchantAccountNew {
pub redirect_to_merchant_with_http_post: Option<bool>,
pub publishable_key: Option<String>,
pub locker_id: Option<String>,
- pub routing_algorithm: Option<serde_json::Value>,
pub metadata: Option<serde_json::Value>,
+ pub routing_algorithm: Option<serde_json::Value>,
}
#[derive(Debug)]
@@ -60,8 +60,8 @@ pub enum MerchantAccountUpdate {
redirect_to_merchant_with_http_post: Option<bool>,
publishable_key: Option<String>,
locker_id: Option<String>,
- routing_algorithm: Option<serde_json::Value>,
metadata: Option<serde_json::Value>,
+ routing_algorithm: Option<serde_json::Value>,
},
}
@@ -80,8 +80,8 @@ pub struct MerchantAccountUpdateInternal {
redirect_to_merchant_with_http_post: Option<bool>,
publishable_key: Option<String>,
locker_id: Option<String>,
- routing_algorithm: Option<serde_json::Value>,
metadata: Option<serde_json::Value>,
+ routing_algorithm: Option<serde_json::Value>,
}
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
diff --git a/crates/storage_models/src/schema.rs b/crates/storage_models/src/schema.rs
index ab21e94bd31..66f8af9ffd3 100644
--- a/crates/storage_models/src/schema.rs
+++ b/crates/storage_models/src/schema.rs
@@ -158,8 +158,8 @@ diesel::table! {
publishable_key -> Nullable<Varchar>,
storage_scheme -> MerchantStorageScheme,
locker_id -> Nullable<Varchar>,
- routing_algorithm -> Nullable<Json>,
metadata -> Nullable<Jsonb>,
+ routing_algorithm -> Nullable<Json>,
}
}
|
fix
|
fix inconsistent field order for merchant account types (#503)
|
3578db7640d8eda8f063e11b8bb64452fb987eef
|
2023-10-27 17:25:35
|
Seemebadnekai
|
feat(connector): [Mollie] Currency Unit Conversion (#2671)
| false
|
diff --git a/crates/router/src/connector/mollie.rs b/crates/router/src/connector/mollie.rs
index 38abed9dea6..337e1b78c9a 100644
--- a/crates/router/src/connector/mollie.rs
+++ b/crates/router/src/connector/mollie.rs
@@ -62,6 +62,10 @@ impl ConnectorCommon for Mollie {
"mollie"
}
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Base
+ }
+
fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
connectors.mollie.base_url.as_ref()
}
@@ -229,7 +233,13 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
&self,
req: &types::PaymentsAuthorizeRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let req_obj = mollie::MolliePaymentsRequest::try_from(req)?;
+ let router_obj = mollie::MollieRouterData::try_from((
+ &self.get_currency_unit(),
+ req.request.currency,
+ req.request.amount,
+ req,
+ ))?;
+ let req_obj = mollie::MolliePaymentsRequest::try_from(&router_obj)?;
let mollie_req = types::RequestBody::log_and_get_request_body(
&req_obj,
utils::Encode::<mollie::MolliePaymentsRequest>::encode_to_string_of_json,
@@ -417,7 +427,13 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
&self,
req: &types::RefundsRouterData<api::Execute>,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let req_obj = mollie::MollieRefundRequest::try_from(req)?;
+ let router_obj = mollie::MollieRouterData::try_from((
+ &self.get_currency_unit(),
+ req.request.currency,
+ req.request.refund_amount,
+ req,
+ ))?;
+ let req_obj = mollie::MollieRefundRequest::try_from(&router_obj)?;
let mollie_req = types::RequestBody::log_and_get_request_body(
&req_obj,
utils::Encode::<mollie::MollieRefundRequest>::encode_to_string_of_json,
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index d0036d3c2f5..3c23c9f1d39 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -19,6 +19,38 @@ use crate::{
type Error = error_stack::Report<errors::ConnectorError>;
+#[derive(Debug, Serialize)]
+pub struct MollieRouterData<T> {
+ pub amount: String,
+ pub router_data: T,
+}
+
+impl<T>
+ TryFrom<(
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ )> for MollieRouterData<T>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(
+ (currency_unit, currency, amount, router_data): (
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
+ Ok(Self {
+ amount,
+ router_data,
+ })
+ }
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MolliePaymentsRequest {
@@ -120,50 +152,55 @@ pub struct MollieBrowserInfo {
language: String,
}
-impl TryFrom<&types::PaymentsAuthorizeRouterData> for MolliePaymentsRequest {
+impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MolliePaymentsRequest {
type Error = Error;
- fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &MollieRouterData<&types::PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
let amount = Amount {
- currency: item.request.currency,
- value: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
+ currency: item.router_data.request.currency,
+ value: item.amount.clone(),
};
- let description = item.get_description()?;
- let redirect_url = item.request.get_return_url()?;
- let payment_method_data = match item.request.capture_method.unwrap_or_default() {
- enums::CaptureMethod::Automatic => match &item.request.payment_method_data {
- api_models::payments::PaymentMethodData::Card(_) => {
- let pm_token = item.get_payment_method_token()?;
- Ok(PaymentMethodData::CreditCard(Box::new(
- CreditCardMethodData {
- billing_address: get_billing_details(item)?,
- shipping_address: get_shipping_details(item)?,
- card_token: Some(Secret::new(match pm_token {
- types::PaymentMethodToken::Token(token) => token,
- types::PaymentMethodToken::ApplePayDecrypt(_) => {
- Err(errors::ConnectorError::InvalidWalletToken)?
- }
- })),
- },
- )))
- }
- api_models::payments::PaymentMethodData::BankRedirect(ref redirect_data) => {
- PaymentMethodData::try_from(redirect_data)
+ let description = item.router_data.get_description()?;
+ let redirect_url = item.router_data.request.get_return_url()?;
+ let payment_method_data = match item.router_data.request.capture_method.unwrap_or_default()
+ {
+ enums::CaptureMethod::Automatic => {
+ match &item.router_data.request.payment_method_data {
+ api_models::payments::PaymentMethodData::Card(_) => {
+ let pm_token = item.router_data.get_payment_method_token()?;
+ Ok(PaymentMethodData::CreditCard(Box::new(
+ CreditCardMethodData {
+ billing_address: get_billing_details(item.router_data)?,
+ shipping_address: get_shipping_details(item.router_data)?,
+ card_token: Some(Secret::new(match pm_token {
+ types::PaymentMethodToken::Token(token) => token,
+ types::PaymentMethodToken::ApplePayDecrypt(_) => {
+ Err(errors::ConnectorError::InvalidWalletToken)?
+ }
+ })),
+ },
+ )))
+ }
+ api_models::payments::PaymentMethodData::BankRedirect(ref redirect_data) => {
+ PaymentMethodData::try_from(redirect_data)
+ }
+ api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => {
+ get_payment_method_for_wallet(item.router_data, wallet_data)
+ }
+ api_models::payments::PaymentMethodData::BankDebit(ref directdebit_data) => {
+ PaymentMethodData::try_from(directdebit_data)
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment Method".to_string(),
+ ))
+ .into_report(),
}
- api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => {
- get_payment_method_for_wallet(item, wallet_data)
- }
- api_models::payments::PaymentMethodData::BankDebit(ref directdebit_data) => {
- PaymentMethodData::try_from(directdebit_data)
- }
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment Method".to_string(),
- ))
- .into_report(),
- },
+ }
_ => Err(errors::ConnectorError::FlowNotSupported {
flow: format!(
"{} capture",
- item.request.capture_method.unwrap_or_default()
+ item.router_data.request.capture_method.unwrap_or_default()
),
connector: "Mollie".to_string(),
})
@@ -526,16 +563,18 @@ pub struct MollieRefundRequest {
description: Option<String>,
}
-impl<F> TryFrom<&types::RefundsRouterData<F>> for MollieRefundRequest {
+impl<F> TryFrom<&MollieRouterData<&types::RefundsRouterData<F>>> for MollieRefundRequest {
type Error = Error;
- fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &MollieRouterData<&types::RefundsRouterData<F>>,
+ ) -> Result<Self, Self::Error> {
let amount = Amount {
- currency: item.request.currency,
- value: utils::to_currency_base_unit(item.request.refund_amount, item.request.currency)?,
+ currency: item.router_data.request.currency,
+ value: item.amount.clone(),
};
Ok(Self {
amount,
- description: item.request.reason.to_owned(),
+ description: item.router_data.request.reason.to_owned(),
})
}
}
|
feat
|
[Mollie] Currency Unit Conversion (#2671)
|
2aef3bccfbf39ad90abd96b41996882a3f24f105
|
2022-12-09 17:18:12
|
Nishant Joshi
|
feat(single_use): add extra fields in `Mandate` table and `MandateData` [Blocked on #61] (#66)
| false
|
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index dbcd8736d4d..b75003271b6 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -128,6 +128,21 @@ impl PaymentsAuthorizeRouterData {
)
.await
.change_context(errors::ApiErrorResponse::MandateNotFound)?;
+ let mandate = match mandate.mandate_type {
+ storage_enums::MandateType::SingleUse => state
+ .store
+ .update_mandate_by_merchant_id_mandate_id(
+ &resp.merchant_id,
+ mandate_id,
+ storage::MandateUpdate::StatusUpdate {
+ mandate_status: storage_enums::MandateStatus::Revoked,
+ },
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::MandateNotFound),
+ storage_enums::MandateType::MultiUse => Ok(mandate),
+ }?;
+
resp.payment_method_id = Some(mandate.payment_method_id);
}
None => {
@@ -173,19 +188,32 @@ impl PaymentsAuthorizeRouterData {
match (self.request.setup_mandate_details.clone(), customer) {
(Some(data), Some(cus)) => {
let mandate_id = utils::generate_id(consts::ID_LENGTH, "man");
- Some(storage::MandateNew {
- mandate_id,
- customer_id: cus.customer_id.clone(),
- merchant_id: self.merchant_id.clone(),
- payment_method_id,
- mandate_status: storage_enums::MandateStatus::Active,
- mandate_type: storage_enums::MandateType::MultiUse,
- customer_ip_address: data.customer_acceptance.get_ip_address().map(Secret::new),
- customer_user_agent: data.customer_acceptance.get_user_agent(),
- customer_accepted_at: Some(data.customer_acceptance.get_accepted_at()),
- ..Default::default() // network_transaction_id: Option<String>,
- // previous_transaction_id: Option<String>,
- // created_at: Option<PrimitiveDateTime>,
+
+ // The construction of the mandate new must be visible
+ let mut new_mandate = storage::MandateNew::default();
+
+ new_mandate
+ .set_mandate_id(mandate_id)
+ .set_customer_id(cus.customer_id.clone())
+ .set_merchant_id(self.merchant_id.clone())
+ .set_payment_method_id(payment_method_id)
+ .set_mandate_status(storage_enums::MandateStatus::Active)
+ .set_customer_ip_address(
+ data.customer_acceptance.get_ip_address().map(Secret::new),
+ )
+ .set_customer_user_agent(data.customer_acceptance.get_user_agent())
+ .set_customer_accepted_at(Some(data.customer_acceptance.get_accepted_at()));
+
+ Some(match data.mandate_type {
+ api::MandateType::SingleUse(data) => new_mandate
+ .set_single_use_amount(Some(data.amount))
+ .set_single_use_currency(Some(data.currency))
+ .set_mandate_type(storage_enums::MandateType::SingleUse)
+ .to_owned(),
+
+ api::MandateType::MultiUse => new_mandate
+ .set_mandate_type(storage_enums::MandateType::MultiUse)
+ .to_owned(),
})
}
(_, _) => None,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e3e84a02bdf..beccb70bfa0 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -139,6 +139,11 @@ pub async fn get_token_for_recurring_mandate(
.await
.map_err(|error| error.to_not_found_response(errors::ApiErrorResponse::MandateNotFound))?;
+ utils::when(
+ mandate.mandate_status != storage_enums::MandateStatus::Active,
+ Err(errors::ApiErrorResponse::MandateNotFound),
+ )?;
+
let customer = req.customer_id.clone().get_required_value("customer_id")?;
let payment_method_id = {
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index c1c149bdbd4..da9c6863016 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -137,7 +137,6 @@ where
payment_data.payment_attempt,
payment_data.payment_intent,
payment_data.refunds,
- payment_data.mandate_id,
payment_data.payment_method_data,
customer,
auth_flow,
@@ -198,7 +197,6 @@ pub fn payments_to_payments_response<R, Op>(
payment_attempt: storage::PaymentAttempt,
payment_intent: storage::PaymentIntent,
refunds: Vec<storage::Refund>,
- mandate_id: Option<String>,
payment_method_data: Option<api::PaymentMethod>,
customer: Option<storage::Customer>,
auth_flow: services::AuthFlow,
@@ -216,6 +214,7 @@ where
.as_ref()
.get_required_value("currency")?
.to_string();
+ let mandate_id = payment_attempt.mandate_id.clone();
let refunds_response = if refunds.is_empty() {
None
} else {
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 4ec9763e237..54b91c1d880 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -14,6 +14,7 @@ use super::app::AppState;
use crate::{
core::{errors::http_not_implemented, payments},
services::api,
+
types::api::{
enums as api_enums,
payments::{
@@ -21,7 +22,7 @@ use crate::{
PaymentsRequest, PaymentsRetrieveRequest,
},
Authorize, Capture, PSync, PaymentRetrieveBody, PaymentsResponse, PaymentsStartRequest,
- Verify, VerifyRequest, VerifyResponse, Void,
+ Verify, VerifyResponse, Void,
}, // FIXME imports
};
@@ -110,33 +111,6 @@ pub async fn payments_start(
.await
}
-#[allow(dead_code)]
-#[instrument(skip(state), fields(flow = ?Flow::ValidatePaymentMethod))]
-pub async fn validate_pm(
- state: web::Data<AppState>,
- req: HttpRequest,
- json_payload: web::Json<VerifyRequest>,
-) -> HttpResponse {
- let payload = json_payload.into_inner();
- api::server_wrap(
- &state,
- &req,
- payload,
- |state, merchant_account, req| {
- payments::payments_core::<Verify, VerifyResponse, _, _, _>(
- state,
- merchant_account,
- payments::PaymentMethodValidate,
- req,
- api::AuthFlow::Merchant,
- payments::CallConnectorAction::Trigger,
- )
- },
- api::MerchantAuthentication::ApiKey,
- )
- .await
-}
-
#[instrument(skip(state), fields(flow = ?Flow::PaymentsRetrieve))]
// #[get("/{payment_id}")]
pub async fn payments_retrieve(
diff --git a/crates/router/src/schema.rs b/crates/router/src/schema.rs
index 9808bb05de1..b98588487ab 100644
--- a/crates/router/src/schema.rs
+++ b/crates/router/src/schema.rs
@@ -127,6 +127,8 @@ diesel::table! {
network_transaction_id -> Nullable<Varchar>,
previous_transaction_id -> Nullable<Varchar>,
created_at -> Timestamp,
+ single_use_amount -> Nullable<Int4>,
+ single_use_currency -> Nullable<Currency>,
}
}
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index c459adad3f7..698836d2b6d 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -7,7 +7,7 @@ use crate::{
core::errors,
pii,
services::api,
- types::{self, api as api_types, api::enums as api_enums},
+ types::{self, api as api_types, api::enums as api_enums, storage},
utils::custom_serde,
};
@@ -126,6 +126,14 @@ pub enum MandateTxnType {
#[serde(deny_unknown_fields)]
pub struct MandateData {
pub customer_acceptance: CustomerAcceptance,
+ pub mandate_type: MandateType,
+}
+
+#[derive(Default, Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
+pub enum MandateType {
+ SingleUse(storage::SingleUseMandate),
+ #[default]
+ MultiUse,
}
#[derive(Default, Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
diff --git a/crates/router/src/types/storage/mandate.rs b/crates/router/src/types/storage/mandate.rs
index 257ebce0185..d9d251e4da0 100644
--- a/crates/router/src/types/storage/mandate.rs
+++ b/crates/router/src/types/storage/mandate.rs
@@ -24,9 +24,13 @@ pub struct Mandate {
pub network_transaction_id: Option<String>,
pub previous_transaction_id: Option<String>,
pub created_at: PrimitiveDateTime,
+ pub single_use_amount: Option<i32>,
+ pub single_use_currency: Option<storage_enums::Currency>,
}
-#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
+#[derive(
+ router_derive::Setter, Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay,
+)]
#[diesel(table_name = mandate)]
pub struct MandateNew {
pub mandate_id: String,
@@ -41,6 +45,8 @@ pub struct MandateNew {
pub network_transaction_id: Option<String>,
pub previous_transaction_id: Option<String>,
pub created_at: Option<PrimitiveDateTime>,
+ pub single_use_amount: Option<i32>,
+ pub single_use_currency: Option<storage_enums::Currency>,
}
#[derive(Debug)]
@@ -50,6 +56,12 @@ pub enum MandateUpdate {
},
}
+#[derive(Clone, Eq, PartialEq, Copy, Debug, Default, serde::Serialize, serde::Deserialize)]
+pub struct SingleUseMandate {
+ pub amount: i32,
+ pub currency: storage_enums::Currency,
+}
+
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = mandate)]
pub(super) struct MandateUpdateInternal {
diff --git a/migrations/2022-12-05-090521_single_use_mandate_fields/down.sql b/migrations/2022-12-05-090521_single_use_mandate_fields/down.sql
new file mode 100644
index 00000000000..177e00e7548
--- /dev/null
+++ b/migrations/2022-12-05-090521_single_use_mandate_fields/down.sql
@@ -0,0 +1,4 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE mandate
+DROP COLUMN IF EXISTS single_use_amount,
+DROP COLUMN IF EXISTS single_use_currency;
\ No newline at end of file
diff --git a/migrations/2022-12-05-090521_single_use_mandate_fields/up.sql b/migrations/2022-12-05-090521_single_use_mandate_fields/up.sql
new file mode 100644
index 00000000000..393506967fd
--- /dev/null
+++ b/migrations/2022-12-05-090521_single_use_mandate_fields/up.sql
@@ -0,0 +1,4 @@
+-- Your SQL goes here
+ALTER TABLE mandate
+ADD IF NOT EXISTS single_use_amount INTEGER DEFAULT NULL,
+ADD IF NOT EXISTS single_use_currency "Currency" DEFAULT NULL;
|
feat
|
add extra fields in `Mandate` table and `MandateData` [Blocked on #61] (#66)
|
8a396a224d0dcdbb5759c38e20964b8a6be78c3a
|
2023-10-13 00:24:12
|
likhinbopanna
|
ci(postman): Added address update test cases (#2555)
| false
|
diff --git a/postman/collection-dir/stripe/.info.json b/postman/collection-dir/stripe/.info.json
index 4d935562e9f..876b7262991 100644
--- a/postman/collection-dir/stripe/.info.json
+++ b/postman/collection-dir/stripe/.info.json
@@ -1,9 +1,9 @@
{
"info": {
- "_postman_id": "8690e6f5-b693-42f3-a9f5-a1492faecdd6",
- "name": "stripe",
+ "_postman_id": "a553df38-fa33-4522-b029-1cd32821730e",
+ "name": "Stripe Postman Collection",
"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": "25737662"
+ "_exporter_id": "24206034"
}
}
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 e2ba5cabc4a..62945fedcfa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
@@ -20,6 +20,8 @@
"Scenario18-Bank Redirect-giropay",
"Scenario19-Bank Transfer-ach",
"Scenario19-Bank Debit-ach",
- "Scenario22-Wallet-Wechatpay"
+ "Scenario22-Wallet-Wechatpay",
+ "Scenario22- Update address and List Payment method",
+ "Scenario23- Update Amount"
]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/.meta.json
new file mode 100644
index 00000000000..cb7836d08ad
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/.meta.json
@@ -0,0 +1,10 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "List Payment Methods for a Merchant",
+ "Payments - Update",
+ "List Payment Methods for a Merchant-copy",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
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/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
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/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/event.test.js
new file mode 100644
index 00000000000..df718ec2c62
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/event.test.js
@@ -0,0 +1,37 @@
+// 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");
+});
+
+
+// Parse the response body as JSON
+var responseBody = pm.response.json();
+
+// Check if "payment_methods" array contains a "payment_method" with the value "card"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "card";
+ });
+});
+
+// Check if "payment_methods" array contains a "payment_method" with the value "ideal"
+pm.test("[GET]::/payment_methods/:merchant_id - Content Check if payment_method matches 'ideal'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "ideal";
+ });
+});
+
+// Check if "payment_methods" array contains a "payment_method" with the value "bank_redirect"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_redirect'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "bank_redirect";
+ });
+});
\ No newline at end of file
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
new file mode 100644
index 00000000000..060c693c7e1
--- /dev/null
+++ 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
@@ -0,0 +1,61 @@
+{
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "",
+ "options": {
+ "raw": {
+ "language": "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/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/event.test.js
new file mode 100644
index 00000000000..98006113bd5
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/event.test.js
@@ -0,0 +1,51 @@
+// 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");
+});
+
+// Parse the response body as JSON
+var responseBody = pm.response.json();
+
+// Check if "payment_methods" array contains a "payment_method" with the value "card"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "card";
+ });
+});
+
+// Check if "payment_methods" array contains a "payment_method" with the value "pay_later"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'pay_later'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "pay_later";
+ });
+});
+// Check if "payment_methods" array contains a "payment_method" with the value "wallet"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'wallet'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "wallet";
+ });
+});
+
+// Check if "payment_methods" array contains a "payment_method" with the value "bank_debit"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_debit'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "bank_debit";
+ });
+});
+
+// Check if "payment_methods" array contains a "payment_method" with the value "bank_transfer"
+pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_transfer'", function () {
+ var paymentMethods = responseBody.payment_methods;
+ var cardPaymentMethod = paymentMethods.find(function (method) {
+ return method.payment_method == "bank_transfer";
+ });
+});
\ No newline at end of file
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
new file mode 100644
index 00000000000..060c693c7e1
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/request.json
@@ -0,0 +1,61 @@
+{
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "",
+ "options": {
+ "raw": {
+ "language": "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/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..49977a01ab9
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/event.test.js
@@ -0,0 +1,25 @@
+// 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");
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {jsonData = pm.response.json();}catch(e){}
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+//// 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");
+})};
+
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
new file mode 100644
index 00000000000..20b99223ac4
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/request.json
@@ -0,0 +1,109 @@
+{
+ "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": "bank_redirect",
+ "payment_method_type": "ideal",
+ "payment_method_data": {
+ "bank_redirect": {
+ "ideal": {
+ "billing_details": {
+ "billing_name": "Example",
+ "email": "[email protected]"
+ },
+ "bank_name": "ing"
+ }
+ }
+ },
+ "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": 7000,
+ "currency": "USD",
+ "start_date": "2023-04-21T00:00:00Z",
+ "end_date": "2023-05-21T00:00:00Z",
+ "metadata": {
+ "frequency": "13"
+ }
+ }
+ }
+ },
+ "setup_future_usage": "off_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": "128.0.0.1"
+ }
+ }
+ },
+ "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/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/event.test.js
new file mode 100644
index 00000000000..f906d881018
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/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){}
+
+// 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.');
+};
+
+// 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.');
+};
+// 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/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
new file mode 100644
index 00000000000..785122a83c5
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json
@@ -0,0 +1,82 @@
+{
+ "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": "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"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..cccd288c0c1
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/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");
+});
+
+// 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_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");
+})};
\ No newline at end of file
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/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/Scenario22- Update address and List Payment method/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/event.test.js
new file mode 100644
index 00000000000..f6f4860c478
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/event.test.js
@@ -0,0 +1,38 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/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("[POST]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+
+// Parse the JSON response
+var jsonData = pm.response.json();
+
+// Check if the 'currency' is equal to "EUR"
+pm.test("[POST]::/payments/:id -Content Check if 'currency' matches 'EUR' ", function () {
+ pm.expect(jsonData.currency).to.eql("EUR");
+});
+
+// Extract the "country" field from the JSON data
+var country = jsonData.billing.address.country;
+
+// Check if the country is "NL"
+pm.test("[POST]::/payments/:id -Content Check if billing 'Country' matches NL (Netherlands)", function () {
+ pm.expect(country).to.equal("NL");
+});
+
+var country1 = jsonData.shipping.address.country;
+
+// Check if the country is "NL"
+pm.test("[POST]::/payments/:id -Content Check if shipping 'Country' matches NL (Netherlands)", function () {
+ pm.expect(country1).to.equal("NL");
+});
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/request.json
new file mode 100644
index 00000000000..da347e0d0bb
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/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": {
+ "currency": "EUR",
+ "shipping": {
+ "address": {
+ "line1": "1468",
+ "line2": "Koramangala ",
+ "line3": "Koramangala ",
+ "city": "Bangalore",
+ "state": "Karnataka",
+ "zip": "560065",
+ "country": "NL",
+ "first_name": "Preeetam",
+ "last_name": "Rev"
+ },
+ "phone": {
+ "number": "8796455689",
+ "country_code": "+91"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1468",
+ "line2": "Koramangala ",
+ "line3": "Koramangala ",
+ "city": "Bangalore",
+ "state": "Karnataka",
+ "zip": "560065",
+ "country": "NL",
+ "first_name": "Preeetam",
+ "last_name": "Rev"
+ },
+ "phone": {
+ "number": "8796455689",
+ "country_code": "+91"
+ }
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Update/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/.meta.json
new file mode 100644
index 00000000000..3038a1f4dd6
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Update",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..a089978fcfd
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/event.test.js
@@ -0,0 +1,36 @@
+// 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");
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {jsonData = pm.response.json();}catch(e){}
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+//// 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");
+})};
+
+
+// Check if the 'amount' is equal to "1000"
+pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '1000' ", function () {
+ pm.expect(jsonData.amount).to.eql(1000);
+});
+
+//// Response body should have value "amount_received" for "1000"
+if (jsonData?.amount_received) {
+pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '1000'", function() {
+ pm.expect(jsonData.amount_received).to.eql(1000);
+})};
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
new file mode 100644
index 00000000000..4d4486b1d43
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
@@ -0,0 +1,98 @@
+{
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "03",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "737"
+ }
+ },
+ "setup_future_usage": "off_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": "128.0.0.1"
+ }
+ }
+ },
+ "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/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/event.test.js
new file mode 100644
index 00000000000..f906d881018
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/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){}
+
+// 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.');
+};
+
+// 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.');
+};
+// 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/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json
new file mode 100644
index 00000000000..785122a83c5
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json
@@ -0,0 +1,82 @@
+{
+ "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": "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"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..af4217f7747
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/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");
+});
+
+// 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 'succeeded'", function() {
+ pm.expect(jsonData.status).to.eql("succeeded");
+})};
+
+
+// Check if the 'amount' is equal to "1000"
+pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '1000' ", function () {
+ pm.expect(jsonData.amount).to.eql(1000);
+});
+
+//// Response body should have value "amount_received" for "1000"
+if (jsonData?.amount_received) {
+pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '1000'", function() {
+ pm.expect(jsonData.amount_received).to.eql(1000);
+})};
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update 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/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/event.test.js
new file mode 100644
index 00000000000..d4d541fea8a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/event.test.js
@@ -0,0 +1,25 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/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("[POST]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+
+// Parse the JSON response
+var jsonData = pm.response.json();
+
+// Check if the 'amount' is equal to "1000"
+pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '1000' ", function () {
+ pm.expect(jsonData.amount).to.eql(1000);
+});
+
+
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/request.json
new file mode 100644
index 00000000000..813d6dc24a4
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/request.json
@@ -0,0 +1,41 @@
+{
+ "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
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Update/response.json
@@ -0,0 +1 @@
+[]
|
ci
|
Added address update test cases (#2555)
|
a7bc8c655f5b745dccd4d818ac3ceb08c3b80c0e
|
2024-01-30 16:12:01
|
Sahkal Poddar
|
refactor(payment_link): segregated payment link in html css js files, sdk over flow issue, surcharge bug, block SPM customer call for payment link (#3410)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f8d31c6e414..c856ae32795 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3496,10 +3496,12 @@ pub struct PaymentLinkStatusDetails {
pub merchant_name: String,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created: PrimitiveDateTime,
- pub intent_status: api_enums::IntentStatus,
- pub payment_link_status: PaymentLinkStatus,
+ pub status: PaymentLinkStatusWrap,
pub error_code: Option<String>,
pub error_message: Option<String>,
+ pub redirect: bool,
+ pub theme: String,
+ pub return_url: String,
}
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
@@ -3583,3 +3585,11 @@ pub enum PaymentLinkStatus {
Active,
Expired,
}
+
+#[derive(PartialEq, Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+#[serde(untagged)]
+pub enum PaymentLinkStatusWrap {
+ PaymentLinkStatus(PaymentLinkStatus),
+ IntentStatus(api_enums::IntentStatus),
+}
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index cd24e430b76..1e28d2c47f3 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -37,10 +37,12 @@ pub const X_HS_LATENCY: &str = "x-hs-latency";
pub const DEFAULT_BACKGROUND_COLOR: &str = "#212E46";
/// Default product Img Link
-pub const DEFAULT_PRODUCT_IMG: &str = "https://i.imgur.com/On3VtKF.png";
+pub const DEFAULT_PRODUCT_IMG: &str =
+ "https://live.hyperswitch.io/payment-link-assets/cart_placeholder.png";
/// Default Merchant Logo Link
-pub const DEFAULT_MERCHANT_LOGO: &str = "https://i.imgur.com/RfxPFQo.png";
+pub const DEFAULT_MERCHANT_LOGO: &str =
+ "https://live.hyperswitch.io/payment-link-assets/Merchant_placeholder.png";
/// Redirect url for Prophetpay
pub const PROPHETPAY_REDIRECT_URL: &str = "https://ccm-thirdparty.cps.golf/hp/tokenize/";
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index 84cd726a7e4..5af948bcf3e 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -1,4 +1,4 @@
-use api_models::admin as admin_types;
+use api_models::{admin as admin_types, payments::PaymentLinkStatusWrap};
use common_utils::{
consts::{
DEFAULT_BACKGROUND_COLOR, DEFAULT_MERCHANT_LOGO, DEFAULT_PRODUCT_IMG, DEFAULT_SDK_LAYOUT,
@@ -89,10 +89,24 @@ pub async fn intiate_payment_link_flow(
}
};
+ let profile_id = payment_link
+ .profile_id
+ .or(payment_intent.profile_id)
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Profile id missing in payment link and payment intent")?;
+
+ 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(),
+ })?;
+
let return_url = if let Some(payment_create_return_url) = payment_intent.return_url.clone() {
payment_create_return_url
} else {
- merchant_account
+ business_profile
.return_url
.ok_or(errors::ApiErrorResponse::MissingRequiredField {
field_name: "return_url",
@@ -121,7 +135,7 @@ pub async fn intiate_payment_link_flow(
let css_script = get_color_scheme_css(payment_link_config.clone());
let payment_link_status = check_payment_link_status(session_expiry);
- if check_payment_link_invalid_conditions(
+ let is_terminal_state = check_payment_link_invalid_conditions(
&payment_intent.status,
&[
storage_enums::IntentStatus::Cancelled,
@@ -130,9 +144,26 @@ pub async fn intiate_payment_link_flow(
storage_enums::IntentStatus::RequiresCapture,
storage_enums::IntentStatus::RequiresMerchantAction,
storage_enums::IntentStatus::Succeeded,
+ storage_enums::IntentStatus::PartiallyCaptured,
],
- ) || payment_link_status == api_models::payments::PaymentLinkStatus::Expired
+ );
+ if is_terminal_state || payment_link_status == api_models::payments::PaymentLinkStatus::Expired
{
+ let status = match payment_link_status {
+ api_models::payments::PaymentLinkStatus::Active => {
+ PaymentLinkStatusWrap::IntentStatus(payment_intent.status)
+ }
+ api_models::payments::PaymentLinkStatus::Expired => {
+ if is_terminal_state {
+ PaymentLinkStatusWrap::IntentStatus(payment_intent.status)
+ } else {
+ PaymentLinkStatusWrap::PaymentLinkStatus(
+ api_models::payments::PaymentLinkStatus::Expired,
+ )
+ }
+ }
+ };
+
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
@@ -148,12 +179,14 @@ pub async fn intiate_payment_link_flow(
currency,
payment_id: payment_intent.payment_id,
merchant_name,
- merchant_logo: payment_link_config.clone().logo,
+ merchant_logo: payment_link_config.logo.clone(),
created: payment_link.created_at,
- intent_status: payment_intent.status,
- payment_link_status,
+ status,
error_code: payment_attempt.error_code,
error_message: payment_attempt.error_message,
+ redirect: false,
+ theme: payment_link_config.theme.clone(),
+ return_url: return_url.clone(),
};
let js_script = get_js_script(
api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details),
@@ -177,11 +210,11 @@ pub async fn intiate_payment_link_flow(
session_expiry,
pub_key,
client_secret,
- merchant_logo: payment_link_config.clone().logo,
+ merchant_logo: payment_link_config.logo.clone(),
max_items_visible_after_collapse: 3,
- theme: payment_link_config.clone().theme,
+ theme: payment_link_config.theme.clone(),
merchant_description: payment_intent.description,
- sdk_layout: payment_link_config.clone().sdk_layout,
+ sdk_layout: payment_link_config.sdk_layout.clone(),
};
let js_script = get_js_script(api_models::payments::PaymentLinkData::PaymentLinkDetails(
@@ -425,3 +458,123 @@ fn check_payment_link_invalid_conditions(
) -> bool {
not_allowed_statuses.contains(intent_status)
}
+
+pub async fn get_payment_link_status(
+ state: AppState,
+ merchant_account: domain::MerchantAccount,
+ merchant_id: String,
+ payment_id: String,
+) -> RouterResponse<services::PaymentLinkFormData> {
+ let db = &*state.store;
+ let payment_intent = db
+ .find_payment_intent_by_payment_id_merchant_id(
+ &payment_id,
+ &merchant_id,
+ merchant_account.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+ let attempt_id = payment_intent.active_attempt.get_id().clone();
+ let payment_attempt = db
+ .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ &payment_intent.payment_id,
+ &merchant_id,
+ &attempt_id.clone(),
+ merchant_account.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+ let payment_link_id = payment_intent
+ .payment_link_id
+ .get_required_value("payment_link_id")
+ .change_context(errors::ApiErrorResponse::PaymentLinkNotFound)?;
+
+ let merchant_name_from_merchant_account = merchant_account
+ .merchant_name
+ .clone()
+ .map(|merchant_name| merchant_name.into_inner().peek().to_owned())
+ .unwrap_or_default();
+
+ let payment_link = db
+ .find_payment_link_by_payment_link_id(&payment_link_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentLinkNotFound)?;
+
+ let payment_link_config = if let Some(pl_config_value) = payment_link.payment_link_config {
+ extract_payment_link_config(pl_config_value)?
+ } else {
+ admin_types::PaymentLinkConfig {
+ theme: DEFAULT_BACKGROUND_COLOR.to_string(),
+ logo: DEFAULT_MERCHANT_LOGO.to_string(),
+ seller_name: merchant_name_from_merchant_account,
+ sdk_layout: DEFAULT_SDK_LAYOUT.to_owned(),
+ }
+ };
+
+ let currency =
+ payment_intent
+ .currency
+ .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "currency",
+ })?;
+
+ let amount = currency
+ .to_currency_base_unit(payment_attempt.net_amount)
+ .into_report()
+ .change_context(errors::ApiErrorResponse::CurrencyConversionFailed)?;
+
+ // converting first letter of merchant name to upperCase
+ let merchant_name = capitalize_first_char(&payment_link_config.seller_name);
+ let css_script = get_color_scheme_css(payment_link_config.clone());
+
+ let profile_id = payment_link
+ .profile_id
+ .or(payment_intent.profile_id)
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Profile id missing in payment link and payment intent")?;
+
+ 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(),
+ })?;
+
+ let return_url = if let Some(payment_create_return_url) = payment_intent.return_url.clone() {
+ payment_create_return_url
+ } else {
+ business_profile
+ .return_url
+ .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "return_url",
+ })?
+ };
+
+ let payment_details = api_models::payments::PaymentLinkStatusDetails {
+ amount,
+ currency,
+ payment_id: payment_intent.payment_id,
+ merchant_name,
+ merchant_logo: payment_link_config.logo.clone(),
+ created: payment_link.created_at,
+ status: PaymentLinkStatusWrap::IntentStatus(payment_intent.status),
+ error_code: payment_attempt.error_code,
+ error_message: payment_attempt.error_message,
+ redirect: true,
+ theme: payment_link_config.theme.clone(),
+ return_url,
+ };
+ let js_script = get_js_script(
+ api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details),
+ )?;
+ let payment_link_status_data = services::PaymentLinkStatusData {
+ js_script,
+ css_script,
+ };
+ Ok(services::ApplicationResponse::PaymenkLinkForm(Box::new(
+ services::api::PaymentLinkAction::PaymentLinkStatus(payment_link_status_data),
+ )))
+}
diff --git a/crates/router/src/core/payment_link/payment_link.html b/crates/router/src/core/payment_link/payment_link.html
deleted file mode 100644
index f6e62f8bdc8..00000000000
--- a/crates/router/src/core/payment_link/payment_link.html
+++ /dev/null
@@ -1,2130 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Payments requested by HyperSwitch</title>
- <style>
- {{ css_color_scheme }}
-
- html,
- body {
- height: 100%;
- overflow: hidden;
- }
-
- body {
- display: flex;
- flex-flow: column;
- align-items: center;
- justify-content: flex-start;
- margin: 0;
- color: #333333;
- }
-
- /* Hide scrollbar for Chrome, Safari and Opera */
- .hide-scrollbar::-webkit-scrollbar {
- display: none;
- }
-
- /* Hide scrollbar for IE, Edge and Firefox */
- .hide-scrollbar {
- -ms-overflow-style: none;
- /* IE and Edge */
- scrollbar-width: none;
- /* Firefox */
- }
-
- /* For ellipsis on text lines */
- .ellipsis-container-3 {
- height: 4em;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- text-overflow: ellipsis;
- white-space: normal;
- }
-
- .hidden {
- display: none !important;
- }
-
- .hyper-checkout {
- display: flex;
- background-color: #f8f9fb;
- color: #333333;
- width: 100%;
- height: 100%;
- overflow: scroll;
- }
-
- #hyper-footer {
- width: 100vw;
- display: flex;
- justify-content: center;
- padding: 20px 0;
- }
-
- .main {
- display: flex;
- flex-flow: column;
- justify-content: center;
- align-items: center;
- min-width: 600px;
- width: 50vw;
- }
-
- #hyper-checkout-details {
- font-family: "Montserrat";
- }
-
- .hyper-checkout-payment {
- min-width: 600px;
- box-shadow: 0px 0px 5px #d1d1d1;
- border-radius: 8px;
- background-color: #fefefe;
- }
-
- .hyper-checkout-payment-content-details {
- display: flex;
- flex-flow: column;
- justify-content: space-between;
- align-content: space-between;
- }
-
- .content-details-wrap {
- display: flex;
- flex-flow: row;
- margin: 20px 20px 30px 20px;
- justify-content: space-between;
- }
-
- .hyper-checkout-payment-price {
- font-weight: 700;
- font-size: 40px;
- height: 64px;
- display: flex;
- align-items: center;
- }
-
- #hyper-checkout-payment-merchant-details {
- margin-top: 5px;
- }
-
- .hyper-checkout-payment-merchant-name {
- font-weight: 600;
- font-size: 19px;
- }
-
- .hyper-checkout-payment-ref {
- font-size: 12px;
- margin-top: 5px;
- }
-
- .hyper-checkout-image-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- #hyper-checkout-merchant-image,
- #hyper-checkout-cart-image {
- height: 64px;
- width: 64px;
- border-radius: 4px;
- display: flex;
- align-self: flex-start;
- align-items: center;
- justify-content: center;
- }
-
- #hyper-checkout-merchant-image > img {
- height: 48px;
- width: 48px;
- }
-
- #hyper-checkout-cart-image {
- display: none;
- cursor: pointer;
- height: 60px;
- width: 60px;
- border-radius: 100px;
- background-color: #f5f5f5;
- }
-
- #hyper-checkout-payment-footer {
- margin-top: 20px;
- background-color: #f5f5f5;
- font-size: 13px;
- font-weight: 500;
- padding: 12px 20px;
- border-radius: 0 0 8px 8px;
- }
-
- #hyper-checkout-cart {
- display: flex;
- flex-flow: column;
- min-width: 600px;
- margin-top: 40px;
- max-height: 60vh;
- }
-
- #hyper-checkout-cart-items {
- max-height: 291px;
- overflow: scroll;
- transition: all 0.3s ease;
- }
-
- .hyper-checkout-cart-header {
- font-size: 15px;
- display: flex;
- flex-flow: row;
- align-items: center;
- }
-
- .hyper-checkout-cart-header > span {
- margin-left: 5px;
- font-weight: 500;
- }
-
- .cart-close {
- display: none;
- cursor: pointer;
- }
-
- .hyper-checkout-cart-item {
- display: flex;
- flex-flow: row;
- padding: 20px 0;
- font-size: 15px;
- }
-
- .hyper-checkout-cart-product-image {
- height: 56px;
- width: 56px;
- border-radius: 4px;
- }
-
- .hyper-checkout-card-item-name {
- font-weight: 500;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
-
- .hyper-checkout-card-item-quantity {
- border: 1px solid #e6e6e6;
- border-radius: 3px;
- width: max-content;
- padding: 5px 12px;
- background-color: #fafafa;
- font-size: 13px;
- font-weight: 500;
- }
-
- .hyper-checkout-cart-product-details {
- display: flex;
- flex-flow: column;
- margin-left: 15px;
- justify-content: space-between;
- width: 100%;
- }
-
- .hyper-checkout-card-item-price {
- justify-self: flex-end;
- font-weight: 600;
- font-size: 16px;
- padding-left: 30px;
- text-align: end;
- min-width: max-content;
- }
-
- .hyper-checkout-cart-item-divider {
- height: 1px;
- background-color: #e6e6e6;
- }
-
- .hyper-checkout-cart-button {
- font-size: 12px;
- font-weight: 500;
- cursor: pointer;
- align-self: flex-start;
- display: flex;
- align-content: flex-end;
- gap: 3px;
- text-decoration: none;
- transition: text-decoration 0.3s;
- margin-top: 10px;
- }
-
- .hyper-checkout-cart-button:hover {
- text-decoration: underline;
- }
-
- #hyper-checkout-merchant-description {
- font-size: 13px;
- color: #808080;
- }
-
- .powered-by-hyper {
- margin-top: 40px;
- align-self: flex-start;
- }
-
- .hyper-checkout-sdk {
- width: 50vw;
- min-width: 584px;
- z-index: 2;
- background-color: var(--primary-color);
- box-shadow: 0px 1px 10px #f2f2f2;
- display: flex;
- flex-flow: column;
- align-items: center;
- justify-content: center;
- }
-
- #payment-form-wrap {
- min-width: 300px;
- width: 30vw;
- padding: 20px;
- background-color: white;
- border-radius: 3px;
- }
-
- #hyper-checkout-sdk-header {
- padding: 10px 10px 10px 22px;
- display: flex;
- align-items: flex-start;
- justify-content: flex-start;
- border-bottom: 1px solid #f2f2f2;
- }
-
- .hyper-checkout-sdk-header-logo {
- height: 60px;
- width: 60px;
- background-color: white;
- border-radius: 2px;
- }
-
- .hyper-checkout-sdk-header-logo > img {
- height: 56px;
- width: 56px;
- margin: 2px;
- }
-
- .hyper-checkout-sdk-header-items {
- display: flex;
- flex-flow: column;
- color: white;
- font-size: 20px;
- font-weight: 700;
- }
-
- .hyper-checkout-sdk-items {
- margin-left: 10px;
- }
-
- .hyper-checkout-sdk-header-brand-name,
- .hyper-checkout-sdk-header-amount {
- font-size: 18px;
- font-weight: 600;
- display: flex;
- align-items: center;
- font-family: "Montserrat";
- justify-self: flex-start;
- }
-
- .hyper-checkout-sdk-header-amount {
- font-weight: 800;
- font-size: 25px;
- }
-
- .page-spinner {
- position: absolute;
- width: 100vw;
- height: 100vh;
- z-index: 3;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .sdk-spinner {
- width: 100%;
- height: 100%;
- z-index: 3;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .spinner {
- width: 60px;
- height: 60px;
- }
- .spinner div {
- transform-origin: 30px 30px;
- animation: spinner 1.2s linear infinite;
- }
- .spinner div:after {
- content: " ";
- display: block;
- position: absolute;
- top: 3px;
- left: 28px;
- width: 4px;
- height: 15px;
- border-radius: 20%;
- background: var(--primary-color);
- }
- .spinner div:nth-child(1) {
- transform: rotate(0deg);
- animation-delay: -1.1s;
- }
- .spinner div:nth-child(2) {
- transform: rotate(30deg);
- animation-delay: -1s;
- }
- .spinner div:nth-child(3) {
- transform: rotate(60deg);
- animation-delay: -0.9s;
- }
- .spinner div:nth-child(4) {
- transform: rotate(90deg);
- animation-delay: -0.8s;
- }
- .spinner div:nth-child(5) {
- transform: rotate(120deg);
- animation-delay: -0.7s;
- }
- .spinner div:nth-child(6) {
- transform: rotate(150deg);
- animation-delay: -0.6s;
- }
- .spinner div:nth-child(7) {
- transform: rotate(180deg);
- animation-delay: -0.5s;
- }
- .spinner div:nth-child(8) {
- transform: rotate(210deg);
- animation-delay: -0.4s;
- }
- .spinner div:nth-child(9) {
- transform: rotate(240deg);
- animation-delay: -0.3s;
- }
- .spinner div:nth-child(10) {
- transform: rotate(270deg);
- animation-delay: -0.2s;
- }
- .spinner div:nth-child(11) {
- transform: rotate(300deg);
- animation-delay: -0.1s;
- }
- .spinner div:nth-child(12) {
- transform: rotate(330deg);
- animation-delay: 0s;
- }
- @keyframes spinner {
- 0% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
-
- #hyper-checkout-status-canvas {
- width: 100%;
- height: 100%;
- justify-content: center;
- align-items: center;
- background-color: var(--primary-color);
- }
-
- .hyper-checkout-status-wrap {
- display: flex;
- flex-flow: column;
- font-family: "Montserrat";
- width: auto;
- min-width: 400px;
- background-color: white;
- border-radius: 5px;
- }
-
- #hyper-checkout-status-header {
- max-width: 1200px;
- border-radius: 3px;
- border-bottom: 1px solid #e6e6e6;
- }
-
- #hyper-checkout-status-header,
- #hyper-checkout-status-content {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 24px;
- font-weight: 600;
- padding: 15px 20px;
- }
-
- .hyper-checkout-status-amount {
- font-family: "Montserrat";
- font-size: 35px;
- font-weight: 700;
- }
-
- .hyper-checkout-status-merchant-logo {
- border: 1px solid #e6e6e6;
- border-radius: 5px;
- padding: 9px;
- height: 48px;
- width: 48px;
- }
-
- #hyper-checkout-status-content {
- height: 100%;
- flex-flow: column;
- min-height: 500px;
- align-items: center;
- justify-content: center;
- }
-
- .hyper-checkout-status-image {
- height: 200px;
- width: 200px;
- }
-
- .hyper-checkout-status-text {
- text-align: center;
- font-size: 21px;
- font-weight: 600;
- margin-top: 20px;
- }
-
- .hyper-checkout-status-message {
- text-align: center;
- font-size: 12px !important;
- margin-top: 10px;
- font-size: 14px;
- font-weight: 500;
- max-width: 400px;
- }
-
- .hyper-checkout-status-details {
- display: flex;
- flex-flow: column;
- margin-top: 20px;
- border-radius: 3px;
- border: 1px solid #e6e6e6;
- max-width: calc(100vw - 40px);
- }
-
- .hyper-checkout-status-item {
- display: flex;
- align-items: center;
- padding: 5px 10px;
- border-bottom: 1px solid #e6e6e6;
- word-wrap: break-word;
- }
-
- .hyper-checkout-status-item:last-child {
- border-bottom: 0;
- }
-
- .hyper-checkout-item-header {
- min-width: 13ch;
- font-size: 12px;
- }
-
- .hyper-checkout-item-value {
- font-size: 12px;
- overflow-x: hidden;
- overflow-y: auto;
- word-wrap: break-word;
- font-weight: 400;
- }
-
- #hyper-checkout-status-redirect-message {
- margin-top: 20px;
- font-family: "Montserrat";
- font-size: 13px;
- }
-
- @keyframes loading {
- 0% {
- -webkit-transform: rotate(0deg);
- transform: rotate(0deg);
- }
-
- 100% {
- -webkit-transform: rotate(360deg);
- transform: rotate(360deg);
- }
- }
-
- @keyframes slide-from-right {
- from {
- right: -582px;
- }
- to {
- right: 0;
- }
- }
-
- @keyframes slide-to-right {
- from {
- right: 0;
- }
- to {
- right: -582px;
- }
- }
-
- #payment-message {
- font-size: 12px;
- font-weight: 500;
- padding: 2%;
- color: #ff0000;
- font-family: "Montserrat";
- }
-
- #payment-form {
- max-width: 560px;
- width: 100%;
- margin: 0 auto;
- text-align: center;
- }
-
- #submit {
- cursor: pointer;
- margin-top: 20px;
- width: 100%;
- height: 38px;
- background-color: var(--primary-color);
- border: 0;
- border-radius: 4px;
- font-size: 18px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- #submit.disabled {
- cursor: not-allowed;
- }
-
- #submit-spinner {
- width: 28px;
- height: 28px;
- border: 4px solid #fff;
- border-bottom-color: #ff3d00;
- border-radius: 50%;
- display: inline-block;
- box-sizing: border-box;
- animation: loading 1s linear infinite;
- }
-
- @media only screen and (max-width: 1400px) {
- body {
- overflow-y: scroll;
- }
-
- .hyper-checkout {
- flex-flow: column;
- margin: 0;
- height: auto;
- overflow: visible;
- }
-
- #hyper-checkout-payment-merchant-details {
- margin-top: 20px;
- }
-
- .main {
- width: auto;
- min-width: 300px;
- }
-
- .hyper-checkout-payment {
- min-width: 300px;
- width: calc(100vw - 50px);
- margin: 0;
- padding: 25px;
- border: 0;
- border-radius: 0;
- background-color: var(--primary-color);
- display: flex;
- flex-flow: column;
- justify-self: flex-start;
- align-self: flex-start;
- }
-
- .hyper-checkout-payment-content-details {
- max-width: 520px;
- width: 100%;
- align-self: center;
- margin-bottom: 0;
- }
-
- .content-details-wrap {
- flex-flow: column;
- flex-direction: column-reverse;
- margin: 0;
- }
-
- #hyper-checkout-merchant-image {
- background-color: white;
- }
-
- #hyper-checkout-cart-image {
- display: flex;
- }
-
- .hyper-checkout-payment-price {
- font-size: 48px;
- margin-top: 20px;
- }
-
- .hyper-checkout-payment-merchant-name {
- font-size: 18px;
- }
-
- #hyper-checkout-payment-footer {
- border-radius: 50px;
- width: max-content;
- padding: 10px 20px;
- }
-
- #hyper-checkout-cart {
- position: absolute;
- top: 0;
- right: 0;
- z-index: 100;
- margin: 0;
- min-width: 300px;
- max-width: 582px;
- max-height: 100vh;
- width: 100vw;
- height: 100vh;
- background-color: #f5f5f5;
- box-shadow: 0px 10px 10px #aeaeae;
- right: 0px;
- animation: slide-from-right 0.3s linear;
- }
-
- .hyper-checkout-cart-header {
- margin: 10px 0 0 10px;
- }
-
- .cart-close {
- margin: 0 10px 0 auto;
- display: inline;
- }
-
- #hyper-checkout-cart-items {
- margin: 20px 20px 0 20px;
- padding: 0;
- }
-
- .hyper-checkout-cart-button {
- margin: 10px;
- text-align: right;
- }
-
- .powered-by-hyper {
- display: none;
- }
-
- #hyper-checkout-sdk {
- background-color: transparent;
- width: auto;
- min-width: 300px;
- box-shadow: none;
- }
-
- #payment-form-wrap {
- min-width: 300px;
- width: calc(100vw - 40px);
- margin: 0;
- padding: 25px 20px;
- }
-
- #hyper-checkout-status-canvas {
- background-color: #fefefe;
- }
-
- .hyper-checkout-status-wrap {
- min-width: 100vw;
- width: 100vw;
- }
-
- #hyper-checkout-status-header {
- max-width: calc(100% - 40px);
- }
- }
- </style>
- <link
- rel="stylesheet"
- href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
- />
- </head>
- <body class="hide-scrollbar">
- <!-- SVG ICONS -->
- <svg xmlns="http://www.w3.org/2000/svg" display="none">
- <defs>
- <symbol id="cart-icon-small">
- <mask
- id="mask0_1_13"
- style="mask-type: luminance"
- maskUnits="userSpaceOnUse"
- x="0"
- y="0"
- width="16"
- height="16"
- >
- <path d="M16 0H0V16H16V0Z" fill="white"></path>
- </mask>
- <g mask="url(#mask0_1_13)">
- <mask
- id="mask1_1_13"
- style="mask-type: alpha"
- maskUnits="userSpaceOnUse"
- x="0"
- y="0"
- width="16"
- height="16"
- >
- <path d="M16 0H0V16H16V0Z" fill="#D9D9D9"></path>
- </mask>
- <g mask="url(#mask1_1_13)">
- <path
- d="M3.53716 14.3331C3.20469 14.3331 2.92071 14.2153 2.68525 13.9798C2.44977 13.7444 2.33203 13.4604 2.33203 13.1279V5.53823C2.33203 5.20575 2.44977 4.92178 2.68525 4.68631C2.92071 4.45083 3.20469 4.3331 3.53716 4.3331H4.9987C4.9987 3.50063 5.29058 2.79252 5.87433 2.20876C6.4581 1.62501 7.16621 1.33313 7.99868 1.33313C8.83115 1.33313 9.53927 1.62501 10.123 2.20876C10.7068 2.79252 10.9987 3.50063 10.9987 4.3331H12.4602C12.7927 4.3331 13.0766 4.45083 13.3121 4.68631C13.5476 4.92178 13.6653 5.20575 13.6653 5.53823V13.1279C13.6653 13.4604 13.5476 13.7444 13.3121 13.9798C13.0766 14.2153 12.7927 14.3331 12.4602 14.3331H3.53716ZM3.53716 13.3331H12.4602C12.5115 13.3331 12.5585 13.3117 12.6012 13.269C12.644 13.2262 12.6653 13.1792 12.6653 13.1279V5.53823C12.6653 5.48694 12.644 5.43992 12.6012 5.39718C12.5585 5.35445 12.5115 5.33308 12.4602 5.33308H3.53716C3.48588 5.33308 3.43886 5.35445 3.39611 5.39718C3.35338 5.43992 3.33201 5.48694 3.33201 5.53823V13.1279C3.33201 13.1792 3.35338 13.2262 3.39611 13.269C3.43886 13.3117 3.48588 13.3331 3.53716 13.3331ZM7.99868 8.99973C8.83115 8.99973 9.53927 8.70785 10.123 8.1241C10.7068 7.54033 10.9987 6.83221 10.9987 5.99975H9.99868C9.99868 6.5553 9.80424 7.02752 9.41535 7.41641C9.02646 7.8053 8.55424 7.99975 7.99868 7.99975C7.44313 7.99975 6.9709 7.8053 6.58202 7.41641C6.19313 7.02752 5.99868 6.5553 5.99868 5.99975H4.9987C4.9987 6.83221 5.29058 7.54033 5.87433 8.1241C6.4581 8.70785 7.16621 8.99973 7.99868 8.99973ZM5.99868 4.3331H9.99868C9.99868 3.77754 9.80424 3.30532 9.41535 2.91643C9.02646 2.52754 8.55424 2.3331 7.99868 2.3331C7.44313 2.3331 6.9709 2.52754 6.58202 2.91643C6.19313 3.30532 5.99868 3.77754 5.99868 4.3331Z"
- fill="#333333"
- ></path>
- </g>
- </g>
- </symbol>
- <symbol id="cart-icon-big">
- <mask
- id="mask0_1_14"
- style="mask-type: luminance"
- maskUnits="userSpaceOnUse"
- x="0"
- y="0"
- width="30"
- height="30"
- >
- <path d="M30 0H0V30H30V0Z" fill="white"></path>
- </mask>
- <g mask="url(#mask0_1_14)">
- <mask
- id="mask1_1_14"
- style="mask-type: alpha"
- maskUnits="userSpaceOnUse"
- x="0"
- y="0"
- width="30"
- height="30"
- >
- <path d="M30 0H0V30H30V0Z" fill="#D9D9D9"></path>
- </mask>
- <g mask="url(#mask1_1_14)">
- <path
- d="M6.63218 26.8746C6.0088 26.8746 5.47633 26.6537 5.03485 26.2121C4.59332 25.7708 4.37256 25.2383 4.37256 24.6148V10.3842C4.37256 9.76078 4.59332 9.22834 5.03485 8.78683C5.47633 8.34531 6.0088 8.12456 6.63218 8.12456H9.37257C9.37257 6.56368 9.91984 5.23597 11.0144 4.14142C12.1089 3.04689 13.4366 2.49962 14.9975 2.49962C16.5584 2.49962 17.8861 3.04689 18.9806 4.14142C20.0753 5.23597 20.6226 6.56368 20.6226 8.12456H23.3629C23.9863 8.12456 24.5186 8.34531 24.9602 8.78683C25.4018 9.22834 25.6224 9.76078 25.6224 10.3842V24.6148C25.6224 25.2383 25.4018 25.7708 24.9602 26.2121C24.5186 26.6537 23.9863 26.8746 23.3629 26.8746H6.63218ZM6.63218 24.9996H23.3629C23.4591 24.9996 23.5472 24.9594 23.6273 24.8794C23.7075 24.7991 23.7474 24.711 23.7474 24.6148V10.3842C23.7474 10.288 23.7075 10.1999 23.6273 10.1197C23.5472 10.0396 23.4591 9.99952 23.3629 9.99952H6.63218C6.53603 9.99952 6.44786 10.0396 6.36771 10.1197C6.28759 10.1999 6.24752 10.288 6.24752 10.3842V24.6148C6.24752 24.711 6.28759 24.7991 6.36771 24.8794C6.44786 24.9594 6.53603 24.9996 6.63218 24.9996ZM14.9975 16.8745C16.5584 16.8745 17.8861 16.3272 18.9806 15.2327C20.0753 14.1381 20.6226 12.8104 20.6226 11.2495H18.7475C18.7475 12.2912 18.383 13.1766 17.6538 13.9058C16.9246 14.6349 16.0392 14.9995 14.9975 14.9995C13.9559 14.9995 13.0704 14.6349 12.3413 13.9058C11.6121 13.1766 11.2475 12.2912 11.2475 11.2495H9.37257C9.37257 12.8104 9.91984 14.1381 11.0144 15.2327C12.1089 16.3272 13.4366 16.8745 14.9975 16.8745ZM11.2475 8.12456H18.7475C18.7475 7.08289 18.383 6.19747 17.6538 5.46831C16.9246 4.73914 16.0392 4.37456 14.9975 4.37456C13.9559 4.37456 13.0704 4.73914 12.3413 5.46831C11.6121 6.19747 11.2475 7.08289 11.2475 8.12456Z"
- fill="#333333"
- ></path>
- </g>
- </g>
- </symbol>
- <symbol id="cart-close">
- <path
- d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"
- ></path>
- </symbol>
- <symbol id="hyperswitch-brand">
- <path
- opacity="0.4"
- d="M0.791016 11.7578H1.64062V9.16992H1.71875C2.00684 9.73145 2.63672 10.0928 3.35938 10.0928C4.69727 10.0928 5.56641 9.02344 5.56641 7.37305V7.36328C5.56641 5.72266 4.69238 4.64355 3.35938 4.64355C2.62695 4.64355 2.04102 4.99023 1.71875 5.57617H1.64062V4.73633H0.791016V11.7578ZM3.16406 9.34082C2.20703 9.34082 1.62109 8.58887 1.62109 7.37305V7.36328C1.62109 6.14746 2.20703 5.39551 3.16406 5.39551C4.12598 5.39551 4.69727 6.1377 4.69727 7.36328V7.37305C4.69727 8.59863 4.12598 9.34082 3.16406 9.34082ZM8.85762 10.0928C10.3566 10.0928 11.2844 9.05762 11.2844 7.37305V7.36328C11.2844 5.67383 10.3566 4.64355 8.85762 4.64355C7.35859 4.64355 6.43086 5.67383 6.43086 7.36328V7.37305C6.43086 9.05762 7.35859 10.0928 8.85762 10.0928ZM8.85762 9.34082C7.86152 9.34082 7.3 8.61328 7.3 7.37305V7.36328C7.3 6.11816 7.86152 5.39551 8.85762 5.39551C9.85371 5.39551 10.4152 6.11816 10.4152 7.36328V7.37305C10.4152 8.61328 9.85371 9.34082 8.85762 9.34082ZM13.223 10H14.0727L15.2445 5.92773H15.3227L16.4994 10H17.3539L18.8285 4.73633H17.9838L16.9486 8.94531H16.8705L15.6938 4.73633H14.8881L13.7113 8.94531H13.6332L12.598 4.73633H11.7484L13.223 10ZM21.7047 10.0928C22.9449 10.0928 23.6969 9.38965 23.8775 8.67676L23.8873 8.6377H23.0377L23.0182 8.68164C22.8766 8.99902 22.4371 9.33594 21.7242 9.33594C20.7867 9.33594 20.1861 8.70117 20.1617 7.6123H23.9508V7.28027C23.9508 5.70801 23.0816 4.64355 21.651 4.64355C20.2203 4.64355 19.2926 5.75684 19.2926 7.38281V7.3877C19.2926 9.03809 20.2008 10.0928 21.7047 10.0928ZM21.6461 5.40039C22.4225 5.40039 22.9986 5.89355 23.0865 6.93359H20.1764C20.2691 5.93262 20.8648 5.40039 21.6461 5.40039ZM25.0691 10H25.9188V6.73828C25.9188 5.9668 26.4949 5.4541 27.3055 5.4541C27.491 5.4541 27.6521 5.47363 27.8279 5.50293V4.67773C27.7449 4.66309 27.5643 4.64355 27.4031 4.64355C26.6902 4.64355 26.1971 4.96582 25.9969 5.51758H25.9188V4.73633H25.0691V10ZM30.6797 10.0928C31.9199 10.0928 32.6719 9.38965 32.8525 8.67676L32.8623 8.6377H32.0127L31.9932 8.68164C31.8516 8.99902 31.4121 9.33594 30.6992 9.33594C29.7617 9.33594 29.1611 8.70117 29.1367 7.6123H32.9258V7.28027C32.9258 5.70801 32.0566 4.64355 30.626 4.64355C29.1953 4.64355 28.2676 5.75684 28.2676 7.38281V7.3877C28.2676 9.03809 29.1758 10.0928 30.6797 10.0928ZM30.6211 5.40039C31.3975 5.40039 31.9736 5.89355 32.0615 6.93359H29.1514C29.2441 5.93262 29.8398 5.40039 30.6211 5.40039ZM35.9875 10.0928C36.7199 10.0928 37.3059 9.74609 37.6281 9.16016H37.7062V10H38.5559V2.64648H37.7062V5.56641H37.6281C37.34 5.00488 36.7102 4.64355 35.9875 4.64355C34.6496 4.64355 33.7805 5.71289 33.7805 7.36328V7.37305C33.7805 9.01367 34.6545 10.0928 35.9875 10.0928ZM36.1828 9.34082C35.2209 9.34082 34.6496 8.59863 34.6496 7.37305V7.36328C34.6496 6.1377 35.2209 5.39551 36.1828 5.39551C37.1398 5.39551 37.7258 6.14746 37.7258 7.36328V7.37305C37.7258 8.58887 37.1398 9.34082 36.1828 9.34082ZM45.2164 10.0928C46.5494 10.0928 47.4234 9.01367 47.4234 7.37305V7.36328C47.4234 5.71289 46.5543 4.64355 45.2164 4.64355C44.4938 4.64355 43.8639 5.00488 43.5758 5.56641H43.4977V2.64648H42.648V10H43.4977V9.16016H43.5758C43.898 9.74609 44.484 10.0928 45.2164 10.0928ZM45.0211 9.34082C44.0641 9.34082 43.4781 8.58887 43.4781 7.37305V7.36328C43.4781 6.14746 44.0641 5.39551 45.0211 5.39551C45.983 5.39551 46.5543 6.1377 46.5543 7.36328V7.37305C46.5543 8.59863 45.983 9.34082 45.0211 9.34082ZM48.7957 11.8457C49.7283 11.8457 50.1629 11.5039 50.5975 10.3223L52.6531 4.73633H51.7596L50.3191 9.06738H50.241L48.7957 4.73633H47.8875L49.8357 10.0049L49.7381 10.3174C49.5477 10.9229 49.2547 11.1426 48.7713 11.1426C48.6541 11.1426 48.5223 11.1377 48.4197 11.1182V11.8164C48.5369 11.8359 48.6834 11.8457 48.7957 11.8457Z"
- fill="currentColor"
- ></path>
- <g opacity="0.6">
- <path
- d="M78.42 6.9958C78.42 9.15638 77.085 10.4444 75.2379 10.4444C74.2164 10.4444 73.3269 10.0276 72.9206 9.33816V12.9166H71.4929V3.65235H72.8018L72.9193 4.66772C73.3256 3.97825 74.189 3.5225 75.2366 3.5225C77.017 3.5225 78.4186 4.75861 78.4186 6.9971L78.42 6.9958ZM76.94 6.9958C76.94 5.62985 76.1288 4.78328 74.9492 4.78328C73.8232 4.77029 72.9598 5.62855 72.9598 7.00878C72.9598 8.38901 73.8246 9.18235 74.9492 9.18235C76.0739 9.18235 76.94 8.36304 76.94 6.9958Z"
- fill="currentColor"
- ></path>
- <path
- d="M86.0132 7.3736H80.8809C80.9071 8.62268 81.7313 9.2732 82.7789 9.2732C83.564 9.2732 84.2197 8.90834 84.494 8.17992H85.9479C85.5939 9.53288 84.3895 10.4444 82.7528 10.4444C80.749 10.4444 79.4271 9.06545 79.4271 6.96978C79.4271 4.87412 80.749 3.50818 82.7397 3.50818C84.7305 3.50818 86.0132 4.83517 86.0132 6.83994V7.3736ZM80.894 6.38419H84.5594C84.481 5.226 83.709 4.6404 82.7397 4.6404C81.7705 4.6404 80.9985 5.226 80.894 6.38419Z"
- fill="currentColor"
- ></path>
- <path
- d="M88.5407 3.65204C87.8745 3.65204 87.335 4.18829 87.335 4.85048V10.3156H88.7758V5.22703C88.7758 5.06213 88.9104 4.92709 89.0776 4.92709H91.2773V3.65204H88.5407Z"
- fill="currentColor"
- ></path>
- <path
- d="M69.1899 3.63908L67.3442 9.17039L65.3535 3.65207H63.8082L66.3606 10.2247C66.439 10.4325 66.4782 10.6026 66.4782 10.7713C66.4782 10.8635 66.469 10.9479 66.4533 11.0258L66.4494 11.0401C66.4403 11.0817 66.4298 11.1206 66.4168 11.1583L66.3201 11.5102C66.2966 11.5971 66.2169 11.6569 66.1268 11.6569H64.0956V12.9189H65.5755C66.5709 12.9189 67.3952 12.6852 67.8667 11.3829L70.6817 3.65207L69.1886 3.63908H69.1899Z"
- fill="currentColor"
- ></path>
- <path
- d="M57 10.3144H58.4264V6.72299C58.4264 5.60375 59.0417 4.82339 60.1807 4.82339C61.1761 4.81041 61.7913 5.396 61.7913 6.68404V10.3144H63.2191V6.46201C63.2191 4.18457 61.8188 3.50809 60.5478 3.50809C59.5785 3.50809 58.8196 3.88593 58.4264 4.51047V0.919022H57V10.3144Z"
- fill="currentColor"
- ></path>
- <path
- d="M93.1623 8.29808C93.1753 8.98755 93.8167 9.39136 94.6945 9.39136C95.5723 9.39136 96.0948 9.06545 96.0948 8.47986C96.0948 7.97218 95.8336 7.69951 95.0733 7.58135L93.7253 7.34763C92.4164 7.1269 91.9057 6.44912 91.9057 5.49997C91.9057 4.30282 93.097 3.52246 94.6161 3.52246C96.2529 3.52246 97.4442 4.30282 97.4572 5.63111H96.0439C96.0308 4.95463 95.4417 4.57679 94.6174 4.57679C93.7932 4.57679 93.3347 4.90269 93.3347 5.44933C93.3347 5.93105 93.6756 6.15178 94.4215 6.28162L95.7434 6.51534C96.987 6.73607 97.563 7.34763 97.563 8.35002C97.563 9.72895 96.2803 10.4457 94.722 10.4457C92.9546 10.4457 91.7633 9.60041 91.7372 8.29808H93.1649H93.1623Z"
- fill="currentColor"
- ></path>
- <path
- d="M100.808 8.75352L102.327 3.652H103.82L105.313 8.75352L106.583 3.652H108.089L106.191 10.3155H104.58L103.061 5.23997L101.529 10.3155H99.9052L97.9941 3.652H99.5002L100.809 8.75352H100.808Z"
- fill="currentColor"
- ></path>
- <path
- d="M108.926 0.918945H110.511V2.40305H108.926V0.918945ZM109.005 3.65214H110.431V10.3157H109.005V3.65214Z"
- fill="currentColor"
- ></path>
- <path
- d="M119.504 4.7452C118.391 4.7452 117.632 5.55152 117.632 6.9707C117.632 8.46779 118.417 9.19621 119.465 9.19621C120.302 9.19621 120.919 8.72748 121.193 7.84325H122.712C122.371 9.45719 121.141 10.4466 119.491 10.4466C117.502 10.4466 116.165 9.06767 116.165 6.972C116.165 4.87634 117.5 3.51039 119.504 3.51039C121.141 3.51039 122.358 4.43487 122.712 6.04752H121.167C120.932 5.21523 120.289 4.7465 119.504 4.7465V4.7452Z"
- fill="currentColor"
- ></path>
- <path
- d="M113.959 9.05208C113.875 9.05208 113.809 8.98456 113.809 8.90276V4.91399H115.367V3.65191H113.809V1.86787H112.382V3.02607C112.382 3.44287 112.252 3.65062 111.833 3.65062H111.256V4.91269H112.382V8.50414C112.382 9.66234 113.024 10.3128 114.189 10.3128H115.354V9.05078H113.96L113.959 9.05208Z"
- fill="currentColor"
- ></path>
- <path
- d="M127.329 3.50801C126.359 3.50801 125.601 3.88585 125.207 4.5104V0.918945H123.781V10.3144H125.207V6.72292C125.207 5.60367 125.823 4.82332 126.962 4.82332C127.957 4.81033 128.572 5.39592 128.572 6.68397V10.3144H130V6.46193C130 4.18449 128.6 3.50801 127.329 3.50801Z"
- fill="currentColor"
- ></path>
- </g>
- </symbol>
- <symbol id="arrow-down">
- <svg
- width="16"
- height="16"
- viewBox="0 0 16 16"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M8.20573 11.0351C8.33593 11.0351 8.45573 10.9831 8.54948 10.8841L12.5911 6.75911C12.6797 6.66536 12.7266 6.55078 12.7266 6.41536C12.7266 6.14974 12.5234 5.94141 12.2526 5.94141C12.1224 5.94141 12.0026 5.99349 11.9141 6.07682L8.20573 9.86848L4.4974 6.07682C4.40887 5.99349 4.29429 5.94141 4.15882 5.94141C3.88798 5.94141 3.68486 6.14974 3.68486 6.41536C3.68486 6.55078 3.7318 6.66536 3.82549 6.75911L7.86198 10.8841C7.96094 10.9831 8.07551 11.0351 8.20573 11.0351Z"
- fill="#333333"
- ></path>
- </svg>
- </symbol>
- <symbol id="arrow-up">
- <svg
- width="16"
- height="16"
- viewBox="0 0 16 16"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M7.79427 4.96485C7.66407 4.96485 7.54427 5.01694 7.45052 5.11587L3.40886 9.24089C3.32032 9.33464 3.27344 9.44922 3.27344 9.58464C3.27344 9.85026 3.47657 10.0586 3.7474 10.0586C3.87761 10.0586 3.9974 10.0065 4.08594 9.92318L7.79427 6.13152L11.5026 9.92318C11.5911 10.0065 11.7057 10.0586 11.8412 10.0586C12.112 10.0586 12.3151 9.85026 12.3151 9.58464C12.3151 9.44922 12.2682 9.33464 12.1745 9.24089L8.13802 5.11587C8.03906 5.01694 7.92449 4.96485 7.79427 4.96485Z"
- fill="#333333"
- ></path>
- </svg>
- </symbol>
- </defs>
- </svg>
- <div id="page-spinner" class="page-spinner hidden">
- <div class="spinner">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- </div>
- <div class="hyper-checkout hide-scrollbar">
- <div class="main hidden" id="hyper-checkout-status-canvas">
- <div class="hyper-checkout-status-wrap">
- <div id="hyper-checkout-status-header"></div>
- <div id="hyper-checkout-status-content"></div>
- </div>
- <div id="hyper-checkout-status-redirect-message"></div>
- </div>
- <div class="main" id="hyper-checkout-details">
- <div id="hyper-checkout-payment" class="hyper-checkout-payment">
- <div class="hyper-checkout-payment-content-details">
- <div class="content-details-wrap">
- <div id="hyper-checkout-payment-context">
- <div id="hyper-checkout-payment-merchant-details"></div>
- </div>
- <div class="hyper-checkout-image-header">
- <div id="hyper-checkout-merchant-image"></div>
- <div
- id="hyper-checkout-cart-image"
- onclick="viewCartInMobileView()"
- >
- <svg
- width="30"
- height="30"
- viewBox="0 0 30 30"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- class="cart-icon"
- >
- <use
- xlink:href="#cart-icon-big"
- x="0"
- y="0"
- width="30"
- height="30"
- ></use>
- </svg>
- </div>
- </div>
- </div>
- <div id="hyper-checkout-payment-footer"></div>
- </div>
- </div>
- <div id="hyper-checkout-cart" class="">
- <div
- id="hyper-checkout-cart-header"
- class="hyper-checkout-cart-header"
- >
- <svg
- width="16"
- height="16"
- viewBox="0 0 16 16"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- class="cart-icon"
- >
- <use
- xlink:href="#cart-icon-small"
- x="0"
- y="0"
- width="16"
- height="16"
- ></use>
- </svg>
- <span>Your Cart</span>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 50 50"
- width="25"
- height="25"
- class="cart-close"
- onclick="hideCartInMobileView()"
- >
- <use
- xlink:href="#cart-close"
- x="0"
- y="0"
- width="50"
- height="50"
- ></use>
- </svg>
- </div>
- <div id="hyper-checkout-cart-items" class="hide-scrollbar"></div>
- <div id="hyper-checkout-merchant-description"></div>
- <div class="powered-by-hyper">
- <svg class="fill-current" height="18" width="130">
- <use
- xlink:href="#hyperswitch-brand"
- x="0"
- y="0"
- height="18"
- width="130"
- ></use>
- </svg>
- </div>
- </div>
- </div>
- <div class="hyper-checkout-sdk" id="hyper-checkout-sdk">
- <div id="payment-form-wrap">
- <div id="sdk-spinner" class="sdk-spinner">
- <div class="spinner">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- </div>
- <form id="payment-form" onclick="handleSubmit(); return false;">
- <div id="unified-checkout"></div>
- <button id="submit" class="hidden">
- <span id="submit-spinner" class="hidden"></span>
- <span id="submit-button-text">Pay now</span>
- </button>
- <div id="payment-message" class="hidden"></div>
- </form>
- </div>
- </div>
- </div>
- <div id="hyper-footer" class="hidden">
- <svg class="fill-current" height="18" width="130">
- <use
- xlink:href="#hyperswitch-brand"
- x="0"
- y="0"
- height="18"
- width="130"
- ></use>
- </svg>
- </div>
-
- <script>
- {{ payment_details_js_script }}
-
- window.state = {
- prevHeight: window.innerHeight,
- prevWidth: window.innerWidth,
- isMobileView: window.innerWidth <= 1400,
- currentScreen: "payment_link",
- };
-
- var widgets = null;
- var unifiedCheckout = null;
- var pub_key = window.__PAYMENT_DETAILS.pub_key;
- var hyper = null;
-
- // Boot functions
- function boot() {
- // Update HTML doc
- var paymentDetails = window.__PAYMENT_DETAILS;
-
- if (paymentDetails.merchant_name) {
- document.title =
- "Payment requested by " + paymentDetails.merchant_name;
- }
-
- if (paymentDetails.merchant_logo) {
- var link = document.createElement("link");
- link.rel = "icon";
- link.href = paymentDetails.merchant_logo;
- link.type = "image/x-icon";
- document.head.appendChild(link);
- }
-
- // Render UI
- renderPaymentDetails(paymentDetails);
- renderSDKHeader(paymentDetails);
- renderCart(paymentDetails);
-
- // Deal w loaders
- show("#sdk-spinner");
- hide("#page-spinner");
- hide("#unified-checkout");
-
- // Add event listeners
- initializeEventListeners(paymentDetails);
-
- // Initialize SDK
- if (window.Hyper) {
- initializeSDK();
- }
-
- // State specific functions
- if (window.state.isMobileView) {
- show("#hyper-footer");
- hide("#hyper-checkout-cart");
- } else {
- show("#hyper-checkout-cart");
- }
- }
- boot();
-
- function initializeEventListeners(paymentDetails) {
- var primaryColor = paymentDetails.theme;
- var lighterColor = adjustLightness(primaryColor, 1.4);
- var darkerColor = adjustLightness(primaryColor, 0.8);
- var contrastBWColor = invert(primaryColor, true);
- var contrastingTone =
- Array.isArray(a) && a.length > 4 ? darkerColor : lighterColor;
- var hyperCheckoutNode = document.getElementById(
- "hyper-checkout-payment"
- );
- var hyperCheckoutCartImageNode = document.getElementById(
- "hyper-checkout-cart-image"
- );
- var hyperCheckoutFooterNode = document.getElementById(
- "hyper-checkout-payment-footer"
- );
- var statusRedirectTextNode = document.getElementById(
- "hyper-checkout-status-redirect-message"
- );
- var submitButtonNode = document.getElementById("submit");
- var submitButtonLoaderNode = document.getElementById("submit-spinner");
-
- if (submitButtonLoaderNode instanceof HTMLSpanElement) {
- submitButtonLoaderNode.style.borderBottomColor = contrastingTone;
- }
-
- if (submitButtonNode instanceof HTMLButtonElement) {
- submitButtonNode.style.color = contrastBWColor;
- }
-
- if (hyperCheckoutCartImageNode instanceof HTMLDivElement) {
- hyperCheckoutCartImageNode.style.backgroundColor = contrastingTone;
- }
-
- if (window.innerWidth <= 1400) {
- statusRedirectTextNode.style.color = "#333333";
- hyperCheckoutNode.style.color = contrastBWColor;
- var a = lighterColor.match(/[fF]/gi);
- hyperCheckoutFooterNode.style.backgroundColor = contrastingTone;
- } else if (window.innerWidth > 1400) {
- statusRedirectTextNode.style.color = contrastBWColor;
- hyperCheckoutNode.style.color = "#333333";
- hyperCheckoutFooterNode.style.backgroundColor = "#F5F5F5";
- }
-
- window.addEventListener("resize", function (event) {
- var currentHeight = window.innerHeight;
- var currentWidth = window.innerWidth;
- if (currentWidth <= 1400 && window.state.prevWidth > 1400) {
- hide("#hyper-checkout-cart");
- if (window.state.currentScreen === "payment_link") {
- show("#hyper-footer");
- }
- try {
- statusRedirectTextNode.style.color = "#333333";
- hyperCheckoutNode.style.color = contrastBWColor;
- hyperCheckoutFooterNode.style.backgroundColor = lighterColor;
- } catch (error) {
- console.error(
- "Failed to fetch primary-color, using default",
- error
- );
- }
- } else if (currentWidth > 1400 && window.state.prevWidth <= 1400) {
- if (window.state.currentScreen === "payment_link") {
- hide("#hyper-footer");
- }
- show("#hyper-checkout-cart");
- try {
- statusRedirectTextNode.style.color = contrastBWColor;
- hyperCheckoutNode.style.color = "#333333";
- hyperCheckoutFooterNode.style.backgroundColor = "#F5F5F5";
- } catch (error) {
- console.error("Failed to revert back to default colors", error);
- }
- }
-
- window.state.prevHeight = currentHeight;
- window.state.prevWidth = currentWidth;
- window.state.isMobileView = currentWidth <= 1400;
- });
- }
-
- function showSDK(paymentDetails) {
- checkStatus(paymentDetails)
- .then(function (res) {
- if (res.showSdk) {
- show("#hyper-checkout-sdk");
- show("#hyper-checkout-details");
- show("#submit");
- } else {
- hide("#hyper-checkout-details");
- hide("#hyper-checkout-sdk");
- show("#hyper-checkout-status-canvas");
- hide("#hyper-footer");
- window.state.currentScreen = "status";
- }
- show("#unified-checkout");
- hide("#sdk-spinner");
- })
- .catch(function (err) {
- console.error("Failed to check status", err);
- });
- }
-
- function initializeSDK() {
- var paymentDetails = window.__PAYMENT_DETAILS;
- var client_secret = paymentDetails.client_secret;
- var appearance = {
- variables: {
- colorPrimary: paymentDetails.theme || "rgb(0, 109, 249)",
- fontFamily: "Work Sans, sans-serif",
- fontSizeBase: "16px",
- colorText: "rgb(51, 65, 85)",
- colorTextSecondary: "#334155B3",
- colorPrimaryText: "rgb(51, 65, 85)",
- colorTextPlaceholder: "#33415550",
- borderColor: "#33415550",
- colorBackground: "rgb(255, 255, 255)",
- },
- };
- hyper = window.Hyper(pub_key, { isPreloadEnabled: false });
- widgets = hyper.widgets({
- appearance: appearance,
- clientSecret: client_secret,
- });
- var type = (paymentDetails.sdk_layout === "spaced_accordion" || paymentDetails.sdk_layout === "accordion")
- ? "accordion"
- : paymentDetails.sdk_layout;
-
- var unifiedCheckoutOptions = {
- layout: {
- type: type, //accordion , tabs, spaced accordion
- spacedAccordionItems: paymentDetails.sdk_layout === "spaced_accordion"
- },
- branding: "never",
- wallets: {
- walletReturnUrl: paymentDetails.return_url,
- style: {
- theme: "dark",
- type: "default",
- height: 55,
- },
- },
- };
- unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions);
- mountUnifiedCheckout("#unified-checkout");
- showSDK(paymentDetails);
- }
-
- // Util functions
- function mountUnifiedCheckout(id) {
- if (unifiedCheckout !== null) {
- unifiedCheckout.mount(id);
- }
- }
-
- function handleSubmit(e) {
- var paymentDetails = window.__PAYMENT_DETAILS;
-
- // Update button loader
- hide("#submit-button-text");
- show("#submit-spinner");
- var submitButtonNode = document.getElementById("submit");
- submitButtonNode.disabled = true;
- submitButtonNode.classList.add("disabled");
-
- hyper
- .confirmPayment({
- widgets: widgets,
- confirmParams: {
- // Make sure to change this to your payment completion page
- return_url: paymentDetails.return_url,
- },
- })
- .then(function (result) {
- var error = result.error;
- if (error) {
- if (error.type === "validation_error") {
- showMessage(error.message);
- } else {
- showMessage("An unexpected error occurred.");
- }
- } else {
- // This point will only be reached if there is an immediate error occurring while confirming the payment. Otherwise, your customer will be redirected to your 'return_url'.
- // For some payment flows such as Sofort, iDEAL, your customer will be redirected to an intermediate page to complete authorization of the payment, and then redirected to the 'return_url'.
- hyper
- .retrievePaymentIntent(paymentDetails.client_secret)
- .then(function (result) {
- var paymentIntent = result.paymentIntent;
- if (paymentIntent && paymentIntent.status) {
- hide("#hyper-checkout-sdk");
- hide("#hyper-checkout-details");
- show("#hyper-checkout-status-canvas");
- showStatus(
- paymentDetails.amount,
- Object.assign(paymentDetails, paymentIntent)
- );
- }
- })
- .catch(function (error) {
- console.error("Error retrieving payment_intent", error);
- });
- }
- })
- .catch(function (error) {
- console.error("Error confirming payment_intent", error);
- })
- .finally(() => {
- hide("#submit-spinner");
- show("#submit-button-text");
- submitButtonNode.disabled = false;
- submitButtonNode.classList.remove("disabled");
- });
- }
-
- // Fetches the payment status after payment submission
- function checkStatus(paymentDetails) {
- return new window.Promise(function (resolve, reject) {
- var res = {
- showSdk: true,
- };
-
- var clientSecret = new URLSearchParams(window.location.search).get(
- "payment_intent_client_secret"
- );
-
- // If clientSecret is not found in URL params, try to fetch from window context
- if (!clientSecret) {
- clientSecret = paymentDetails.client_secret;
- }
-
- // If clientSecret is not present, show status
- if (!clientSecret) {
- res.showSdk = false;
- showStatus(
- paymentDetails.amount,
- Object.assign(paymentDetails, {
- status: "",
- error: {
- code: "NO_CLIENT_SECRET",
- message: "client_secret not found",
- },
- })
- );
- return resolve(res);
- }
- hyper
- .retrievePaymentIntent(clientSecret)
- .then(function (response) {
- var paymentIntent = response.paymentIntent;
- // If paymentIntent was not found, show status
- if (!paymentIntent) {
- res.showSdk = false;
- showStatus(
- paymentDetails.amount,
- Object.assign(paymentDetails, {
- status: "",
- error: {
- code: "NOT_FOUND",
- message: "PaymentIntent was not found",
- },
- })
- );
- return resolve(res);
- }
- // Show SDK only if paymentIntent status has not been initiated
- switch (paymentIntent.status) {
- case "requires_confirmation":
- case "requires_payment_method":
- return resolve(res);
- }
- showStatus(
- paymentDetails.amount,
- Object.assign(paymentDetails, paymentIntent)
- );
- res.showSdk = false;
- resolve(res);
- })
- .catch(function (error) {
- reject(error);
- });
- });
- }
-
- function show(id) {
- removeClass(id, "hidden");
- }
- function hide(id) {
- addClass(id, "hidden");
- }
-
- function showMessage(msg) {
- show("#payment-message");
- addText("#payment-message", msg);
- }
-
- function showStatus(amount, paymentDetails) {
- var status = paymentDetails.status;
- var statusDetails = {
- imageSource: "",
- message: null,
- status: status,
- amountText: "",
- items: [],
- };
-
- // Payment details
- var paymentId = createItem("Ref Id", paymentDetails.payment_id);
- // @ts-ignore
- statusDetails.items.push(paymentId);
-
- // Status specific information
- switch (status) {
- case "succeeded":
- statusDetails.imageSource = "https://i.imgur.com/5BOmYVl.png";
- statusDetails.message =
- "We have successfully received your payment";
- statusDetails.status = "Paid successfully";
- statusDetails.amountText = new Date(
- paymentDetails.created
- ).toTimeString();
- break;
-
- case "processing":
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.message =
- "Sorry! Your payment is taking longer than expected. Please check back again in sometime.";
- statusDetails.status = "Payment Pending";
- break;
-
- case "failed":
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Payment Failed!";
- var errorCodeNode = createItem(
- "Error code",
- paymentDetails.error_code
- );
- var errorMessageNode = createItem(
- "Error message",
- paymentDetails.error_message
- );
- // @ts-ignore
- statusDetails.items.push(errorMessageNode, errorCodeNode);
- break;
-
- case "cancelled":
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Payment Cancelled";
- break;
-
- case "requires_merchant_action":
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.status = "Payment under review";
- break;
-
- case "requires_capture":
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.status = "Payment Pending";
- break;
-
- case "partially_captured":
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.message = "Partial payment was captured.";
- statusDetails.status = "Partial Payment Pending";
- break;
-
- default:
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Something went wrong";
- // Error details
- if (typeof paymentDetails.error === "object") {
- var errorCodeNode = createItem(
- "Error Code",
- paymentDetails.error.code
- );
- var errorMessageNode = createItem(
- "Error Message",
- paymentDetails.error.message
- );
- // @ts-ignore
- statusDetails.items.push(errorMessageNode, errorCodeNode);
- }
- break;
- }
-
- // Form header items
- var amountNode = document.createElement("div");
- amountNode.className = "hyper-checkout-status-amount";
- amountNode.innerText = paymentDetails.currency + " " + amount;
- var merchantLogoNode = document.createElement("img");
- merchantLogoNode.className = "hyper-checkout-status-merchant-logo";
- merchantLogoNode.src = window.__PAYMENT_DETAILS.merchant_logo;
- merchantLogoNode.alt = "";
-
- // Form content items
- var statusImageNode = document.createElement("img");
- statusImageNode.className = "hyper-checkout-status-image";
- statusImageNode.src = statusDetails.imageSource;
- var statusTextNode = document.createElement("div");
- statusTextNode.className = "hyper-checkout-status-text";
- statusTextNode.innerText = statusDetails.status;
- var statusMessageNode = document.createElement("div");
- statusMessageNode.className = "hyper-checkout-status-message";
- statusMessageNode.innerText = statusDetails.message;
- var statusDetailsNode = document.createElement("div");
- statusDetailsNode.className = "hyper-checkout-status-details";
-
- // Append items
- if (statusDetailsNode instanceof HTMLDivElement) {
- statusDetails.items.map(function (item) {
- statusDetailsNode.append(item);
- });
- }
- var statusHeaderNode = document.getElementById(
- "hyper-checkout-status-header"
- );
- if (statusHeaderNode instanceof HTMLDivElement) {
- statusHeaderNode.append(amountNode, merchantLogoNode);
- }
- var statusContentNode = document.getElementById(
- "hyper-checkout-status-content"
- );
- if (statusContentNode instanceof HTMLDivElement) {
- statusContentNode.append(statusImageNode, statusTextNode);
- if (statusDetails.message instanceof HTMLDivElement) {
- statusContentNode.append(statusMessageNode);
- }
- statusContentNode.append(statusDetailsNode);
- }
-
- // Form redirect text
- var statusRedirectTextNode = document.getElementById(
- "hyper-checkout-status-redirect-message"
- );
- if (
- statusRedirectTextNode &&
- typeof paymentDetails.return_url === "string"
- ) {
- var timeout = 5,
- j = 0;
- for (var i = 0; i <= timeout; i++) {
- setTimeout(function () {
- var secondsLeft = timeout - j++;
- var innerText =
- secondsLeft === 0
- ? "Redirecting ..."
- : "Redirecting in " + secondsLeft + " seconds ...";
- statusRedirectTextNode.innerText = innerText;
- if (secondsLeft === 0) {
- // Form query params
- var queryParams = {
- payment_id: paymentDetails.payment_id,
- status: paymentDetails.status,
- payment_intent_client_secret: paymentDetails.client_secret,
- amount: amount,
- manual_retry_allowed: paymentDetails.manual_retry_allowed,
- };
- var url = new URL(paymentDetails.return_url);
- var params = new URLSearchParams(url.search);
- // Attach query params to return_url
- for (var key in queryParams) {
- if (queryParams.hasOwnProperty(key)) {
- params.set(key, queryParams[key]);
- }
- }
- url.search = params.toString();
- setTimeout(function () {
- // Finally redirect
- window.location.href = url.toString();
- }, 1000);
- }
- }, i * 1000);
- }
- }
- }
-
- function createItem(heading, value) {
- var itemNode = document.createElement("div");
- itemNode.className = "hyper-checkout-status-item";
- var headerNode = document.createElement("div");
- headerNode.className = "hyper-checkout-item-header";
- headerNode.innerText = heading;
- var valueNode = document.createElement("div");
- valueNode.className = "hyper-checkout-item-value";
- valueNode.innerText = value;
- itemNode.append(headerNode);
- itemNode.append(valueNode);
- return itemNode;
- }
-
- function addText(id, msg) {
- var element = document.querySelector(id);
- element.innerText = msg;
- }
-
- function addClass(id, className) {
- var element = document.querySelector(id);
- element.classList.add(className);
- }
-
- function removeClass(id, className) {
- var element = document.querySelector(id);
- element.classList.remove(className);
- }
-
- function formatDate(date) {
- var months = [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December",
- ];
-
- var hours = date.getHours();
- var minutes = date.getMinutes();
- minutes = minutes < 10 ? "0" + minutes : minutes;
- var suffix = hours > 11 ? "PM" : "AM";
- hours = hours % 12;
- hours = hours ? hours : 12;
- var day = date.getDate();
- var month = months[date.getMonth()];
- var year = date.getUTCFullYear();
-
- var locale = navigator.language || navigator.userLanguage;
- var timezoneShorthand = date
- .toLocaleDateString(locale, {
- day: "2-digit",
- timeZoneName: "long",
- })
- .substring(4)
- .split(" ")
- .reduce(function (tz, c) {
- return tz + c.charAt(0).toUpperCase();
- }, "");
-
- var formatted =
- hours +
- ":" +
- minutes +
- " " +
- suffix +
- " " +
- timezoneShorthand +
- " " +
- month +
- " " +
- day +
- ", " +
- year;
- return formatted;
- }
-
- function renderPaymentDetails(paymentDetails) {
- // Create price node
- var priceNode = document.createElement("div");
- priceNode.className = "hyper-checkout-payment-price";
- priceNode.innerText =
- paymentDetails.currency + " " + paymentDetails.amount;
-
- // Create merchant name's node
- var merchantNameNode = document.createElement("div");
- merchantNameNode.className = "hyper-checkout-payment-merchant-name";
- merchantNameNode.innerText =
- "Requested by " + paymentDetails.merchant_name;
-
- // Create payment ID node
- var paymentIdNode = document.createElement("div");
- paymentIdNode.className = "hyper-checkout-payment-ref";
- paymentIdNode.innerText = "Ref Id: " + paymentDetails.payment_id;
-
- // Create merchant logo's node
- var merchantLogoNode = document.createElement("img");
- merchantLogoNode.src = paymentDetails.merchant_logo;
-
- // Create expiry node
- var paymentExpiryNode = document.createElement("div");
- paymentExpiryNode.className = "hyper-checkout-payment-footer-expiry";
- var expiryDate = new Date(paymentDetails.session_expiry);
- var formattedDate = formatDate(expiryDate);
- paymentExpiryNode.innerText = "Link expires on: " + formattedDate;
-
- // Append information to DOM
- var paymentContextNode = document.getElementById(
- "hyper-checkout-payment-context"
- );
- paymentContextNode.prepend(priceNode);
- var paymentMerchantDetails = document.getElementById(
- "hyper-checkout-payment-merchant-details"
- );
- paymentMerchantDetails.append(merchantNameNode);
- paymentMerchantDetails.append(paymentIdNode);
- var merchantImageNode = document.getElementById(
- "hyper-checkout-merchant-image"
- );
- merchantImageNode.prepend(merchantLogoNode);
- var footerNode = document.getElementById(
- "hyper-checkout-payment-footer"
- );
- footerNode.append(paymentExpiryNode);
- }
-
- function renderCart(paymentDetails) {
- var orderDetails = paymentDetails.order_details;
-
- // Cart items
- if (Array.isArray(orderDetails) && orderDetails.length > 0) {
- var cartNode = document.getElementById("hyper-checkout-cart");
- var cartItemsNode = document.getElementById(
- "hyper-checkout-cart-items"
- );
- var MAX_ITEMS_VISIBLE_AFTER_COLLAPSE =
- paymentDetails.max_items_visible_after_collapse;
-
- orderDetails.map(function (item, index) {
- if (index >= MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
- return;
- }
- renderCartItem(
- item,
- paymentDetails,
- index !== 0 && index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE,
- cartItemsNode
- );
- });
- // Expand / collapse button
- var totalItems = orderDetails.length;
- if (totalItems > MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
- var expandButtonNode = document.createElement("div");
- expandButtonNode.className = "hyper-checkout-cart-button";
- expandButtonNode.onclick = () => {
- handleCartView(paymentDetails);
- };
- var buttonImageNode = document.createElement("svg");
- buttonImageNode.id = "hyper-checkout-cart-button-arrow";
- buttonImageNode.innerHTML =
- document.getElementById("arrow-down").innerHTML;
- var buttonTextNode = document.createElement("span");
- buttonTextNode.id = "hyper-checkout-cart-button-text";
- var hiddenItemsCount =
- orderDetails.length - MAX_ITEMS_VISIBLE_AFTER_COLLAPSE;
- buttonTextNode.innerText = "Show More (" + hiddenItemsCount + ")";
- expandButtonNode.append(buttonTextNode, buttonImageNode);
- cartNode.insertBefore(expandButtonNode, cartNode.lastElementChild);
- }
- } else {
- hide("#hyper-checkout-cart-header");
- hide("#hyper-checkout-cart-items");
- hide("#hyper-checkout-cart-image");
- if (
- typeof paymentDetails.merchant_description === "string" &&
- paymentDetails.merchant_description.length > 0
- ) {
- show("#hyper-checkout-merchant-description");
- var merchantDescription = paymentDetails.merchant_description;
- document.getElementById(
- "hyper-checkout-merchant-description"
- ).innerText = merchantDescription;
- }
- }
- }
-
- function renderCartItem(
- item,
- paymentDetails,
- shouldAddDividerNode,
- cartItemsNode
- ) {
- // Wrappers
- var itemWrapperNode = document.createElement("div");
- itemWrapperNode.className = "hyper-checkout-cart-item";
- var nameAndQuantityWrapperNode = document.createElement("div");
- nameAndQuantityWrapperNode.className =
- "hyper-checkout-cart-product-details";
- // Image
- var productImageNode = document.createElement("img");
- productImageNode.className = "hyper-checkout-cart-product-image";
- productImageNode.src = item.product_img_link;
- // Product title
- var productNameNode = document.createElement("div");
- productNameNode.className = "hyper-checkout-card-item-name";
- productNameNode.innerText = item.product_name;
- // Product quantity
- var quantityNode = document.createElement("div");
- quantityNode.className = "hyper-checkout-card-item-quantity";
- quantityNode.innerText = "Qty: " + item.quantity;
- // Product price
- var priceNode = document.createElement("div");
- priceNode.className = "hyper-checkout-card-item-price";
- priceNode.innerText = paymentDetails.currency + " " + item.amount;
- // Append items
- nameAndQuantityWrapperNode.append(productNameNode, quantityNode);
- itemWrapperNode.append(
- productImageNode,
- nameAndQuantityWrapperNode,
- priceNode
- );
- if (shouldAddDividerNode) {
- var dividerNode = document.createElement("div");
- dividerNode.className = "hyper-checkout-cart-item-divider";
- cartItemsNode.append(dividerNode);
- }
- cartItemsNode.append(itemWrapperNode);
- }
-
- function handleCartView(paymentDetails) {
- var orderDetails = paymentDetails.order_details;
- var MAX_ITEMS_VISIBLE_AFTER_COLLAPSE =
- paymentDetails.max_items_visible_after_collapse;
- var itemsHTMLCollection = document.getElementsByClassName(
- "hyper-checkout-cart-item"
- );
- var dividerHTMLCollection = document.getElementsByClassName(
- "hyper-checkout-cart-item-divider"
- );
- var cartItems = [].slice.call(itemsHTMLCollection);
- var dividerItems = [].slice.call(dividerHTMLCollection);
- var isHidden = cartItems.length < orderDetails.length;
- var cartItemsNode = document.getElementById(
- "hyper-checkout-cart-items"
- );
- var cartButtonTextNode = document.getElementById(
- "hyper-checkout-cart-button-text"
- );
- var cartButtonImageNode = document.getElementById(
- "hyper-checkout-cart-button-arrow"
- );
- if (isHidden) {
- if (Array.isArray(orderDetails)) {
- orderDetails.map(function (item, index) {
- if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
- return;
- }
- renderCartItem(
- item,
- paymentDetails,
- index >= MAX_ITEMS_VISIBLE_AFTER_COLLAPSE,
- cartItemsNode
- );
- });
- }
- cartItemsNode.style.maxHeight = cartItemsNode.scrollHeight + "px";
- cartItemsNode.style.height = cartItemsNode.scrollHeight + "px";
- cartButtonTextNode.innerText = "Show Less";
- cartButtonImageNode.innerHTML =
- document.getElementById("arrow-up").innerHTML;
- } else {
- cartItemsNode.style.maxHeight = "300px";
- cartItemsNode.style.height = "290px";
- cartItemsNode.scrollTo({ top: 0, behavior: "smooth" });
- setTimeout(function () {
- cartItems.map(function (item, index) {
- if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
- return;
- }
- cartItemsNode.removeChild(item);
- });
- dividerItems.map(function (item, index) {
- if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE - 1) {
- return;
- }
- cartItemsNode.removeChild(item);
- });
- }, 300);
- setTimeout(function () {
- var hiddenItemsCount =
- orderDetails.length - MAX_ITEMS_VISIBLE_AFTER_COLLAPSE;
- cartButtonTextNode.innerText =
- "Show More (" + hiddenItemsCount + ")";
- cartButtonImageNode.innerHTML =
- document.getElementById("arrow-down").innerHTML;
- }, 250);
- }
- }
-
- function hideCartInMobileView() {
- window.history.back();
- var cartNode = document.getElementById("hyper-checkout-cart");
- cartNode.style.animation = "slide-to-right 0.3s linear";
- cartNode.style.right = "-582px";
- setTimeout(function () {
- hide("#hyper-checkout-cart");
- }, 300);
- }
-
- function viewCartInMobileView() {
- window.history.pushState("view-cart", "");
- var cartNode = document.getElementById("hyper-checkout-cart");
- cartNode.style.animation = "slide-from-right 0.3s linear";
- cartNode.style.right = "0px";
- show("#hyper-checkout-cart");
- }
-
- function renderSDKHeader(paymentDetails) {
- // SDK headers' items
- var sdkHeaderItemNode = document.createElement("div");
- sdkHeaderItemNode.className = "hyper-checkout-sdk-items";
- var sdkHeaderMerchantNameNode = document.createElement("div");
- sdkHeaderMerchantNameNode.className =
- "hyper-checkout-sdk-header-brand-name";
- sdkHeaderMerchantNameNode.innerText = paymentDetails.merchant_name;
- var sdkHeaderAmountNode = document.createElement("div");
- sdkHeaderAmountNode.className = "hyper-checkout-sdk-header-amount";
- sdkHeaderAmountNode.innerText =
- paymentDetails.currency + " " + paymentDetails.amount;
- sdkHeaderItemNode.append(sdkHeaderMerchantNameNode);
- sdkHeaderItemNode.append(sdkHeaderAmountNode);
-
- // Append to SDK header's node
- var sdkHeaderNode = document.getElementById(
- "hyper-checkout-sdk-header"
- );
- if (sdkHeaderNode instanceof HTMLDivElement) {
- sdkHeaderNode.append(sdkHeaderLogoNode);
- sdkHeaderNode.append(sdkHeaderItemNode);
- }
- }
-
- function adjustLightness(hexColor, factor) {
- // Convert hex to RGB
- var r = parseInt(hexColor.slice(1, 3), 16);
- var g = parseInt(hexColor.slice(3, 5), 16);
- var b = parseInt(hexColor.slice(5, 7), 16);
-
- // Convert RGB to HSL
- var hsl = rgbToHsl(r, g, b);
-
- // Adjust lightness
- hsl[2] = Math.max(0, Math.min(100, hsl[2] * factor));
-
- // Convert HSL back to RGB
- var rgb = hslToRgb(hsl[0], hsl[1], hsl[2]);
-
- // Convert RGB to hex
- var newHexColor = rgbToHex(rgb[0], rgb[1], rgb[2]);
-
- return newHexColor;
- }
- function rgbToHsl(r, g, b) {
- r /= 255;
- g /= 255;
- b /= 255;
- var max = Math.max(r, g, b),
- min = Math.min(r, g, b);
- var h,
- s,
- l = (max + min) / 2;
-
- if (max === min) {
- h = s = 0;
- } else {
- var d = max - min;
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
- switch (max) {
- case r:
- h = (g - b) / d + (g < b ? 6 : 0);
- break;
- case g:
- h = (b - r) / d + 2;
- break;
- case b:
- h = (r - g) / d + 4;
- break;
- }
- h /= 6;
- }
-
- return [h * 360, s * 100, l * 100];
- }
- function hslToRgb(h, s, l) {
- h /= 360;
- s /= 100;
- l /= 100;
- var r, g, b;
-
- if (s === 0) {
- r = g = b = l;
- } else {
- var hue2rgb = function (p, q, t) {
- if (t < 0) t += 1;
- if (t > 1) t -= 1;
- if (t < 1 / 6) return p + (q - p) * 6 * t;
- if (t < 1 / 2) return q;
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
- return p;
- };
-
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
- var p = 2 * l - q;
-
- r = hue2rgb(p, q, h + 1 / 3);
- g = hue2rgb(p, q, h);
- b = hue2rgb(p, q, h - 1 / 3);
- }
-
- return [r * 255, g * 255, b * 255];
- }
- function rgbToHex(r, g, b) {
- var toHex = function (c) {
- var hex = Math.round(c).toString(16);
- return hex.length === 1 ? "0" + hex : hex;
- };
- return "#" + toHex(r) + toHex(g) + toHex(b);
- }
-
- /**
- * Ref - https://github.com/onury/invert-color/blob/master/lib/cjs/invert.js
- */
- function padz(str, len) {
- if (len === void 0) {
- len = 2;
- }
- return (new Array(len).join("0") + str).slice(-len);
- }
- function hexToRgbArray(hex) {
- if (hex.slice(0, 1) === "#") hex = hex.slice(1);
- var RE_HEX = /^(?:[0-9a-f]{3}){1,2}$/i;
- if (!RE_HEX.test(hex))
- throw new Error('Invalid HEX color: "' + hex + '"');
- if (hex.length === 3) {
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
- }
- return [
- parseInt(hex.slice(0, 2), 16),
- parseInt(hex.slice(2, 4), 16),
- parseInt(hex.slice(4, 6), 16),
- ];
- }
- function toRgbArray(c) {
- if (!c) throw new Error("Invalid color value");
- if (Array.isArray(c)) return c;
- return typeof c === "string" ? hexToRgbArray(c) : [c.r, c.g, c.b];
- }
- function getLuminance(c) {
- var i, x;
- var a = [];
- for (i = 0; i < c.length; i++) {
- x = c[i] / 255;
- a[i] = x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
- }
- return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];
- }
- function invertToBW(color, bw, asArr) {
- var DEFAULT_BW = {
- black: "#090302",
- white: "#FFFFFC",
- threshold: Math.sqrt(1.05 * 0.05) - 0.05,
- };
- var options =
- bw === true ? DEFAULT_BW : Object.assign({}, DEFAULT_BW, bw);
- return getLuminance(color) > options.threshold
- ? asArr
- ? hexToRgbArray(options.black)
- : options.black
- : asArr
- ? hexToRgbArray(options.white)
- : options.white;
- }
- function invert(color, bw) {
- if (bw === void 0) {
- bw = false;
- }
- color = toRgbArray(color);
- if (bw) return invertToBW(color, bw);
- return (
- "#" +
- color
- .map(function (c) {
- return padz((255 - c).toString(16));
- })
- .join("")
- );
- }
- </script>
- {{ hyperloader_sdk_link }}
- </body>
-</html>
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css
new file mode 100644
index 00000000000..ee5600e42bf
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css
@@ -0,0 +1,785 @@
+{{ css_color_scheme }}
+
+html,
+body {
+ height: 100%;
+ overflow: hidden;
+}
+
+body {
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: flex-start;
+ margin: 0;
+ color: #333333;
+}
+
+/* Hide scrollbar for Chrome, Safari and Opera */
+.hide-scrollbar::-webkit-scrollbar {
+ display: none;
+}
+
+/* Hide scrollbar for IE, Edge and Firefox */
+.hide-scrollbar {
+ -ms-overflow-style: none;
+ /* IE and Edge */
+ scrollbar-width: none;
+ /* Firefox */
+}
+
+/* For ellipsis on text lines */
+.ellipsis-container-3 {
+ height: 4em;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ text-overflow: ellipsis;
+ white-space: normal;
+}
+
+.hidden {
+ display: none !important;
+}
+
+.hyper-checkout {
+ display: flex;
+ background-color: #f8f9fb;
+ color: #333333;
+ width: 100%;
+ height: 100%;
+ overflow: scroll;
+}
+
+#hyper-footer {
+ width: 100vw;
+ display: flex;
+ justify-content: center;
+ padding: 20px 0;
+}
+
+.main {
+ display: flex;
+ flex-flow: column;
+ justify-content: center;
+ align-items: center;
+ min-width: 600px;
+ width: 50vw;
+}
+
+#hyper-checkout-details {
+ font-family: "Montserrat";
+}
+
+.hyper-checkout-payment {
+ min-width: 600px;
+ box-shadow: 0px 0px 5px #d1d1d1;
+ border-radius: 8px;
+ background-color: #fefefe;
+}
+
+.hyper-checkout-payment-content-details {
+ display: flex;
+ flex-flow: column;
+ justify-content: space-between;
+ align-content: space-between;
+}
+
+.content-details-wrap {
+ display: flex;
+ flex-flow: row;
+ margin: 20px 20px 30px 20px;
+ justify-content: space-between;
+}
+
+.hyper-checkout-payment-price {
+ font-weight: 700;
+ font-size: 40px;
+ height: 64px;
+ display: flex;
+ align-items: center;
+}
+
+#hyper-checkout-payment-merchant-details {
+ margin-top: 5px;
+}
+
+.hyper-checkout-payment-merchant-name {
+ font-weight: 600;
+ font-size: 19px;
+}
+
+.hyper-checkout-payment-ref {
+ font-size: 12px;
+ margin-top: 5px;
+}
+
+.hyper-checkout-image-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+#hyper-checkout-merchant-image,
+#hyper-checkout-cart-image {
+ height: 64px;
+ width: 64px;
+ border-radius: 4px;
+ display: flex;
+ align-self: flex-start;
+ align-items: center;
+ justify-content: center;
+}
+
+#hyper-checkout-merchant-image > img {
+ height: 48px;
+ width: 48px;
+}
+
+#hyper-checkout-cart-image {
+ display: none;
+ cursor: pointer;
+ height: 60px;
+ width: 60px;
+ border-radius: 100px;
+ background-color: #f5f5f5;
+}
+
+#hyper-checkout-payment-footer {
+ margin-top: 20px;
+ background-color: #f5f5f5;
+ font-size: 13px;
+ font-weight: 500;
+ padding: 12px 20px;
+ border-radius: 0 0 8px 8px;
+}
+
+#hyper-checkout-cart {
+ display: flex;
+ flex-flow: column;
+ min-width: 600px;
+ margin-top: 40px;
+ max-height: 60vh;
+}
+
+#hyper-checkout-cart-items {
+ max-height: 291px;
+ overflow: scroll;
+ transition: all 0.3s ease;
+}
+
+.hyper-checkout-cart-header {
+ font-size: 15px;
+ display: flex;
+ flex-flow: row;
+ align-items: center;
+}
+
+.hyper-checkout-cart-header > span {
+ margin-left: 5px;
+ font-weight: 500;
+}
+
+.cart-close {
+ display: none;
+ cursor: pointer;
+}
+
+.hyper-checkout-cart-item {
+ display: flex;
+ flex-flow: row;
+ padding: 20px 0;
+ font-size: 15px;
+}
+
+.hyper-checkout-cart-product-image {
+ height: 56px;
+ width: 56px;
+ border-radius: 4px;
+}
+
+.hyper-checkout-card-item-name {
+ font-weight: 500;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-line-clamp: 2;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+}
+
+.hyper-checkout-card-item-quantity {
+ border: 1px solid #e6e6e6;
+ border-radius: 3px;
+ width: max-content;
+ padding: 5px 12px;
+ background-color: #fafafa;
+ font-size: 13px;
+ font-weight: 500;
+}
+
+.hyper-checkout-cart-product-details {
+ display: flex;
+ flex-flow: column;
+ margin-left: 15px;
+ justify-content: space-between;
+ width: 100%;
+}
+
+.hyper-checkout-card-item-price {
+ justify-self: flex-end;
+ font-weight: 600;
+ font-size: 16px;
+ padding-left: 30px;
+ text-align: end;
+ min-width: max-content;
+}
+
+.hyper-checkout-cart-item-divider {
+ height: 1px;
+ background-color: #e6e6e6;
+}
+
+.hyper-checkout-cart-button {
+ font-size: 12px;
+ font-weight: 500;
+ cursor: pointer;
+ align-self: flex-start;
+ display: flex;
+ align-content: flex-end;
+ gap: 3px;
+ text-decoration: none;
+ transition: text-decoration 0.3s;
+ margin-top: 10px;
+}
+
+.hyper-checkout-cart-button:hover {
+ text-decoration: underline;
+}
+
+#hyper-checkout-merchant-description {
+ font-size: 13px;
+ color: #808080;
+}
+
+.powered-by-hyper {
+ margin-top: 40px;
+ align-self: flex-start;
+}
+
+.hyper-checkout-sdk {
+ width: 50vw;
+ min-width: 584px;
+ z-index: 2;
+ background-color: var(--primary-color);
+ box-shadow: 0px 1px 10px #f2f2f2;
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: center;
+}
+
+#payment-form-wrap {
+ min-width: 300px;
+ width: 30vw;
+ padding: 20px;
+ background-color: white;
+ border-radius: 3px;
+}
+
+#hyper-checkout-sdk-header {
+ padding: 10px 10px 10px 22px;
+ display: flex;
+ align-items: flex-start;
+ justify-content: flex-start;
+ border-bottom: 1px solid #f2f2f2;
+}
+
+.hyper-checkout-sdk-header-logo {
+ height: 60px;
+ width: 60px;
+ background-color: white;
+ border-radius: 2px;
+}
+
+.hyper-checkout-sdk-header-logo > img {
+ height: 56px;
+ width: 56px;
+ margin: 2px;
+}
+
+.hyper-checkout-sdk-header-items {
+ display: flex;
+ flex-flow: column;
+ color: white;
+ font-size: 20px;
+ font-weight: 700;
+}
+
+.hyper-checkout-sdk-items {
+ margin-left: 10px;
+}
+
+.hyper-checkout-sdk-header-brand-name,
+.hyper-checkout-sdk-header-amount {
+ font-size: 18px;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ font-family: "Montserrat";
+ justify-self: flex-start;
+}
+
+.hyper-checkout-sdk-header-amount {
+ font-weight: 800;
+ font-size: 25px;
+}
+
+.page-spinner {
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
+ z-index: 3;
+ background-color: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.sdk-spinner {
+ width: 100%;
+ height: 100%;
+ z-index: 3;
+ background-color: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.spinner {
+ width: 60px;
+ height: 60px;
+}
+
+.spinner div {
+ transform-origin: 30px 30px;
+ animation: spinner 1.2s linear infinite;
+}
+
+.spinner div:after {
+ content: " ";
+ display: block;
+ position: absolute;
+ top: 3px;
+ left: 28px;
+ width: 4px;
+ height: 15px;
+ border-radius: 20%;
+ background: var(--primary-color);
+}
+
+.spinner div:nth-child(1) {
+ transform: rotate(0deg);
+ animation-delay: -1.1s;
+}
+
+.spinner div:nth-child(2) {
+ transform: rotate(30deg);
+ animation-delay: -1s;
+}
+
+.spinner div:nth-child(3) {
+ transform: rotate(60deg);
+ animation-delay: -0.9s;
+}
+
+.spinner div:nth-child(4) {
+ transform: rotate(90deg);
+ animation-delay: -0.8s;
+}
+
+.spinner div:nth-child(5) {
+ transform: rotate(120deg);
+ animation-delay: -0.7s;
+}
+
+.spinner div:nth-child(6) {
+ transform: rotate(150deg);
+ animation-delay: -0.6s;
+}
+
+.spinner div:nth-child(7) {
+ transform: rotate(180deg);
+ animation-delay: -0.5s;
+}
+
+.spinner div:nth-child(8) {
+ transform: rotate(210deg);
+ animation-delay: -0.4s;
+}
+
+.spinner div:nth-child(9) {
+ transform: rotate(240deg);
+ animation-delay: -0.3s;
+}
+
+.spinner div:nth-child(10) {
+ transform: rotate(270deg);
+ animation-delay: -0.2s;
+}
+
+.spinner div:nth-child(11) {
+ transform: rotate(300deg);
+ animation-delay: -0.1s;
+}
+
+.spinner div:nth-child(12) {
+ transform: rotate(330deg);
+ animation-delay: 0s;
+}
+
+@keyframes spinner {
+ 0% {
+ opacity: 1;
+ }
+
+ 100% {
+ opacity: 0;
+ }
+}
+
+#hyper-checkout-status-canvas {
+ width: 100%;
+ height: 100%;
+ justify-content: center;
+ align-items: center;
+ background-color: var(--primary-color);
+}
+
+.hyper-checkout-status-wrap {
+ display: flex;
+ flex-flow: column;
+ font-family: "Montserrat";
+ width: auto;
+ min-width: 400px;
+ background-color: white;
+ border-radius: 5px;
+}
+
+#hyper-checkout-status-header {
+ max-width: 1200px;
+ border-radius: 3px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+#hyper-checkout-status-header,
+#hyper-checkout-status-content {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 24px;
+ font-weight: 600;
+ padding: 15px 20px;
+}
+
+.hyper-checkout-status-amount {
+ font-family: "Montserrat";
+ font-size: 35px;
+ font-weight: 700;
+}
+
+.hyper-checkout-status-merchant-logo {
+ border: 1px solid #e6e6e6;
+ border-radius: 5px;
+ padding: 9px;
+ height: 48px;
+ width: 48px;
+}
+
+#hyper-checkout-status-content {
+ height: 100%;
+ flex-flow: column;
+ min-height: 500px;
+ align-items: center;
+ justify-content: center;
+}
+
+.hyper-checkout-status-image {
+ height: 200px;
+ width: 200px;
+}
+
+.hyper-checkout-status-text {
+ text-align: center;
+ font-size: 21px;
+ font-weight: 600;
+ margin-top: 20px;
+}
+
+.hyper-checkout-status-message {
+ text-align: center;
+ font-size: 12px !important;
+ margin-top: 10px;
+ font-size: 14px;
+ font-weight: 500;
+ max-width: 400px;
+}
+
+.hyper-checkout-status-details {
+ display: flex;
+ flex-flow: column;
+ margin-top: 20px;
+ border-radius: 3px;
+ border: 1px solid #e6e6e6;
+ max-width: calc(100vw - 40px);
+}
+
+.hyper-checkout-status-item {
+ display: flex;
+ align-items: center;
+ padding: 5px 10px;
+ border-bottom: 1px solid #e6e6e6;
+ word-wrap: break-word;
+}
+
+.hyper-checkout-status-item:last-child {
+ border-bottom: 0;
+}
+
+.hyper-checkout-item-header {
+ min-width: 13ch;
+ font-size: 12px;
+}
+
+.hyper-checkout-item-value {
+ font-size: 12px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ word-wrap: break-word;
+ font-weight: 400;
+}
+
+#hyper-checkout-status-redirect-message {
+ margin-top: 20px;
+ font-family: "Montserrat";
+ font-size: 13px;
+}
+
+@keyframes loading {
+ 0% {
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -webkit-transform: rotate(360deg);
+ transform: rotate(360deg);
+ }
+}
+
+@keyframes slide-from-right {
+ from {
+ right: -582px;
+ }
+
+ to {
+ right: 0;
+ }
+}
+
+@keyframes slide-to-right {
+ from {
+ right: 0;
+ }
+
+ to {
+ right: -582px;
+ }
+}
+
+#payment-message {
+ font-size: 12px;
+ font-weight: 500;
+ padding: 2%;
+ color: #ff0000;
+ font-family: "Montserrat";
+}
+
+#payment-form {
+ max-width: 560px;
+ width: 100%;
+ min-height: 500px;
+ max-height: 90vh;
+ height: 100%;
+ overflow: scroll;
+ margin: 0 auto;
+ text-align: center;
+}
+
+#submit {
+ cursor: pointer;
+ margin-top: 20px;
+ width: 100%;
+ height: 38px;
+ background-color: var(--primary-color);
+ border: 0;
+ border-radius: 4px;
+ font-size: 18px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+#submit.disabled {
+ cursor: not-allowed;
+}
+
+#submit-spinner {
+ width: 28px;
+ height: 28px;
+ border: 4px solid #fff;
+ border-bottom-color: #ff3d00;
+ border-radius: 50%;
+ display: inline-block;
+ box-sizing: border-box;
+ animation: loading 1s linear infinite;
+}
+
+@media only screen and (max-width: 1400px) {
+ body {
+ overflow-y: scroll;
+ }
+
+ .hyper-checkout {
+ flex-flow: column;
+ margin: 0;
+ height: auto;
+ overflow: visible;
+ }
+
+ #hyper-checkout-payment-merchant-details {
+ margin-top: 20px;
+ }
+
+ .main {
+ width: auto;
+ min-width: 300px;
+ }
+
+ .hyper-checkout-payment {
+ min-width: 300px;
+ width: calc(100vw - 50px);
+ margin: 0;
+ padding: 25px;
+ border: 0;
+ border-radius: 0;
+ background-color: var(--primary-color);
+ display: flex;
+ flex-flow: column;
+ justify-self: flex-start;
+ align-self: flex-start;
+ }
+
+ .hyper-checkout-payment-content-details {
+ max-width: 520px;
+ width: 100%;
+ align-self: center;
+ margin-bottom: 0;
+ }
+
+ .content-details-wrap {
+ flex-flow: column;
+ flex-direction: column-reverse;
+ margin: 0;
+ }
+
+ #hyper-checkout-merchant-image {
+ background-color: white;
+ }
+
+ #hyper-checkout-cart-image {
+ display: flex;
+ }
+
+ .hyper-checkout-payment-price {
+ font-size: 48px;
+ margin-top: 20px;
+ }
+
+ .hyper-checkout-payment-merchant-name {
+ font-size: 18px;
+ }
+
+ #hyper-checkout-payment-footer {
+ border-radius: 50px;
+ width: max-content;
+ padding: 10px 20px;
+ }
+
+ #hyper-checkout-cart {
+ position: absolute;
+ top: 0;
+ right: 0;
+ z-index: 100;
+ margin: 0;
+ min-width: 300px;
+ max-width: 582px;
+ max-height: 100vh;
+ width: 100vw;
+ height: 100vh;
+ background-color: #f5f5f5;
+ box-shadow: 0px 10px 10px #aeaeae;
+ right: 0px;
+ animation: slide-from-right 0.3s linear;
+ }
+
+ .hyper-checkout-cart-header {
+ margin: 10px 0 0 10px;
+ }
+
+ .cart-close {
+ margin: 0 10px 0 auto;
+ display: inline;
+ }
+
+ #hyper-checkout-cart-items {
+ margin: 20px 20px 0 20px;
+ padding: 0;
+ }
+
+ .hyper-checkout-cart-button {
+ margin: 10px;
+ text-align: right;
+ }
+
+ .powered-by-hyper {
+ display: none;
+ }
+
+ #hyper-checkout-sdk {
+ background-color: transparent;
+ width: auto;
+ min-width: 300px;
+ box-shadow: none;
+ }
+
+ #payment-form-wrap {
+ min-width: 300px;
+ width: calc(100vw - 40px);
+ margin: 0;
+ padding: 25px 20px;
+ }
+
+ #hyper-checkout-status-canvas {
+ background-color: #fefefe;
+ }
+
+ .hyper-checkout-status-wrap {
+ min-width: 100vw;
+ width: 100vw;
+ }
+
+ #hyper-checkout-status-header {
+ max-width: calc(100% - 40px);
+ }
+}
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html
new file mode 100644
index 00000000000..be4369be1d9
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html
@@ -0,0 +1,197 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Payments requested by HyperSwitch</title>
+ <style>
+ {{rendered_css}}
+ </style>
+ <link
+ rel="stylesheet"
+ href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
+ />
+ </head>
+ <body class="hide-scrollbar">
+ <!-- SVG ICONS -->
+ <svg xmlns="http://www.w3.org/2000/svg" display="none">
+ <defs>
+ <symbol id="cart-icon-small">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/cart-small.svg"/>
+ </symbol>
+ <symbol id="cart-icon-big">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/cart-big.svg"/>
+ </symbol>
+ <symbol id="cart-close">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/close.svg"/>
+ </symbol>
+ <symbol id="hyperswitch-brand">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/powered-by-hyperswitch.svg" opacity="0.4"/>
+ </symbol>
+ <symbol id="arrow-down">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/arrow-down.svg"/>
+ </symbol>
+ <symbol id="arrow-up">
+ <image href="https://live.hyperswitch.io/payment-link-assets/icons/arrow-up.svg"/>
+ </symbol>
+ </defs>
+ </svg>
+ <div id="page-spinner" class="page-spinner hidden">
+ <div class="spinner">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="hyper-checkout hide-scrollbar">
+ <div class="main hidden" id="hyper-checkout-status-canvas">
+ <div class="hyper-checkout-status-wrap">
+ <div id="hyper-checkout-status-header"></div>
+ <div id="hyper-checkout-status-content"></div>
+ </div>
+ <div id="hyper-checkout-status-redirect-message"></div>
+ </div>
+ <div class="main" id="hyper-checkout-details">
+ <div id="hyper-checkout-payment" class="hyper-checkout-payment">
+ <div class="hyper-checkout-payment-content-details">
+ <div class="content-details-wrap">
+ <div id="hyper-checkout-payment-context">
+ <div id="hyper-checkout-payment-merchant-details"></div>
+ </div>
+ <div class="hyper-checkout-image-header">
+ <div id="hyper-checkout-merchant-image"></div>
+ <div
+ id="hyper-checkout-cart-image"
+ onclick="viewCartInMobileView()"
+ >
+ <svg
+ width="30"
+ height="30"
+ viewBox="0 0 30 30"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ class="cart-icon"
+ >
+ <use
+ xlink:href="#cart-icon-big"
+ x="0"
+ y="0"
+ width="30"
+ height="30"
+ ></use>
+ </svg>
+ </div>
+ </div>
+ </div>
+ <div id="hyper-checkout-payment-footer"></div>
+ </div>
+ </div>
+ <div id="hyper-checkout-cart" class="">
+ <div
+ id="hyper-checkout-cart-header"
+ class="hyper-checkout-cart-header"
+ >
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ class="cart-icon"
+ >
+ <use
+ xlink:href="#cart-icon-small"
+ x="0"
+ y="0"
+ width="16"
+ height="16"
+ ></use>
+ </svg>
+ <span>Your Cart</span>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 50 50"
+ width="25"
+ height="25"
+ class="cart-close"
+ onclick="hideCartInMobileView()"
+ >
+ <use
+ xlink:href="#cart-close"
+ x="0"
+ y="0"
+ width="50"
+ height="50"
+ ></use>
+ </svg>
+ </div>
+ <div id="hyper-checkout-cart-items" class="hide-scrollbar"></div>
+ <div id="hyper-checkout-merchant-description"></div>
+ <div class="powered-by-hyper">
+ <svg class="fill-current" height="18" width="130">
+ <use
+ xlink:href="#hyperswitch-brand"
+ x="0"
+ y="0"
+ height="18"
+ width="130"
+ ></use>
+ </svg>
+ </div>
+ </div>
+ </div>
+ <div class="hyper-checkout-sdk" id="hyper-checkout-sdk">
+ <div id="payment-form-wrap">
+ <div id="sdk-spinner" class="sdk-spinner">
+ <div class="spinner">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <form id="payment-form" onclick="handleSubmit(); return false;">
+ <div id="unified-checkout"></div>
+ <button id="submit" class="hidden">
+ <span id="submit-spinner" class="hidden"></span>
+ <span id="submit-button-text">Pay now</span>
+ </button>
+ <div id="payment-message" class="hidden"></div>
+ </form>
+ </div>
+ </div>
+ </div>
+ <div id="hyper-footer" class="hidden">
+ <svg class="fill-current" height="18" width="130">
+ <use
+ xlink:href="#hyperswitch-brand"
+ x="0"
+ y="0"
+ height="18"
+ width="130"
+ ></use>
+ </svg>
+ </div>
+ <script>
+ {{rendered_js}}
+ </script>
+ {{ hyperloader_sdk_link }}
+ </body>
+</html>
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js
new file mode 100644
index 00000000000..75e063c3a99
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js
@@ -0,0 +1,906 @@
+// @ts-check
+
+/**
+ * UTIL FUNCTIONS
+ */
+
+function adjustLightness(hexColor, factor) {
+ // Convert hex to RGB
+ var r = parseInt(hexColor.slice(1, 3), 16);
+ var g = parseInt(hexColor.slice(3, 5), 16);
+ var b = parseInt(hexColor.slice(5, 7), 16);
+
+ // Convert RGB to HSL
+ var hsl = rgbToHsl(r, g, b);
+
+ // Adjust lightness
+ hsl[2] = Math.max(0, Math.min(100, hsl[2] * factor));
+
+ // Convert HSL back to RGB
+ var rgb = hslToRgb(hsl[0], hsl[1], hsl[2]);
+
+ // Convert RGB to hex
+ var newHexColor = rgbToHex(rgb[0], rgb[1], rgb[2]);
+
+ return newHexColor;
+}
+function rgbToHsl(r, g, b) {
+ r /= 255;
+ g /= 255;
+ b /= 255;
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h = 1,
+ s,
+ l = (max + min) / 2;
+
+ if (max === min) {
+ h = s = 0;
+ } else {
+ var d = max - min;
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ switch (max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ break;
+ }
+ h /= 6;
+ }
+
+ return [h * 360, s * 100, l * 100];
+}
+function hslToRgb(h, s, l) {
+ h /= 360;
+ s /= 100;
+ l /= 100;
+ var r, g, b;
+
+ if (s === 0) {
+ r = g = b = l;
+ } else {
+ var hue2rgb = function (p, q, t) {
+ if (t < 0) t += 1;
+ if (t > 1) t -= 1;
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
+ if (t < 1 / 2) return q;
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
+ return p;
+ };
+
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ var p = 2 * l - q;
+
+ r = hue2rgb(p, q, h + 1 / 3);
+ g = hue2rgb(p, q, h);
+ b = hue2rgb(p, q, h - 1 / 3);
+ }
+
+ return [r * 255, g * 255, b * 255];
+}
+function rgbToHex(r, g, b) {
+ var toHex = function (c) {
+ var hex = Math.round(c).toString(16);
+ return hex.length === 1 ? "0" + hex : hex;
+ };
+ return "#" + toHex(r) + toHex(g) + toHex(b);
+}
+
+/**
+ * Ref - https://github.com/onury/invert-color/blob/master/lib/cjs/invert.js
+ */
+function padz(str, len) {
+ if (len === void 0) {
+ len = 2;
+ }
+ return (new Array(len).join("0") + str).slice(-len);
+}
+function hexToRgbArray(hex) {
+ if (hex.slice(0, 1) === "#") hex = hex.slice(1);
+ var RE_HEX = /^(?:[0-9a-f]{3}){1,2}$/i;
+ if (!RE_HEX.test(hex)) throw new Error('Invalid HEX color: "' + hex + '"');
+ if (hex.length === 3) {
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
+ }
+ return [
+ parseInt(hex.slice(0, 2), 16),
+ parseInt(hex.slice(2, 4), 16),
+ parseInt(hex.slice(4, 6), 16),
+ ];
+}
+function toRgbArray(c) {
+ if (!c) throw new Error("Invalid color value");
+ if (Array.isArray(c)) return c;
+ return typeof c === "string" ? hexToRgbArray(c) : [c.r, c.g, c.b];
+}
+function getLuminance(c) {
+ var i, x;
+ var a = [];
+ for (i = 0; i < c.length; i++) {
+ x = c[i] / 255;
+ a[i] = x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
+ }
+ return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];
+}
+function invertToBW(color, bw, asArr) {
+ var DEFAULT_BW = {
+ black: "#090302",
+ white: "#FFFFFC",
+ threshold: Math.sqrt(1.05 * 0.05) - 0.05,
+ };
+ var options = bw === true ? DEFAULT_BW : Object.assign({}, DEFAULT_BW, bw);
+ return getLuminance(color) > options.threshold
+ ? asArr
+ ? hexToRgbArray(options.black)
+ : options.black
+ : asArr
+ ? hexToRgbArray(options.white)
+ : options.white;
+}
+function invert(color, bw) {
+ if (bw === void 0) {
+ bw = false;
+ }
+ color = toRgbArray(color);
+ if (bw) return invertToBW(color, bw);
+ return (
+ "#" +
+ color
+ .map(function (c) {
+ return padz((255 - c).toString(16));
+ })
+ .join("")
+ );
+}
+
+/**
+ * UTIL FUNCTIONS END HERE
+ */
+
+{{ payment_details_js_script }}
+
+// @ts-ignore
+window.state = {
+ prevHeight: window.innerHeight,
+ prevWidth: window.innerWidth,
+ isMobileView: window.innerWidth <= 1400,
+ currentScreen: "payment_link",
+};
+
+var widgets = null;
+var unifiedCheckout = null;
+// @ts-ignore
+var pub_key = window.__PAYMENT_DETAILS.pub_key;
+var hyper = null;
+
+/**
+ * Trigger - init function invoked once the script tag is loaded
+ * Use
+ * - Update document's title
+ * - Update document's icon
+ * - Render and populate document with payment details and cart
+ * - Initialize event listeners for updating UI on screen size changes
+ * - Initialize SDK
+ **/
+function boot() {
+ // @ts-ignore
+ var paymentDetails = window.__PAYMENT_DETAILS;
+
+ if (paymentDetails.merchant_name) {
+ document.title = "Payment requested by " + paymentDetails.merchant_name;
+ }
+
+ if (paymentDetails.merchant_logo) {
+ var link = document.createElement("link");
+ link.rel = "icon";
+ link.href = paymentDetails.merchant_logo;
+ link.type = "image/x-icon";
+ document.head.appendChild(link);
+ }
+
+ // Render UI
+ renderPaymentDetails(paymentDetails);
+ renderSDKHeader(paymentDetails);
+ renderCart(paymentDetails);
+
+ // Deal w loaders
+ show("#sdk-spinner");
+ hide("#page-spinner");
+ hide("#unified-checkout");
+
+ // Add event listeners
+ initializeEventListeners(paymentDetails);
+
+ // Initialize SDK
+ // @ts-ignore
+ if (window.Hyper) {
+ initializeSDK();
+ }
+
+ // State specific functions
+ // @ts-ignore
+ if (window.state.isMobileView) {
+ show("#hyper-footer");
+ hide("#hyper-checkout-cart");
+ } else {
+ show("#hyper-checkout-cart");
+ }
+}
+boot();
+
+/**
+ * Use - add event listeners for changing UI on screen resize
+ * @param {PaymentDetails} paymentDetails
+ */
+function initializeEventListeners(paymentDetails) {
+ var primaryColor = paymentDetails.theme;
+ var lighterColor = adjustLightness(primaryColor, 1.4);
+ var darkerColor = adjustLightness(primaryColor, 0.8);
+ var contrastBWColor = invert(primaryColor, true);
+ var a = lighterColor.match(/[fF]/gi);
+ var contrastingTone =
+ Array.isArray(a) && a.length > 4 ? darkerColor : lighterColor;
+ var hyperCheckoutNode = document.getElementById("hyper-checkout-payment");
+ var hyperCheckoutCartImageNode = document.getElementById(
+ "hyper-checkout-cart-image"
+ );
+ var hyperCheckoutFooterNode = document.getElementById(
+ "hyper-checkout-payment-footer"
+ );
+ var submitButtonNode = document.getElementById("submit");
+ var submitButtonLoaderNode = document.getElementById("submit-spinner");
+
+ if (submitButtonLoaderNode instanceof HTMLSpanElement) {
+ submitButtonLoaderNode.style.borderBottomColor = contrastingTone;
+ }
+
+ if (submitButtonNode instanceof HTMLButtonElement) {
+ submitButtonNode.style.color = contrastBWColor;
+ }
+
+ if (hyperCheckoutCartImageNode instanceof HTMLDivElement) {
+ hyperCheckoutCartImageNode.style.backgroundColor = contrastingTone;
+ }
+
+ if (window.innerWidth <= 1400) {
+ if (hyperCheckoutNode instanceof HTMLDivElement) {
+ hyperCheckoutNode.style.color = contrastBWColor;
+ }
+ if (hyperCheckoutFooterNode instanceof HTMLDivElement) {
+ hyperCheckoutFooterNode.style.backgroundColor = contrastingTone;
+ }
+ } else if (window.innerWidth > 1400) {
+ if (hyperCheckoutNode instanceof HTMLDivElement) {
+ hyperCheckoutNode.style.color = "#333333";
+ }
+ if (hyperCheckoutFooterNode instanceof HTMLDivElement) {
+ hyperCheckoutFooterNode.style.backgroundColor = "#F5F5F5";
+ }
+ }
+
+ window.addEventListener("resize", function (event) {
+ var currentHeight = window.innerHeight;
+ var currentWidth = window.innerWidth;
+ // @ts-ignore
+ if (currentWidth <= 1400 && window.state.prevWidth > 1400) {
+ hide("#hyper-checkout-cart");
+ // @ts-ignore
+ if (window.state.currentScreen === "payment_link") {
+ show("#hyper-footer");
+ }
+ try {
+ if (hyperCheckoutNode instanceof HTMLDivElement) {
+ hyperCheckoutNode.style.color = contrastBWColor;
+ }
+ if (hyperCheckoutFooterNode instanceof HTMLDivElement) {
+ hyperCheckoutFooterNode.style.backgroundColor = lighterColor;
+ }
+ } catch (error) {
+ console.error("Failed to fetch primary-color, using default", error);
+ }
+ // @ts-ignore
+ } else if (currentWidth > 1400 && window.state.prevWidth <= 1400) {
+ // @ts-ignore
+ if (window.state.currentScreen === "payment_link") {
+ hide("#hyper-footer");
+ }
+ show("#hyper-checkout-cart");
+ try {
+ if (hyperCheckoutNode instanceof HTMLDivElement) {
+ hyperCheckoutNode.style.color = "#333333";
+ }
+ if (hyperCheckoutFooterNode instanceof HTMLDivElement) {
+ hyperCheckoutFooterNode.style.backgroundColor = "#F5F5F5";
+ }
+ } catch (error) {
+ console.error("Failed to revert back to default colors", error);
+ }
+ }
+
+ // @ts-ignore
+ window.state.prevHeight = currentHeight;
+ // @ts-ignore
+ window.state.prevWidth = currentWidth;
+ // @ts-ignore
+ window.state.isMobileView = currentWidth <= 1400;
+ });
+}
+
+/**
+ * Trigger - post mounting SDK
+ * Use - set relevant classes to elements in the doc for showing SDK
+ **/
+function showSDK() {
+ show("#hyper-checkout-sdk");
+ show("#hyper-checkout-details");
+ show("#submit");
+ show("#unified-checkout");
+ hide("#sdk-spinner");
+}
+
+/**
+ * Trigger - post downloading SDK
+ * Uses
+ * - Instantiate SDK
+ * - Create a payment widget
+ * - Decide whether or not to show SDK (based on status)
+ **/
+function initializeSDK() {
+ // @ts-ignore
+ var paymentDetails = window.__PAYMENT_DETAILS;
+ var client_secret = paymentDetails.client_secret;
+ var appearance = {
+ variables: {
+ colorPrimary: paymentDetails.theme || "rgb(0, 109, 249)",
+ fontFamily: "Work Sans, sans-serif",
+ fontSizeBase: "16px",
+ colorText: "rgb(51, 65, 85)",
+ colorTextSecondary: "#334155B3",
+ colorPrimaryText: "rgb(51, 65, 85)",
+ colorTextPlaceholder: "#33415550",
+ borderColor: "#33415550",
+ colorBackground: "rgb(255, 255, 255)",
+ },
+ };
+ // @ts-ignore
+ hyper = window.Hyper(pub_key, {
+ isPreloadEnabled: false,
+ });
+ widgets = hyper.widgets({
+ appearance: appearance,
+ clientSecret: client_secret,
+ });
+ var type =
+ paymentDetails.sdk_layout === "spaced_accordion" ||
+ paymentDetails.sdk_layout === "accordion"
+ ? "accordion"
+ : paymentDetails.sdk_layout;
+
+ var unifiedCheckoutOptions = {
+ disableSaveCards: true,
+ layout: {
+ type: type, //accordion , tabs, spaced accordion
+ spacedAccordionItems: paymentDetails.sdk_layout === "spaced_accordion",
+ },
+ branding: "never",
+ wallets: {
+ walletReturnUrl: paymentDetails.return_url,
+ style: {
+ theme: "dark",
+ type: "default",
+ height: 55,
+ },
+ },
+ };
+ unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions);
+ mountUnifiedCheckout("#unified-checkout");
+ showSDK();
+}
+
+/**
+ * Use - mount payment widget on the passed element
+ * @param {String} id
+ **/
+function mountUnifiedCheckout(id) {
+ if (unifiedCheckout !== null) {
+ unifiedCheckout.mount(id);
+ }
+}
+
+/**
+ * Trigger - on clicking submit button
+ * Uses
+ * - Trigger /payment/confirm through SDK
+ * - Toggle UI loaders appropriately
+ * - Handle errors and redirect to status page
+ * @param {Event} e
+ */
+function handleSubmit(e) {
+ // @ts-ignore
+ var paymentDetails = window.__PAYMENT_DETAILS;
+
+ // Update button loader
+ hide("#submit-button-text");
+ show("#submit-spinner");
+ var submitButtonNode = document.getElementById("submit");
+ if (submitButtonNode instanceof HTMLButtonElement) {
+ submitButtonNode.disabled = true;
+ submitButtonNode.classList.add("disabled");
+ }
+
+ hyper
+ .confirmPayment({
+ widgets: widgets,
+ confirmParams: {
+ // Make sure to change this to your payment completion page
+ return_url: paymentDetails.return_url,
+ },
+ })
+ .then(function (result) {
+ var error = result.error;
+ if (error) {
+ if (error.type === "validation_error") {
+ showMessage(error.message);
+ } else {
+ showMessage("An unexpected error occurred.");
+ }
+ } else {
+ redirectToStatus();
+ }
+ })
+ .catch(function (error) {
+ console.error("Error confirming payment_intent", error);
+ })
+ .finally(() => {
+ hide("#submit-spinner");
+ show("#submit-button-text");
+ if (submitButtonNode instanceof HTMLButtonElement) {
+ submitButtonNode.disabled = false;
+ submitButtonNode.classList.remove("disabled");
+ }
+ });
+}
+
+function show(id) {
+ removeClass(id, "hidden");
+}
+function hide(id) {
+ addClass(id, "hidden");
+}
+
+function showMessage(msg) {
+ show("#payment-message");
+ addText("#payment-message", msg);
+}
+
+/**
+ * Use - redirect to /payment_link/status
+ */
+function redirectToStatus() {
+ var arr = window.location.pathname.split("/");
+ arr.splice(0, 2);
+ arr.unshift("status");
+ arr.unshift("payment_link");
+ window.location.href = window.location.origin + "/" + arr.join("/");
+}
+
+function addText(id, msg) {
+ var element = document.querySelector(id);
+ element.innerText = msg;
+}
+
+function addClass(id, className) {
+ var element = document.querySelector(id);
+ element.classList.add(className);
+}
+
+function removeClass(id, className) {
+ var element = document.querySelector(id);
+ element.classList.remove(className);
+}
+
+/**
+ * Use - format date in "hh:mm AM/PM timezone MM DD, YYYY"
+ * @param {Date} date
+ **/
+function formatDate(date) {
+ var months = [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December",
+ ];
+
+ var hours = date.getHours();
+ var minutes = date.getMinutes();
+ minutes = minutes < 10 ? "0" + minutes : minutes;
+ var suffix = hours > 11 ? "PM" : "AM";
+ hours = hours % 12;
+ hours = hours ? hours : 12;
+ var day = date.getDate();
+ var month = months[date.getMonth()];
+ var year = date.getUTCFullYear();
+
+ // @ts-ignore
+ var locale = navigator.language || navigator.userLanguage;
+ var timezoneShorthand = date
+ .toLocaleDateString(locale, {
+ day: "2-digit",
+ timeZoneName: "long",
+ })
+ .substring(4)
+ .split(" ")
+ .reduce(function (tz, c) {
+ return tz + c.charAt(0).toUpperCase();
+ }, "");
+
+ var formatted =
+ hours +
+ ":" +
+ minutes +
+ " " +
+ suffix +
+ " " +
+ timezoneShorthand +
+ " " +
+ month +
+ " " +
+ day +
+ ", " +
+ year;
+ return formatted;
+}
+
+/**
+ * Trigger - on boot
+ * Uses
+ * - Render payment related details (header bit)
+ * - Amount
+ * - Merchant's name
+ * - Expiry
+ * @param {PaymentDetails} paymentDetails
+ **/
+function renderPaymentDetails(paymentDetails) {
+ // Create price node
+ var priceNode = document.createElement("div");
+ priceNode.className = "hyper-checkout-payment-price";
+ priceNode.innerText = paymentDetails.currency + " " + paymentDetails.amount;
+
+ // Create merchant name's node
+ var merchantNameNode = document.createElement("div");
+ merchantNameNode.className = "hyper-checkout-payment-merchant-name";
+ merchantNameNode.innerText = "Requested by " + paymentDetails.merchant_name;
+
+ // Create payment ID node
+ var paymentIdNode = document.createElement("div");
+ paymentIdNode.className = "hyper-checkout-payment-ref";
+ paymentIdNode.innerText = "Ref Id: " + paymentDetails.payment_id;
+
+ // Create merchant logo's node
+ var merchantLogoNode = document.createElement("img");
+ merchantLogoNode.src = paymentDetails.merchant_logo;
+
+ // Create expiry node
+ var paymentExpiryNode = document.createElement("div");
+ paymentExpiryNode.className = "hyper-checkout-payment-footer-expiry";
+ var expiryDate = new Date(paymentDetails.session_expiry);
+ var formattedDate = formatDate(expiryDate);
+ paymentExpiryNode.innerText = "Link expires on: " + formattedDate;
+
+ // Append information to DOM
+ var paymentContextNode = document.getElementById(
+ "hyper-checkout-payment-context"
+ );
+ if (paymentContextNode instanceof HTMLDivElement) {
+ paymentContextNode.prepend(priceNode);
+ }
+ var paymentMerchantDetails = document.getElementById(
+ "hyper-checkout-payment-merchant-details"
+ );
+ if (paymentMerchantDetails instanceof HTMLDivElement) {
+ paymentMerchantDetails.append(merchantNameNode);
+ paymentMerchantDetails.append(paymentIdNode);
+ }
+ var merchantImageNode = document.getElementById(
+ "hyper-checkout-merchant-image"
+ );
+ if (merchantImageNode instanceof HTMLDivElement) {
+ merchantImageNode.prepend(merchantLogoNode);
+ }
+ var footerNode = document.getElementById("hyper-checkout-payment-footer");
+ if (footerNode instanceof HTMLDivElement) {
+ footerNode.append(paymentExpiryNode);
+ }
+}
+
+/**
+ * Trigger - on boot
+ * Uses
+ * - Render cart wrapper and items
+ * - Attaches an onclick event for toggling expand on the items list
+ * @param {PaymentDetails} paymentDetails
+ **/
+function renderCart(paymentDetails) {
+ var orderDetails = paymentDetails.order_details;
+
+ // Cart items
+ if (Array.isArray(orderDetails) && orderDetails.length > 0) {
+ var cartNode = document.getElementById("hyper-checkout-cart");
+ var cartItemsNode = document.getElementById("hyper-checkout-cart-items");
+ var MAX_ITEMS_VISIBLE_AFTER_COLLAPSE =
+ paymentDetails.max_items_visible_after_collapse;
+
+ orderDetails.map(function (item, index) {
+ if (index >= MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
+ return;
+ }
+ renderCartItem(
+ item,
+ paymentDetails,
+ index !== 0 && index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE,
+ cartItemsNode
+ );
+ });
+ // Expand / collapse button
+ var totalItems = orderDetails.length;
+ if (totalItems > MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
+ var expandButtonNode = document.createElement("div");
+ expandButtonNode.className = "hyper-checkout-cart-button";
+ expandButtonNode.onclick = () => {
+ handleCartView(paymentDetails);
+ };
+ var buttonImageNode = document.createElement("svg");
+ buttonImageNode.id = "hyper-checkout-cart-button-arrow";
+ var arrowDownImage = document.getElementById("arrow-down");
+ if (arrowDownImage instanceof Object) {
+ buttonImageNode.innerHTML = arrowDownImage.innerHTML;
+ }
+ var buttonTextNode = document.createElement("span");
+ buttonTextNode.id = "hyper-checkout-cart-button-text";
+ var hiddenItemsCount =
+ orderDetails.length - MAX_ITEMS_VISIBLE_AFTER_COLLAPSE;
+ buttonTextNode.innerText = "Show More (" + hiddenItemsCount + ")";
+ expandButtonNode.append(buttonTextNode, buttonImageNode);
+ if (cartNode instanceof HTMLDivElement) {
+ cartNode.insertBefore(expandButtonNode, cartNode.lastElementChild);
+ }
+ }
+ } else {
+ hide("#hyper-checkout-cart-header");
+ hide("#hyper-checkout-cart-items");
+ hide("#hyper-checkout-cart-image");
+ if (
+ typeof paymentDetails.merchant_description === "string" &&
+ paymentDetails.merchant_description.length > 0
+ ) {
+ var merchantDescriptionNode = document.getElementById(
+ "hyper-checkout-merchant-description"
+ );
+ if (merchantDescriptionNode instanceof HTMLDivElement) {
+ merchantDescriptionNode.innerText = paymentDetails.merchant_description;
+ }
+ show("#hyper-checkout-merchant-description");
+ }
+ }
+}
+
+/**
+ * Trigger - on cart render
+ * Uses
+ * - Renders a single cart item which includes
+ * - Product image
+ * - Product name
+ * - Quantity
+ * - Single item amount
+ * @param {OrderDetailsWithAmount} item
+ * @param {PaymentDetails} paymentDetails
+ * @param {boolean} shouldAddDividerNode
+ * @param {HTMLDivElement} cartItemsNode
+ **/
+function renderCartItem(
+ item,
+ paymentDetails,
+ shouldAddDividerNode,
+ cartItemsNode
+) {
+ // Wrappers
+ var itemWrapperNode = document.createElement("div");
+ itemWrapperNode.className = "hyper-checkout-cart-item";
+ var nameAndQuantityWrapperNode = document.createElement("div");
+ nameAndQuantityWrapperNode.className = "hyper-checkout-cart-product-details";
+ // Image
+ var productImageNode = document.createElement("img");
+ productImageNode.className = "hyper-checkout-cart-product-image";
+ productImageNode.src = item.product_img_link;
+ // Product title
+ var productNameNode = document.createElement("div");
+ productNameNode.className = "hyper-checkout-card-item-name";
+ productNameNode.innerText = item.product_name;
+ // Product quantity
+ var quantityNode = document.createElement("div");
+ quantityNode.className = "hyper-checkout-card-item-quantity";
+ quantityNode.innerText = "Qty: " + item.quantity;
+ // Product price
+ var priceNode = document.createElement("div");
+ priceNode.className = "hyper-checkout-card-item-price";
+ priceNode.innerText = paymentDetails.currency + " " + item.amount;
+ // Append items
+ nameAndQuantityWrapperNode.append(productNameNode, quantityNode);
+ itemWrapperNode.append(
+ productImageNode,
+ nameAndQuantityWrapperNode,
+ priceNode
+ );
+ if (shouldAddDividerNode) {
+ var dividerNode = document.createElement("div");
+ dividerNode.className = "hyper-checkout-cart-item-divider";
+ cartItemsNode.append(dividerNode);
+ }
+ cartItemsNode.append(itemWrapperNode);
+}
+
+/**
+ * Trigger - on toggling expansion of cart list
+ * Uses
+ * - Render or delete items based on current state of the rendered cart list
+ * @param {PaymentDetails} paymentDetails
+ **/
+function handleCartView(paymentDetails) {
+ var orderDetails = paymentDetails.order_details;
+ var MAX_ITEMS_VISIBLE_AFTER_COLLAPSE =
+ paymentDetails.max_items_visible_after_collapse;
+ var itemsHTMLCollection = document.getElementsByClassName(
+ "hyper-checkout-cart-item"
+ );
+ var dividerHTMLCollection = document.getElementsByClassName(
+ "hyper-checkout-cart-item-divider"
+ );
+ var cartItems = [].slice.call(itemsHTMLCollection);
+ var dividerItems = [].slice.call(dividerHTMLCollection);
+ var isHidden = cartItems.length < orderDetails.length;
+ var cartItemsNode = document.getElementById("hyper-checkout-cart-items");
+ var cartButtonTextNode = document.getElementById(
+ "hyper-checkout-cart-button-text"
+ );
+ var cartButtonImageNode = document.getElementById(
+ "hyper-checkout-cart-button-arrow"
+ );
+ if (isHidden) {
+ if (Array.isArray(orderDetails)) {
+ orderDetails.map(function (item, index) {
+ if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
+ return;
+ }
+ renderCartItem(
+ item,
+ paymentDetails,
+ index >= MAX_ITEMS_VISIBLE_AFTER_COLLAPSE,
+ cartItemsNode
+ );
+ });
+ }
+ if (cartItemsNode instanceof HTMLDivElement) {
+ cartItemsNode.style.maxHeight = cartItemsNode.scrollHeight + "px";
+ cartItemsNode.style.height = cartItemsNode.scrollHeight + "px";
+ }
+ if (cartButtonTextNode instanceof HTMLButtonElement) {
+ cartButtonTextNode.innerText = "Show Less";
+ }
+ var arrowUpImage = document.getElementById("arrow-up");
+ if (
+ cartButtonImageNode instanceof Object &&
+ arrowUpImage instanceof Object
+ ) {
+ cartButtonImageNode.innerHTML = arrowUpImage.innerHTML;
+ }
+ } else {
+ if (cartItemsNode instanceof HTMLDivElement) {
+ cartItemsNode.style.maxHeight = "300px";
+ cartItemsNode.style.height = "290px";
+ cartItemsNode.scrollTo({ top: 0, behavior: "smooth" });
+ setTimeout(function () {
+ cartItems.map(function (item, index) {
+ if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
+ return;
+ }
+ if (cartItemsNode instanceof HTMLDivElement) {
+ cartItemsNode.removeChild(item);
+ }
+ });
+ dividerItems.map(function (item, index) {
+ if (index < MAX_ITEMS_VISIBLE_AFTER_COLLAPSE - 1) {
+ return;
+ }
+ if (cartItemsNode instanceof HTMLDivElement) {
+ cartItemsNode.removeChild(item);
+ }
+ });
+ }, 300);
+ }
+ setTimeout(function () {
+ var hiddenItemsCount =
+ orderDetails.length - MAX_ITEMS_VISIBLE_AFTER_COLLAPSE;
+ if (cartButtonTextNode instanceof HTMLButtonElement) {
+ cartButtonTextNode.innerText = "Show More (" + hiddenItemsCount + ")";
+ }
+ var arrowDownImage = document.getElementById("arrow-down");
+ if (
+ cartButtonImageNode instanceof Object &&
+ arrowDownImage instanceof Object
+ ) {
+ cartButtonImageNode.innerHTML = arrowDownImage.innerHTML;
+ }
+ }, 250);
+ }
+}
+
+/**
+ * Use - hide cart when in mobile view
+ **/
+function hideCartInMobileView() {
+ window.history.back();
+ var cartNode = document.getElementById("hyper-checkout-cart");
+ if (cartNode instanceof HTMLDivElement) {
+ cartNode.style.animation = "slide-to-right 0.3s linear";
+ cartNode.style.right = "-582px";
+ }
+ setTimeout(function () {
+ hide("#hyper-checkout-cart");
+ }, 300);
+}
+
+/**
+ * Use - show cart when in mobile view
+ **/
+function viewCartInMobileView() {
+ window.history.pushState("view-cart", "");
+ var cartNode = document.getElementById("hyper-checkout-cart");
+ if (cartNode instanceof HTMLDivElement) {
+ cartNode.style.animation = "slide-from-right 0.3s linear";
+ cartNode.style.right = "0px";
+ }
+ show("#hyper-checkout-cart");
+}
+
+/**
+ * Trigger - on boot
+ * Uses
+ * - Render SDK header node
+ * - merchant's name
+ * - currency + amount
+ * @param {PaymentDetails} paymentDetails
+ **/
+function renderSDKHeader(paymentDetails) {
+ // SDK headers' items
+ var sdkHeaderItemNode = document.createElement("div");
+ sdkHeaderItemNode.className = "hyper-checkout-sdk-items";
+ var sdkHeaderMerchantNameNode = document.createElement("div");
+ sdkHeaderMerchantNameNode.className = "hyper-checkout-sdk-header-brand-name";
+ sdkHeaderMerchantNameNode.innerText = paymentDetails.merchant_name;
+ var sdkHeaderAmountNode = document.createElement("div");
+ sdkHeaderAmountNode.className = "hyper-checkout-sdk-header-amount";
+ sdkHeaderAmountNode.innerText =
+ paymentDetails.currency + " " + paymentDetails.amount;
+ sdkHeaderItemNode.append(sdkHeaderMerchantNameNode);
+ sdkHeaderItemNode.append(sdkHeaderAmountNode);
+
+ // Append to SDK header's node
+ var sdkHeaderNode = document.getElementById("hyper-checkout-sdk-header");
+ if (sdkHeaderNode instanceof HTMLDivElement) {
+ // sdkHeaderNode.append(sdkHeaderLogoNode);
+ sdkHeaderNode.append(sdkHeaderItemNode);
+ }
+}
diff --git a/crates/router/src/core/payment_link/payment_link_status/status.css b/crates/router/src/core/payment_link/payment_link_status/status.css
new file mode 100644
index 00000000000..113f1353138
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_status/status.css
@@ -0,0 +1,161 @@
+{{ css_color_scheme }}
+
+body,
+body > div {
+ height: 100vh;
+ width: 100vw;
+}
+
+body {
+ font-family: "Montserrat";
+ background-color: var(--primary-color);
+ color: #333;
+ text-align: center;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+}
+
+body > div {
+ height: 100vh;
+ width: 100vw;
+ overflow: scroll;
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: center;
+}
+
+.hyper-checkout-status-wrap {
+ display: flex;
+ flex-flow: column;
+ font-family: "Montserrat";
+ width: auto;
+ min-width: 400px;
+ max-width: 800px;
+ background-color: white;
+ border-radius: 5px;
+}
+
+#hyper-checkout-status-header {
+ max-width: 1200px;
+ border-radius: 3px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+#hyper-checkout-status-header,
+#hyper-checkout-status-content {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 24px;
+ font-weight: 600;
+ padding: 15px 20px;
+}
+
+.hyper-checkout-status-amount {
+ font-family: "Montserrat";
+ font-size: 35px;
+ font-weight: 700;
+}
+
+.hyper-checkout-status-merchant-logo {
+ border: 1px solid #e6e6e6;
+ border-radius: 5px;
+ padding: 9px;
+ height: 48px;
+ width: 48px;
+}
+
+#hyper-checkout-status-content {
+ height: 100%;
+ flex-flow: column;
+ min-height: 500px;
+ align-items: center;
+ justify-content: center;
+}
+
+.hyper-checkout-status-image {
+ height: 200px;
+ width: 200px;
+}
+
+.hyper-checkout-status-text {
+ text-align: center;
+ font-size: 21px;
+ font-weight: 600;
+ margin-top: 20px;
+}
+
+.hyper-checkout-status-message {
+ text-align: center;
+ font-size: 12px !important;
+ margin-top: 10px;
+ font-size: 14px;
+ font-weight: 500;
+ max-width: 400px;
+}
+
+.hyper-checkout-status-details {
+ display: flex;
+ flex-flow: column;
+ margin-top: 20px;
+ border-radius: 3px;
+ border: 1px solid #e6e6e6;
+ max-width: calc(100vw - 40px);
+}
+
+.hyper-checkout-status-item {
+ display: flex;
+ align-items: center;
+ padding: 5px 10px;
+ border-bottom: 1px solid #e6e6e6;
+ word-wrap: break-word;
+}
+
+.hyper-checkout-status-item:last-child {
+ border-bottom: 0;
+}
+
+.hyper-checkout-item-header {
+ min-width: 13ch;
+ font-size: 12px;
+}
+
+.hyper-checkout-item-value {
+ font-size: 12px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ word-wrap: break-word;
+ font-weight: 400;
+ text-align: center;
+}
+
+#hyper-checkout-status-redirect-message {
+ margin-top: 20px;
+ font-family: "Montserrat";
+ font-size: 13px;
+}
+
+.ellipsis-container-2 {
+ height: 2.5em;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ text-overflow: ellipsis;
+ white-space: normal;
+}
+
+@media only screen and (max-width: 1136px) {
+ .info {
+ flex-flow: column;
+ align-self: flex-start;
+ align-items: flex-start;
+ min-width: auto;
+ }
+
+ .value {
+ margin: 0;
+ }
+}
\ No newline at end of file
diff --git a/crates/router/src/core/payment_link/payment_link_status/status.html b/crates/router/src/core/payment_link/payment_link_status/status.html
new file mode 100644
index 00000000000..00f1efe38c0
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_status/status.html
@@ -0,0 +1,26 @@
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Payment Status</title>
+ <style>
+ {{rendered_css}}
+ </style>
+ <link
+ rel="stylesheet"
+ href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
+ />
+ <script>
+ {{ rendered_js }}
+ </script>
+ </head>
+ <body onload="boot()">
+ <div>
+ <div class="hyper-checkout-status-wrap">
+ <div id="hyper-checkout-status-header"></div>
+ <div id="hyper-checkout-status-content"></div>
+ </div>
+ <div id="hyper-checkout-status-redirect-message"></div>
+ </div>
+ </body>
+</html>
diff --git a/crates/router/src/core/payment_link/payment_link_status/status.js b/crates/router/src/core/payment_link/payment_link_status/status.js
new file mode 100644
index 00000000000..7bf2dbaabb3
--- /dev/null
+++ b/crates/router/src/core/payment_link/payment_link_status/status.js
@@ -0,0 +1,379 @@
+// @ts-check
+
+/**
+ * UTIL FUNCTIONS
+ */
+
+/**
+ * Ref - https://github.com/onury/invert-color/blob/master/lib/cjs/invert.js
+ */
+function padz(str, len) {
+ if (len === void 0) {
+ len = 2;
+ }
+ return (new Array(len).join("0") + str).slice(-len);
+}
+function hexToRgbArray(hex) {
+ if (hex.slice(0, 1) === "#") hex = hex.slice(1);
+ var RE_HEX = /^(?:[0-9a-f]{3}){1,2}$/i;
+ if (!RE_HEX.test(hex)) throw new Error('Invalid HEX color: "' + hex + '"');
+ if (hex.length === 3) {
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
+ }
+ return [
+ parseInt(hex.slice(0, 2), 16),
+ parseInt(hex.slice(2, 4), 16),
+ parseInt(hex.slice(4, 6), 16),
+ ];
+}
+function toRgbArray(c) {
+ if (!c) throw new Error("Invalid color value");
+ if (Array.isArray(c)) return c;
+ return typeof c === "string" ? hexToRgbArray(c) : [c.r, c.g, c.b];
+}
+function getLuminance(c) {
+ var i, x;
+ var a = [];
+ for (i = 0; i < c.length; i++) {
+ x = c[i] / 255;
+ a[i] = x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
+ }
+ return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];
+}
+function invertToBW(color, bw, asArr) {
+ var DEFAULT_BW = {
+ black: "#090302",
+ white: "#FFFFFC",
+ threshold: Math.sqrt(1.05 * 0.05) - 0.05,
+ };
+ var options = bw === true ? DEFAULT_BW : Object.assign({}, DEFAULT_BW, bw);
+ return getLuminance(color) > options.threshold
+ ? asArr
+ ? hexToRgbArray(options.black)
+ : options.black
+ : asArr
+ ? hexToRgbArray(options.white)
+ : options.white;
+}
+function invert(color, bw) {
+ if (bw === void 0) {
+ bw = false;
+ }
+ color = toRgbArray(color);
+ if (bw) return invertToBW(color, bw);
+ return (
+ "#" +
+ color
+ .map(function (c) {
+ return padz((255 - c).toString(16));
+ })
+ .join("")
+ );
+}
+
+/**
+ * UTIL FUNCTIONS END HERE
+ */
+
+// @ts-ignore
+{{ payment_details_js_script }}
+
+// @ts-ignore
+window.state = {
+ prevHeight: window.innerHeight,
+ prevWidth: window.innerWidth,
+ isMobileView: window.innerWidth <= 1400,
+};
+
+/**
+ * Trigger - init function invoked once the script tag is loaded
+ * Use
+ * - Update document's title
+ * - Update document's icon
+ * - Render and populate document with payment details and cart
+ * - Initialize event listeners for updating UI on screen size changes
+ * - Initialize SDK
+ **/
+function boot() {
+ // @ts-ignore
+ var paymentDetails = window.__PAYMENT_DETAILS;
+
+ // Attach document icon
+ if (paymentDetails.merchant_logo) {
+ var link = document.createElement("link");
+ link.rel = "icon";
+ link.href = paymentDetails.merchant_logo;
+ link.type = "image/x-icon";
+ document.head.appendChild(link);
+ }
+
+ // Render status details
+ renderStatusDetails(paymentDetails);
+
+ // Add event listeners
+ initializeEventListeners(paymentDetails);
+}
+
+/**
+ * Trigger - on boot
+ * Uses
+ * - Render status details
+ * - Header - (amount, merchant name, merchant logo)
+ * - Body - status with image
+ * - Footer - payment details (id | error code and msg, if any)
+ * @param {PaymentDetails} paymentDetails
+ **/
+function renderStatusDetails(paymentDetails) {
+ var status = paymentDetails.status;
+
+ var statusDetails = {
+ imageSource: "",
+ message: "",
+ status: status,
+ amountText: "",
+ items: [],
+ };
+
+ // Payment details
+ var paymentId = createItem("Ref Id", paymentDetails.payment_id);
+ // @ts-ignore
+ statusDetails.items.push(paymentId);
+
+ // Status specific information
+ switch (status) {
+ case "expired":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/failed.png";
+ statusDetails.status = "Payment Link Expired";
+ statusDetails.message =
+ "Sorry, this payment link has expired. Please use below reference for further investigation.";
+ break;
+
+ case "succeeded":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/success.png";
+ statusDetails.message = "We have successfully received your payment";
+ statusDetails.status = "Paid successfully";
+ statusDetails.amountText = new Date(
+ paymentDetails.created
+ ).toTimeString();
+ break;
+
+ case "processing":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/pending.png";
+ statusDetails.message =
+ "Sorry! Your payment is taking longer than expected. Please check back again in sometime.";
+ statusDetails.status = "Payment Pending";
+ break;
+
+ case "failed":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/failed.png";
+ statusDetails.status = "Payment Failed!";
+ var errorCodeNode = createItem("Error code", paymentDetails.error_code);
+ var errorMessageNode = createItem(
+ "Error message",
+ paymentDetails.error_message
+ );
+ // @ts-ignore
+ statusDetails.items.push(errorMessageNode, errorCodeNode);
+ break;
+
+ case "cancelled":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/failed.png";
+ statusDetails.status = "Payment Cancelled";
+ break;
+
+ case "requires_merchant_action":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/pending.png";
+ statusDetails.status = "Payment under review";
+ break;
+
+ case "requires_capture":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/success.png";
+ statusDetails.message = "We have successfully received your payment";
+ statusDetails.status = "Payment Success";
+ break;
+
+ case "partially_captured":
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/success.png";
+ statusDetails.message = "Partial payment was captured.";
+ statusDetails.status = "Payment Success";
+ break;
+
+ default:
+ statusDetails.imageSource = "https://live.hyperswitch.io/payment-link-assets/failed.png";
+ statusDetails.status = "Something went wrong";
+ // Error details
+ if (typeof paymentDetails.error === "object") {
+ var errorCodeNode = createItem("Error Code", paymentDetails.error.code);
+ var errorMessageNode = createItem(
+ "Error Message",
+ paymentDetails.error.message
+ );
+ // @ts-ignore
+ statusDetails.items.push(errorMessageNode, errorCodeNode);
+ }
+ break;
+ }
+
+ // Form header items
+ var amountNode = document.createElement("div");
+ amountNode.className = "hyper-checkout-status-amount";
+ amountNode.innerText = paymentDetails.currency + " " + paymentDetails.amount;
+ var merchantLogoNode = document.createElement("img");
+ merchantLogoNode.className = "hyper-checkout-status-merchant-logo";
+ // @ts-ignore
+ merchantLogoNode.src = window.__PAYMENT_DETAILS.merchant_logo;
+ merchantLogoNode.alt = "";
+
+ // Form content items
+ var statusImageNode = document.createElement("img");
+ statusImageNode.className = "hyper-checkout-status-image";
+ statusImageNode.src = statusDetails.imageSource;
+ var statusTextNode = document.createElement("div");
+ statusTextNode.className = "hyper-checkout-status-text";
+ statusTextNode.innerText = statusDetails.status;
+ var statusMessageNode = document.createElement("div");
+ statusMessageNode.className = "hyper-checkout-status-message";
+ statusMessageNode.innerText = statusDetails.message;
+ var statusDetailsNode = document.createElement("div");
+ statusDetailsNode.className = "hyper-checkout-status-details";
+
+ // Append items
+ if (statusDetailsNode instanceof HTMLDivElement) {
+ statusDetails.items.map(function (item) {
+ statusDetailsNode.append(item);
+ });
+ }
+ var statusHeaderNode = document.getElementById(
+ "hyper-checkout-status-header"
+ );
+ if (statusHeaderNode instanceof HTMLDivElement) {
+ statusHeaderNode.append(amountNode, merchantLogoNode);
+ }
+ var statusContentNode = document.getElementById(
+ "hyper-checkout-status-content"
+ );
+ if (statusContentNode instanceof HTMLDivElement) {
+ statusContentNode.append(statusImageNode, statusTextNode);
+ if (statusMessageNode instanceof HTMLDivElement) {
+ statusContentNode.append(statusMessageNode);
+ }
+ statusContentNode.append(statusDetailsNode);
+ }
+
+ if (paymentDetails.redirect === true) {
+ // Form redirect text
+ var statusRedirectTextNode = document.getElementById(
+ "hyper-checkout-status-redirect-message"
+ );
+ if (
+ statusRedirectTextNode instanceof HTMLDivElement &&
+ typeof paymentDetails.return_url === "string"
+ ) {
+ var timeout = 5,
+ j = 0;
+ for (var i = 0; i <= timeout; i++) {
+ setTimeout(function () {
+ var secondsLeft = timeout - j++;
+ var innerText =
+ secondsLeft === 0
+ ? "Redirecting ..."
+ : "Redirecting in " + secondsLeft + " seconds ...";
+ // @ts-ignore
+ statusRedirectTextNode.innerText = innerText;
+ if (secondsLeft === 0) {
+ // Form query params
+ var queryParams = {
+ payment_id: paymentDetails.payment_id,
+ status: paymentDetails.status,
+ };
+ var url = new URL(paymentDetails.return_url);
+ var params = new URLSearchParams(url.search);
+ // Attach query params to return_url
+ for (var key in queryParams) {
+ if (queryParams.hasOwnProperty(key)) {
+ params.set(key, queryParams[key]);
+ }
+ }
+ url.search = params.toString();
+ setTimeout(function () {
+ // Finally redirect
+ window.location.href = url.toString();
+ }, 1000);
+ }
+ }, i * 1000);
+ }
+ }
+ }
+}
+
+/**
+ * Use - create an item which is a key-value pair of some information related to a payment
+ * @param {String} heading
+ * @param {String} value
+ **/
+function createItem(heading, value) {
+ var itemNode = document.createElement("div");
+ itemNode.className = "hyper-checkout-status-item";
+ var headerNode = document.createElement("div");
+ headerNode.className = "hyper-checkout-item-header";
+ headerNode.innerText = heading;
+ var valueNode = document.createElement("div");
+ valueNode.className = "hyper-checkout-item-value";
+ valueNode.innerText = value;
+ itemNode.append(headerNode);
+ itemNode.append(valueNode);
+ return itemNode;
+}
+
+/**
+ * Use - add event listeners for changing UI on screen resize
+ * @param {PaymentDetails} paymentDetails
+ */
+function initializeEventListeners(paymentDetails) {
+ var primaryColor = paymentDetails.theme;
+ var contrastBWColor = invert(primaryColor, true);
+ var statusRedirectTextNode = document.getElementById(
+ "hyper-checkout-status-redirect-message"
+ );
+
+ if (window.innerWidth <= 1400) {
+ if (statusRedirectTextNode instanceof HTMLDivElement) {
+ statusRedirectTextNode.style.color = "#333333";
+ }
+ } else if (window.innerWidth > 1400) {
+ if (statusRedirectTextNode instanceof HTMLDivElement) {
+ statusRedirectTextNode.style.color = contrastBWColor;
+ }
+ }
+
+ window.addEventListener("resize", function (event) {
+ var currentHeight = window.innerHeight;
+ var currentWidth = window.innerWidth;
+ // @ts-ignore
+ if (currentWidth <= 1400 && window.state.prevWidth > 1400) {
+ try {
+ if (statusRedirectTextNode instanceof HTMLDivElement) {
+ statusRedirectTextNode.style.color = "#333333";
+ }
+ } catch (error) {
+ console.error("Failed to fetch primary-color, using default", error);
+ }
+ // @ts-ignore
+ } else if (currentWidth > 1400 && window.state.prevWidth <= 1400) {
+ try {
+ if (statusRedirectTextNode instanceof HTMLDivElement) {
+ statusRedirectTextNode.style.color = contrastBWColor;
+ }
+ } catch (error) {
+ console.error("Failed to revert back to default colors", error);
+ }
+ }
+
+ // @ts-ignore
+ window.state.prevHeight = currentHeight;
+ // @ts-ignore
+ window.state.prevWidth = currentWidth;
+ // @ts-ignore
+ window.state.isMobileView = currentWidth <= 1400;
+ });
+}
diff --git a/crates/router/src/core/payment_link/status.html b/crates/router/src/core/payment_link/status.html
deleted file mode 100644
index d3bb97d294d..00000000000
--- a/crates/router/src/core/payment_link/status.html
+++ /dev/null
@@ -1,355 +0,0 @@
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>404 Not Found</title>
- <style>
- {{ css_color_scheme }}
-
- body,
- body > div {
- height: 100vh;
- width: 100vw;
- }
-
- body {
- font-family: "Montserrat";
- background-color: var(--primary-color);
- color: #333;
- text-align: center;
- margin: 0;
- padding: 0;
- overflow: hidden;
- }
-
- body > div {
- height: 100vh;
- width: 100vw;
- overflow: scroll;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .hyper-checkout-status-wrap {
- display: flex;
- flex-flow: column;
- font-family: "Montserrat";
- width: auto;
- min-width: 400px;
- max-width: 800px;
- background-color: white;
- border-radius: 5px;
- }
-
- #hyper-checkout-status-header {
- max-width: 1200px;
- border-radius: 3px;
- border-bottom: 1px solid #e6e6e6;
- }
-
- #hyper-checkout-status-header,
- #hyper-checkout-status-content {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 24px;
- font-weight: 600;
- padding: 15px 20px;
- }
-
- .hyper-checkout-status-amount {
- font-family: "Montserrat";
- font-size: 35px;
- font-weight: 700;
- }
-
- .hyper-checkout-status-merchant-logo {
- border: 1px solid #e6e6e6;
- border-radius: 5px;
- padding: 9px;
- height: 48px;
- width: 48px;
- }
-
- #hyper-checkout-status-content {
- height: 100%;
- flex-flow: column;
- min-height: 500px;
- align-items: center;
- justify-content: center;
- }
-
- .hyper-checkout-status-image {
- height: 200px;
- width: 200px;
- }
-
- .hyper-checkout-status-text {
- text-align: center;
- font-size: 21px;
- font-weight: 600;
- margin-top: 20px;
- }
-
- .hyper-checkout-status-message {
- text-align: center;
- font-size: 12px !important;
- margin-top: 10px;
- font-size: 14px;
- font-weight: 500;
- max-width: 400px;
- }
-
- .hyper-checkout-status-details {
- display: flex;
- flex-flow: column;
- margin-top: 20px;
- border-radius: 3px;
- border: 1px solid #e6e6e6;
- max-width: calc(100vw - 40px);
- }
-
- .hyper-checkout-status-item {
- display: flex;
- align-items: center;
- padding: 5px 10px;
- border-bottom: 1px solid #e6e6e6;
- word-wrap: break-word;
- }
-
- .hyper-checkout-status-item:last-child {
- border-bottom: 0;
- }
-
- .hyper-checkout-item-header {
- min-width: 13ch;
- font-size: 12px;
- }
-
- .hyper-checkout-item-value {
- font-size: 12px;
- overflow-x: hidden;
- overflow-y: auto;
- word-wrap: break-word;
- font-weight: 400;
- text-align: center;
- }
-
- .ellipsis-container-2 {
- height: 2.5em;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- text-overflow: ellipsis;
- white-space: normal;
- }
-
- @media only screen and (max-width: 1136px) {
- .info {
- flex-flow: column;
- align-self: flex-start;
- align-items: flex-start;
- min-width: auto;
- }
-
- .value {
- margin: 0;
- }
- }
- </style>
- <link
- rel="stylesheet"
- href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
- />
- <script>
- {{ payment_details_js_script }}
-
- function boot() {
- var paymentDetails = window.__PAYMENT_DETAILS;
-
- // Attach document icon
- if (paymentDetails.merchant_logo) {
- var link = document.createElement("link");
- link.rel = "icon";
- link.href = paymentDetails.merchant_logo;
- link.type = "image/x-icon";
- document.head.appendChild(link);
- }
-
- var statusDetails = {
- imageSource: "",
- message: "",
- status: "",
- items: [],
- };
-
- var paymentId = createItem("Ref Id", paymentDetails.payment_id);
- statusDetails.items.push(paymentId);
-
- // Decide screen to render
- switch (paymentDetails.payment_link_status) {
- case "expired": {
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Payment Link Expired!";
- statusDetails.message = "This payment link is expired.";
- break;
- }
-
- default: {
- statusDetails.status = paymentDetails.intent_status;
- // Render status screen
- switch (paymentDetails.intent_status) {
- case "succeeded": {
- statusDetails.imageSource = "https://i.imgur.com/5BOmYVl.png";
- statusDetails.message =
- "We have successfully received your payment";
- break;
- }
-
- case "processing": {
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.message =
- "Sorry! Your payment is taking longer than expected. Please check back again in sometime.";
- statusDetails.status = "Payment Pending";
- break;
- }
-
- case "failed": {
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Payment Failed!";
- var errorCodeNode = createItem(
- "Error code",
- paymentDetails.error_code
- );
- var errorMessageNode = createItem(
- "Error message",
- paymentDetails.error_message
- );
- // @ts-ignore
- statusDetails.items.push(errorMessageNode, errorCodeNode);
- break;
- }
-
- case "cancelled": {
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Payment Cancelled";
- break;
- }
-
- case "requires_merchant_action": {
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.status = "Payment under review";
- break;
- }
-
- case "requires_capture": {
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.status = "Payment Pending";
- break;
- }
-
- case "partially_captured": {
- statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
- statusDetails.message = "Partial payment was captured.";
- statusDetails.status = "Partial Payment Pending";
- break;
- }
-
- default:
- statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
- statusDetails.status = "Something went wrong";
- // Error details
- if (typeof paymentDetails.error === "object") {
- var errorCodeNode = createItem(
- "Error Code",
- paymentDetails.error.code
- );
- var errorMessageNode = createItem(
- "Error Message",
- paymentDetails.error.message
- );
- // @ts-ignore
- statusDetails.items.push(errorMessageNode, errorCodeNode);
- }
- }
- }
- }
-
- // Form header
- var hyperCheckoutImageNode = document.createElement("img");
- var hyperCheckoutAmountNode = document.createElement("div");
-
- hyperCheckoutImageNode.src = paymentDetails.merchant_logo;
- hyperCheckoutImageNode.className =
- "hyper-checkout-status-merchant-logo";
- hyperCheckoutAmountNode.innerText =
- paymentDetails.currency + " " + paymentDetails.amount;
- hyperCheckoutAmountNode.className = "hyper-checkout-status-amount";
- var hyperCheckoutHeaderNode = document.getElementById(
- "hyper-checkout-status-header"
- );
- if (hyperCheckoutHeaderNode instanceof HTMLDivElement) {
- hyperCheckoutHeaderNode.append(
- hyperCheckoutAmountNode,
- hyperCheckoutImageNode
- );
- }
-
- // Form and append items
- var hyperCheckoutStatusTextNode = document.createElement("div");
- hyperCheckoutStatusTextNode.innerText = statusDetails.status;
- hyperCheckoutStatusTextNode.className = "hyper-checkout-status-text";
-
- var merchantLogoNode = document.createElement("img");
- merchantLogoNode.src = statusDetails.imageSource;
- merchantLogoNode.className = "hyper-checkout-status-image";
-
- var hyperCheckoutStatusMessageNode = document.createElement("div");
- hyperCheckoutStatusMessageNode.innerText = statusDetails.message;
-
- var hyperCheckoutDetailsNode = document.createElement("div");
- hyperCheckoutDetailsNode.className = "hyper-checkout-status-details";
- if (hyperCheckoutDetailsNode instanceof HTMLDivElement) {
- hyperCheckoutDetailsNode.append(...statusDetails.items);
- }
-
- var hyperCheckoutContentNode = document.getElementById(
- "hyper-checkout-status-content"
- );
- if (hyperCheckoutContentNode instanceof HTMLDivElement) {
- hyperCheckoutContentNode.prepend(
- merchantLogoNode,
- hyperCheckoutStatusTextNode,
- hyperCheckoutDetailsNode
- );
- }
- }
-
- function createItem(heading, value) {
- var itemNode = document.createElement("div");
- itemNode.className = "hyper-checkout-status-item";
- var headerNode = document.createElement("div");
- headerNode.className = "hyper-checkout-item-header";
- headerNode.innerText = heading;
- var valueNode = document.createElement("div");
- valueNode.classList.add("hyper-checkout-item-value");
- // valueNode.classList.add("ellipsis-container-2");
- valueNode.innerText = value;
- itemNode.append(headerNode);
- itemNode.append(valueNode);
- return itemNode;
- }
- </script>
- </head>
-
- <body onload="boot()">
- <div>
- <div class="hyper-checkout-status-wrap">
- <div id="hyper-checkout-status-header"></div>
- <div id="hyper-checkout-status-content"></div>
- </div>
- </div>
- </body>
-</html>
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index ae0328c56f6..4a726084c2c 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -892,6 +892,10 @@ impl PaymentLink {
web::resource("{merchant_id}/{payment_id}")
.route(web::get().to(initiate_payment_link)),
)
+ .service(
+ web::resource("status/{merchant_id}/{payment_id}")
+ .route(web::get().to(payment_link_status)),
+ )
}
}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 07894afe732..4cd85efe8d5 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -147,9 +147,10 @@ impl From<Flow> for ApiIdentifier {
| Flow::BusinessProfileDelete
| Flow::BusinessProfileList => Self::Business,
- Flow::PaymentLinkRetrieve | Flow::PaymentLinkInitiate | Flow::PaymentLinkList => {
- Self::PaymentLink
- }
+ Flow::PaymentLinkRetrieve
+ | Flow::PaymentLinkInitiate
+ | Flow::PaymentLinkList
+ | Flow::PaymentLinkStatus => Self::PaymentLink,
Flow::Verification => Self::Verification,
diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs
index d45d67568b8..4d79b923163 100644
--- a/crates/router/src/routes/payment_link.rs
+++ b/crates/router/src/routes/payment_link.rs
@@ -123,3 +123,33 @@ pub async fn payments_link_list(
)
.await
}
+
+pub async fn payment_link_status(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ path: web::Path<(String, String)>,
+) -> impl Responder {
+ let flow = Flow::PaymentLinkStatus;
+ let (merchant_id, payment_id) = path.into_inner();
+ let payload = api_models::payments::PaymentLinkInitiateRequest {
+ payment_id,
+ merchant_id: merchant_id.clone(),
+ };
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload.clone(),
+ |state, auth, _| {
+ get_payment_link_status(
+ state,
+ auth.merchant_account,
+ payload.merchant_id.clone(),
+ payload.payment_id.clone(),
+ )
+ },
+ &crate::services::authentication::MerchantIdAuth(merchant_id),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index e0c6a086257..4251679d5d3 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -1749,19 +1749,50 @@ pub fn build_redirection_form(
pub fn build_payment_link_html(
payment_link_data: PaymentLinkFormData,
) -> CustomResult<String, errors::ApiErrorResponse> {
- let html_template = include_str!("../core/payment_link/payment_link.html").to_string();
-
let mut tera = Tera::default();
+ // Add modification to css template with dynamic data
+ let css_template =
+ include_str!("../core/payment_link/payment_link_initiate/payment_link.css").to_string();
+ let _ = tera.add_raw_template("payment_link_css", &css_template);
+ let mut context = Context::new();
+ context.insert("css_color_scheme", &payment_link_data.css_script);
+
+ let rendered_css = match tera.render("payment_link_css", &context) {
+ Ok(rendered_css) => rendered_css,
+ Err(tera_error) => {
+ crate::logger::warn!("{tera_error}");
+ Err(errors::ApiErrorResponse::InternalServerError)?
+ }
+ };
+
+ // Add modification to js template with dynamic data
+ let js_template =
+ include_str!("../core/payment_link/payment_link_initiate/payment_link.js").to_string();
+ let _ = tera.add_raw_template("payment_link_js", &js_template);
+
+ context.insert("payment_details_js_script", &payment_link_data.js_script);
+
+ let rendered_js = match tera.render("payment_link_js", &context) {
+ Ok(rendered_js) => rendered_js,
+ Err(tera_error) => {
+ crate::logger::warn!("{tera_error}");
+ Err(errors::ApiErrorResponse::InternalServerError)?
+ }
+ };
+
+ // Modify Html template with rendered js and rendered css files
+ let html_template =
+ include_str!("../core/payment_link/payment_link_initiate/payment_link.html").to_string();
+
let _ = tera.add_raw_template("payment_link", &html_template);
- let mut context = Context::new();
context.insert(
"hyperloader_sdk_link",
&get_hyper_loader_sdk(&payment_link_data.sdk_url),
);
- context.insert("css_color_scheme", &payment_link_data.css_script);
- context.insert("payment_details_js_script", &payment_link_data.js_script);
+ context.insert("rendered_css", &rendered_css);
+ context.insert("rendered_js", &rendered_js);
match tera.render("payment_link", &context) {
Ok(rendered_html) => Ok(rendered_html),
@@ -1779,14 +1810,46 @@ fn get_hyper_loader_sdk(sdk_url: &str) -> String {
pub fn get_payment_link_status(
payment_link_data: PaymentLinkStatusData,
) -> CustomResult<String, errors::ApiErrorResponse> {
- let html_template = include_str!("../core/payment_link/status.html").to_string();
let mut tera = Tera::default();
- let _ = tera.add_raw_template("payment_link_status", &html_template);
+ // Add modification to css template with dynamic data
+ let css_template =
+ include_str!("../core/payment_link/payment_link_status/status.css").to_string();
+ let _ = tera.add_raw_template("payment_link_css", &css_template);
let mut context = Context::new();
context.insert("css_color_scheme", &payment_link_data.css_script);
+
+ let rendered_css = match tera.render("payment_link_css", &context) {
+ Ok(rendered_css) => rendered_css,
+ Err(tera_error) => {
+ crate::logger::warn!("{tera_error}");
+ Err(errors::ApiErrorResponse::InternalServerError)?
+ }
+ };
+
+ // Add modification to js template with dynamic data
+ let js_template =
+ include_str!("../core/payment_link/payment_link_status/status.js").to_string();
+ let _ = tera.add_raw_template("payment_link_js", &js_template);
context.insert("payment_details_js_script", &payment_link_data.js_script);
+ let rendered_js = match tera.render("payment_link_js", &context) {
+ Ok(rendered_js) => rendered_js,
+ Err(tera_error) => {
+ crate::logger::warn!("{tera_error}");
+ Err(errors::ApiErrorResponse::InternalServerError)?
+ }
+ };
+
+ // Modify Html template with rendered js and rendered css files
+ let html_template =
+ include_str!("../core/payment_link/payment_link_status/status.html").to_string();
+ let _ = tera.add_raw_template("payment_link_status", &html_template);
+
+ context.insert("rendered_css", &rendered_css);
+
+ context.insert("rendered_js", &rendered_js);
+
match tera.render("payment_link_status", &context) {
Ok(rendered_html) => Ok(rendered_html),
Err(tera_error) => {
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 0d5710820ee..ac2dfb47c63 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -241,6 +241,8 @@ pub enum Flow {
PaymentLinkInitiate,
/// Payment Link List flow
PaymentLinkList,
+ /// Payment Link Status
+ PaymentLinkStatus,
/// Create a business profile
BusinessProfileCreate,
/// Update a business profile
|
refactor
|
segregated payment link in html css js files, sdk over flow issue, surcharge bug, block SPM customer call for payment link (#3410)
|
016857fff0681058f3321a7952c7bd917442293a
|
2023-06-15 14:06:27
|
Arjun Karthik
|
fix(connector): fix for sending refund_amount in connectors refund request (#1278)
| false
|
diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs
index 7417d0459d1..c689e8ffd0b 100644
--- a/crates/router/src/connector/bambora/transformers.rs
+++ b/crates/router/src/connector/bambora/transformers.rs
@@ -480,7 +480,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for BamboraRefundRequest {
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
- amount: item.request.amount,
+ amount: item.request.refund_amount,
})
}
}
diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/router/src/connector/forte/transformers.rs
index 415aae14df5..8c860c74d99 100644
--- a/crates/router/src/connector/forte/transformers.rs
+++ b/crates/router/src/connector/forte/transformers.rs
@@ -463,7 +463,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for ForteRefundRequest {
utils::to_connector_meta(item.request.connector_metadata.clone())?;
let auth_code = connector_auth_id.auth_id;
let authorization_amount =
- utils::to_currency_base_unit_asf64(item.request.amount, item.request.currency)?;
+ utils::to_currency_base_unit_asf64(item.request.refund_amount, item.request.currency)?;
Ok(Self {
action: "reverse".to_string(),
authorization_amount,
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index 1d0c8ecd529..a3e2e911117 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -352,7 +352,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for MollieRefundRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
let amount = Amount {
currency: item.request.currency,
- value: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
+ value: utils::to_currency_base_unit(item.request.refund_amount, item.request.currency)?,
};
Ok(Self {
amount,
diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs
index 0b060a5c46f..d3a1da39d89 100644
--- a/crates/router/src/connector/multisafepay/transformers.rs
+++ b/crates/router/src/connector/multisafepay/transformers.rs
@@ -508,7 +508,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for MultisafepayRefundRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
currency: item.request.currency,
- amount: item.request.amount,
+ amount: item.request.refund_amount,
description: item.description.clone(),
refund_order_id: Some(item.request.refund_id.clone()),
checkout_data: None,
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 232d7bdaf3d..4392d3df98a 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -1009,7 +1009,7 @@ impl TryFrom<&types::RefundExecuteRouterData> for NuveiPaymentFlowRequest {
Self::try_from(NuveiPaymentRequestData {
client_request_id: item.attempt_id.clone(),
connector_auth_type: item.connector_auth_type.clone(),
- amount: item.request.amount.to_string(),
+ amount: item.request.refund_amount.to_string(),
currency: item.request.currency,
related_transaction_id: Some(item.request.connector_transaction_id.clone()),
..Default::default()
diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rs
index 3fc79a7800c..d398022a630 100644
--- a/crates/router/src/connector/opennode/transformers.rs
+++ b/crates/router/src/connector/opennode/transformers.rs
@@ -145,7 +145,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for OpennodeRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
- amount: item.request.amount,
+ amount: item.request.refund_amount,
})
}
}
diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rs
index 3e2fff0b19a..5f39317f23c 100644
--- a/crates/router/src/connector/rapyd/transformers.rs
+++ b/crates/router/src/connector/rapyd/transformers.rs
@@ -257,7 +257,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for RapydRefundRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
payment: item.request.connector_transaction_id.to_string(),
- amount: Some(item.request.amount),
+ amount: Some(item.request.refund_amount),
currency: Some(item.request.currency),
})
}
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index 3199abf81b0..7b05ef3c591 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -885,7 +885,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for TrustpayRefundRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
let amount = format!(
"{:.2}",
- utils::to_currency_base_unit(item.request.amount, item.request.currency)?
+ utils::to_currency_base_unit(item.request.refund_amount, item.request.currency)?
.parse::<f64>()
.into_report()
.change_context(errors::ConnectorError::RequestEncodingFailed)?
diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs
index bbb8cb35fff..3cc65f5d1c1 100644
--- a/crates/router/src/connector/worldpay/transformers.rs
+++ b/crates/router/src/connector/worldpay/transformers.rs
@@ -171,7 +171,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for WorldpayRefundRequest {
Ok(Self {
reference: item.request.connector_transaction_id.clone(),
value: PaymentValue {
- amount: item.request.amount,
+ amount: item.request.refund_amount,
currency: item.request.currency.to_string(),
},
})
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 370f970f73f..7158a4fb8e4 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -52,7 +52,7 @@ pub async fn construct_refund_router_data<'a, F>(
let status = payment_attempt.status;
- let (amount, currency) = money;
+ let (payment_amount, currency) = money;
let payment_method_type = payment_attempt
.payment_method
@@ -87,7 +87,7 @@ pub async fn construct_refund_router_data<'a, F>(
connector_transaction_id: refund.connector_transaction_id.clone(),
refund_amount: refund.refund_amount,
currency,
- amount,
+ payment_amount,
webhook_url,
connector_metadata: payment_attempt.connector_metadata.clone(),
reason: refund.refund_reason.clone(),
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 186dd2791a7..2020114f4ef 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -461,7 +461,7 @@ pub struct RefundsData {
pub connector_refund_id: Option<String>,
pub currency: storage_enums::Currency,
/// Amount for the payment against which this refund is issued
- pub amount: i64,
+ pub payment_amount: i64,
pub reason: Option<String>,
pub webhook_url: Option<String>,
/// Amount to be refunded
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 2f1374d912b..6211dc24c30 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -98,7 +98,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
description: Some("This is a test".to_string()),
return_url: None,
request: types::RefundsData {
- amount: 1000,
+ payment_amount: 1000,
currency: enums::Currency::USD,
refund_id: uuid::Uuid::new_v4().to_string(),
diff --git a/crates/router/tests/connectors/forte.rs b/crates/router/tests/connectors/forte.rs
index db87ef0ae1f..6028f44117c 100644
--- a/crates/router/tests/connectors/forte.rs
+++ b/crates/router/tests/connectors/forte.rs
@@ -454,28 +454,6 @@ async fn should_sync_refund() {
}
// Cards Negative scenerios
-// Creates a payment with incorrect card number.
-#[actix_web::test]
-async fn should_fail_payment_for_incorrect_card_number() {
- let response = CONNECTOR
- .make_payment(
- Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethodData::Card(api::Card {
- card_number: CardNumber::from_str("4111111111111100").unwrap(),
- ..utils::CCardType::default().0
- }),
- ..utils::PaymentAuthorizeType::default().0
- }),
- get_default_payment_info(),
- )
- .await
- .unwrap();
- assert_eq!(
- response.response.unwrap_err().message,
- "INVALID CREDIT CARD NUMBER".to_string(),
- );
-}
-
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
diff --git a/crates/router/tests/connectors/multisafepay.rs b/crates/router/tests/connectors/multisafepay.rs
index 25a4ac198f7..53517d01589 100644
--- a/crates/router/tests/connectors/multisafepay.rs
+++ b/crates/router/tests/connectors/multisafepay.rs
@@ -1,11 +1,10 @@
-use std::str::FromStr;
-
+use api_models::payments::{Address, AddressDetails};
use masking::Secret;
-use router::types::{self, api, storage::enums};
+use router::types::{self, api, storage::enums, PaymentAddress};
use crate::{
connector_auth,
- utils::{self, ConnectorActions},
+ utils::{self, ConnectorActions, PaymentInfo},
};
#[derive(Clone, Copy)]
@@ -36,28 +35,55 @@ impl utils::Connector for MultisafepayTest {
static CONNECTOR: MultisafepayTest = MultisafepayTest {};
+fn get_default_payment_info() -> Option<PaymentInfo> {
+ let address = Some(PaymentAddress {
+ shipping: None,
+ billing: Some(Address {
+ address: Some(AddressDetails {
+ first_name: Some(Secret::new("John".to_string())),
+ last_name: Some(Secret::new("Doe".to_string())),
+ line1: Some(Secret::new("Kraanspoor".to_string())),
+ line2: Some(Secret::new("line2".to_string())),
+ line3: Some(Secret::new("line3".to_string())),
+ city: Some("Amsterdam".to_string()),
+ zip: Some(Secret::new("1033SC".to_string())),
+ country: Some(api_models::enums::CountryAlpha2::NL),
+ state: Some(Secret::new("Amsterdam".to_string())),
+ }),
+ phone: None,
+ }),
+ });
+ Some(PaymentInfo {
+ address,
+ ..utils::PaymentInfo::default()
+ })
+}
+
// Cards Positive Tests
// Creates a payment using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_only_authorize_payment() {
let response = CONNECTOR
- .authorize_payment(None, None)
+ .authorize_payment(None, 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).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_capture_authorized_payment() {
let response = CONNECTOR
- .authorize_and_capture_payment(None, None, None)
+ .authorize_and_capture_payment(None, 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).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
@@ -67,7 +93,7 @@ async fn should_partially_capture_authorized_payment() {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.expect("Capture payment response");
@@ -75,12 +101,17 @@ async fn should_partially_capture_authorized_payment() {
}
// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
- .authorize_payment(None, None)
+ .authorize_payment(None, get_default_payment_info())
.await
.expect("Authorize payment response");
+ assert_eq!(
+ authorize_response.status,
+ enums::AttemptStatus::AuthenticationPending,
+ );
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
@@ -99,6 +130,7 @@ async fn should_sync_authorized_payment() {
}
// Voids a payment using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_void_authorized_payment() {
let response = CONNECTOR
@@ -109,7 +141,7 @@ async fn should_void_authorized_payment() {
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
- None,
+ get_default_payment_info(),
)
.await
.expect("Void payment response");
@@ -117,10 +149,11 @@ async fn should_void_authorized_payment() {
}
// Refunds a payment using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
- .capture_payment_and_refund(None, None, None, None)
+ .capture_payment_and_refund(None, None, None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
@@ -130,6 +163,7 @@ async fn should_refund_manually_captured_payment() {
}
// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
@@ -140,7 +174,7 @@ async fn should_partially_refund_manually_captured_payment() {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
@@ -151,10 +185,11 @@ async fn should_partially_refund_manually_captured_payment() {
}
// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
- .capture_payment_and_refund(None, None, None, None)
+ .capture_payment_and_refund(None, None, None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
@@ -173,16 +208,24 @@ async fn should_sync_manually_captured_refund() {
}
// Creates a payment using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_make_payment() {
- let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ let authorize_response = CONNECTOR
+ .make_payment(None, get_default_payment_info())
+ .await
+ .unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_sync_auto_captured_payment() {
- let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ let authorize_response = CONNECTOR
+ .make_payment(None, 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");
@@ -203,10 +246,11 @@ async fn should_sync_auto_captured_payment() {
}
// Refunds a payment using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
- .make_payment_and_refund(None, None, None)
+ .make_payment_and_refund(None, None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
@@ -216,6 +260,7 @@ async fn should_refund_auto_captured_payment() {
}
// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
@@ -225,7 +270,7 @@ async fn should_partially_refund_succeeded_payment() {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
@@ -236,6 +281,7 @@ async fn should_partially_refund_succeeded_payment() {
}
// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
@@ -245,16 +291,17 @@ async fn should_refund_succeeded_payment_multiple_times() {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await;
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_sync_refund() {
let refund_response = CONNECTOR
- .make_payment_and_refund(None, None, None)
+ .make_payment_and_refund(None, None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
@@ -273,38 +320,20 @@ async fn should_sync_refund() {
}
// Cards Negative scenerios
-// Creates a payment with incorrect card number.
-#[actix_web::test]
-async fn should_fail_payment_for_incorrect_card_number() {
- let response = CONNECTOR
- .make_payment(
- Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethodData::Card(api::Card {
- card_number: cards::CardNumber::from_str("37450000000001").unwrap(),
- ..utils::CCardType::default().0
- }),
- ..utils::PaymentAuthorizeType::default().0
- }),
- None,
- )
- .await
- .unwrap();
- assert!(response.response.is_err());
-}
-
// Creates a payment with incorrect CVC.
+#[ignore = "Connector doesn't fail invalid cvv scenario"]
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::api::PaymentMethodData::Card(api::Card {
- card_cvc: Secret::new("12345".to_string()),
+ card_cvc: Secret::new("123498765".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
@@ -323,7 +352,7 @@ async fn should_fail_payment_for_invalid_exp_month() {
}),
..utils::PaymentAuthorizeType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
@@ -342,7 +371,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
}),
..utils::PaymentAuthorizeType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
@@ -350,9 +379,13 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
}
// Voids a payment using automatic capture flow (Non 3DS).
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_fail_void_payment_for_auto_capture() {
- let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ let authorize_response = CONNECTOR
+ .make_payment(None, 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");
@@ -370,16 +403,17 @@ async fn should_fail_void_payment_for_auto_capture() {
#[actix_web::test]
async fn should_fail_capture_for_invalid_payment() {
let capture_response = CONNECTOR
- .capture_payment("123456789".to_string(), None, None)
+ .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'")
+ String::from("Something went wrong")
);
}
// Refunds a payment with refund amount higher than payment amount.
+#[ignore = "Connector supports only 3ds flow"]
#[actix_web::test]
async fn should_fail_for_refund_amount_higher_than_payment_amount() {
let response = CONNECTOR
@@ -389,7 +423,7 @@ async fn should_fail_for_refund_amount_higher_than_payment_amount() {
refund_amount: 150,
..utils::PaymentRefundType::default().0
}),
- None,
+ get_default_payment_info(),
)
.await
.unwrap();
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 81b2677c9bb..9470b23f2b6 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -319,7 +319,7 @@ pub trait ConnectorActions: Connector {
let integration = self.get_data().connector.get_connector_integration();
let request = self.generate_data(
payment_data.unwrap_or_else(|| types::RefundsData {
- amount: 1000,
+ payment_amount: 1000,
currency: enums::Currency::USD,
refund_id: uuid::Uuid::new_v4().to_string(),
connector_transaction_id: "".to_string(),
@@ -582,7 +582,7 @@ impl Default for PaymentSyncType {
impl Default for PaymentRefundType {
fn default() -> Self {
let data = types::RefundsData {
- amount: 100,
+ payment_amount: 100,
currency: enums::Currency::USD,
refund_id: uuid::Uuid::new_v4().to_string(),
connector_transaction_id: String::new(),
|
fix
|
fix for sending refund_amount in connectors refund request (#1278)
|
bea4b9e7f430c3d7fbb25be0b472d2afb01135ec
|
2024-12-02 23:34:00
|
Kashif
|
fix(connector): adyen - propagate connector mandate details in incoming webhooks (#6720)
| false
|
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index f3b7414a923..57b80f58153 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -1908,6 +1908,27 @@ impl api::IncomingWebhook for Adyen {
updated_at: notif.event_date,
})
}
+
+ fn get_mandate_details(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<
+ Option<hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails>,
+ errors::ConnectorError,
+ > {
+ let notif = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ let mandate_reference =
+ notif
+ .additional_data
+ .recurring_detail_reference
+ .map(|mandate_id| {
+ hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails {
+ connector_mandate_id: mandate_id.clone(),
+ }
+ });
+ Ok(mandate_reference)
+ }
}
impl api::Dispute for Adyen {}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 7daee6e73d7..cae5f508a2e 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -4261,6 +4261,9 @@ pub struct AdyenAdditionalDataWH {
pub chargeback_reason_code: Option<String>,
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub defense_period_ends_at: Option<PrimitiveDateTime>,
+ /// Enable recurring details in dashboard to receive this ID, https://docs.adyen.com/online-payments/tokenization/create-and-use-tokens#test-and-go-live
+ #[serde(rename = "recurring.recurringDetailReference")]
+ pub recurring_detail_reference: Option<Secret<String>>,
}
#[derive(Debug, Deserialize)]
|
fix
|
adyen - propagate connector mandate details in incoming webhooks (#6720)
|
0e600837f77af0443335deb0c73d6f3b2bda5ac2
|
2024-03-04 18:52:06
|
ivor-juspay
|
chore: upgrade msrv to 1.70 (#3938)
| false
|
diff --git a/.deepsource.toml b/.deepsource.toml
index d3932afd231..640298afbdb 100644
--- a/.deepsource.toml
+++ b/.deepsource.toml
@@ -13,4 +13,4 @@ name = "rust"
enabled = true
[analyzers.meta]
-msrv = "1.65.0"
+msrv = "1.70.0"
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index d6b3d98b8c8..052afd5d25c 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -114,7 +114,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
- toolchain: 1.65
+ toolchain: "1.70"
- uses: Swatinem/[email protected]
with:
@@ -124,7 +124,6 @@ jobs:
uses: baptiste0928/[email protected]
with:
crate: cargo-hack
- version: 0.6.5
- name: Deny warnings
shell: bash
diff --git a/.github/workflows/CI-push.yml b/.github/workflows/CI-push.yml
index 90b301bbd9e..c946513f723 100644
--- a/.github/workflows/CI-push.yml
+++ b/.github/workflows/CI-push.yml
@@ -61,7 +61,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
- toolchain: 1.65
+ toolchain: "1.70"
- uses: Swatinem/[email protected]
with:
@@ -71,7 +71,6 @@ jobs:
uses: baptiste0928/[email protected]
with:
crate: cargo-hack
- version: 0.6.5
- name: Deny warnings
shell: bash
diff --git a/Cargo.toml b/Cargo.toml
index 21e01cf4d3c..82687a32ba6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
resolver = "2"
members = ["crates/*"]
package.edition = "2021"
-package.rust-version = "1.65"
+package.rust-version = "1.70"
package.license = "Apache-2.0"
[profile.release]
diff --git a/INSTALL_dependencies.sh b/INSTALL_dependencies.sh
index 5c488611520..288dea1bd44 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.65.0
+RUST_MSRV=1.70.0
_DB_NAME="hyperswitch_db"
_DB_USER="db_user"
_DB_PASS="db_password"
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index b209fd57169..959f387a315 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -176,7 +176,7 @@ impl From<Flow> for ApiIdentifier {
| Flow::Signout
| Flow::ChangePassword
| Flow::SetDashboardMetadata
- | Flow::GetMutltipleDashboardMetadata
+ | Flow::GetMultipleDashboardMetadata
| Flow::VerifyPaymentConnector
| Flow::InternalUserSignup
| Flow::SwitchMerchant
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 0568b31338b..6603eb44b81 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -179,7 +179,7 @@ pub async fn get_multiple_dashboard_metadata(
req: HttpRequest,
query: web::Query<user_api::dashboard_metadata::GetMultipleMetaDataRequest>,
) -> HttpResponse {
- let flow = Flow::GetMutltipleDashboardMetadata;
+ let flow = Flow::GetMultipleDashboardMetadata;
let payload = match ReportSwitchExt::<_, ApiErrorResponse>::switch(parse_string_to_enums(
query.into_inner().keys,
)) {
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 08148084349..0de256a6aca 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -309,7 +309,7 @@ pub enum Flow {
/// Set Dashboard Metadata flow
SetDashboardMetadata,
/// Get Multiple Dashboard Metadata flow
- GetMutltipleDashboardMetadata,
+ GetMultipleDashboardMetadata,
/// Payment Connector Verify
VerifyPaymentConnector,
/// Internal user signup
diff --git a/crates/test_utils/tests/connectors/selenium.rs b/crates/test_utils/tests/connectors/selenium.rs
index 303d4cd7ccb..5030b984861 100644
--- a/crates/test_utils/tests/connectors/selenium.rs
+++ b/crates/test_utils/tests/connectors/selenium.rs
@@ -9,7 +9,7 @@ use std::{
collections::{HashMap, HashSet},
env,
io::Read,
- path::MAIN_SEPARATOR,
+ path::{MAIN_SEPARATOR, MAIN_SEPARATOR_STR},
time::Duration,
};
@@ -862,7 +862,7 @@ fn get_chrome_profile_path() -> Result<String, WebDriverError> {
.map(|str| {
let mut fp = str.split(MAIN_SEPARATOR).collect::<Vec<_>>();
fp.truncate(3);
- fp.join(&MAIN_SEPARATOR.to_string())
+ fp.join(MAIN_SEPARATOR_STR)
})
.unwrap();
if env::consts::OS == "macos" {
@@ -880,7 +880,7 @@ fn get_firefox_profile_path() -> Result<String, WebDriverError> {
.map(|str| {
let mut fp = str.split(MAIN_SEPARATOR).collect::<Vec<_>>();
fp.truncate(3);
- fp.join(&MAIN_SEPARATOR.to_string())
+ fp.join(MAIN_SEPARATOR_STR)
})
.unwrap();
if env::consts::OS == "macos" {
diff --git a/loadtest/Dockerfile b/loadtest/Dockerfile
index 45c4c7540a1..ebea439eb81 100644
--- a/loadtest/Dockerfile
+++ b/loadtest/Dockerfile
@@ -1,10 +1,10 @@
-FROM rust:1.65 AS builder
+FROM rust:latest AS builder
WORKDIR /app
COPY . .
RUN cargo install diesel_cli && cargo build --bin router --release
-FROM rust:1.65 AS runtime
+FROM rust:latest AS runtime
WORKDIR /app
COPY --from=builder /app/migrations migrations
COPY --from=builder /app/target/release/router router
diff --git a/monitoring/docker-compose-ckh.yaml b/monitoring/docker-compose-ckh.yaml
index 2bbf5b2ec4a..88fc88d133a 100644
--- a/monitoring/docker-compose-ckh.yaml
+++ b/monitoring/docker-compose-ckh.yaml
@@ -156,7 +156,7 @@ services:
hard: 262144
hyperswitch-server:
- image: rust:1.65
+ image: rust:latest
command: cargo run -- -f ./config/docker_compose.toml
working_dir: /app
ports:
|
chore
|
upgrade msrv to 1.70 (#3938)
|
b63d723b8bd2cfc146db762be4a11be64a72d196
|
2024-08-27 13:31:01
|
Sanchith Hegde
|
refactor: introduce a domain type for profile ID (#5687)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 5a8ebcc0f36..4a37b597d30 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2096,6 +2096,7 @@ name = "connector_configs"
version = "0.1.0"
dependencies = [
"api_models",
+ "common_utils",
"serde",
"serde_with",
"toml 0.8.12",
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index bdbdd9aec77..125f15d868c 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8445,7 +8445,8 @@
},
"profile_id": {
"type": "string",
- "description": "Identifier for the business profile, if not provided default will be chosen from merchant account"
+ "description": "Identifier for the business profile, if not provided default will be chosen from merchant account",
+ "maxLength": 64
},
"connector_account_details": {
"allOf": [
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index cfd2fe43503..fdc8c8ba875 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -7786,7 +7786,7 @@
},
"profile_id": {
"type": "string",
- "description": "The default business profile that must be used for creating merchant accounts and payments",
+ "description": "The identifier for business profile. This must be used for creating merchant accounts, payments and payouts",
"example": "pro_abcdefghijklmnopqrstuvwxyz",
"maxLength": 64
},
@@ -12510,7 +12510,7 @@
},
"default_profile": {
"type": "string",
- "description": "The default business profile that must be used for creating merchant accounts and payments\nTo unset this field, pass an empty string",
+ "description": "The default business profile that must be used for creating merchant accounts and payments",
"nullable": true,
"maxLength": 64
},
@@ -12548,7 +12548,8 @@
"profile_id": {
"type": "string",
"description": "Identifier for the business profile, if not provided default will be chosen from merchant account",
- "nullable": true
+ "nullable": true,
+ "maxLength": 64
},
"connector_account_details": {
"allOf": [
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 18ad5dbf844..a23b891f65e 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -330,9 +330,8 @@ pub struct MerchantAccountUpdate {
pub frm_routing_algorithm: Option<serde_json::Value>,
/// The default business profile that must be used for creating merchant accounts and payments
- /// To unset this field, pass an empty string
- #[schema(max_length = 64)]
- pub default_profile: Option<String>,
+ #[schema(max_length = 64, value_type = Option<String>)]
+ pub default_profile: Option<id_type::ProfileId>,
/// Default payment method collect link config
#[schema(value_type = Option<BusinessCollectLinkConfig>)]
@@ -526,8 +525,8 @@ pub struct MerchantAccountResponse {
pub is_recon_enabled: bool,
/// The default business profile that must be used for creating merchant accounts and payments
- #[schema(max_length = 64)]
- pub default_profile: Option<String>,
+ #[schema(max_length = 64, value_type = Option<String>)]
+ pub default_profile: Option<id_type::ProfileId>,
/// Used to indicate the status of the recon module for a merchant account
#[schema(value_type = ReconStatus, example = "not_requested")]
@@ -699,7 +698,8 @@ pub struct MerchantConnectorCreate {
pub connector_label: Option<String>,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// An object containing the required details/credentials for a Connector account.
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
@@ -829,7 +829,8 @@ pub struct MerchantConnectorCreate {
pub connector_label: Option<String>,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- pub profile_id: Option<String>,
+ #[schema(max_length = 64, value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
/// An object containing the required details/credentials for a Connector account.
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
@@ -1063,8 +1064,8 @@ pub struct MerchantConnectorResponse {
pub id: String,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- #[schema(max_length = 64)]
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// An object containing the required details/credentials for a Connector account.
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
@@ -1170,8 +1171,8 @@ pub struct MerchantConnectorResponse {
pub merchant_connector_id: String,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- #[schema(max_length = 64)]
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// An object containing the required details/credentials for a Connector account.
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
@@ -1294,8 +1295,8 @@ pub struct MerchantConnectorListResponse {
pub merchant_connector_id: String,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- #[schema(max_length = 64)]
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// An object containing the details about the payment methods that need to be enabled under this merchant connector account
#[schema(example = json!([
@@ -1403,8 +1404,8 @@ pub struct MerchantConnectorListResponse {
pub id: String,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
- #[schema(max_length = 64)]
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// An object containing the details about the payment methods that need to be enabled under this merchant connector account
#[schema(example = json!([
@@ -2076,9 +2077,9 @@ pub struct BusinessProfileResponse {
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
- /// The default business profile that must be used for creating merchant accounts and payments
- #[schema(max_length = 64, example = "pro_abcdefghijklmnopqrstuvwxyz")]
- pub profile_id: String,
+ /// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
+ #[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
+ pub profile_id: id_type::ProfileId,
/// Name of the business profile
#[schema(max_length = 64)]
@@ -2193,8 +2194,8 @@ pub struct BusinessProfileResponse {
pub merchant_id: id_type::MerchantId,
/// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
- #[schema(max_length = 64, example = "pro_abcdefghijklmnopqrstuvwxyz")]
- pub id: String,
+ #[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
+ pub id: id_type::ProfileId,
/// Name of the business profile
#[schema(max_length = 64)]
diff --git a/crates/api_models/src/connector_onboarding.rs b/crates/api_models/src/connector_onboarding.rs
index 1ed18392dcb..de4b8843dfc 100644
--- a/crates/api_models/src/connector_onboarding.rs
+++ b/crates/api_models/src/connector_onboarding.rs
@@ -15,7 +15,7 @@ pub enum ActionUrlResponse {
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct OnboardingSyncRequest {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub connector_id: String,
pub connector: enums::Connector,
}
diff --git a/crates/api_models/src/disputes.rs b/crates/api_models/src/disputes.rs
index e4c38cef860..5e9db4cdfd1 100644
--- a/crates/api_models/src/disputes.rs
+++ b/crates/api_models/src/disputes.rs
@@ -44,7 +44,8 @@ pub struct DisputeResponse {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
/// The `profile_id` associated with the dispute
- pub profile_id: Option<String>,
+ #[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>,
}
@@ -109,7 +110,8 @@ pub struct DisputeListConstraints {
/// limit on the number of objects to return
pub limit: Option<i64>,
/// The identifier for business profile
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
/// status of the dispute
pub dispute_status: Option<DisputeStatus>,
/// stage of the dispute
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 99735f57928..be657cb948b 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -480,7 +480,8 @@ pub struct PaymentsRequest {
/// The business profile to be used for this payment, if not passed the default business profile associated with the merchant account will be used. It is mandatory in case multiple business profiles have been set up.
#[remove_in(PaymentsUpdateRequest, PaymentsConfirmRequest)]
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
#[remove_in(PaymentsConfirmRequest)]
#[schema(value_type = Option<RequestSurchargeDetails>)]
@@ -3815,7 +3816,8 @@ pub struct PaymentsResponse {
/// Details for Payment link
pub payment_link: Option<PaymentLinkResponse>,
/// The business profile that is associated with this payment
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
/// Details of surcharge applied on this payment
pub surcharge_details: Option<RequestSurchargeDetails>,
@@ -4031,7 +4033,7 @@ pub struct PaymentListFilterConstraints {
/// The identifier for payment
pub payment_id: Option<String>,
/// The identifier for business profile
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
/// The identifier for customer
pub customer_id: Option<id_type::CustomerId>,
/// The limit on the number of objects. The default limit is 10 and max limit is 20
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 0010c2988e1..b755a07d7ff 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -144,7 +144,8 @@ pub struct PayoutCreateRequest {
pub payout_token: Option<String>,
/// The business profile to use for this payout, especially if there are multiple business profiles associated with the account, otherwise default business profile associated with the merchant account will be used.
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
/// The send method which will be required for processing payouts, check options for better understanding.
#[schema(value_type = Option<PayoutSendPriority>, example = "instant")]
@@ -481,7 +482,8 @@ pub struct PayoutCreateResponse {
pub error_code: Option<String>,
/// The business profile that is associated with this payout
- pub profile_id: String,
+ #[schema(value_type = String)]
+ pub profile_id: id_type::ProfileId,
/// Time when the payout was created
#[schema(example = "2022-09-10T10:11:12Z")]
@@ -685,7 +687,8 @@ pub struct PayoutListFilterConstraints {
)]
pub payout_id: Option<String>,
/// The identifier for business profile
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
/// The identifier for customer
#[schema(value_type = Option<String>,example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: Option<id_type::CustomerId>,
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index dd6f1a22503..656416dce96 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -156,7 +156,8 @@ pub struct RefundResponse {
#[schema(example = "stripe")]
pub connector: String,
/// The id of business profile for this refund
- pub profile_id: Option<String>,
+ #[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>,
/// Charge specific fields for controlling the revert of funds from either platform or connected account
@@ -171,7 +172,8 @@ pub struct RefundListRequest {
/// The identifier for the refund
pub refund_id: Option<String>,
/// The identifier for business profile
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
/// Limit on the number of objects to return
pub limit: Option<i64>,
/// The starting point within a list of objects
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 2c52f726c86..04a58aed0d9 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -36,7 +36,8 @@ pub struct RoutingConfigRequest {
pub name: String,
pub description: String,
pub algorithm: RoutingAlgorithm,
- pub profile_id: String,
+ #[schema(value_type = String)]
+ pub profile_id: common_utils::id_type::ProfileId,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
@@ -45,12 +46,14 @@ pub struct RoutingConfigRequest {
pub name: Option<String>,
pub description: Option<String>,
pub algorithm: Option<RoutingAlgorithm>,
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
}
#[derive(Debug, serde::Serialize, ToSchema)]
pub struct ProfileDefaultRoutingConfig {
- pub profile_id: String,
+ #[schema(value_type = String)]
+ pub profile_id: common_utils::id_type::ProfileId,
pub connectors: Vec<RoutableConnectorChoice>,
}
@@ -62,13 +65,13 @@ pub struct RoutingRetrieveQuery {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct RoutingRetrieveLinkQuery {
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct RoutingRetrieveLinkQueryWrapper {
pub routing_query: RoutingRetrieveQuery,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
/// Response of the retrieved routing configs for a merchant account
@@ -87,7 +90,8 @@ pub enum LinkedRoutingConfigRetrieveResponse {
/// Routing Algorithm specific to merchants
pub struct MerchantRoutingAlgorithm {
pub id: String,
- pub profile_id: String,
+ #[schema(value_type = String)]
+ pub profile_id: common_utils::id_type::ProfileId,
pub name: String,
pub description: String,
pub algorithm: RoutingAlgorithm,
@@ -257,10 +261,9 @@ pub enum RoutingAlgorithmKind {
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-
pub struct RoutingPayloadWrapper {
pub updated_config: Vec<RoutableConnectorChoice>,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -453,8 +456,8 @@ impl RoutingAlgorithmRef {
pub struct RoutingDictionaryRecord {
pub id: String,
-
- pub profile_id: String,
+ #[schema(value_type = String)]
+ pub profile_id: common_utils::id_type::ProfileId,
pub name: String,
pub kind: RoutingAlgorithmKind,
pub description: String,
@@ -485,6 +488,6 @@ pub struct RoutingAlgorithmId {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RoutingLinkWrapper {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub algorithm_id: RoutingAlgorithmId,
}
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index 9867aba7b39..1fdf47425e2 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -405,6 +405,6 @@ pub struct ListMerchantsForUserInOrgResponse {
#[derive(Debug, serde::Serialize)]
pub struct ListProfilesForUserInOrgAndMerchantAccountResponse {
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
pub profile_name: String,
}
diff --git a/crates/api_models/src/user/sample_data.rs b/crates/api_models/src/user/sample_data.rs
index 6d20b20f369..dc95de913fa 100644
--- a/crates/api_models/src/user/sample_data.rs
+++ b/crates/api_models/src/user/sample_data.rs
@@ -19,5 +19,5 @@ pub struct SampleDataRequest {
pub auth_type: Option<Vec<AuthenticationType>>,
pub business_country: Option<CountryAlpha2>,
pub business_label: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
}
diff --git a/crates/api_models/src/webhook_events.rs b/crates/api_models/src/webhook_events.rs
index fa61cc0f253..f9741147cd0 100644
--- a/crates/api_models/src/webhook_events.rs
+++ b/crates/api_models/src/webhook_events.rs
@@ -26,7 +26,8 @@ pub struct EventListConstraints {
pub object_id: Option<String>,
/// Filter all events associated with the specified business profile ID.
- pub profile_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
}
#[derive(Debug)]
@@ -54,8 +55,8 @@ pub struct EventListItemResponse {
pub merchant_id: common_utils::id_type::MerchantId,
/// The identifier for the Business Profile.
- #[schema(max_length = 64, example = "SqB0zwDGR5wHppWf0bx7GKr1f2")]
- pub profile_id: String,
+ #[schema(max_length = 64, value_type = String, example = "SqB0zwDGR5wHppWf0bx7GKr1f2")]
+ pub profile_id: common_utils::id_type::ProfileId,
/// The identifier for the object (Payment Intent ID, Refund ID, etc.)
#[schema(max_length = 64, example = "QHrfd5LUDdZaKtAjdJmMu0dMa1")]
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 43777143968..48b2e9d98c0 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -35,6 +35,9 @@ pub enum ApiEventsType {
Customer {
customer_id: id_type::CustomerId,
},
+ BusinessProfile {
+ profile_id: id_type::ProfileId,
+ },
User {
user_id: String,
},
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index 55e2e3ffb18..cc4c56d6abb 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -6,6 +6,7 @@ use std::{borrow::Cow, fmt::Debug};
mod customer;
mod merchant;
mod organization;
+mod profile;
mod global_id;
@@ -19,6 +20,7 @@ use diesel::{
};
pub use merchant::MerchantId;
pub use organization::OrganizationId;
+pub use profile::ProfileId;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -198,6 +200,12 @@ where
}
}
+/// An interface to generate object identifiers.
+pub trait GenerateId {
+ /// Generates a random object identifier.
+ fn generate() -> Self;
+}
+
#[cfg(test)]
mod alphanumeric_id_tests {
#![allow(clippy::unwrap_used)]
diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rs
index 65049125960..9d02f201383 100644
--- a/crates/common_utils/src/id_type/customer.rs
+++ b/crates/common_utils/src/id_type/customer.rs
@@ -9,6 +9,7 @@ crate::impl_debug_id_type!(CustomerId);
crate::impl_default_id_type!(CustomerId, "cus");
crate::impl_try_from_cow_str_id_type!(CustomerId, "customer_id");
+crate::impl_generate_id_id_type!(CustomerId, "cus");
crate::impl_serializable_secret_id_type!(CustomerId);
crate::impl_queryable_id_type!(CustomerId);
crate::impl_to_sql_from_sql_id_type!(CustomerId);
diff --git a/crates/common_utils/src/id_type/merchant.rs b/crates/common_utils/src/id_type/merchant.rs
index 8358f39051e..08b80249ae3 100644
--- a/crates/common_utils/src/id_type/merchant.rs
+++ b/crates/common_utils/src/id_type/merchant.rs
@@ -25,6 +25,7 @@ crate::impl_debug_id_type!(MerchantId);
crate::impl_default_id_type!(MerchantId, "mer");
crate::impl_try_from_cow_str_id_type!(MerchantId, "merchant_id");
+crate::impl_generate_id_id_type!(MerchantId, "mer");
crate::impl_serializable_secret_id_type!(MerchantId);
crate::impl_queryable_id_type!(MerchantId);
crate::impl_to_sql_from_sql_id_type!(MerchantId);
diff --git a/crates/common_utils/src/id_type/organization.rs b/crates/common_utils/src/id_type/organization.rs
index 336442e6057..f88a62daa1d 100644
--- a/crates/common_utils/src/id_type/organization.rs
+++ b/crates/common_utils/src/id_type/organization.rs
@@ -9,6 +9,7 @@ crate::impl_debug_id_type!(OrganizationId);
crate::impl_default_id_type!(OrganizationId, "org");
crate::impl_try_from_cow_str_id_type!(OrganizationId, "organization_id");
+crate::impl_generate_id_id_type!(OrganizationId, "org");
crate::impl_serializable_secret_id_type!(OrganizationId);
crate::impl_queryable_id_type!(OrganizationId);
crate::impl_to_sql_from_sql_id_type!(OrganizationId);
diff --git a/crates/common_utils/src/id_type/profile.rs b/crates/common_utils/src/id_type/profile.rs
new file mode 100644
index 00000000000..e9d90e7bba1
--- /dev/null
+++ b/crates/common_utils/src/id_type/profile.rs
@@ -0,0 +1,22 @@
+crate::id_type!(
+ ProfileId,
+ "A type for profile_id that can be used for business profile ids"
+);
+crate::impl_id_type_methods!(ProfileId, "profile_id");
+
+// This is to display the `ProfileId` as ProfileId(abcd)
+crate::impl_debug_id_type!(ProfileId);
+crate::impl_try_from_cow_str_id_type!(ProfileId, "profile_id");
+
+crate::impl_generate_id_id_type!(ProfileId, "pro");
+crate::impl_serializable_secret_id_type!(ProfileId);
+crate::impl_queryable_id_type!(ProfileId);
+crate::impl_to_sql_from_sql_id_type!(ProfileId);
+
+impl crate::events::ApiEventMetric for ProfileId {
+ fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
+ Some(crate::events::ApiEventsType::BusinessProfile {
+ profile_id: self.clone(),
+ })
+ }
+}
diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs
index 400da349983..67a67bee5c3 100644
--- a/crates/common_utils/src/lib.rs
+++ b/crates/common_utils/src/lib.rs
@@ -214,12 +214,23 @@ fn generate_ref_id_with_default_length<const MAX_LENGTH: u8, const MIN_LENGTH: u
/// Generate a customer id with default length, with prefix as `cus`
pub fn generate_customer_id_of_default_length() -> id_type::CustomerId {
- id_type::CustomerId::default()
+ use id_type::GenerateId;
+
+ id_type::CustomerId::generate()
}
/// Generate a organization id with default length, with prefix as `org`
pub fn generate_organization_id_of_default_length() -> id_type::OrganizationId {
- id_type::OrganizationId::default()
+ use id_type::GenerateId;
+
+ id_type::OrganizationId::generate()
+}
+
+/// Generate a profile id with default length, with prefix as `pro`
+pub fn generate_profile_id_of_default_length() -> id_type::ProfileId {
+ use id_type::GenerateId;
+
+ id_type::ProfileId::generate()
}
/// Generate a nanoid with the given prefix and a default length
diff --git a/crates/common_utils/src/macros.rs b/crates/common_utils/src/macros.rs
index 06554ee9b51..94d8074c301 100644
--- a/crates/common_utils/src/macros.rs
+++ b/crates/common_utils/src/macros.rs
@@ -233,6 +233,18 @@ mod id_type {
};
}
+ /// Implements the `GenerateId` trait on the specified ID type.
+ #[macro_export]
+ macro_rules! impl_generate_id_id_type {
+ ($type:ty, $prefix:literal) => {
+ impl $crate::id_type::GenerateId for $type {
+ fn generate() -> Self {
+ Self($crate::generate_ref_id_with_default_length($prefix))
+ }
+ }
+ };
+ }
+
/// Implements the `SerializableSecret` trait on the specified ID type.
#[macro_export]
macro_rules! impl_serializable_secret_id_type {
diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml
index 1541a0864cc..1809d755834 100644
--- a/crates/connector_configs/Cargo.toml
+++ b/crates/connector_configs/Cargo.toml
@@ -17,6 +17,7 @@ payouts = ["api_models/payouts"]
[dependencies]
# First party crates
api_models = { version = "0.1.0", path = "../api_models", package = "api_models" }
+common_utils = { version = "0.1.0", path = "../common_utils" }
# Third party crates
serde = { version = "1.0.197", features = ["derive"] }
diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs
index 88b8165853d..d0becb80468 100644
--- a/crates/connector_configs/src/common_config.rs
+++ b/crates/connector_configs/src/common_config.rs
@@ -161,7 +161,7 @@ pub struct Provider {
#[serde(rename_all = "snake_case")]
pub struct ConnectorApiIntegrationPayload {
pub connector_type: String,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub connector_name: api_models::enums::Connector,
#[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")]
diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs
index cb518805ebf..606644255bc 100644
--- a/crates/diesel_models/src/authentication.rs
+++ b/crates/diesel_models/src/authentication.rs
@@ -41,7 +41,7 @@ pub struct Authentication {
pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>,
pub acs_signed_content: Option<String>,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub payment_id: Option<String>,
pub merchant_connector_id: String,
pub ds_trans_id: Option<String>,
@@ -88,7 +88,7 @@ pub struct AuthenticationNew {
pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>,
pub acs_signed_content: Option<String>,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub payment_id: Option<String>,
pub merchant_connector_id: String,
pub ds_trans_id: Option<String>,
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index cab1aec410f..20add83bd2c 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -25,7 +25,7 @@ use crate::schema_v2::business_profile;
#[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id), check_for_backend(diesel::pg::Pg))]
pub struct BusinessProfile {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
@@ -67,7 +67,7 @@ pub struct BusinessProfile {
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id))]
pub struct BusinessProfileNew {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
@@ -242,7 +242,7 @@ impl BusinessProfileUpdateInternal {
#[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id), check_for_backend(diesel::pg::Pg))]
pub struct BusinessProfile {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
@@ -283,7 +283,7 @@ pub struct BusinessProfile {
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id))]
pub struct BusinessProfileNew {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
diff --git a/crates/diesel_models/src/dispute.rs b/crates/diesel_models/src/dispute.rs
index 704b1781e2a..14fe16c9826 100644
--- a/crates/diesel_models/src/dispute.rs
+++ b/crates/diesel_models/src/dispute.rs
@@ -27,7 +27,7 @@ pub struct DisputeNew {
pub connector_updated_at: Option<PrimitiveDateTime>,
pub connector: String,
pub evidence: Option<Secret<serde_json::Value>>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<String>,
pub dispute_amount: i64,
}
@@ -56,7 +56,7 @@ pub struct Dispute {
pub modified_at: PrimitiveDateTime,
pub connector: String,
pub evidence: Secret<serde_json::Value>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<String>,
pub dispute_amount: i64,
}
diff --git a/crates/diesel_models/src/events.rs b/crates/diesel_models/src/events.rs
index 20c811654a7..2cc2bfff3b2 100644
--- a/crates/diesel_models/src/events.rs
+++ b/crates/diesel_models/src/events.rs
@@ -22,7 +22,7 @@ pub struct EventNew {
pub primary_object_type: storage_enums::EventObjectType,
pub created_at: PrimitiveDateTime,
pub merchant_id: Option<common_utils::id_type::MerchantId>,
- pub business_profile_id: Option<String>,
+ pub business_profile_id: Option<common_utils::id_type::ProfileId>,
pub primary_object_created_at: Option<PrimitiveDateTime>,
pub idempotent_event_id: Option<String>,
pub initial_attempt_id: Option<String>,
@@ -51,7 +51,7 @@ pub struct Event {
#[serde(with = "custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
pub merchant_id: Option<common_utils::id_type::MerchantId>,
- pub business_profile_id: Option<String>,
+ pub business_profile_id: Option<common_utils::id_type::ProfileId>,
// This column can be used to partition the database table, so that all events related to a
// single object would reside in the same partition
pub primary_object_created_at: Option<PrimitiveDateTime>,
diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rs
index e5ad3568d70..523bb1f26ef 100644
--- a/crates/diesel_models/src/file.rs
+++ b/crates/diesel_models/src/file.rs
@@ -17,7 +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>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<String>,
}
@@ -36,7 +36,7 @@ pub struct FileMetadata {
#[serde(with = "custom_serde::iso8601")]
pub created_at: time::PrimitiveDateTime,
pub connector_label: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<String>,
}
@@ -46,7 +46,7 @@ pub enum FileMetadataUpdate {
provider_file_id: Option<String>,
file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
merchant_connector_id: Option<String>,
},
}
@@ -57,7 +57,7 @@ pub struct FileMetadataUpdateInternal {
provider_file_id: Option<String>,
file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
merchant_connector_id: Option<String>,
}
diff --git a/crates/diesel_models/src/merchant_account.rs b/crates/diesel_models/src/merchant_account.rs
index b3ef64b3e3d..ac7635e88c5 100644
--- a/crates/diesel_models/src/merchant_account.rs
+++ b/crates/diesel_models/src/merchant_account.rs
@@ -52,7 +52,7 @@ pub struct MerchantAccount {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub is_recon_enabled: bool,
- pub default_profile: Option<String>,
+ pub default_profile: Option<common_utils::id_type::ProfileId>,
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
@@ -87,7 +87,7 @@ pub struct MerchantAccountSetter {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub is_recon_enabled: bool,
- pub default_profile: Option<String>,
+ pub default_profile: Option<common_utils::id_type::ProfileId>,
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
@@ -241,7 +241,7 @@ pub struct MerchantAccountNew {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub is_recon_enabled: bool,
- pub default_profile: Option<String>,
+ pub default_profile: Option<common_utils::id_type::ProfileId>,
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
@@ -306,7 +306,7 @@ pub struct MerchantAccountUpdateInternal {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: Option<common_utils::id_type::OrganizationId>,
pub is_recon_enabled: Option<bool>,
- pub default_profile: Option<Option<String>>,
+ pub default_profile: Option<Option<common_utils::id_type::ProfileId>>,
pub recon_status: Option<storage_enums::ReconStatus>,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 876240f44a3..61f2af238ed 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -48,7 +48,7 @@ pub struct MerchantConnectorAccount {
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
@@ -95,7 +95,7 @@ pub struct MerchantConnectorAccount {
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
@@ -139,7 +139,7 @@ pub struct MerchantConnectorAccountNew {
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
@@ -166,7 +166,7 @@ pub struct MerchantConnectorAccountNew {
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index bdea1fe52a7..7bd1652ab56 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -47,7 +47,7 @@ pub struct PaymentIntent {
pub connector_metadata: Option<serde_json::Value>,
pub feature_metadata: Option<serde_json::Value>,
pub attempt_count: i16,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
// Denotes the action(approve or reject) taken by merchant in case of manual review.
// Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment
pub merchant_decision: Option<String>,
@@ -108,7 +108,7 @@ pub struct PaymentIntent {
pub connector_metadata: Option<serde_json::Value>,
pub feature_metadata: Option<serde_json::Value>,
pub attempt_count: i16,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
// Denotes the action(approve or reject) taken by merchant in case of manual review.
// Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment
pub merchant_decision: Option<String>,
@@ -170,7 +170,7 @@ pub struct PaymentIntentNew {
pub connector_metadata: Option<serde_json::Value>,
pub feature_metadata: Option<serde_json::Value>,
pub attempt_count: i16,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub merchant_decision: Option<String>,
pub payment_link_id: Option<String>,
pub payment_confirm_source: Option<storage_enums::PaymentSource>,
diff --git a/crates/diesel_models/src/payment_link.rs b/crates/diesel_models/src/payment_link.rs
index 347a730eb68..51e3b89d605 100644
--- a/crates/diesel_models/src/payment_link.rs
+++ b/crates/diesel_models/src/payment_link.rs
@@ -23,7 +23,7 @@ pub struct PaymentLink {
pub custom_merchant_name: Option<String>,
pub payment_link_config: Option<serde_json::Value>,
pub description: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub secure_link: Option<String>,
}
@@ -54,6 +54,6 @@ pub struct PaymentLinkNew {
pub custom_merchant_name: Option<String>,
pub payment_link_config: Option<serde_json::Value>,
pub description: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub secure_link: Option<String>,
}
diff --git a/crates/diesel_models/src/payout_attempt.rs b/crates/diesel_models/src/payout_attempt.rs
index 17600e0cd78..7e9b2ec4e1c 100644
--- a/crates/diesel_models/src/payout_attempt.rs
+++ b/crates/diesel_models/src/payout_attempt.rs
@@ -27,7 +27,7 @@ pub struct PayoutAttempt {
pub created_at: PrimitiveDateTime,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_connector_id: Option<String>,
pub routing_info: Option<serde_json::Value>,
}
@@ -59,11 +59,11 @@ pub struct PayoutAttemptNew {
pub error_code: Option<String>,
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<String>,
- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
- pub created_at: Option<PrimitiveDateTime>,
- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
- pub last_modified_at: Option<PrimitiveDateTime>,
- pub profile_id: String,
+ #[serde(with = "common_utils::custom_serde::iso8601")]
+ pub created_at: PrimitiveDateTime,
+ #[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 routing_info: Option<serde_json::Value>,
}
diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rs
index cb8f6f9a884..8acdc4a0a5a 100644
--- a/crates/diesel_models/src/payouts.rs
+++ b/crates/diesel_models/src/payouts.rs
@@ -31,7 +31,7 @@ pub struct Payouts {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
pub attempt_count: i16,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub payout_link_id: Option<String>,
@@ -72,7 +72,7 @@ pub struct PayoutsNew {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
pub attempt_count: i16,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub payout_link_id: Option<String>,
@@ -92,7 +92,7 @@ pub enum PayoutsUpdate {
return_url: Option<String>,
entity_type: storage_enums::PayoutEntityType,
metadata: Option<pii::SecretSerdeValue>,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
status: Option<storage_enums::PayoutStatus>,
confirm: Option<bool>,
payout_type: Option<storage_enums::PayoutType>,
@@ -126,7 +126,7 @@ pub struct PayoutsUpdateInternal {
pub entity_type: Option<storage_enums::PayoutEntityType>,
pub metadata: Option<pii::SecretSerdeValue>,
pub payout_method_id: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub status: Option<storage_enums::PayoutStatus>,
pub last_modified_at: PrimitiveDateTime,
pub attempt_count: Option<i16>,
diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs
index fb80449cdc6..807648b5dce 100644
--- a/crates/diesel_models/src/query/business_profile.rs
+++ b/crates/diesel_models/src/query/business_profile.rs
@@ -40,7 +40,10 @@ impl BusinessProfile {
}
}
- pub async fn find_by_profile_id(conn: &PgPooledConn, profile_id: &str) -> StorageResult<Self> {
+ pub async fn find_by_profile_id(
+ conn: &PgPooledConn,
+ profile_id: &common_utils::id_type::ProfileId,
+ ) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::profile_id.eq(profile_id.to_owned()),
@@ -51,7 +54,7 @@ impl BusinessProfile {
pub async fn find_by_merchant_id_profile_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
@@ -97,7 +100,7 @@ impl BusinessProfile {
pub async fn delete_by_profile_id_merchant_id(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
diff --git a/crates/diesel_models/src/query/events.rs b/crates/diesel_models/src/query/events.rs
index 8b2a1a001f8..34222e6e7d8 100644
--- a/crates/diesel_models/src/query/events.rs
+++ b/crates/diesel_models/src/query/events.rs
@@ -118,7 +118,7 @@ impl Event {
pub async fn list_initial_attempts_by_profile_id_primary_object_id(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
@@ -137,7 +137,7 @@ impl Event {
pub async fn list_initial_attempts_by_profile_id_constraints(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
created_after: Option<time::PrimitiveDateTime>,
created_before: Option<time::PrimitiveDateTime>,
limit: Option<i64>,
@@ -187,7 +187,7 @@ impl Event {
pub async fn list_by_profile_id_initial_attempt_id(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
initial_attempt_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs
index e4dcdba5975..7eeddd5d592 100644
--- a/crates/diesel_models/src/query/merchant_connector_account.rs
+++ b/crates/diesel_models/src/query/merchant_connector_account.rs
@@ -78,7 +78,7 @@ impl MerchantConnectorAccount {
pub async fn find_by_profile_id_connector_name(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
diff --git a/crates/diesel_models/src/query/routing_algorithm.rs b/crates/diesel_models/src/query/routing_algorithm.rs
index 0f3b709d264..f0fc75430e8 100644
--- a/crates/diesel_models/src/query/routing_algorithm.rs
+++ b/crates/diesel_models/src/query/routing_algorithm.rs
@@ -34,7 +34,7 @@ impl RoutingAlgorithm {
pub async fn find_by_algorithm_id_profile_id(
conn: &PgPooledConn,
algorithm_id: &str,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
@@ -48,7 +48,7 @@ impl RoutingAlgorithm {
pub async fn find_metadata_by_algorithm_id_profile_id(
conn: &PgPooledConn,
algorithm_id: &str,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<RoutingProfileMetadata> {
Self::table()
.select((
@@ -68,7 +68,7 @@ impl RoutingAlgorithm {
)
.limit(1)
.load_async::<(
- String,
+ common_utils::id_type::ProfileId,
String,
String,
Option<String>,
@@ -109,7 +109,7 @@ impl RoutingAlgorithm {
pub async fn list_metadata_by_profile_id(
conn: &PgPooledConn,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
limit: i64,
offset: i64,
) -> StorageResult<Vec<RoutingProfileMetadata>> {
@@ -129,7 +129,7 @@ impl RoutingAlgorithm {
.offset(offset)
.load_async::<(
String,
- String,
+ common_utils::id_type::ProfileId,
String,
Option<String>,
enums::RoutingAlgorithmKind,
@@ -188,7 +188,7 @@ impl RoutingAlgorithm {
.offset(offset)
.order(dsl::modified_at.desc())
.load_async::<(
- String,
+ common_utils::id_type::ProfileId,
String,
String,
Option<String>,
@@ -250,7 +250,7 @@ impl RoutingAlgorithm {
.offset(offset)
.order(dsl::modified_at.desc())
.load_async::<(
- String,
+ common_utils::id_type::ProfileId,
String,
String,
Option<String>,
diff --git a/crates/diesel_models/src/query/user_role.rs b/crates/diesel_models/src/query/user_role.rs
index b4789b3c169..7904d3c2645 100644
--- a/crates/diesel_models/src/query/user_role.rs
+++ b/crates/diesel_models/src/query/user_role.rs
@@ -83,7 +83,7 @@ impl UserRole {
user_id: String,
org_id: id_type::OrganizationId,
merchant_id: id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
version: UserRoleVersion,
) -> StorageResult<Self> {
// Checking in user roles, for a user in token hierarchy, only one of the relation will be true, either org level, merchant level or profile level
@@ -116,7 +116,7 @@ impl UserRole {
user_id: String,
org_id: id_type::OrganizationId,
merchant_id: id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
update: UserRoleUpdate,
version: UserRoleVersion,
) -> StorageResult<Self> {
@@ -156,7 +156,7 @@ impl UserRole {
user_id: String,
org_id: id_type::OrganizationId,
merchant_id: id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
version: UserRoleVersion,
) -> StorageResult<Self> {
// Checking in user roles, for a user in token hierarchy, only one of the relation will be true, either org level, merchant level or profile level
@@ -190,7 +190,7 @@ impl UserRole {
user_id: String,
org_id: Option<id_type::OrganizationId>,
merchant_id: Option<id_type::MerchantId>,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
entity_id: Option<String>,
version: Option<UserRoleVersion>,
) -> StorageResult<Vec<Self>> {
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index e4a74a6d66e..3b73a603677 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -46,7 +46,7 @@ pub struct Refund {
pub attempt_id: String,
pub refund_reason: Option<String>,
pub refund_error_code: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub updated_by: String,
pub merchant_connector_id: Option<String>,
pub charges: Option<ChargeRefunds>,
@@ -88,7 +88,7 @@ pub struct RefundNew {
pub description: Option<String>,
pub attempt_id: String,
pub refund_reason: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<common_utils::id_type::ProfileId>,
pub updated_by: String,
pub merchant_connector_id: Option<String>,
pub charges: Option<ChargeRefunds>,
diff --git a/crates/diesel_models/src/routing_algorithm.rs b/crates/diesel_models/src/routing_algorithm.rs
index e2566783e9b..6be0be3d5e4 100644
--- a/crates/diesel_models/src/routing_algorithm.rs
+++ b/crates/diesel_models/src/routing_algorithm.rs
@@ -7,7 +7,7 @@ use crate::{enums, schema::routing_algorithm};
#[diesel(table_name = routing_algorithm, primary_key(algorithm_id), check_for_backend(diesel::pg::Pg))]
pub struct RoutingAlgorithm {
pub algorithm_id: String,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub name: String,
pub description: Option<String>,
@@ -29,7 +29,7 @@ pub struct RoutingAlgorithmMetadata {
}
pub struct RoutingProfileMetadata {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub algorithm_id: String,
pub name: String,
pub description: Option<String>,
diff --git a/crates/diesel_models/src/user_role.rs b/crates/diesel_models/src/user_role.rs
index 1a006f2a4ad..b508c86211b 100644
--- a/crates/diesel_models/src/user_role.rs
+++ b/crates/diesel_models/src/user_role.rs
@@ -18,7 +18,7 @@ pub struct UserRole {
pub last_modified_by: String,
pub created_at: PrimitiveDateTime,
pub last_modified: PrimitiveDateTime,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub entity_id: Option<String>,
pub entity_type: Option<EntityType>,
pub version: enums::UserRoleVersion,
@@ -36,7 +36,7 @@ pub struct UserRoleNew {
pub last_modified_by: String,
pub created_at: PrimitiveDateTime,
pub last_modified: PrimitiveDateTime,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub entity_id: Option<String>,
pub entity_type: Option<EntityType>,
pub version: enums::UserRoleVersion,
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index ec072521d99..9a6edc50e73 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -23,7 +23,7 @@ use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
))]
#[derive(Clone, Debug)]
pub struct BusinessProfile {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
@@ -453,7 +453,7 @@ impl super::behaviour::Conversion for BusinessProfile {
#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
#[derive(Clone, Debug)]
pub struct BusinessProfile {
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub profile_name: String,
pub created_at: time::PrimitiveDateTime,
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index c86dff60eaa..50b1effd27f 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -45,7 +45,7 @@ pub struct MerchantAccount {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub is_recon_enabled: bool,
- pub default_profile: Option<String>,
+ pub default_profile: Option<common_utils::id_type::ProfileId>,
pub recon_status: diesel_models::enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
@@ -82,7 +82,7 @@ pub struct MerchantAccountSetter {
pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub is_recon_enabled: bool,
- pub default_profile: Option<String>,
+ pub default_profile: Option<common_utils::id_type::ProfileId>,
pub recon_status: diesel_models::enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
@@ -231,7 +231,7 @@ pub enum MerchantAccountUpdate {
intent_fulfillment_time: Option<i64>,
frm_routing_algorithm: Option<serde_json::Value>,
payout_routing_algorithm: Option<serde_json::Value>,
- default_profile: Option<Option<String>>,
+ default_profile: Option<Option<common_utils::id_type::ProfileId>>,
payment_link_config: Option<serde_json::Value>,
pm_collect_link_config: Option<serde_json::Value>,
},
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
index 9e2f6918b43..76b7cd4a85a 100644
--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
@@ -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: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
pub status: enums::ConnectorStatus,
@@ -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: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
pub status: enums::ConnectorStatus,
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 3f7cfde2f78..11a2c3c3164 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -44,7 +44,7 @@ pub struct PaymentIntent {
pub connector_metadata: Option<serde_json::Value>,
pub feature_metadata: Option<serde_json::Value>,
pub attempt_count: i16,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub payment_link_id: Option<String>,
// Denotes the action(approve or reject) taken by merchant in case of manual review.
// Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index c129e83d556..4c59a90ba15 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -133,7 +133,7 @@ pub struct PaymentIntentNew {
pub connector_metadata: Option<serde_json::Value>,
pub feature_metadata: Option<serde_json::Value>,
pub attempt_count: i16,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub merchant_decision: Option<String>,
pub payment_link_id: Option<String>,
pub payment_confirm_source: Option<storage_enums::PaymentSource>,
@@ -746,7 +746,7 @@ pub struct PaymentIntentListParams {
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 profile_id: Option<id_type::ProfileId>,
pub customer_id: Option<id_type::CustomerId>,
pub starting_after_id: Option<String>,
pub ending_before_id: Option<String>,
diff --git a/crates/hyperswitch_domain_models/src/payouts.rs b/crates/hyperswitch_domain_models/src/payouts.rs
index bb636d2dc48..952028fab30 100644
--- a/crates/hyperswitch_domain_models/src/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts.rs
@@ -19,7 +19,7 @@ pub struct PayoutListParams {
pub currency: Option<Vec<storage_enums::Currency>>,
pub status: Option<Vec<storage_enums::PayoutStatus>>,
pub payout_method: Option<Vec<common_enums::PayoutType>>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub customer_id: Option<id_type::CustomerId>,
pub starting_after_id: Option<String>,
pub ending_before_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 a1f08610f9c..8182ed35bab 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
@@ -75,7 +75,7 @@ pub struct PayoutAttempt {
pub created_at: PrimitiveDateTime,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
pub merchant_connector_id: Option<String>,
pub routing_info: Option<serde_json::Value>,
}
@@ -96,41 +96,13 @@ pub struct PayoutAttemptNew {
pub error_code: Option<String>,
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<String>,
- pub created_at: Option<PrimitiveDateTime>,
- pub last_modified_at: Option<PrimitiveDateTime>,
- pub profile_id: String,
+ pub created_at: PrimitiveDateTime,
+ pub last_modified_at: PrimitiveDateTime,
+ pub profile_id: id_type::ProfileId,
pub merchant_connector_id: Option<String>,
pub routing_info: Option<serde_json::Value>,
}
-impl Default for PayoutAttemptNew {
- fn default() -> Self {
- let now = common_utils::date_time::now();
-
- Self {
- payout_attempt_id: String::default(),
- payout_id: String::default(),
- customer_id: None,
- merchant_id: id_type::MerchantId::default(),
- address_id: None,
- connector: None,
- connector_payout_id: None,
- payout_token: None,
- status: storage_enums::PayoutStatus::default(),
- is_eligible: None,
- error_message: None,
- error_code: None,
- business_country: None,
- business_label: None,
- created_at: Some(now),
- last_modified_at: Some(now),
- profile_id: String::default(),
- merchant_connector_id: None,
- routing_info: None,
- }
- }
-}
-
#[derive(Debug, Clone)]
pub enum PayoutAttemptUpdate {
StatusUpdate {
diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
index 834b6bb3f76..e514dbfb4c3 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
@@ -106,7 +106,7 @@ pub struct Payouts {
pub created_at: PrimitiveDateTime,
pub last_modified_at: PrimitiveDateTime,
pub attempt_count: i16,
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub payout_link_id: Option<String>,
@@ -131,10 +131,10 @@ pub struct PayoutsNew {
pub return_url: Option<String>,
pub entity_type: storage_enums::PayoutEntityType,
pub metadata: Option<pii::SecretSerdeValue>,
- pub created_at: Option<PrimitiveDateTime>,
- pub last_modified_at: Option<PrimitiveDateTime>,
+ pub created_at: PrimitiveDateTime,
+ pub last_modified_at: PrimitiveDateTime,
pub attempt_count: i16,
- pub profile_id: String,
+ pub profile_id: id_type::ProfileId,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub payout_link_id: Option<String>,
@@ -142,39 +142,6 @@ pub struct PayoutsNew {
pub priority: Option<storage_enums::PayoutSendPriority>,
}
-impl Default for PayoutsNew {
- fn default() -> Self {
- let now = common_utils::date_time::now();
-
- Self {
- payout_id: String::default(),
- merchant_id: id_type::MerchantId::default(),
- customer_id: None,
- address_id: None,
- payout_type: None,
- payout_method_id: None,
- amount: MinorUnit::new(i64::default()),
- destination_currency: storage_enums::Currency::default(),
- source_currency: storage_enums::Currency::default(),
- description: None,
- recurring: bool::default(),
- auto_fulfill: bool::default(),
- return_url: None,
- entity_type: storage_enums::PayoutEntityType::default(),
- metadata: None,
- created_at: Some(now),
- last_modified_at: Some(now),
- attempt_count: 1,
- profile_id: String::default(),
- status: storage_enums::PayoutStatus::default(),
- confirm: None,
- payout_link_id: None,
- client_secret: None,
- priority: None,
- }
- }
-}
-
#[derive(Debug, Serialize, Deserialize)]
pub enum PayoutsUpdate {
Update {
@@ -187,7 +154,7 @@ pub enum PayoutsUpdate {
return_url: Option<String>,
entity_type: storage_enums::PayoutEntityType,
metadata: Option<pii::SecretSerdeValue>,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
status: Option<storage_enums::PayoutStatus>,
confirm: Option<bool>,
payout_type: Option<storage_enums::PayoutType>,
@@ -220,7 +187,7 @@ pub struct PayoutsUpdateInternal {
pub entity_type: Option<storage_enums::PayoutEntityType>,
pub metadata: Option<pii::SecretSerdeValue>,
pub payout_method_id: Option<String>,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
pub status: Option<storage_enums::PayoutStatus>,
pub attempt_count: Option<i16>,
pub confirm: Option<bool>,
diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rs
index ab2e8c80ca4..5a078de1d79 100644
--- a/crates/kgraph_utils/benches/evaluation.rs
+++ b/crates/kgraph_utils/benches/evaluation.rs
@@ -52,6 +52,8 @@ fn build_test_data(
});
}
+ let profile_id = common_utils::generate_profile_id_of_default_length();
+
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
@@ -64,7 +66,7 @@ fn build_test_data(
connector_label: Some("something".to_string()),
frm_configs: None,
connector_webhook_details: None,
- profile_id: "profile_id".to_string(),
+ profile_id,
applepay_verified_domains: None,
pm_auth_config: None,
status: api_enums::ConnectorStatus::Inactive,
@@ -90,7 +92,7 @@ fn build_test_data(
business_sub_label: Some("something".to_string()),
frm_configs: None,
connector_webhook_details: None,
- profile_id: "profile_id".to_string(),
+ profile_id,
applepay_verified_domains: None,
pm_auth_config: None,
status: api_enums::ConnectorStatus::Inactive,
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index d4e04669714..1e099589b00 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -704,6 +704,8 @@ mod tests {
fn build_test_data() -> ConstraintGraph<dir::DirValue> {
use api_models::{admin::*, payment_methods::*};
+ let profile_id = common_utils::generate_profile_id_of_default_length();
+
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
@@ -752,7 +754,7 @@ mod tests {
}]),
frm_configs: None,
connector_webhook_details: None,
- profile_id: "profile_id".to_string(),
+ profile_id,
applepay_verified_domains: None,
pm_auth_config: None,
status: api_enums::ConnectorStatus::Inactive,
@@ -813,7 +815,7 @@ mod tests {
}]),
frm_configs: None,
connector_webhook_details: None,
- profile_id: "profile_id".to_string(),
+ profile_id,
applepay_verified_domains: None,
pm_auth_config: None,
status: api_enums::ConnectorStatus::Inactive,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index e90924a593a..f78d5dca2e0 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -721,7 +721,7 @@ pub async fn list_merchant_account(
pub async fn get_merchant_account(
state: SessionState,
req: api::MerchantId,
- _profile_id: Option<String>,
+ _profile_id: Option<id_type::ProfileId>,
) -> RouterResponse<api::MerchantAccountResponse> {
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -842,8 +842,6 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
) -> RouterResult<storage::MerchantAccountUpdate> {
- use common_utils::ext_traits::ConfigExt;
-
let key_manager_state = &state.into();
let key = key_store.key.get_inner().peek();
@@ -885,21 +883,16 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
// This supports changing the business profile by passing in the profile_id
let business_profile_id_update = if let Some(ref profile_id) = self.default_profile {
- if !profile_id.is_empty_after_trim() {
- // Validate whether profile_id passed in request is valid and is linked to the merchant
- core_utils::validate_and_get_business_profile(
- state.store.as_ref(),
- key_manager_state,
- key_store,
- Some(profile_id),
- merchant_id,
- )
- .await?
- .map(|business_profile| Some(business_profile.profile_id))
- } else {
- // If empty, Update profile_id to None in the database
- Some(None)
- }
+ // Validate whether profile_id passed in request is valid and is linked to the merchant
+ core_utils::validate_and_get_business_profile(
+ state.store.as_ref(),
+ key_manager_state,
+ key_store,
+ Some(profile_id),
+ merchant_id,
+ )
+ .await?
+ .map(|business_profile| Some(business_profile.profile_id))
} else {
None
};
@@ -1047,7 +1040,7 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
pub async fn merchant_account_update(
state: SessionState,
merchant_id: &id_type::MerchantId,
- _profile_id: Option<String>,
+ _profile_id: Option<id_type::ProfileId>,
req: api::MerchantAccountUpdate,
) -> RouterResponse<api::MerchantAccountResponse> {
let db = state.store.as_ref();
@@ -1765,7 +1758,7 @@ struct PMAuthConfigValidation<'a> {
pm_auth_config: &'a Option<pii::SecretSerdeValue>,
db: &'a dyn StorageInterface,
merchant_id: &'a id_type::MerchantId,
- profile_id: &'a String,
+ profile_id: &'a id_type::ProfileId,
key_store: &'a domain::MerchantKeyStore,
key_manager_state: &'a KeyManagerState,
}
@@ -1877,7 +1870,7 @@ struct MerchantDefaultConfigUpdate<'a> {
merchant_connector_id: &'a String,
store: &'a dyn StorageInterface,
merchant_id: &'a id_type::MerchantId,
- profile_id: &'a String,
+ profile_id: &'a id_type::ProfileId,
transaction_type: &'a api_enums::TransactionType,
}
#[cfg(all(
@@ -1897,7 +1890,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {
let mut default_routing_config_for_profile = routing::helpers::get_merchant_default_config(
self.store,
- self.profile_id,
+ self.profile_id.get_string_repr(),
self.transaction_type,
)
.await?;
@@ -1922,7 +1915,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {
default_routing_config_for_profile.push(choice);
routing::helpers::update_merchant_default_config(
self.store,
- self.profile_id,
+ self.profile_id.get_string_repr(),
default_routing_config_for_profile.clone(),
self.transaction_type,
)
@@ -1969,7 +1962,7 @@ impl<'a> DefaultFallbackRoutingConfigUpdate<'a> {
profile_wrapper
.update_default_fallback_routing_of_connectors_under_profile(
self.store,
- &default_routing_config_for_profile,
+ default_routing_config_for_profile,
self.key_manager_state,
&self.key_store,
)
@@ -2438,7 +2431,9 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
)
.await?
.get_required_value("BusinessProfile")
- .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id })?;
+ .change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.get_string_repr().to_owned(),
+ })?;
Ok(business_profile)
}
@@ -2614,7 +2609,9 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
.await?
.get_required_value("BusinessProfile")
.change_context(
- errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id },
+ errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.get_string_repr().to_owned(),
+ },
)?;
Ok(business_profile)
@@ -2746,7 +2743,7 @@ pub async fn create_connector(
.await
.to_duplicate_response(
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount {
- profile_id: business_profile.profile_id.clone(),
+ profile_id: business_profile.profile_id.get_string_repr().to_owned(),
connector_label: merchant_connector_account
.connector_label
.unwrap_or_default(),
@@ -2809,7 +2806,7 @@ async fn validate_pm_auth(
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
- profile_id: &String,
+ profile_id: &id_type::ProfileId,
) -> RouterResponse<()> {
let config =
serde_json::from_value::<api_models::pm_auth::PaymentMethodAuthConfig>(val.expose())
@@ -2858,7 +2855,7 @@ async fn validate_pm_auth(
pub async fn retrieve_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
merchant_connector_id: String,
) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let store = state.store.as_ref();
@@ -2939,7 +2936,7 @@ pub async fn retrieve_connector(
pub async fn list_payment_connectors(
state: SessionState,
merchant_id: id_type::MerchantId,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<id_type::ProfileId>>,
) -> RouterResponse<Vec<api_models::admin::MerchantConnectorListResponse>> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -2984,7 +2981,7 @@ pub async fn list_payment_connectors(
pub async fn update_connector(
state: SessionState,
merchant_id: &id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
merchant_connector_id: &str,
req: api_models::admin::MerchantConnectorUpdate,
) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
@@ -3042,7 +3039,7 @@ pub async fn update_connector(
.await
.change_context(
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount {
- profile_id,
+ profile_id: profile_id.get_string_repr().to_owned(),
connector_label: request_connector_label.unwrap_or_default(),
},
)
@@ -3409,7 +3406,7 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
}
// Generate a unique profile id
- let profile_id = common_utils::generate_id_with_default_len("pro");
+ let profile_id = common_utils::generate_profile_id_of_default_length();
let profile_name = self.profile_name.unwrap_or("default".to_string());
let current_time = date_time::now();
@@ -3523,7 +3520,7 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
// Generate a unique profile id
// TODO: the profile_id should be generated from the profile_name
- let profile_id = common_utils::generate_id_with_default_len("pro");
+ let profile_id = common_utils::generate_profile_id_of_default_length();
let profile_name = self.profile_name;
let current_time = date_time::now();
@@ -3656,7 +3653,10 @@ pub async fn create_business_profile(
.insert_business_profile(key_manager_state, &key_store, business_profile)
.await
.to_duplicate_response(errors::ApiErrorResponse::GenericDuplicateError {
- message: format!("Business Profile with the profile_id {profile_id} already exists"),
+ message: format!(
+ "Business Profile with the profile_id {} already exists",
+ profile_id.get_string_repr()
+ ),
})
.attach_printable("Failed to insert Business profile because of duplication error")?;
@@ -3715,7 +3715,7 @@ pub async fn list_business_profile(
pub async fn retrieve_business_profile(
state: SessionState,
- profile_id: String,
+ profile_id: id_type::ProfileId,
merchant_id: id_type::MerchantId,
) -> RouterResponse<api_models::admin::BusinessProfileResponse> {
let db = state.store.as_ref();
@@ -3731,7 +3731,7 @@ pub async fn retrieve_business_profile(
.find_business_profile_by_profile_id(&(&state).into(), &key_store, &profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id,
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(service_api::ApplicationResponse::Json(
@@ -3743,7 +3743,7 @@ pub async fn retrieve_business_profile(
pub async fn delete_business_profile(
state: SessionState,
- profile_id: String,
+ profile_id: id_type::ProfileId,
merchant_id: &id_type::MerchantId,
) -> RouterResponse<bool> {
let db = state.store.as_ref();
@@ -3751,7 +3751,7 @@ pub async fn delete_business_profile(
.delete_business_profile_by_profile_id_merchant_id(&profile_id, merchant_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id,
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(service_api::ApplicationResponse::Json(delete_result))
@@ -3977,7 +3977,7 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
#[cfg(feature = "olap")]
pub async fn update_business_profile(
state: SessionState,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
merchant_id: &id_type::MerchantId,
request: api::BusinessProfileUpdate,
) -> RouterResponse<api::BusinessProfileResponse> {
@@ -3997,12 +3997,12 @@ pub async fn update_business_profile(
.find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_owned(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
if business_profile.merchant_id != *merchant_id {
Err(errors::ApiErrorResponse::AccessForbidden {
- resource: profile_id.to_string(),
+ resource: profile_id.get_string_repr().to_owned(),
})?
}
@@ -4019,7 +4019,7 @@ pub async fn update_business_profile(
)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_owned(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(service_api::ApplicationResponse::Json(
@@ -4055,8 +4055,9 @@ impl BusinessProfileWrapper {
storage_impl::redis::cache::CacheKind::Routing(
format!(
- "routing_config_{}_{profile_id}",
- merchant_id.get_string_repr()
+ "routing_config_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr()
)
.into(),
)
@@ -4177,7 +4178,7 @@ impl BusinessProfileWrapper {
pub async fn extended_card_info_toggle(
state: SessionState,
merchant_id: &id_type::MerchantId,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
ext_card_info_choice: admin_types::ExtendedCardInfoChoice,
) -> RouterResponse<admin_types::ExtendedCardInfoChoice> {
let db = state.store.as_ref();
@@ -4197,7 +4198,7 @@ pub async fn extended_card_info_toggle(
.find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
if business_profile.is_extended_card_info_enabled.is_none()
@@ -4217,7 +4218,7 @@ pub async fn extended_card_info_toggle(
)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_owned(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
}
@@ -4227,7 +4228,7 @@ pub async fn extended_card_info_toggle(
pub async fn connector_agnostic_mit_toggle(
state: SessionState,
merchant_id: &id_type::MerchantId,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
connector_agnostic_mit_choice: admin_types::ConnectorAgnosticMitChoice,
) -> RouterResponse<admin_types::ConnectorAgnosticMitChoice> {
let db = state.store.as_ref();
@@ -4247,12 +4248,12 @@ pub async fn connector_agnostic_mit_toggle(
.find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
if business_profile.merchant_id != *merchant_id {
Err(errors::ApiErrorResponse::AccessForbidden {
- resource: profile_id.to_string(),
+ resource: profile_id.get_string_repr().to_owned(),
})?
}
@@ -4271,7 +4272,7 @@ pub async fn connector_agnostic_mit_toggle(
)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_owned(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
}
diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs
index 87235582c09..58862d18906 100644
--- a/crates/router/src/core/authentication/utils.rs
+++ b/crates/router/src/core/authentication/utils.rs
@@ -178,7 +178,7 @@ pub async fn create_new_authentication(
merchant_id: common_utils::id_type::MerchantId,
authentication_connector: String,
token: String,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
payment_id: Option<String>,
merchant_connector_id: String,
) -> RouterResult<storage::Authentication> {
@@ -285,7 +285,7 @@ pub async fn get_authentication_connector_data(
.ok_or(errors::ApiErrorResponse::UnprocessableEntity {
message: format!(
"No authentication_connector found for profile_id {}",
- business_profile.profile_id
+ business_profile.profile_id.get_string_repr()
),
})
.attach_printable(
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 71e982031e0..1044ca78224 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -433,7 +433,7 @@ impl<'a> MerchantReferenceIdForCustomer<'a> {
pub async fn retrieve_customer(
state: SessionState,
merchant_account: domain::MerchantAccount,
- _profile_id: Option<String>,
+ _profile_id: Option<id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
req: customers::CustomerId,
) -> errors::CustomerResponse<customers::CustomerResponse> {
@@ -494,7 +494,7 @@ pub async fn retrieve_customer(
pub async fn list_customers(
state: SessionState,
merchant_id: id_type::MerchantId,
- _profile_id_list: Option<Vec<String>>,
+ _profile_id_list: Option<Vec<id_type::ProfileId>>,
key_store: domain::MerchantKeyStore,
) -> errors::CustomerResponse<Vec<customers::CustomerResponse>> {
let db = state.store.as_ref();
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index 73215959305..24c6c0f8be8 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -26,7 +26,7 @@ use crate::{
pub async fn retrieve_dispute(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
req: disputes::DisputeId,
) -> RouterResponse<api_models::disputes::DisputeResponse> {
let dispute = state
@@ -45,7 +45,7 @@ pub async fn retrieve_dispute(
pub async fn retrieve_disputes_list(
state: SessionState,
merchant_account: domain::MerchantAccount,
- _profile_id_list: Option<Vec<String>>,
+ _profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
constraints: api_models::disputes::DisputeListConstraints,
) -> RouterResponse<Vec<api_models::disputes::DisputeResponse>> {
let disputes = state
@@ -65,7 +65,7 @@ pub async fn retrieve_disputes_list(
pub async fn accept_dispute(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
req: disputes::DisputeId,
) -> RouterResponse<dispute_models::DisputeResponse> {
@@ -169,7 +169,7 @@ pub async fn accept_dispute(
pub async fn submit_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
req: dispute_models::SubmitEvidenceRequest,
) -> RouterResponse<dispute_models::DisputeResponse> {
@@ -336,7 +336,7 @@ pub async fn submit_evidence(
pub async fn attach_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
attach_evidence_request: api::AttachEvidenceRequest,
) -> RouterResponse<files_api_models::CreateFileResponse> {
@@ -415,7 +415,7 @@ pub async fn attach_evidence(
pub async fn retrieve_dispute_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
req: disputes::DisputeId,
) -> RouterResponse<Vec<api_models::disputes::DisputeEvidenceBlock>> {
let dispute = state
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index b479d131564..14e404e88a0 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -245,7 +245,7 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
(
String,
api_models::enums::FileUploadProvider,
- Option<String>,
+ Option<common_utils::id_type::ProfileId>,
Option<String>,
),
errors::ApiErrorResponse,
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index a5d78377a8f..d185e3545b4 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -128,7 +128,7 @@ pub async fn should_call_frm<F: Send + Clone>(
) -> RouterResult<(
bool,
Option<FrmRoutingAlgorithm>,
- Option<String>,
+ Option<common_utils::id_type::ProfileId>,
Option<FrmConfigsObject>,
)> {
// Frm routing algorithm is not present in the merchant account
@@ -145,7 +145,7 @@ pub async fn should_call_frm<F: Send + Clone>(
) -> RouterResult<(
bool,
Option<FrmRoutingAlgorithm>,
- Option<String>,
+ Option<common_utils::id_type::ProfileId>,
Option<FrmConfigsObject>,
)> {
use common_utils::ext_traits::OptionExt;
@@ -327,7 +327,7 @@ pub async fn should_call_frm<F: Send + Clone>(
Ok((
is_frm_enabled,
Some(frm_routing_algorithm_struct),
- Some(profile_id.to_string()),
+ Some(profile_id),
Some(frm_configs_object),
))
}
@@ -354,7 +354,7 @@ pub async fn make_frm_data_and_fraud_check_operation<'a, F>(
merchant_account: &domain::MerchantAccount,
payment_data: payments::PaymentData<F>,
frm_routing_algorithm: FrmRoutingAlgorithm,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
frm_configs: FrmConfigsObject,
_customer: &Option<domain::Customer>,
) -> RouterResult<FrmInfo<F>>
diff --git a/crates/router/src/core/fraud_check/types.rs b/crates/router/src/core/fraud_check/types.rs
index d35e3227e6d..7f9d21216bc 100644
--- a/crates/router/src/core/fraud_check/types.rs
+++ b/crates/router/src/core/fraud_check/types.rs
@@ -69,7 +69,7 @@ pub struct FrmInfo<F> {
#[derive(Clone, Debug)]
pub struct ConnectorDetailsCore {
pub connector_name: String,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
}
#[derive(Clone)]
pub struct PaymentToFrmData {
diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs
index 9899d85fc73..e5fa762aeb0 100644
--- a/crates/router/src/core/mandate/helpers.rs
+++ b/crates/router/src/core/mandate/helpers.rs
@@ -16,7 +16,7 @@ pub async fn get_profile_id_for_mandate(
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
mandate: Mandate,
-) -> CustomResult<String, errors::ApiErrorResponse> {
+) -> CustomResult<common_utils::id_type::ProfileId, errors::ApiErrorResponse> {
let profile_id = if let Some(ref payment_id) = mandate.original_payment_id {
let pi = state
.store
@@ -35,6 +35,7 @@ pub async fn get_profile_id_for_mandate(
.ok_or(errors::ApiErrorResponse::BusinessProfileNotFound {
id: pi
.profile_id
+ .map(|profile_id| profile_id.get_string_repr().to_owned())
.unwrap_or_else(|| "Profile id is Null".to_string()),
})?;
Ok(profile_id)
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index e7f21ae0fdb..bb39bede2d6 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -129,7 +129,7 @@ pub async fn form_payment_link_data(
.find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let return_url = if let Some(payment_create_return_url) = payment_intent.return_url.clone() {
@@ -754,7 +754,7 @@ pub async fn get_payment_link_status(
.find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let return_url = if let Some(payment_create_return_url) = payment_intent.return_url.clone() {
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 274ef3c0966..586e93a0fe6 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2734,7 +2734,7 @@ pub async fn list_payment_methods(
format!(
"pm_filters_cgraph_{}_{}",
merchant_account.get_id().get_string_repr(),
- profile_id
+ profile_id.get_string_repr()
)
};
@@ -4909,7 +4909,7 @@ async fn generate_saved_pm_response(
pub async fn get_mca_status(
state: &routes::SessionState,
key_store: &domain::MerchantKeyStore,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
merchant_id: &id_type::MerchantId,
is_connector_agnostic_mit_enabled: bool,
connector_mandate_details: Option<storage::PaymentsMandateReference>,
@@ -5789,7 +5789,7 @@ where
pub async fn list_countries_currencies_for_connector_payment_method(
state: routes::SessionState,
req: ListCountriesCurrenciesRequest,
- _profile_id: Option<String>,
+ _profile_id: Option<id_type::ProfileId>,
) -> errors::RouterResponse<ListCountriesCurrenciesResponse> {
Ok(services::ApplicationResponse::Json(
list_countries_currencies_for_connector_payment_method_util(
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 6938d3c407b..72a188a47ec 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -106,7 +106,7 @@ pub async fn payments_operation_core<F, Req, Op, FData>(
state: &SessionState,
req_state: ReqState,
merchant_account: domain::MerchantAccount,
- profile_id_from_auth_layer: Option<String>,
+ profile_id_from_auth_layer: Option<id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
operation: Op,
req: Req,
@@ -828,7 +828,7 @@ pub async fn payments_core<F, Res, Req, Op, FData>(
state: SessionState,
req_state: ReqState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
operation: Op,
req: Req,
@@ -1067,7 +1067,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
.find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(router_types::RedirectPaymentFlowResponse {
payments_response,
@@ -1201,7 +1201,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
.find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(router_types::RedirectPaymentFlowResponse {
payments_response,
@@ -1432,7 +1432,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok(router_types::AuthenticatePaymentFlowResponse {
payments_response,
@@ -2019,10 +2019,9 @@ where
.as_ref()
.get_required_value("profile_id")
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("profile_id is not set in payment_intent")?
- .clone();
+ .attach_printable("profile_id is not set in payment_intent")?;
- format!("{connector_name}_{profile_id}")
+ format!("{connector_name}_{}", profile_id.get_string_repr())
};
let (should_call_connector, existing_connector_customer_id) =
@@ -2912,7 +2911,7 @@ pub fn is_operation_complete_authorize<Op: Debug>(operation: &Op) -> bool {
pub async fn list_payments(
state: SessionState,
merchant: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<id_type::ProfileId>>,
key_store: domain::MerchantKeyStore,
constraints: api::PaymentListConstraints,
) -> RouterResponse<api::PaymentListResponse> {
@@ -2987,7 +2986,7 @@ pub async fn list_payments(
pub async fn apply_filters_on_payments(
state: SessionState,
merchant: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<id_type::ProfileId>>,
merchant_key_store: domain::MerchantKeyStore,
constraints: api::PaymentListFilterConstraints,
) -> RouterResponse<api::PaymentListResponseV2> {
@@ -3085,7 +3084,7 @@ pub async fn get_filters_for_payments(
pub async fn get_payment_filters(
state: SessionState,
merchant: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<id_type::ProfileId>>,
) -> RouterResponse<api::PaymentListFiltersV2> {
let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
super::admin::list_payment_connectors(state, merchant.get_id().to_owned(), profile_id_list)
@@ -4329,7 +4328,7 @@ pub async fn payment_external_authentication(
.find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id)
.await
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let authentication_details = business_profile
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 068a66a248f..98d680197b9 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -136,7 +136,7 @@ pub fn create_certificate(
pub fn filter_mca_based_on_profile_and_connector_type(
merchant_connector_accounts: Vec<domain::MerchantConnectorAccount>,
- profile_id: &String,
+ profile_id: &id_type::ProfileId,
connector_type: ConnectorType,
) -> Vec<domain::MerchantConnectorAccount> {
merchant_connector_accounts
@@ -3272,7 +3272,7 @@ pub async fn get_merchant_connector_account(
merchant_id: &id_type::MerchantId,
creds_identifier: Option<String>,
key_store: &domain::MerchantKeyStore,
- profile_id: &String,
+ profile_id: &id_type::ProfileId,
connector_name: &str,
merchant_connector_id: Option<&String>,
) -> RouterResult<MerchantConnectorAccountType> {
@@ -3397,7 +3397,8 @@ pub async fn get_merchant_connector_account(
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: format!(
- "profile id {profile_id} and connector name {connector_name}"
+ "profile id {} and connector name {connector_name}",
+ profile_id.get_string_repr()
),
},
)
@@ -3838,7 +3839,7 @@ mod test {
pub async fn get_additional_payment_data(
pm_data: &domain::PaymentMethodData,
db: &dyn StorageInterface,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
) -> Option<api_models::payments::AdditionalPaymentData> {
match pm_data {
domain::PaymentMethodData::Card(card_data) => {
@@ -3846,7 +3847,7 @@ pub async fn get_additional_payment_data(
let card_isin = Some(card_data.card_number.get_card_isin());
let enable_extended_bin =db
.find_config_by_key_unwrap_or(
- format!("{}_enable_extended_card_bin", profile_id).as_str(),
+ format!("{}_enable_extended_card_bin", profile_id.get_string_repr()).as_str(),
Some("false".to_string()))
.await.map_err(|err| services::logger::error!(message="Failed to fetch the config", extended_card_bin_error=?err)).ok();
@@ -4347,7 +4348,7 @@ where
))]
let fallback_connetors_list = crate::core::routing::helpers::get_merchant_default_config(
&*state.clone().store,
- profile_id,
+ profile_id.get_string_repr(),
&api_enums::TransactionType::Payment,
)
.await
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 401e1c2c7a1..7034cfab2f7 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -81,7 +81,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRequest>
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let attempt_id = payment_intent.active_attempt.get_id().clone();
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 84eaf97bfaa..4a26e533443 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -150,7 +150,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = PaymentData {
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 0d096e1d3ae..de7ee996195 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -196,7 +196,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = payments::PaymentData {
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 8d4e6f7a5f2..c7a2686724f 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -290,7 +290,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = PaymentData {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 2e7131edce2..273773a80bb 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -164,7 +164,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.map(|business_profile_result| {
business_profile_result.to_not_found_response(
errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
},
)
})
@@ -476,7 +476,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
helpers::get_additional_payment_data(
&payment_method_data.into(),
store.as_ref(),
- profile_id.as_ref(),
+ &profile_id,
)
.await
})
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 2b80598adfb..a455f1d4c59 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -140,7 +140,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.await
.to_not_found_response(
errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
},
)?
};
@@ -883,7 +883,7 @@ impl PaymentCreate {
payment_method_billing_address_id: Option<String>,
payment_method_info: &Option<PaymentMethod>,
key_store: &domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
customer_acceptance: &Option<payments::CustomerAcceptance>,
) -> RouterResult<(
storage::PaymentAttemptNew,
@@ -1083,7 +1083,7 @@ impl PaymentCreate {
payment_link_data: Option<api_models::payments::PaymentLinkResponse>,
billing_address_id: Option<String>,
active_attempt_id: String,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
session_expiry: PrimitiveDateTime,
) -> RouterResult<storage::PaymentIntent> {
let created_at @ modified_at @ last_synced = common_utils::date_time::now();
@@ -1293,7 +1293,7 @@ async fn create_payment_link(
db: &dyn StorageInterface,
amount: api::Amount,
description: Option<String>,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
domain_name: String,
session_expiry: PrimitiveDateTime,
locale: Option<String>,
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index a5d0b95a672..b148d5bbccc 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -134,7 +134,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsCancelRequest> for P
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = PaymentData {
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index af5f234e2ce..6b101b6bd1b 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -159,7 +159,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = PaymentData {
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index ae9397aa8ec..9a29b36b55a 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -144,7 +144,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = PaymentData {
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 587bdc8ef00..f2453e52c86 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -376,7 +376,7 @@ async fn get_tracker_for_sync<
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_method_info =
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index e7045116f23..32d7b32059b 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -419,7 +419,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let surcharge_details = request.surcharge_details.map(|request_surcharge_details| {
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 31883042eca..e3e3bf4260e 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -112,7 +112,7 @@ impl<F: Send + Clone>
.find_business_profile_by_profile_id(key_manager_state, key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
let payment_data = payments::PaymentData {
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 30c1edb6e04..692a5924a06 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -81,7 +81,7 @@ pub struct SessionRoutingPmTypeInput<'a> {
routing_algorithm: &'a MerchantAccountRoutingAlgorithm,
backend_input: dsl_inputs::BackendInput,
allowed_connectors: FxHashMap<String, api::GetToken>,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
}
type RoutingResult<O> = oss_errors::CustomResult<O, errors::RoutingError>;
@@ -291,7 +291,7 @@ pub async fn perform_static_routing_v1<F: Clone>(
))]
let fallback_config = routing::helpers::get_merchant_default_config(
&*state.clone().store,
- &business_profile.profile_id,
+ business_profile.profile_id.get_string_repr(),
&api_enums::TransactionType::from(transaction_data),
)
.await
@@ -342,22 +342,24 @@ async fn ensure_algorithm_cached_v1(
state: &SessionState,
merchant_id: &common_utils::id_type::MerchantId,
algorithm_id: &str,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &api_enums::TransactionType,
) -> RoutingResult<Arc<CachedAlgorithm>> {
let key = {
match transaction_type {
common_enums::TransactionType::Payment => {
format!(
- "routing_config_{}_{profile_id}",
- merchant_id.get_string_repr()
+ "routing_config_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr(),
)
}
#[cfg(feature = "payouts")]
common_enums::TransactionType::Payout => {
format!(
- "routing_config_po_{}_{profile_id}",
- merchant_id.get_string_repr()
+ "routing_config_po_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr()
)
}
}
@@ -425,7 +427,7 @@ pub async fn refresh_routing_cache_v1(
state: &SessionState,
key: String,
algorithm_id: &str,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
) -> RoutingResult<Arc<CachedAlgorithm>> {
let algorithm = {
let algorithm = state
@@ -507,7 +509,7 @@ pub fn perform_volume_split(
pub async fn get_merchant_cgraph<'a>(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &api_enums::TransactionType,
) -> RoutingResult<Arc<hyperswitch_constraint_graph::ConstraintGraph<euclid_dir::DirValue>>> {
let merchant_id = &key_store.merchant_id;
@@ -515,11 +517,19 @@ pub async fn get_merchant_cgraph<'a>(
let key = {
match transaction_type {
api_enums::TransactionType::Payment => {
- format!("cgraph_{}_{}", merchant_id.get_string_repr(), profile_id)
+ format!(
+ "cgraph_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr()
+ )
}
#[cfg(feature = "payouts")]
api_enums::TransactionType::Payout => {
- format!("cgraph_po_{}_{}", merchant_id.get_string_repr(), profile_id)
+ format!(
+ "cgraph_po_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr()
+ )
}
}
};
@@ -546,7 +556,7 @@ pub async fn refresh_cgraph_cache<'a>(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
key: String,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &api_enums::TransactionType,
) -> RoutingResult<Arc<hyperswitch_constraint_graph::ConstraintGraph<euclid_dir::DirValue>>> {
let mut merchant_connector_accounts = state
@@ -645,7 +655,7 @@ async fn perform_cgraph_filtering(
chosen: Vec<routing_types::RoutableConnectorChoice>,
backend_input: dsl_inputs::BackendInput,
eligible_connectors: Option<&Vec<api_enums::RoutableConnectors>>,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &api_enums::TransactionType,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
let context = euclid_graph::AnalysisContext::from_dir_values(
@@ -689,7 +699,7 @@ pub async fn perform_eligibility_analysis<F: Clone>(
chosen: Vec<routing_types::RoutableConnectorChoice>,
transaction_data: &routing::TransactionData<'_, F>,
eligible_connectors: Option<&Vec<api_enums::RoutableConnectors>>,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
let backend_input = match transaction_data {
routing::TransactionData::Payment(payment_data) => make_dsl_input(payment_data)?,
@@ -728,9 +738,12 @@ pub async fn perform_fallback_routing<F: Clone>(
.profile_id
.as_ref()
.get_required_value("profile_id")
- .change_context(errors::RoutingError::ProfileIdMissing)?,
+ .change_context(errors::RoutingError::ProfileIdMissing)?
+ .get_string_repr(),
#[cfg(feature = "payouts")]
- routing::TransactionData::Payout(payout_data) => &payout_data.payout_attempt.profile_id,
+ routing::TransactionData::Payout(payout_data) => {
+ payout_data.payout_attempt.profile_id.get_string_repr()
+ }
},
&api_enums::TransactionType::from(transaction_data),
)
@@ -1015,7 +1028,7 @@ async fn perform_session_routing_for_pm_type(
} else {
routing::helpers::get_merchant_default_config(
&*session_pm_input.state.clone().store,
- &session_pm_input.profile_id,
+ session_pm_input.profile_id.get_string_repr(),
transaction_type,
)
.await
@@ -1036,7 +1049,7 @@ async fn perform_session_routing_for_pm_type(
if final_selection.is_empty() {
let fallback = routing::helpers::get_merchant_default_config(
&*session_pm_input.state.clone().store,
- &session_pm_input.profile_id,
+ session_pm_input.profile_id.get_string_repr(),
transaction_type,
)
.await
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index f331639be5e..ed847526a3c 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -66,7 +66,7 @@ pub struct PayoutData {
pub payouts: storage::Payouts,
pub payout_attempt: storage::PayoutAttempt,
pub payout_method_data: Option<payouts::PayoutMethodData>,
- pub profile_id: String,
+ pub profile_id: common_utils::id_type::ProfileId,
pub should_terminate: bool,
pub payout_link: Option<PayoutLink>,
}
@@ -514,7 +514,7 @@ pub async fn payouts_update_core(
pub async fn payouts_retrieve_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
req: payouts::PayoutRetrieveRequest,
) -> RouterResponse<payouts::PayoutCreateResponse> {
@@ -740,7 +740,7 @@ pub async fn payouts_fulfill_core(
pub async fn payouts_list_core(
_state: SessionState,
_merchant_account: domain::MerchantAccount,
- _profile_id_list: Option<Vec<String>>,
+ _profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
_key_store: domain::MerchantKeyStore,
_constraints: payouts::PayoutListConstraints,
) -> RouterResponse<payouts::PayoutListResponse> {
@@ -755,7 +755,7 @@ pub async fn payouts_list_core(
pub async fn payouts_list_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
key_store: domain::MerchantKeyStore,
constraints: payouts::PayoutListConstraints,
) -> RouterResponse<payouts::PayoutListResponse> {
@@ -864,7 +864,7 @@ pub async fn payouts_list_core(
pub async fn payouts_filtered_list_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
key_store: domain::MerchantKeyStore,
filters: payouts::PayoutListFilterConstraints,
) -> RouterResponse<payouts::PayoutListResponse> {
@@ -1143,7 +1143,11 @@ pub async fn create_recipient(
let connector_name = connector_data.connector_name.to_string();
// Create the connector label using {profile_id}_{connector_name}
- let connector_label = format!("{}_{}", payout_data.profile_id, connector_name);
+ let connector_label = format!(
+ "{}_{}",
+ payout_data.profile_id.get_string_repr(),
+ connector_name
+ );
let (should_call_connector, _connector_customer_id) =
helpers::should_call_payout_connector_create_customer(
state,
@@ -2217,7 +2221,7 @@ pub async fn payout_create_db_entries(
key_store: &domain::MerchantKeyStore,
req: &payouts::PayoutCreateRequest,
payout_id: &String,
- profile_id: &String,
+ profile_id: &common_utils::id_type::ProfileId,
stored_payout_method_data: Option<&payouts::PayoutMethodData>,
locale: &String,
customer: Option<&domain::Customer>,
@@ -2291,7 +2295,7 @@ pub async fn payout_create_db_entries(
let payouts_req = storage::PayoutsNew {
payout_id: payout_id.to_string(),
merchant_id: merchant_id.to_owned(),
- customer_id,
+ customer_id: customer_id.to_owned(),
address_id: address_id.to_owned(),
payout_type,
amount,
@@ -2303,7 +2307,7 @@ pub async fn payout_create_db_entries(
return_url: req.return_url.to_owned(),
entity_type: req.entity_type.unwrap_or_default(),
payout_method_id,
- profile_id: profile_id.to_string(),
+ profile_id: profile_id.to_owned(),
attempt_count: 1,
metadata: req.metadata.clone(),
confirm: req.confirm,
@@ -2313,7 +2317,8 @@ pub async fn payout_create_db_entries(
client_secret: Some(client_secret),
priority: req.priority,
status,
- ..Default::default()
+ created_at: common_utils::date_time::now(),
+ last_modified_at: common_utils::date_time::now(),
};
let payouts = db
.insert_payout(payouts_req, merchant_account.storage_scheme)
@@ -2333,8 +2338,18 @@ pub async fn payout_create_db_entries(
business_country: req.business_country.to_owned(),
business_label: req.business_label.to_owned(),
payout_token: req.payout_token.to_owned(),
- profile_id: profile_id.to_string(),
- ..Default::default()
+ profile_id: profile_id.to_owned(),
+ customer_id,
+ address_id,
+ connector: None,
+ connector_payout_id: None,
+ is_eligible: None,
+ error_message: None,
+ error_code: None,
+ created_at: common_utils::date_time::now(),
+ last_modified_at: common_utils::date_time::now(),
+ merchant_connector_id: None,
+ routing_info: None,
};
let payout_attempt = db
.insert_payout_attempt(
@@ -2371,7 +2386,7 @@ pub async fn payout_create_db_entries(
pub async fn make_payout_data(
_state: &SessionState,
_merchant_account: &domain::MerchantAccount,
- _auth_profile_id: Option<String>,
+ _auth_profile_id: Option<common_utils::id_type::ProfileId>,
_key_store: &domain::MerchantKeyStore,
_req: &payouts::PayoutRequest,
) -> RouterResult<PayoutData> {
@@ -2382,7 +2397,7 @@ pub async fn make_payout_data(
pub async fn make_payout_data(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
- auth_profile_id: Option<String>,
+ auth_profile_id: Option<common_utils::id_type::ProfileId>,
key_store: &domain::MerchantKeyStore,
req: &payouts::PayoutRequest,
) -> RouterResult<PayoutData> {
@@ -2567,7 +2582,7 @@ pub async fn add_external_account_addition_task(
async fn validate_and_get_business_profile(
state: &SessionState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: &String,
+ profile_id: &common_utils::id_type::ProfileId,
merchant_id: &common_utils::id_type::MerchantId,
) -> RouterResult<domain::BusinessProfile> {
let db = &*state.store;
@@ -2587,7 +2602,7 @@ async fn validate_and_get_business_profile(
db.find_business_profile_by_profile_id(key_manager_state, merchant_key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})
}
}
@@ -2726,7 +2741,7 @@ pub async fn create_payout_link_db_entry(
pub async fn get_mca_from_profile_id(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
- profile_id: &String,
+ profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
merchant_connector_id: Option<&String>,
key_store: &domain::MerchantKeyStore,
diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rs
index 284f81a1702..08fef69988c 100644
--- a/crates/router/src/core/payouts/retry.rs
+++ b/crates/router/src/core/payouts/retry.rs
@@ -285,8 +285,16 @@ pub async fn modify_trackers(
business_country: payout_data.payout_attempt.business_country.to_owned(),
business_label: payout_data.payout_attempt.business_label.to_owned(),
payout_token: payout_data.payout_attempt.payout_token.to_owned(),
- profile_id: payout_data.payout_attempt.profile_id.to_string(),
- ..Default::default()
+ profile_id: payout_data.payout_attempt.profile_id.to_owned(),
+ connector_payout_id: None,
+ status: common_enums::PayoutStatus::default(),
+ is_eligible: None,
+ error_message: None,
+ error_code: None,
+ created_at: common_utils::date_time::now(),
+ last_modified_at: common_utils::date_time::now(),
+ merchant_connector_id: None,
+ routing_info: None,
};
payout_data.payout_attempt = db
.insert_payout_attempt(
diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs
index d425725645b..bde753a90e0 100644
--- a/crates/router/src/core/payouts/validator.rs
+++ b/crates/router/src/core/payouts/validator.rs
@@ -56,7 +56,7 @@ pub async fn validate_create_request(
) -> RouterResult<(
String,
Option<payouts::PayoutMethodData>,
- String,
+ common_utils::id_type::ProfileId,
Option<domain::Customer>,
)> {
let merchant_id = merchant_account.get_id();
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 878ec241854..89450347404 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -47,7 +47,7 @@ use crate::{
pub async fn refund_create_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
- _profile_id: Option<String>,
+ _profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
req: refunds::RefundRequest,
) -> RouterResponse<refunds::RefundResponse> {
@@ -374,7 +374,7 @@ where
pub async fn refund_response_wrapper<'a, F, Fut, T, Req>(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
request: Req,
f: F,
@@ -383,7 +383,7 @@ where
F: Fn(
SessionState,
domain::MerchantAccount,
- Option<String>,
+ Option<common_utils::id_type::ProfileId>,
domain::MerchantKeyStore,
Req,
) -> Fut,
@@ -401,7 +401,7 @@ where
pub async fn refund_retrieve_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
request: refunds::RefundsRetrieveRequest,
) -> RouterResult<storage::Refund> {
@@ -865,7 +865,7 @@ pub async fn validate_and_create_refund(
pub async fn refund_list(
state: SessionState,
merchant_account: domain::MerchantAccount,
- _profile_id_list: Option<Vec<String>>,
+ _profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
req: api_models::refunds::RefundListRequest,
) -> RouterResponse<api_models::refunds::RefundListResponse> {
let db = state.store;
@@ -987,7 +987,7 @@ pub async fn refund_manual_update(
pub async fn get_filters_for_refunds(
state: SessionState,
merchant_account: domain::MerchantAccount,
- profile_id_list: Option<Vec<String>>,
+ profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
) -> RouterResponse<api_models::refunds::RefundListFilters> {
let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
super::admin::list_payment_connectors(
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 640b12c52c2..267a3d55ce4 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -50,7 +50,7 @@ impl RoutingAlgorithmUpdate {
pub fn create_new_routing_algorithm(
request: &routing_types::RoutingConfigRequest,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &enums::TransactionType,
) -> Self {
let algorithm_id = common_utils::generate_id(
@@ -279,7 +279,7 @@ pub async fn link_routing_config_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
algorithm_id: String,
transaction_type: &enums::TransactionType,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
@@ -377,7 +377,7 @@ pub async fn link_routing_config(
.await?
.get_required_value("BusinessProfile")
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: routing_algorithm.profile_id.clone(),
+ id: routing_algorithm.profile_id.get_string_repr().to_owned(),
})?;
let mut routing_ref: routing_types::RoutingAlgorithmRef = business_profile
@@ -506,7 +506,7 @@ pub async fn unlink_routing_config_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &enums::TransactionType,
) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
metrics::ROUTING_UNLINK_CONFIG.add(&metrics::CONTEXT, 1, &[]);
@@ -652,7 +652,7 @@ pub async fn update_default_fallback_routing(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
updated_list_of_connectors: Vec<routing_types::RoutableConnectorChoice>,
) -> RouterResponse<Vec<routing_types::RoutableConnectorChoice>> {
metrics::ROUTING_UPDATE_CONFIG.add(&metrics::CONTEXT, 1, &[]);
@@ -788,7 +788,7 @@ pub async fn retrieve_default_fallback_algorithm_for_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
) -> RouterResponse<Vec<routing_types::RoutableConnectorChoice>> {
metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG.add(&metrics::CONTEXT, 1, &[]);
let db = state.store.as_ref();
@@ -844,7 +844,7 @@ pub async fn retrieve_routing_config_under_profile(
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
query_params: RoutingRetrieveQuery,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &enums::TransactionType,
) -> RouterResponse<routing_types::LinkedRoutingConfigRetrieveResponse> {
metrics::ROUTING_RETRIEVE_LINK_CONFIG.add(&metrics::CONTEXT, 1, &[]);
@@ -908,7 +908,9 @@ pub async fn retrieve_linked_routing_config(
.await?
.map(|profile| vec![profile])
.get_required_value("BusinessProfile")
- .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id })?
+ .change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.get_string_repr().to_owned(),
+ })?
} else {
db.list_business_profile_by_merchant_id(
key_manager_state,
@@ -975,7 +977,13 @@ pub async fn retrieve_default_routing_config_for_profiles(
let retrieve_config_futures = all_profiles
.iter()
- .map(|prof| helpers::get_merchant_default_config(db, &prof.profile_id, transaction_type))
+ .map(|prof| {
+ helpers::get_merchant_default_config(
+ db,
+ prof.profile_id.get_string_repr(),
+ transaction_type,
+ )
+ })
.collect::<Vec<_>>();
let configs = futures::future::join_all(retrieve_config_futures)
@@ -1003,7 +1011,7 @@ pub async fn update_default_routing_config_for_profile(
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
updated_config: Vec<routing_types::RoutableConnectorChoice>,
- profile_id: String,
+ profile_id: common_utils::id_type::ProfileId,
transaction_type: &enums::TransactionType,
) -> RouterResponse<routing_types::ProfileDefaultRoutingConfig> {
metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE.add(&metrics::CONTEXT, 1, &[]);
@@ -1019,10 +1027,15 @@ pub async fn update_default_routing_config_for_profile(
)
.await?
.get_required_value("BusinessProfile")
- .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id })?;
- let default_config =
- helpers::get_merchant_default_config(db, &business_profile.profile_id, transaction_type)
- .await?;
+ .change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.get_string_repr().to_owned(),
+ })?;
+ let default_config = helpers::get_merchant_default_config(
+ db,
+ business_profile.profile_id.get_string_repr(),
+ transaction_type,
+ )
+ .await?;
utils::when(default_config.len() != updated_config.len(), || {
Err(errors::ApiErrorResponse::PreconditionFailed {
@@ -1061,7 +1074,7 @@ pub async fn update_default_routing_config_for_profile(
helpers::update_merchant_default_config(
db,
- &business_profile.profile_id,
+ business_profile.profile_id.get_string_repr(),
updated_config.clone(),
transaction_type,
)
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 43da2bb2bd0..5cbb1e9fdf6 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -207,8 +207,9 @@ pub async fn update_business_profile_active_algorithm_ref(
let routing_cache_key = cache::CacheKind::Routing(
format!(
- "routing_config_{}_{profile_id}",
- merchant_id.get_string_repr()
+ "routing_config_{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr(),
)
.into(),
);
@@ -300,13 +301,13 @@ impl MerchantConnectorAccounts {
pub fn filter_by_profile<'a, T>(
&'a self,
- profile_id: &'a str,
+ profile_id: &'a common_utils::id_type::ProfileId,
func: impl Fn(&'a MerchantConnectorAccount) -> T,
) -> FxHashSet<T>
where
T: std::hash::Hash + Eq,
{
- self.filter_and_map(|mca| mca.profile_id == profile_id, func)
+ self.filter_and_map(|mca| mca.profile_id == *profile_id, func)
}
}
@@ -396,7 +397,7 @@ pub async fn validate_connectors_in_routing_config(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
routing_algorithm: &routing_types::RoutingAlgorithm,
) -> RouterResult<()> {
let all_mcas = &*state
@@ -413,13 +414,13 @@ pub async fn validate_connectors_in_routing_config(
})?;
let name_mca_id_set = all_mcas
.iter()
- .filter(|mca| mca.profile_id == profile_id)
+ .filter(|mca| mca.profile_id == *profile_id)
.map(|mca| (&mca.connector_name, mca.get_id()))
.collect::<FxHashSet<_>>();
let name_set = all_mcas
.iter()
- .filter(|mca| mca.profile_id == profile_id)
+ .filter(|mca| mca.profile_id == *profile_id)
.map(|mca| &mca.connector_name)
.collect::<FxHashSet<_>>();
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 02a10252cd3..c46fac1322c 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -94,7 +94,11 @@ pub async fn construct_payout_router_data<'a, F>(
let payouts = &payout_data.payouts;
let payout_attempt = &payout_data.payout_attempt;
let customer_details = &payout_data.customer_details;
- let connector_label = format!("{}_{}", payout_data.profile_id, connector_name);
+ let connector_label = format!(
+ "{}_{}",
+ payout_data.profile_id.get_string_repr(),
+ connector_name
+ );
let connector_customer_id = customer_details
.as_ref()
.and_then(|c| c.connector_customer.as_ref())
@@ -394,6 +398,7 @@ pub fn validate_uuid(uuid: String, key: &str) -> Result<String, errors::ApiError
#[cfg(test)]
mod tests {
+ #![allow(clippy::expect_used)]
use super::*;
#[test]
@@ -425,23 +430,33 @@ mod tests {
fn test_filter_objects_based_on_profile_id_list() {
#[derive(PartialEq, Debug, Clone)]
struct Object {
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
}
impl Object {
- pub fn new(profile_id: &str) -> Self {
+ pub fn new(profile_id: &'static str) -> Self {
Self {
- profile_id: Some(profile_id.to_string()),
+ profile_id: Some(
+ common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from(
+ profile_id,
+ ))
+ .expect("invalid profile ID"),
+ ),
}
}
}
impl GetProfileId for Object {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
}
+ fn new_profile_id(profile_id: &'static str) -> common_utils::id_type::ProfileId {
+ common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from(profile_id))
+ .expect("invalid profile ID")
+ }
+
// non empty object_list and profile_id_list
let object_list = vec![
Object::new("p1"),
@@ -450,7 +465,11 @@ mod tests {
Object::new("p4"),
Object::new("p5"),
];
- let profile_id_list = vec!["p1".to_string(), "p2".to_string(), "p3".to_string()];
+ let profile_id_list = vec![
+ new_profile_id("p1"),
+ new_profile_id("p2"),
+ new_profile_id("p3"),
+ ];
let filtered_list =
filter_objects_based_on_profile_id_list(Some(profile_id_list), object_list.clone());
let expected_result = vec![Object::new("p1"), Object::new("p2"), Object::new("p2")];
@@ -1040,7 +1059,7 @@ pub async fn validate_and_get_business_profile(
db: &dyn StorageInterface,
key_manager_state: &common_utils::types::keymanager::KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: Option<&String>,
+ profile_id: Option<&common_utils::id_type::ProfileId>,
merchant_id: &common_utils::id_type::MerchantId,
) -> RouterResult<Option<domain::BusinessProfile>> {
profile_id
@@ -1052,7 +1071,7 @@ pub async fn validate_and_get_business_profile(
)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_owned(),
+ id: profile_id.get_string_repr().to_owned(),
})
})
.await
@@ -1061,7 +1080,7 @@ pub async fn validate_and_get_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 {
- resource: business_profile.profile_id,
+ resource: business_profile.profile_id.get_string_repr().to_owned(),
}
.into())
} else {
@@ -1123,10 +1142,10 @@ 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>,
+ request_profile_id: Option<&common_utils::id_type::ProfileId>,
db: &dyn StorageInterface,
should_validate: bool,
-) -> RouterResult<String> {
+) -> RouterResult<common_utils::id_type::ProfileId> {
match request_profile_id.or(merchant_account.default_profile.as_ref()) {
Some(profile_id) => {
// Check whether this business profile belongs to the merchant
@@ -1297,55 +1316,55 @@ pub fn get_incremental_authorization_allowed_value(
}
pub(super) trait GetProfileId {
- fn get_profile_id(&self) -> Option<&String>;
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId>;
}
impl GetProfileId for MerchantConnectorAccount {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
Some(&self.profile_id)
}
}
impl GetProfileId for storage::PaymentIntent {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
}
impl<A> GetProfileId for (storage::PaymentIntent, A) {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.0.get_profile_id()
}
}
impl GetProfileId for diesel_models::Dispute {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
}
impl GetProfileId for diesel_models::Refund {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
}
#[cfg(feature = "payouts")]
impl GetProfileId for storage::Payouts {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
Some(&self.profile_id)
}
}
#[cfg(feature = "payouts")]
impl<T, F> GetProfileId for (storage::Payouts, T, F) {
- fn get_profile_id(&self) -> Option<&String> {
+ fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.0.get_profile_id()
}
}
/// Filter Objects based on profile ids
pub(super) fn filter_objects_based_on_profile_id_list<T: GetProfileId>(
- profile_id_list_auth_layer: Option<Vec<String>>,
+ profile_id_list_auth_layer: Option<Vec<common_utils::id_type::ProfileId>>,
object_list: Vec<T>,
) -> Vec<T> {
if let Some(profile_id_list) = profile_id_list_auth_layer {
@@ -1369,7 +1388,7 @@ pub(super) fn filter_objects_based_on_profile_id_list<T: GetProfileId>(
}
pub(super) fn validate_profile_id_from_auth_layer<T: GetProfileId + std::fmt::Debug>(
- profile_id_auth_layer: Option<String>,
+ profile_id_auth_layer: Option<common_utils::id_type::ProfileId>,
object: &T,
) -> RouterResult<()> {
match (profile_id_auth_layer, object.get_profile_id()) {
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index 795e188c8aa..44bb67d0baf 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -12,7 +12,7 @@ pub async fn verify_merchant_creds_for_applepay(
state: SessionState,
body: verifications::ApplepayMerchantVerificationRequest,
merchant_id: common_utils::id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
) -> CustomResult<services::ApplicationResponse<ApplepayMerchantResponse>, errors::ApiErrorResponse>
{
let applepay_merchant_configs = state.conf.applepay_merchant_configs.get_inner();
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index dd0aa3edef4..4b8e0ac0748 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -15,7 +15,7 @@ use crate::{
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<String>,
+ profile_id_from_auth_layer: Option<common_utils::id_type::ProfileId>,
merchant_connector_id: String,
domain_from_req: Vec<String>,
) -> CustomResult<Vec<String>, errors::ApiErrorResponse> {
diff --git a/crates/router/src/core/verify_connector.rs b/crates/router/src/core/verify_connector.rs
index b6f03c27ab0..f7fa06dee5f 100644
--- a/crates/router/src/core/verify_connector.rs
+++ b/crates/router/src/core/verify_connector.rs
@@ -19,7 +19,7 @@ use crate::{
pub async fn verify_connector_credentials(
state: SessionState,
req: VerifyConnectorRequest,
- _profile_id: Option<String>,
+ _profile_id: Option<common_utils::id_type::ProfileId>,
) -> errors::RouterResponse<()> {
let boxed_connector = api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index d3e5873e9e9..01a1046be36 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -347,14 +347,14 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
)?,
};
- let profile_id = merchant_connector_account.profile_id.as_ref();
+ let profile_id = &merchant_connector_account.profile_id;
let business_profile = state
.store
.find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id)
.await
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
})?;
match flow_type {
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index b075b15e7f8..276d296a4cb 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -71,7 +71,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
|| webhook_url_result.as_ref().is_ok_and(String::is_empty)
{
logger::debug!(
- business_profile_id=%business_profile.profile_id,
+ business_profile_id=?business_profile.profile_id,
%idempotent_event_id,
"Outgoing webhooks are disabled in application configuration, or merchant webhook URL \
could not be obtained; skipping outgoing webhooks for event"
diff --git a/crates/router/src/core/webhooks/types.rs b/crates/router/src/core/webhooks/types.rs
index d9eed529e88..d9094bff001 100644
--- a/crates/router/src/core/webhooks/types.rs
+++ b/crates/router/src/core/webhooks/types.rs
@@ -59,7 +59,7 @@ impl OutgoingWebhookType for webhooks::OutgoingWebhook {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub(crate) struct OutgoingWebhookTrackingData {
pub(crate) merchant_id: common_utils::id_type::MerchantId,
- pub(crate) business_profile_id: String,
+ pub(crate) business_profile_id: common_utils::id_type::ProfileId,
pub(crate) event_type: enums::EventType,
pub(crate) event_class: enums::EventClass,
pub(crate) primary_object_id: String,
diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs
index cf4a8d87263..13f1e95fc2a 100644
--- a/crates/router/src/core/webhooks/webhook_events.rs
+++ b/crates/router/src/core/webhooks/webhook_events.rs
@@ -265,7 +265,7 @@ pub async fn retry_delivery_attempt(
async fn get_account_and_key_store(
state: SessionState,
merchant_id: common_utils::id_type::MerchantId,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
) -> errors::RouterResult<(MerchantAccountOrBusinessProfile, domain::MerchantKeyStore)> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -292,13 +292,13 @@ async fn get_account_and_key_store(
.await
.attach_printable_lazy(|| {
format!(
- "Failed to find business profile by merchant_id `{merchant_id:?}` and profile_id `{profile_id}`. \
- The merchant_id associated with the business profile `{profile_id}` may be \
+ "Failed to find business profile by merchant_id `{merchant_id:?}` and profile_id `{profile_id:?}`. \
+ The merchant_id associated with the business profile `{profile_id:?}` may be \
different than the merchant_id specified (`{merchant_id:?}`)."
)
})
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id,
+ id: profile_id.get_string_repr().to_owned(),
})?;
Ok((
diff --git a/crates/router/src/db/business_profile.rs b/crates/router/src/db/business_profile.rs
index ed178f275fd..8c81b0c3df1 100644
--- a/crates/router/src/db/business_profile.rs
+++ b/crates/router/src/db/business_profile.rs
@@ -33,7 +33,7 @@ where
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError>;
async fn find_business_profile_by_merchant_id_profile_id(
@@ -41,7 +41,7 @@ where
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError>;
async fn find_business_profile_by_profile_name_merchant_id(
@@ -62,7 +62,7 @@ where
async fn delete_business_profile_by_profile_id_merchant_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError>;
@@ -105,7 +105,7 @@ impl BusinessProfileInterface for Store {
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::BusinessProfile::find_by_profile_id(&conn, profile_id)
@@ -125,7 +125,7 @@ impl BusinessProfileInterface for Store {
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::BusinessProfile::find_by_merchant_id_profile_id(&conn, merchant_id, profile_id)
@@ -191,7 +191,7 @@ impl BusinessProfileInterface for Store {
#[instrument(skip_all)]
async fn delete_business_profile_by_profile_id_merchant_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -262,13 +262,13 @@ impl BusinessProfileInterface for MockDb {
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
self.business_profiles
.lock()
.await
.iter()
- .find(|business_profile| business_profile.profile_id == profile_id)
+ .find(|business_profile| business_profile.profile_id == *profile_id)
.cloned()
.async_map(|business_profile| async {
business_profile
@@ -284,7 +284,7 @@ impl BusinessProfileInterface for MockDb {
.transpose()?
.ok_or(
errors::StorageError::ValueNotFound(format!(
- "No business profile found for profile_id = {profile_id}"
+ "No business profile found for profile_id = {profile_id:?}"
))
.into(),
)
@@ -295,7 +295,7 @@ impl BusinessProfileInterface for MockDb {
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
merchant_id: &common_utils::id_type::MerchantId,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
self.business_profiles
.lock()
@@ -303,7 +303,7 @@ impl BusinessProfileInterface for MockDb {
.iter()
.find(|business_profile| {
business_profile.merchant_id == *merchant_id
- && business_profile.profile_id == profile_id
+ && business_profile.profile_id == *profile_id
})
.cloned()
.async_map(|business_profile| async {
@@ -320,7 +320,7 @@ impl BusinessProfileInterface for MockDb {
.transpose()?
.ok_or(
errors::StorageError::ValueNotFound(format!(
- "No business profile found for merchant_id = {merchant_id:?} and profile_id = {profile_id}"
+ "No business profile found for merchant_id = {merchant_id:?} and profile_id = {profile_id:?}"
))
.into(),
)
@@ -362,7 +362,7 @@ impl BusinessProfileInterface for MockDb {
.transpose()?
.ok_or(
errors::StorageError::ValueNotFound(format!(
- "No business profile found for profile_id = {profile_id}"
+ "No business profile found for profile_id = {profile_id:?}"
))
.into(),
)
@@ -370,18 +370,18 @@ impl BusinessProfileInterface for MockDb {
async fn delete_business_profile_by_profile_id_merchant_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
let mut business_profiles = self.business_profiles.lock().await;
let index = business_profiles
.iter()
.position(|business_profile| {
- business_profile.profile_id == profile_id
+ business_profile.profile_id == *profile_id
&& business_profile.merchant_id == *merchant_id
})
.ok_or::<errors::StorageError>(errors::StorageError::ValueNotFound(format!(
- "No business profile found for profile_id = {profile_id} and merchant_id = {merchant_id:?}"
+ "No business profile found for profile_id = {profile_id:?} and merchant_id = {merchant_id:?}"
)))?;
business_profiles.remove(index);
Ok(true)
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index edd1eecff95..6aae49f1bde 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -67,7 +67,7 @@ where
async fn list_initial_events_by_profile_id_primary_object_id(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Event>, errors::StorageError>;
@@ -76,7 +76,7 @@ where
async fn list_initial_events_by_profile_id_constraints(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
created_after: Option<time::PrimitiveDateTime>,
created_before: Option<time::PrimitiveDateTime>,
limit: Option<i64>,
@@ -256,7 +256,7 @@ impl EventInterface for Store {
async fn list_initial_events_by_profile_id_primary_object_id(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
@@ -291,7 +291,7 @@ impl EventInterface for Store {
async fn list_initial_events_by_profile_id_constraints(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
created_after: Option<time::PrimitiveDateTime>,
created_before: Option<time::PrimitiveDateTime>,
limit: Option<i64>,
@@ -554,7 +554,7 @@ impl EventInterface for MockDb {
async fn list_initial_events_by_profile_id_primary_object_id(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
@@ -589,7 +589,7 @@ impl EventInterface for MockDb {
async fn list_initial_events_by_profile_id_constraints(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
created_after: Option<time::PrimitiveDateTime>,
created_before: Option<time::PrimitiveDateTime>,
limit: Option<i64>,
@@ -737,7 +737,8 @@ mod tests {
let merchant_id =
common_utils::id_type::MerchantId::try_from(std::borrow::Cow::from("merchant_1"))
.unwrap();
- let business_profile_id = "profile1";
+ let business_profile_id =
+ common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from("profile1")).unwrap();
let payment_id = "test_payment_id";
let key_manager_state = &state.into();
let master_key = mockdb.get_master_key();
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index c02304c7b4e..37613d5961e 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -714,7 +714,7 @@ impl EventInterface for KafkaStore {
async fn list_initial_events_by_profile_id_primary_object_id(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
primary_object_id: &str,
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Event>, errors::StorageError> {
@@ -731,7 +731,7 @@ impl EventInterface for KafkaStore {
async fn list_initial_events_by_profile_id_constraints(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
created_after: Option<PrimitiveDateTime>,
created_before: Option<PrimitiveDateTime>,
limit: Option<i64>,
@@ -1129,7 +1129,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
connector_name: &str,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
@@ -2373,7 +2373,7 @@ impl BusinessProfileInterface for KafkaStore {
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
self.diesel_store
.find_business_profile_by_profile_id(key_manager_state, merchant_key_store, profile_id)
@@ -2385,7 +2385,7 @@ impl BusinessProfileInterface for KafkaStore {
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
merchant_id: &id_type::MerchantId,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
) -> CustomResult<domain::BusinessProfile, errors::StorageError> {
self.diesel_store
.find_business_profile_by_merchant_id_profile_id(
@@ -2416,7 +2416,7 @@ impl BusinessProfileInterface for KafkaStore {
async fn delete_business_profile_by_profile_id_merchant_id(
&self,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
merchant_id: &id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store
@@ -2493,7 +2493,7 @@ impl RoutingAlgorithmInterface for KafkaStore {
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
algorithm_id: &str,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
@@ -2514,7 +2514,7 @@ impl RoutingAlgorithmInterface for KafkaStore {
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &str,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
) -> CustomResult<storage::RoutingProfileMetadata, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_metadata_by_algorithm_id_profile_id(algorithm_id, profile_id)
@@ -2523,7 +2523,7 @@ impl RoutingAlgorithmInterface for KafkaStore {
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
- profile_id: &str,
+ profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
@@ -2807,7 +2807,7 @@ impl UserRoleInterface for KafkaStore {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
@@ -2826,7 +2826,7 @@ impl UserRoleInterface for KafkaStore {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
update: user_storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
@@ -2847,7 +2847,7 @@ impl UserRoleInterface for KafkaStore {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
@@ -2876,7 +2876,7 @@ impl UserRoleInterface for KafkaStore {
user_id: &str,
org_id: Option<&id_type::OrganizationId>,
merchant_id: Option<&id_type::MerchantId>,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
entity_id: Option<&String>,
version: Option<enums::UserRoleVersion>,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index 5a828ebb0cd..8aa013ab08f 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -589,7 +589,7 @@ async fn publish_and_redact_merchant_account_cache(
format!(
"cgraph_{}_{}",
merchant_account.get_id().get_string_repr(),
- profile_id,
+ profile_id.get_string_repr(),
)
.into(),
)
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index f039728de46..1908e01e94f 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -141,7 +141,7 @@ where
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
@@ -290,7 +290,7 @@ impl MerchantConnectorAccountInterface for Store {
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
@@ -322,7 +322,7 @@ impl MerchantConnectorAccountInterface for Store {
{
cache::get_or_populate_in_memory(
self,
- &format!("{}_{}", profile_id, connector_name),
+ &format!("{}_{}", profile_id.get_string_repr(), connector_name),
find_call,
&cache::ACCOUNTS_CACHE,
)
@@ -587,7 +587,7 @@ impl MerchantConnectorAccountInterface for Store {
self,
[
cache::CacheKind::Accounts(
- format!("{}_{}", _profile_id, _connector_name).into(),
+ format!("{}_{}", _profile_id.get_string_repr(), _connector_name).into(),
),
cache::CacheKind::Accounts(
format!(
@@ -598,8 +598,12 @@ impl MerchantConnectorAccountInterface for Store {
.into(),
),
cache::CacheKind::CGraph(
- format!("cgraph_{}_{_profile_id}", _merchant_id.get_string_repr())
- .into(),
+ format!(
+ "cgraph_{}_{}",
+ _merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
],
|| update,
@@ -683,7 +687,7 @@ impl MerchantConnectorAccountInterface for Store {
self,
[
cache::CacheKind::Accounts(
- format!("{}_{}", _profile_id, _connector_name).into(),
+ format!("{}_{}", _profile_id.get_string_repr(), _connector_name).into(),
),
cache::CacheKind::Accounts(
format!(
@@ -694,12 +698,18 @@ impl MerchantConnectorAccountInterface for Store {
.into(),
),
cache::CacheKind::CGraph(
- format!("cgraph_{}_{_profile_id}", _merchant_id.get_string_repr()).into(),
+ format!(
+ "cgraph_{}_{}",
+ _merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::PmFiltersCGraph(
format!(
- "pm_filters_cgraph_{}_{_profile_id}",
- _merchant_id.get_string_repr()
+ "pm_filters_cgraph_{}_{}",
+ _merchant_id.get_string_repr(),
+ _profile_id.get_string_repr(),
)
.into(),
),
@@ -759,7 +769,7 @@ impl MerchantConnectorAccountInterface for Store {
self,
[
cache::CacheKind::Accounts(
- format!("{}_{}", _profile_id, _connector_name).into(),
+ format!("{}_{}", _profile_id.get_string_repr(), _connector_name).into(),
),
cache::CacheKind::Accounts(
format!(
@@ -770,12 +780,18 @@ impl MerchantConnectorAccountInterface for Store {
.into(),
),
cache::CacheKind::CGraph(
- format!("cgraph_{}_{_profile_id}", _merchant_id.get_string_repr()).into(),
+ format!(
+ "cgraph_{}_{}",
+ _merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::PmFiltersCGraph(
format!(
- "pm_filters_cgraph_{}_{_profile_id}",
- _merchant_id.get_string_repr()
+ "pm_filters_cgraph_{}_{}",
+ _merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
)
.into(),
),
@@ -835,16 +851,26 @@ impl MerchantConnectorAccountInterface for Store {
self,
[
cache::CacheKind::Accounts(
- format!("{}_{}", mca.merchant_id.get_string_repr(), _profile_id).into(),
+ format!(
+ "{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::CGraph(
- format!("cgraph_{}_{_profile_id}", mca.merchant_id.get_string_repr())
- .into(),
+ format!(
+ "cgraph_{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::PmFiltersCGraph(
format!(
- "pm_filters_cgraph_{}_{_profile_id}",
- mca.merchant_id.get_string_repr()
+ "pm_filters_cgraph_{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
)
.into(),
),
@@ -890,16 +916,26 @@ impl MerchantConnectorAccountInterface for Store {
self,
[
cache::CacheKind::Accounts(
- format!("{}_{}", mca.merchant_id.get_string_repr(), _profile_id).into(),
+ format!(
+ "{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::CGraph(
- format!("cgraph_{}_{_profile_id}", mca.merchant_id.get_string_repr())
- .into(),
+ format!(
+ "cgraph_{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
+ )
+ .into(),
),
cache::CacheKind::PmFiltersCGraph(
format!(
- "pm_filters_cgraph_{}_{_profile_id}",
- mca.merchant_id.get_string_repr()
+ "pm_filters_cgraph_{}_{}",
+ mca.merchant_id.get_string_repr(),
+ _profile_id.get_string_repr()
)
.into(),
),
@@ -1016,7 +1052,7 @@ impl MerchantConnectorAccountInterface for MockDb {
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
@@ -1475,7 +1511,9 @@ mod merchant_connector_account_cache_tests {
let connector_label = "stripe_USA";
let merchant_connector_id = "simple_merchant_connector_id";
- let profile_id = "pro_max_ultra";
+ let profile_id =
+ common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from("pro_max_ultra"))
+ .unwrap();
let key_manager_state = &state.into();
db.insert_merchant_key_store(
key_manager_state,
@@ -1536,7 +1574,7 @@ mod merchant_connector_account_cache_tests {
created_at: date_time::now(),
modified_at: date_time::now(),
connector_webhook_details: None,
- profile_id: profile_id.to_string(),
+ profile_id: profile_id.to_owned(),
applepay_verified_domains: None,
pm_auth_config: None,
status: common_enums::ConnectorStatus::Inactive,
@@ -1564,7 +1602,7 @@ mod merchant_connector_account_cache_tests {
Conversion::convert(
db.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
- profile_id,
+ &profile_id,
&mca.connector_name,
&merchant_key,
)
@@ -1576,7 +1614,11 @@ mod merchant_connector_account_cache_tests {
};
let _: storage::MerchantConnectorAccount = cache::get_or_populate_in_memory(
&db,
- &format!("{}_{}", merchant_id.get_string_repr(), profile_id),
+ &format!(
+ "{}_{}",
+ merchant_id.get_string_repr(),
+ profile_id.get_string_repr(),
+ ),
find_call,
&ACCOUNTS_CACHE,
)
@@ -1644,7 +1686,9 @@ mod merchant_connector_account_cache_tests {
.unwrap();
let connector_label = "stripe_USA";
let id = "simple_id";
- let profile_id = "pro_max_ultra";
+ let profile_id =
+ common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from("pro_max_ultra"))
+ .unwrap();
let key_manager_state = &state.into();
db.insert_merchant_key_store(
key_manager_state,
@@ -1701,7 +1745,7 @@ mod merchant_connector_account_cache_tests {
created_at: date_time::now(),
modified_at: date_time::now(),
connector_webhook_details: None,
- profile_id: profile_id.to_string(),
+ profile_id: profile_id.to_owned(),
applepay_verified_domains: None,
pm_auth_config: None,
status: common_enums::ConnectorStatus::Inactive,
@@ -1748,7 +1792,11 @@ mod merchant_connector_account_cache_tests {
let _: storage::MerchantConnectorAccount = cache::get_or_populate_in_memory(
&db,
- &format!("{}_{}", merchant_id.clone().get_string_repr(), profile_id),
+ &format!(
+ "{}_{}",
+ merchant_id.clone().get_string_repr(),
+ profile_id.get_string_repr()
+ ),
find_call,
&ACCOUNTS_CACHE,
)
diff --git a/crates/router/src/db/routing_algorithm.rs b/crates/router/src/db/routing_algorithm.rs
index ad4b3bd9192..5672777bfa2 100644
--- a/crates/router/src/db/routing_algorithm.rs
+++ b/crates/router/src/db/routing_algorithm.rs
@@ -20,7 +20,7 @@ pub trait RoutingAlgorithmInterface {
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
algorithm_id: &str,
) -> StorageResult<routing_storage::RoutingAlgorithm>;
@@ -33,12 +33,12 @@ pub trait RoutingAlgorithmInterface {
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &str,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<routing_storage::RoutingProfileMetadata>;
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
limit: i64,
offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>>;
@@ -76,7 +76,7 @@ impl RoutingAlgorithmInterface for Store {
#[instrument(skip_all)]
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
algorithm_id: &str,
) -> StorageResult<routing_storage::RoutingAlgorithm> {
let conn = connection::pg_connection_write(self).await?;
@@ -109,7 +109,7 @@ impl RoutingAlgorithmInterface for Store {
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &str,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<routing_storage::RoutingProfileMetadata> {
let conn = connection::pg_connection_write(self).await?;
routing_storage::RoutingAlgorithm::find_metadata_by_algorithm_id_profile_id(
@@ -124,7 +124,7 @@ impl RoutingAlgorithmInterface for Store {
#[instrument(skip_all)]
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
- profile_id: &str,
+ profile_id: &common_utils::id_type::ProfileId,
limit: i64,
offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>> {
@@ -185,7 +185,7 @@ impl RoutingAlgorithmInterface for MockDb {
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
- _profile_id: &str,
+ _profile_id: &common_utils::id_type::ProfileId,
_algorithm_id: &str,
) -> StorageResult<routing_storage::RoutingAlgorithm> {
Err(errors::StorageError::MockDbError)?
@@ -202,14 +202,14 @@ impl RoutingAlgorithmInterface for MockDb {
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
_algorithm_id: &str,
- _profile_id: &str,
+ _profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<routing_storage::RoutingProfileMetadata> {
Err(errors::StorageError::MockDbError)?
}
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
- _profile_id: &str,
+ _profile_id: &common_utils::id_type::ProfileId,
_limit: i64,
_offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>> {
diff --git a/crates/router/src/db/user_role.rs b/crates/router/src/db/user_role.rs
index f028437b346..524eaaaab79 100644
--- a/crates/router/src/db/user_role.rs
+++ b/crates/router/src/db/user_role.rs
@@ -47,7 +47,7 @@ pub trait UserRoleInterface {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError>;
@@ -56,7 +56,7 @@ pub trait UserRoleInterface {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
update: storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError>;
@@ -66,7 +66,7 @@ pub trait UserRoleInterface {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError>;
@@ -75,7 +75,7 @@ pub trait UserRoleInterface {
user_id: &str,
org_id: Option<&id_type::OrganizationId>,
merchant_id: Option<&id_type::MerchantId>,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
entity_id: Option<&String>,
version: Option<enums::UserRoleVersion>,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError>;
@@ -155,7 +155,7 @@ impl UserRoleInterface for Store {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -177,7 +177,7 @@ impl UserRoleInterface for Store {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
update: storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
@@ -201,7 +201,7 @@ impl UserRoleInterface for Store {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -222,7 +222,7 @@ impl UserRoleInterface for Store {
user_id: &str,
org_id: Option<&id_type::OrganizationId>,
merchant_id: Option<&id_type::MerchantId>,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
entity_id: Option<&String>,
version: Option<enums::UserRoleVersion>,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
@@ -377,7 +377,7 @@ impl UserRoleInterface for MockDb {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
let user_roles = self.user_roles.lock().await;
@@ -416,7 +416,7 @@ impl UserRoleInterface for MockDb {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
update: storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
@@ -470,7 +470,7 @@ impl UserRoleInterface for MockDb {
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
let mut user_roles = self.user_roles.lock().await;
@@ -510,7 +510,7 @@ impl UserRoleInterface for MockDb {
user_id: &str,
org_id: Option<&id_type::OrganizationId>,
merchant_id: Option<&id_type::MerchantId>,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
entity_id: Option<&String>,
version: Option<enums::UserRoleVersion>,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 80ee0494847..343246e31a0 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -946,7 +946,10 @@ pub async fn business_profile_create(
pub async fn business_profile_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::ProfileId,
+ )>,
) -> HttpResponse {
let flow = Flow::BusinessProfileRetrieve;
let (merchant_id, profile_id) = path.into_inner();
@@ -975,7 +978,7 @@ pub async fn business_profile_retrieve(
pub async fn business_profile_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
) -> HttpResponse {
let flow = Flow::BusinessProfileRetrieve;
let profile_id = path.into_inner();
@@ -1015,7 +1018,10 @@ pub async fn business_profile_retrieve(
pub async fn business_profile_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::ProfileId,
+ )>,
json_payload: web::Json<api_models::admin::BusinessProfileUpdate>,
) -> HttpResponse {
let flow = Flow::BusinessProfileUpdate;
@@ -1045,7 +1051,7 @@ pub async fn business_profile_update(
pub async fn business_profile_update(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
json_payload: web::Json<api_models::admin::BusinessProfileUpdate>,
) -> HttpResponse {
let flow = Flow::BusinessProfileUpdate;
@@ -1081,7 +1087,10 @@ pub async fn business_profile_update(
pub async fn business_profile_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::ProfileId,
+ )>,
) -> HttpResponse {
let flow = Flow::BusinessProfileDelete;
let (merchant_id, profile_id) = path.into_inner();
@@ -1129,7 +1138,10 @@ pub async fn business_profiles_list(
pub async fn toggle_connector_agnostic_mit(
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::ProfileId,
+ )>,
json_payload: web::Json<api_models::admin::ConnectorAgnosticMitChoice>,
) -> HttpResponse {
let flow = Flow::ToggleConnectorAgnosticMit;
@@ -1200,7 +1212,10 @@ pub async fn merchant_account_transfer_keys(
pub async fn toggle_extended_card_info(
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::ProfileId,
+ )>,
json_payload: web::Json<api_models::admin::ExtendedCardInfoChoice>,
) -> HttpResponse {
let flow = Flow::ToggleExtendedCardInfo;
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 11cdf4eb7e9..63c40580e53 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -1327,7 +1327,7 @@ async fn authorize_verify_select<Op>(
state: app::SessionState,
req_state: ReqState,
merchant_account: domain::MerchantAccount,
- profile_id: Option<String>,
+ profile_id: Option<common_utils::id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
header_payload: HeaderPayload,
req: api_models::payments::PaymentsRequest,
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 79e8ec11f21..61d89e5e773 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -96,7 +96,7 @@ pub async fn routing_link_config(
pub async fn routing_link_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
json_payload: web::Json<routing_types::RoutingAlgorithmId>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
@@ -209,7 +209,7 @@ pub async fn list_routing_configs(
pub async fn routing_unlink_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
let flow = Flow::RoutingUnlinkConfig;
@@ -290,7 +290,7 @@ pub async fn routing_unlink_config(
pub async fn routing_update_default_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>,
) -> impl Responder {
let wrapper = routing_types::ProfileDefaultRoutingConfig {
@@ -372,7 +372,7 @@ pub async fn routing_update_default_config(
pub async fn routing_retrieve_default_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
) -> impl Responder {
Box::pin(oss_api::server_wrap(
Flow::RoutingRetrieveDefaultConfig,
@@ -674,7 +674,7 @@ pub async fn routing_retrieve_linked_config(
state: web::Data<AppState>,
req: HttpRequest,
query: web::Query<RoutingRetrieveQuery>,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
use crate::services::authentication::AuthenticationData;
@@ -753,7 +753,7 @@ pub async fn routing_retrieve_default_config_for_profiles(
pub async fn routing_update_default_config_for_profile(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::ProfileId>,
json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 9ab2e2e3b07..f1de5528224 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -59,14 +59,14 @@ mod detached;
pub struct AuthenticationData {
pub merchant_account: domain::MerchantAccount,
pub key_store: domain::MerchantKeyStore,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
}
#[derive(Clone, Debug)]
pub struct AuthenticationDataWithMultipleProfiles {
pub merchant_account: domain::MerchantAccount,
pub key_store: domain::MerchantKeyStore,
- pub profile_id_list: Option<Vec<String>>,
+ pub profile_id_list: Option<Vec<id_type::ProfileId>>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
@@ -195,7 +195,7 @@ pub struct AuthToken {
pub role_id: String,
pub exp: u64,
pub org_id: id_type::OrganizationId,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
}
#[cfg(feature = "olap")]
@@ -206,7 +206,7 @@ impl AuthToken {
role_id: String,
settings: &Settings,
org_id: id_type::OrganizationId,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
) -> UserResult<String> {
let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS);
let exp = jwt::generate_exp(exp_duration)?.as_secs();
@@ -228,7 +228,7 @@ pub struct UserFromToken {
pub merchant_id: id_type::MerchantId,
pub role_id: String,
pub org_id: id_type::OrganizationId,
- pub profile_id: Option<String>,
+ pub profile_id: Option<id_type::ProfileId>,
}
pub struct UserIdFromAuth {
diff --git a/crates/router/src/services/kafka/authentication.rs b/crates/router/src/services/kafka/authentication.rs
index be3e0933342..42079525d8a 100644
--- a/crates/router/src/services/kafka/authentication.rs
+++ b/crates/router/src/services/kafka/authentication.rs
@@ -35,7 +35,7 @@ pub struct KafkaAuthentication<'a> {
pub acs_reference_number: Option<&'a String>,
pub acs_trans_id: Option<&'a String>,
pub acs_signed_content: Option<&'a String>,
- pub profile_id: &'a String,
+ pub profile_id: &'a common_utils::id_type::ProfileId,
pub payment_id: Option<&'a String>,
pub merchant_connector_id: &'a String,
pub ds_trans_id: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/authentication_event.rs b/crates/router/src/services/kafka/authentication_event.rs
index 3f10c7596ac..6213488a6d3 100644
--- a/crates/router/src/services/kafka/authentication_event.rs
+++ b/crates/router/src/services/kafka/authentication_event.rs
@@ -36,7 +36,7 @@ pub struct KafkaAuthenticationEvent<'a> {
pub acs_reference_number: Option<&'a String>,
pub acs_trans_id: Option<&'a String>,
pub acs_signed_content: Option<&'a String>,
- pub profile_id: &'a String,
+ pub profile_id: &'a common_utils::id_type::ProfileId,
pub payment_id: Option<&'a String>,
pub merchant_connector_id: &'a String,
pub ds_trans_id: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/dispute.rs b/crates/router/src/services/kafka/dispute.rs
index b4b493a79df..6f789cbe94e 100644
--- a/crates/router/src/services/kafka/dispute.rs
+++ b/crates/router/src/services/kafka/dispute.rs
@@ -30,7 +30,7 @@ pub struct KafkaDispute<'a> {
pub modified_at: OffsetDateTime,
pub connector: &'a String,
pub evidence: &'a Secret<serde_json::Value>,
- pub profile_id: Option<&'a String>,
+ pub profile_id: Option<&'a common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<&'a String>,
}
diff --git a/crates/router/src/services/kafka/dispute_event.rs b/crates/router/src/services/kafka/dispute_event.rs
index d6cb5d58491..e4254912597 100644
--- a/crates/router/src/services/kafka/dispute_event.rs
+++ b/crates/router/src/services/kafka/dispute_event.rs
@@ -31,7 +31,7 @@ pub struct KafkaDisputeEvent<'a> {
pub modified_at: OffsetDateTime,
pub connector: &'a String,
pub evidence: &'a Secret<serde_json::Value>,
- pub profile_id: Option<&'a String>,
+ pub profile_id: Option<&'a common_utils::id_type::ProfileId>,
pub merchant_connector_id: Option<&'a String>,
}
diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs
index 3296956797b..29aa5632837 100644
--- a/crates/router/src/services/kafka/payment_intent.rs
+++ b/crates/router/src/services/kafka/payment_intent.rs
@@ -33,7 +33,7 @@ pub struct KafkaPaymentIntent<'a> {
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<&'a String>,
pub attempt_count: i16,
- pub profile_id: Option<&'a String>,
+ pub profile_id: Option<&'a id_type::ProfileId>,
pub payment_confirm_source: Option<storage_enums::PaymentSource>,
pub billing_details: Option<Encryptable<Secret<Value>>>,
pub shipping_details: Option<Encryptable<Secret<Value>>>,
diff --git a/crates/router/src/services/kafka/payment_intent_event.rs b/crates/router/src/services/kafka/payment_intent_event.rs
index f5186a0b2bb..50d2c48a4bd 100644
--- a/crates/router/src/services/kafka/payment_intent_event.rs
+++ b/crates/router/src/services/kafka/payment_intent_event.rs
@@ -34,7 +34,7 @@ pub struct KafkaPaymentIntentEvent<'a> {
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<&'a String>,
pub attempt_count: i16,
- pub profile_id: Option<&'a String>,
+ pub profile_id: Option<&'a id_type::ProfileId>,
pub payment_confirm_source: Option<storage_enums::PaymentSource>,
pub billing_details: Option<Encryptable<Secret<Value>>>,
pub shipping_details: Option<Encryptable<Secret<Value>>>,
diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs
index ca89a34f18d..08733c46008 100644
--- a/crates/router/src/services/kafka/payout.rs
+++ b/crates/router/src/services/kafka/payout.rs
@@ -10,7 +10,7 @@ pub struct KafkaPayout<'a> {
pub merchant_id: &'a id_type::MerchantId,
pub customer_id: Option<&'a id_type::CustomerId>,
pub address_id: Option<&'a String>,
- pub profile_id: &'a String,
+ pub profile_id: &'a id_type::ProfileId,
pub payout_method_id: Option<&'a String>,
pub payout_type: Option<storage_enums::PayoutType>,
pub amount: MinorUnit,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 912cc1c1fad..c959c59badc 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -250,7 +250,7 @@ pub async fn create_business_profile_from_merchant_account(
use crate::core;
// Generate a unique profile id
- let profile_id = common_utils::generate_id_with_default_len("pro");
+ let profile_id = common_utils::generate_profile_id_of_default_length();
let merchant_id = merchant_account.get_id().to_owned();
let current_time = common_utils::date_time::now();
diff --git a/crates/router/src/types/domain/event.rs b/crates/router/src/types/domain/event.rs
index 872eb303901..badbb9df7b4 100644
--- a/crates/router/src/types/domain/event.rs
+++ b/crates/router/src/types/domain/event.rs
@@ -26,7 +26,7 @@ pub struct Event {
pub primary_object_type: EventObjectType,
pub created_at: time::PrimitiveDateTime,
pub merchant_id: Option<common_utils::id_type::MerchantId>,
- pub business_profile_id: Option<String>,
+ pub business_profile_id: Option<common_utils::id_type::ProfileId>,
pub primary_object_created_at: Option<time::PrimitiveDateTime>,
pub idempotent_event_id: Option<String>,
pub initial_attempt_id: Option<String>,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index ef07ab6a846..7e5f8571340 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -467,7 +467,10 @@ pub async fn get_mca_from_payment_intent(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: format!("profile_id {profile_id} and connector_name {connector_name}"),
+ id: format!(
+ "profile_id {} and connector_name {connector_name}",
+ profile_id.get_string_repr()
+ ),
},
)
}
@@ -556,7 +559,8 @@ pub async fn get_mca_from_payout_attempt(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: format!(
"profile_id {} and connector_name {}",
- payout.profile_id, connector_name
+ payout.profile_id.get_string_repr(),
+ connector_name
),
},
)
@@ -603,7 +607,10 @@ pub async fn get_mca_from_object_reference_id(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: format!("profile_id {profile_id} and connector_name {connector_name}"),
+ id: format!(
+ "profile_id {} and connector_name {connector_name}",
+ profile_id.get_string_repr()
+ ),
},
)
}
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 1de45b74360..30a0e1ca788 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -114,7 +114,7 @@ pub async fn generate_jwt_auth_token_with_custom_role_attributes(
merchant_id: id_type::MerchantId,
org_id: id_type::OrganizationId,
role_id: String,
- profile_id: Option<String>,
+ profile_id: Option<id_type::ProfileId>,
) -> UserResult<Secret<String>> {
let token = AuthToken::new_token(
user.get_user_id().to_string(),
diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs
index 7aebbe1bbcf..792a79c91eb 100644
--- a/crates/router/src/utils/user_role.rs
+++ b/crates/router/src/utils/user_role.rs
@@ -182,7 +182,7 @@ pub async fn update_v1_and_v2_user_roles_in_db(
user_id: &str,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
- profile_id: Option<&String>,
+ profile_id: Option<&id_type::ProfileId>,
update: UserRoleUpdate,
) -> (
Result<UserRole, Report<StorageError>>,
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index c536ec7e4e9..207af2ea4bf 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -177,7 +177,7 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
.await
.to_not_found_response(
errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
+ id: profile_id.get_string_repr().to_owned(),
},
)?;
diff --git a/crates/storage_impl/src/payouts/payout_attempt.rs b/crates/storage_impl/src/payouts/payout_attempt.rs
index aba6f2016ba..08843a060a7 100644
--- a/crates/storage_impl/src/payouts/payout_attempt.rs
+++ b/crates/storage_impl/src/payouts/payout_attempt.rs
@@ -60,7 +60,6 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
payout_attempt_id: &payout_attempt_id,
};
let key_str = key.to_string();
- let now = common_utils::date_time::now();
let created_attempt = PayoutAttempt {
payout_attempt_id: new_payout_attempt.payout_attempt_id.clone(),
payout_id: new_payout_attempt.payout_id.clone(),
@@ -76,8 +75,8 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
error_code: new_payout_attempt.error_code.clone(),
business_country: new_payout_attempt.business_country,
business_label: new_payout_attempt.business_label.clone(),
- created_at: new_payout_attempt.created_at.unwrap_or(now),
- last_modified_at: new_payout_attempt.last_modified_at.unwrap_or(now),
+ created_at: new_payout_attempt.created_at,
+ last_modified_at: new_payout_attempt.last_modified_at,
profile_id: new_payout_attempt.profile_id.clone(),
merchant_connector_id: new_payout_attempt.merchant_connector_id.clone(),
routing_info: new_payout_attempt.routing_info.clone(),
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index aee21771db8..320aee2006f 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -91,7 +91,6 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
};
let key_str = key.to_string();
let field = format!("po_{}", new.payout_id);
- let now = common_utils::date_time::now();
let created_payout = Payouts {
payout_id: new.payout_id.clone(),
merchant_id: new.merchant_id.clone(),
@@ -108,8 +107,8 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
return_url: new.return_url.clone(),
entity_type: new.entity_type,
metadata: new.metadata.clone(),
- created_at: new.created_at.unwrap_or(now),
- last_modified_at: new.last_modified_at.unwrap_or(now),
+ created_at: new.created_at,
+ last_modified_at: new.last_modified_at,
profile_id: new.profile_id.clone(),
status: new.status,
attempt_count: new.attempt_count,
@@ -936,10 +935,8 @@ impl DataModelExt for PayoutsNew {
return_url: self.return_url,
entity_type: self.entity_type,
metadata: self.metadata,
- created_at: self.created_at.unwrap_or_else(common_utils::date_time::now),
- last_modified_at: self
- .last_modified_at
- .unwrap_or_else(common_utils::date_time::now),
+ created_at: self.created_at,
+ last_modified_at: self.last_modified_at,
profile_id: self.profile_id,
status: self.status,
attempt_count: self.attempt_count,
@@ -967,8 +964,8 @@ impl DataModelExt for PayoutsNew {
return_url: storage_model.return_url,
entity_type: storage_model.entity_type,
metadata: storage_model.metadata,
- created_at: Some(storage_model.created_at),
- last_modified_at: Some(storage_model.last_modified_at),
+ created_at: storage_model.created_at,
+ last_modified_at: storage_model.last_modified_at,
profile_id: storage_model.profile_id,
status: storage_model.status,
attempt_count: storage_model.attempt_count,
diff --git a/scripts/ci-checks-v2.sh b/scripts/ci-checks-v2.sh
index 151e5a382d0..93bd2921a38 100755
--- a/scripts/ci-checks-v2.sh
+++ b/scripts/ci-checks-v2.sh
@@ -1,8 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
-crates_to_check=\
-'api_models
+crates_to_check='api_models
diesel_models
hyperswitch_domain_models
storage_impl'
@@ -38,7 +37,7 @@ if [[ "${GITHUB_EVENT_NAME:-}" == 'pull_request' ]]; then
# A package must be checked if it has been modified
if grep --quiet --extended-regexp "^crates/${package_name}" <<< "${files_modified}"; then
if [[ "${package_name}" == "storage_impl" ]]; then
- all_commands+=("cargo hack clippy --features 'v2,payment_v2,customer_v2,payment_methods_v2' -p storage_impl")
+ all_commands+=("cargo hack clippy --features 'v2,payment_v2,customer_v2' -p storage_impl")
else
valid_features="$(features_to_run "$package_name")"
all_commands+=("cargo hack clippy --feature-powerset --depth 2 --ignore-unknown-features --at-least-one-of 'v2 ' --include-features '${valid_features}' --package '${package_name}'")
@@ -54,7 +53,7 @@ if [[ "${GITHUB_EVENT_NAME:-}" == 'pull_request' ]]; then
else
# If we are doing this locally or on merge queue, then check for all the V2 crates
- all_commands+=("cargo hack clippy --features 'v2,payment_v2' -p storage_impl")
+ all_commands+=("cargo hack clippy --features 'v2,payment_v2,customer_v2' -p storage_impl")
common_command="cargo hack clippy --feature-powerset --depth 2 --ignore-unknown-features --at-least-one-of 'v2 '"
while IFS= read -r crate; do
if [[ "${crate}" != "storage_impl" ]]; then
|
refactor
|
introduce a domain type for profile ID (#5687)
|
90949d94cf3cdfba7ae4deb7d931b0a40e330310
|
2024-09-19 23:30:41
|
Pa1NarK
|
fix(cypress): fix user login in routing cypress framework (#5950)
| false
|
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
index eff36cf502c..284eff5fd1d 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
@@ -22,8 +22,18 @@ function normalise(input) {
};
if (typeof input !== "string") {
- const spec_name = Cypress.spec.name.split("-")[1].split(".")[0];
- return `${spec_name}`;
+ const specName = Cypress.spec.name;
+
+ if (specName.includes("-")) {
+ const parts = specName.split("-");
+
+ if (parts.length > 1 && parts[1].includes(".")) {
+ return parts[1].split(".")[0];
+ }
+ }
+
+ // Fallback
+ return `${specName}`;
}
const lowerCaseInput = input.toLowerCase();
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
index 6fe7dc63922..e0db22b347d 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
@@ -34,21 +34,21 @@ export const connectorDetails = {
payment_method: "card",
billing: {
address: {
- line1: "1467",
- line2: "CA",
- line3: "CA",
- city: "Musterhausen",
- state: "California",
- zip: "12345",
- country: "DE",
- first_name: "Max",
- last_name: "Mustermann"
+ line1: "1467",
+ line2: "CA",
+ line3: "CA",
+ city: "Musterhausen",
+ state: "California",
+ zip: "12345",
+ country: "DE",
+ first_name: "Max",
+ last_name: "Mustermann",
},
email: "[email protected]",
phone: {
- number: "9123456789",
- country_code: "+91"
- }
+ number: "9123456789",
+ country_code: "+91",
+ },
},
payment_method_data: {
card: successfulThreeDSTestCardDetails,
@@ -68,21 +68,21 @@ export const connectorDetails = {
payment_method: "card",
billing: {
address: {
- line1: "1467",
- line2: "CA",
- line3: "CA",
- city: "Musterhausen",
- state: "California",
- zip: "12345",
- country: "DE",
- first_name: "Max",
- last_name: "Mustermann"
+ line1: "1467",
+ line2: "CA",
+ line3: "CA",
+ city: "Musterhausen",
+ state: "California",
+ zip: "12345",
+ country: "DE",
+ first_name: "Max",
+ last_name: "Mustermann",
},
email: "[email protected]",
phone: {
- number: "9123456789",
- country_code: "+91"
- }
+ number: "9123456789",
+ country_code: "+91",
+ },
},
payment_method_data: {
card: successfulThreeDSTestCardDetails,
diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js b/cypress-tests/cypress/e2e/PayoutUtils/Commons.js
index 248d0fe2a4d..5f8a580731e 100644
--- a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js
+++ b/cypress-tests/cypress/e2e/PayoutUtils/Commons.js
@@ -18,6 +18,21 @@ function normalise(input) {
// Add more known exceptions here
};
+ if (typeof input !== "string") {
+ const specName = Cypress.spec.name;
+
+ if (specName.includes("-")) {
+ const parts = specName.split("-");
+
+ if (parts.length > 1 && parts[1].includes(".")) {
+ return parts[1].split(".")[0];
+ }
+ }
+
+ // Fallback
+ return `${specName}`;
+ }
+
if (exceptions[input.toLowerCase()]) {
return exceptions[input.toLowerCase()];
} else {
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
index 09f237d7d47..3037a6eb99e 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
@@ -6,7 +6,8 @@ let globalState;
describe("Priority Based Routing Test", () => {
let should_continue = true;
- context("Create Jwt Token", () => {
+
+ context("Login", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -16,14 +17,11 @@ describe("Priority Based Routing Test", () => {
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-jwt-token", () => {
- let data = utils.getConnectorDetails("common")["jwt"];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createJWTToken(req_data, res_data, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
+ it("User login", () => {
+ cy.userLogin(globalState);
+ cy.terminate2Fa(globalState);
+ cy.userInfo(globalState);
});
it("merchant retrieve call", () => {
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
index e0b1ee589de..665afc97581 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
@@ -5,9 +5,7 @@ import * as utils from "../RoutingUtils/Utils";
let globalState;
describe("Volume Based Routing Test", () => {
- let should_continue = true;
-
- context("Create Jwt Token", () => {
+ context("Login", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -17,14 +15,11 @@ describe("Volume Based Routing Test", () => {
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-jwt-token", () => {
- let data = utils.getConnectorDetails("common")["jwt"];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createJWTToken(req_data, res_data, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
+ it("User login", () => {
+ cy.userLogin(globalState);
+ cy.terminate2Fa(globalState);
+ cy.userInfo(globalState);
});
it("merchant retrieve call", () => {
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
index 583573ba699..c98f34a55bb 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
@@ -5,9 +5,7 @@ import * as utils from "../RoutingUtils/Utils";
let globalState;
describe("Rule Based Routing Test", () => {
- let should_continue = true;
-
- context("Create Jwt Token", () => {
+ context("Login", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -17,12 +15,11 @@ describe("Rule Based Routing Test", () => {
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-jwt-token", () => {
- let data = utils.getConnectorDetails("common")["jwt"];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createJWTToken(req_data, res_data, globalState);
+ it("User login", () => {
+ cy.userLogin(globalState);
+ cy.terminate2Fa(globalState);
+ cy.userInfo(globalState);
});
it("merchant retrieve call", () => {
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js
index 86758215001..2638b18f479 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js
@@ -16,12 +16,10 @@ describe("Auto Retries & Step Up 3DS", () => {
cy.task("setGlobalState", globalState.data);
});
- it("Create JWT token", () => {
- let data = utils.getConnectorDetails("common")["jwt"];
- let req_data = data["Request"];
- let res_data = data["Response"];
-
- cy.createJWTToken(req_data, res_data, globalState);
+ it("User login", () => {
+ cy.userLogin(globalState);
+ cy.terminate2Fa(globalState);
+ cy.userInfo(globalState);
});
it("List MCA", () => {
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 3c7cbad2f9e..396be8e59f4 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -967,7 +967,6 @@ Cypress.Commands.add(
(confirmBody, req_data, res_data, confirm, globalState) => {
const paymentIntentId = globalState.get("paymentID");
const connectorId = globalState.get("connectorId");
- console.log("connectorId", connectorId);
for (const key in req_data) {
confirmBody[key] = req_data[key];
}
@@ -989,7 +988,6 @@ Cypress.Commands.add(
expect(response.headers["content-type"]).to.include("application/json");
globalState.set("paymentID", paymentIntentId);
globalState.set("connectorId", response.body.connector);
- console.log("connectorId", response.body.connector);
globalState.set("paymentMethodType", confirmBody.payment_method_type);
switch (response.body.authentication_type) {
@@ -2063,46 +2061,104 @@ Cypress.Commands.add("retrievePayoutCallTest", (globalState) => {
});
});
-Cypress.Commands.add("createJWTToken", (req_data, res_data, globalState) => {
- const jwt_body = {
+// User API calls
+// Below 3 commands should be called in sequence to login a user
+Cypress.Commands.add("userLogin", (globalState) => {
+ // Define the necessary variables and constant
+ const base_url = globalState.get("baseUrl");
+ const query_params = `token_only=true`;
+ const signin_body = {
email: `${globalState.get("email")}`,
password: `${globalState.get("password")}`,
};
+ const url = `${base_url}/user/v2/signin?${query_params}`;
cy.request({
method: "POST",
- url: `${globalState.get("baseUrl")}/user/v2/signin`,
+ url: url,
headers: {
"Content-Type": "application/json",
},
+ body: signin_body,
failOnStatusCode: false,
- body: jwt_body,
}).then((response) => {
logRequestId(response.headers["x-request-id"]);
- expect(response.headers["content-type"]).to.include("application/json");
if (response.status === 200) {
- expect(response.body).to.have.property("token");
- //set jwt_token
- globalState.set("jwtToken", response.body.token);
+ if (response.body.token_type === "totp") {
+ expect(response.body).to.have.property("token").and.to.not.be.empty;
- //setting merchantId for manual create merchant
- globalState.set("merchantId", response.body.merchant_id);
+ globalState.set("totpToken", response.body.token);
+ cy.task("setGlobalState", globalState.data);
+ }
+ } else {
+ throw new Error(
+ `User login call failed to get totp token with status ${response.status} and message ${response.body.message}`
+ );
+ }
+ });
+});
+Cypress.Commands.add("terminate2Fa", (globalState) => {
+ // Define the necessary variables and constant
+ const base_url = globalState.get("baseUrl");
+ const query_params = `skip_two_factor_auth=true`;
+ const api_key = globalState.get("totpToken");
+ const url = `${base_url}/user/2fa/terminate?${query_params}`;
- // set session cookie
- const sessionCookie = response.headers["set-cookie"][0];
- const sessionValue = sessionCookie.split(";")[0];
- globalState.set("cookie", sessionValue);
+ cy.request({
+ method: "GET",
+ url: url,
+ headers: {
+ Authorization: `Bearer ${api_key}`,
+ "Content-Type": "application/json",
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
- // set api key
- globalState.set("apiKey", globalState.get("routingApiKey"));
- globalState.set("merchantId", response.body.merchant_id);
+ if (response.status === 200) {
+ if (response.body.token_type === "user_info") {
+ expect(response.body).to.have.property("token").and.to.not.be.empty;
- for (const key in res_data.body) {
- expect(res_data.body[key]).to.equal(response.body[key]);
+ globalState.set("userInfoToken", response.body.token);
+ cy.task("setGlobalState", globalState.data);
}
} else {
- defaultErrorHandler(response, res_data);
+ throw new Error(
+ `2FA terminate call failed with status ${response.status} and message ${response.body.message}`
+ );
+ }
+ });
+});
+Cypress.Commands.add("userInfo", (globalState) => {
+ // Define the necessary variables and constant
+ const base_url = globalState.get("baseUrl");
+ const api_key = globalState.get("userInfoToken");
+ const url = `${base_url}/user`;
+
+ cy.request({
+ method: "GET",
+ url: url,
+ headers: {
+ Authorization: `Bearer ${api_key}`,
+ "Content-Type": "application/json",
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ if (response.status === 200) {
+ expect(response.body).to.have.property("merchant_id").and.to.not.be.empty;
+ expect(response.body).to.have.property("org_id").and.to.not.be.empty;
+ expect(response.body).to.have.property("profile_id").and.to.not.be.empty;
+
+ globalState.set("merchantId", response.body.merchant_id);
+ globalState.set("organizationId", response.body.org_id);
+ globalState.set("profileId", response.body.profile_id);
+ } else {
+ throw new Error(
+ `User login call failed to fetch user info with status ${response.status} and message ${response.body.message}`
+ );
}
});
});
@@ -2145,9 +2201,9 @@ Cypress.Commands.add(
method: "POST",
url: `${globalState.get("baseUrl")}/routing`,
headers: {
+ Authorization: `Bearer ${globalState.get("userInfoToken")}`,
"Content-Type": "application/json",
Cookie: `${globalState.get("cookie")}`,
- "api-key": `Bearer ${globalState.get("jwtToken")}`,
},
failOnStatusCode: false,
body: routingBody,
@@ -2176,9 +2232,9 @@ Cypress.Commands.add(
method: "POST",
url: `${globalState.get("baseUrl")}/routing/${routing_config_id}/activate`,
headers: {
+ Authorization: `Bearer ${globalState.get("userInfoToken")}`,
"Content-Type": "application/json",
Cookie: `${globalState.get("cookie")}`,
- "api-key": globalState.get("apiKey"),
},
failOnStatusCode: false,
}).then((response) => {
@@ -2205,9 +2261,9 @@ Cypress.Commands.add(
method: "GET",
url: `${globalState.get("baseUrl")}/routing/${routing_config_id}`,
headers: {
+ Authorization: `Bearer ${globalState.get("userInfoToken")}`,
"Content-Type": "application/json",
Cookie: `${globalState.get("cookie")}`,
- "api-key": globalState.get("apiKey"),
},
failOnStatusCode: false,
}).then((response) => {
|
fix
|
fix user login in routing cypress framework (#5950)
|
0b232c57e3aedc20e4847c483da2b91284913ef4
|
2024-07-08 14:57:20
|
github-actions
|
chore(version): 2024.07.08.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6954b3c4161..53cd35842da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.07.08.1
+
+### Bug Fixes
+
+- **core:** Fetch customer id from customer object during MIT ([#5218](https://github.com/juspay/hyperswitch/pull/5218)) ([`a79437d`](https://github.com/juspay/hyperswitch/commit/a79437d5f078287a3eddb9bfdc7902533efd41b4))
+- **cypress:**
+ - Remove unsupported manual confirm tests ([#5223](https://github.com/juspay/hyperswitch/pull/5223)) ([`549c293`](https://github.com/juspay/hyperswitch/commit/549c293c3f0f5393ee3c29ee74fee1a983c46755))
+ - Fix payouts failing ([#5239](https://github.com/juspay/hyperswitch/pull/5239)) ([`864d53c`](https://github.com/juspay/hyperswitch/commit/864d53c6d20ed993b55d9932e8d62abd4a64fd5a))
+- **router:** [Iatapay] add CLEARED refund status ([#5231](https://github.com/juspay/hyperswitch/pull/5231)) ([`d4813b9`](https://github.com/juspay/hyperswitch/commit/d4813b99500d2607985a8a21c888f040fff843dc))
+
+**Full Changelog:** [`2024.07.08.0...2024.07.08.1`](https://github.com/juspay/hyperswitch/compare/2024.07.08.0...2024.07.08.1)
+
+- - -
+
## 2024.07.08.0
### Bug Fixes
|
chore
|
2024.07.08.1
|
cf47a65916fd4fb5c996946ffd579fd6755d02f7
|
2023-12-19 23:50:02
|
Prasunna Soppa
|
fix(events): add logger for incoming webhook payload (#3171)
| false
|
diff --git a/crates/router/src/routes/webhooks.rs b/crates/router/src/routes/webhooks.rs
index 2162ee56121..10eb4ef75e4 100644
--- a/crates/router/src/routes/webhooks.rs
+++ b/crates/router/src/routes/webhooks.rs
@@ -25,8 +25,8 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
flow.clone(),
state,
&req,
- (),
- |state, auth, _| {
+ WebhookBytes(body),
+ |state, auth, payload| {
webhooks::webhooks_wrapper::<W, Oss>(
&flow,
state.to_owned(),
@@ -34,7 +34,7 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
auth.merchant_account,
auth.key_store,
&connector_id_or_name,
- body.clone(),
+ payload.0,
)
},
&auth::MerchantIdAuth(merchant_id),
@@ -42,3 +42,19 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
))
.await
}
+
+#[derive(Debug)]
+struct WebhookBytes(web::Bytes);
+
+impl serde::Serialize for WebhookBytes {
+ fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
+ let payload: serde_json::Value = serde_json::from_slice(&self.0).unwrap_or_default();
+ payload.serialize(serializer)
+ }
+}
+
+impl common_utils::events::ApiEventMetric for WebhookBytes {
+ fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+ Some(common_utils::events::ApiEventsType::Miscellaneous)
+ }
+}
|
fix
|
add logger for incoming webhook payload (#3171)
|
57e1ae9dea6ff70fb1bca47c479c35026c167bad
|
2023-12-14 11:38:14
|
Hrithikesh
|
feat(core): enable surcharge support for all connectors (#3109)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index ef0ae3a15ce..717a908b1f0 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -322,9 +322,7 @@ impl PaymentsRequest {
pub fn get_total_capturable_amount(&self) -> Option<i64> {
let surcharge_amount = self
.surcharge_details
- .map(|surcharge_details| {
- surcharge_details.surcharge_amount + surcharge_details.tax_amount.unwrap_or(0)
- })
+ .map(|surcharge_details| surcharge_details.get_total_surcharge_amount())
.unwrap_or(0);
self.amount
.map(|amount| i64::from(amount) + surcharge_amount)
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index f7b849f1d4e..61e48cb64e9 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -156,6 +156,16 @@ pub struct PaymentAttempt {
pub unified_message: Option<String>,
}
+impl PaymentAttempt {
+ pub fn get_total_amount(&self) -> i64 {
+ self.amount + self.surcharge_amount.unwrap_or(0) + self.tax_amount.unwrap_or(0)
+ }
+ pub fn get_total_surcharge_amount(&self) -> Option<i64> {
+ self.surcharge_amount
+ .map(|surcharge_amount| surcharge_amount + self.tax_amount.unwrap_or(0))
+ }
+}
+
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PaymentListFilters {
pub connector: Vec<String>,
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index 334a5804026..7a9799d415d 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -265,10 +265,6 @@ impl ConnectorValidation for Paypal {
),
}
}
-
- fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
- Ok(())
- }
}
impl
@@ -423,10 +419,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
let connector_router_data = paypal::PaypalRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
- req.request
- .surcharge_details
- .as_ref()
- .map_or(req.request.amount, |surcharge| surcharge.final_amount),
+ req.request.amount,
req,
))?;
let connector_req = paypal::PaypalPaymentsRequest::try_from(&connector_router_data)?;
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index c618357ffb5..ef809915964 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -154,11 +154,7 @@ impl ConnectorCommon for Trustpay {
}
}
-impl ConnectorValidation for Trustpay {
- fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
- Ok(())
- }
-}
+impl ConnectorValidation for Trustpay {}
impl api::Payment for Trustpay {}
@@ -432,12 +428,7 @@ impl
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let currency = req.request.get_currency()?;
- let amount = req
- .request
- .surcharge_details
- .as_ref()
- .map(|surcharge_details| surcharge_details.final_amount)
- .unwrap_or(req.request.get_amount()?);
+ let amount = req.request.get_amount()?;
let connector_router_data = trustpay::TrustpayRouterData::try_from((
&self.get_currency_unit(),
currency,
@@ -544,12 +535,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
req: &types::PaymentsAuthorizeRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let amount = req
- .request
- .surcharge_details
- .as_ref()
- .map(|surcharge_details| surcharge_details.final_amount)
- .unwrap_or(req.request.amount);
+ let amount = req.request.amount;
let connector_router_data = trustpay::TrustpayRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 9283ff41f73..d06caf3ae20 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -28,8 +28,8 @@ use crate::{
},
pii::PeekInterface,
types::{
- self, api, storage::payment_attempt::PaymentAttemptExt, transformers::ForeignTryFrom,
- ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId,
+ self, api, transformers::ForeignTryFrom, ApplePayPredecryptData, BrowserInformation,
+ PaymentsCancelData, ResponseId,
},
utils::{OptionExt, ValueExt},
};
@@ -367,6 +367,10 @@ pub trait PaymentsAuthorizeRequestData {
fn get_connector_mandate_id(&self) -> Result<String, Error>;
fn get_complete_authorize_url(&self) -> Result<String, Error>;
fn get_ip_address_as_optional(&self) -> Option<Secret<String, IpAddress>>;
+ fn get_original_amount(&self) -> i64;
+ fn get_surcharge_amount(&self) -> Option<i64>;
+ fn get_tax_on_surcharge_amount(&self) -> Option<i64>;
+ fn get_total_surcharge_amount(&self) -> Option<i64>;
}
pub trait PaymentMethodTokenizationRequestData {
@@ -473,6 +477,27 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
.map(|ip| Secret::new(ip.to_string()))
})
}
+ fn get_original_amount(&self) -> i64 {
+ self.surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.original_amount)
+ .unwrap_or(self.amount)
+ }
+ fn get_surcharge_amount(&self) -> Option<i64> {
+ self.surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.surcharge_amount)
+ }
+ fn get_tax_on_surcharge_amount(&self) -> Option<i64> {
+ self.surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.tax_on_surcharge_amount)
+ }
+ fn get_total_surcharge_amount(&self) -> Option<i64> {
+ self.surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.get_total_surcharge_amount())
+ }
}
pub trait ConnectorCustomerData {
diff --git a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
index e130795e945..db1064b36a7 100644
--- a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
+++ b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
@@ -310,6 +310,7 @@ fn get_surcharge_details_from_surcharge_output(
.transpose()?
.unwrap_or(0);
Ok(types::SurchargeDetails {
+ original_amount: payment_attempt.amount,
surcharge: match surcharge_details.surcharge {
surcharge_decision_configs::SurchargeOutput::Fixed { amount } => {
common_utils_types::Surcharge::Fixed(amount)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 3c7ac0fd78d..3f815f16be4 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -204,10 +204,6 @@ where
);
if should_continue_transaction {
- operation
- .to_domain()?
- .populate_payment_data(state, &mut payment_data, &merchant_account)
- .await?;
payment_data = match connector_details {
api::ConnectorCallType::PreDetermined(connector) => {
let schedule_time = if should_add_task_to_process_tracker {
@@ -484,6 +480,13 @@ where
.surcharge_applicable
.unwrap_or(false)
{
+ if let Some(surcharge_details) = payment_data.payment_attempt.get_surcharge_details() {
+ // if retry payment, surcharge would have been populated from the previous attempt. Use the same surcharge
+ let surcharge_details =
+ types::SurchargeDetails::from((&surcharge_details, &payment_data.payment_attempt));
+ payment_data.surcharge_details = Some(surcharge_details);
+ return Ok(());
+ }
let raw_card_key = payment_data
.payment_method_data
.as_ref()
@@ -562,6 +565,7 @@ where
payment_data.payment_attempt.amount + surcharge_amount + tax_on_surcharge_amount;
Ok(Some(api::SessionSurchargeDetails::PreDetermined(
types::SurchargeDetails {
+ original_amount: payment_data.payment_attempt.amount,
surcharge: Surcharge::Fixed(surcharge_amount),
tax_on_surcharge: None,
surcharge_amount,
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 4ef23f481a2..c934c7c2cd6 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -76,12 +76,6 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
.connector
.validate_capture_method(self.request.capture_method)
.to_payment_failed_response()?;
- if self.request.surcharge_details.is_some() {
- connector
- .connector
- .validate_if_surcharge_implemented()
- .to_payment_failed_response()?;
- }
if self.should_proceed_with_authorize() {
self.decide_authentication_type();
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 7d0ec0718c2..1a6945b09c8 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -139,7 +139,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
payment_method_type.or(payment_attempt.payment_method_type);
payment_attempt.payment_experience = request.payment_experience;
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 7e6572ff07d..9810980cd34 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -102,7 +102,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.await?;
let currency = payment_attempt.currency.get_required_value("currency")?;
- let amount = payment_attempt.amount.into();
+ let amount = payment_attempt.get_total_amount().into();
payment_attempt.cancellation_reason = request.cancellation_reason.clone();
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 19998a9a0a7..3986b16ce35 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -124,7 +124,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
let shipping_address = helpers::create_or_find_address_for_payment_by_request(
db,
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 3e91a09ab54..abb08d14d92 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -135,7 +135,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.payment_experience
.or(payment_attempt.payment_experience);
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 95556ac1e0b..58983f264c7 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -377,7 +377,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
payment_attempt.capture_method = request.capture_method.or(payment_attempt.capture_method);
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
@@ -732,7 +732,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
m_db.update_payment_attempt_with_attempt_id(
m_payment_data_payment_attempt,
storage::PaymentAttemptUpdate::ConfirmUpdate {
- amount: payment_data.amount.into(),
+ amount: payment_data.payment_attempt.amount,
currency: payment_data.currency,
status: attempt_status,
payment_method,
@@ -780,7 +780,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
m_db.update_payment_intent(
m_payment_data_payment_intent,
storage::PaymentIntentUpdate::Update {
- amount: payment_data.amount.into(),
+ amount: payment_data.payment_intent.amount,
currency: payment_data.currency,
setup_future_usage,
status: intent_status,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 97cd59e632d..798678e64df 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -297,7 +297,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.map(|(payment_method_data, additional_payment_data)| {
payment_method_data.apply_additional_payment_data(additional_payment_data)
});
-
+ let amount = payment_attempt.get_total_amount().into();
let payment_data = PaymentData {
flow: PhantomData,
payment_intent,
@@ -643,6 +643,12 @@ impl PaymentCreate {
} else {
utils::get_payment_attempt_id(payment_id, 1)
};
+ let surcharge_amount = request
+ .surcharge_details
+ .map(|surcharge_details| surcharge_details.surcharge_amount);
+ let tax_amount = request
+ .surcharge_details
+ .and_then(|surcharge_details| surcharge_details.tax_amount);
Ok((
storage::PaymentAttemptNew {
@@ -668,6 +674,8 @@ impl PaymentCreate {
payment_token: request.payment_token.clone(),
mandate_id: request.mandate_id.clone(),
business_sub_label: request.business_sub_label.clone(),
+ surcharge_amount,
+ tax_amount,
mandate_details: request
.mandate_data
.as_ref()
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 5cb3c95dc25..37c7dfd1bae 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -100,7 +100,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.await?;
let currency = payment_attempt.currency.get_required_value("currency")?;
- let amount = payment_attempt.amount.into();
+ let amount = payment_attempt.get_total_amount().into();
let frm_response = db
.find_fraud_check_by_payment_id(payment_intent.payment_id.clone(), merchant_account.merchant_id.clone())
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index f92487d74a7..8b301c525fd 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -24,10 +24,7 @@ use crate::{
services::RedirectForm,
types::{
self, api,
- storage::{
- self, enums,
- payment_attempt::{AttemptStatusExt, PaymentAttemptExt},
- },
+ storage::{self, enums, payment_attempt::AttemptStatusExt},
transformers::{ForeignFrom, ForeignTryFrom},
CaptureSyncResponse,
},
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 7d9c3733934..6f7dcd6c11a 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -93,7 +93,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
payment_attempt.payment_method = Some(storage_enums::PaymentMethod::Wallet);
- let amount = payment_intent.amount.into();
+ let amount = payment_attempt.get_total_amount().into();
let shipping_address = helpers::create_or_find_address_for_payment_by_request(
db,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 67c8579d263..8896e4e43ef 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -89,7 +89,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
let shipping_address = helpers::create_or_find_address_for_payment_by_request(
db,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 44fbdf10781..c5311ce3d03 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -244,7 +244,7 @@ async fn get_tracker_for_sync<
let payment_id_str = payment_attempt.payment_id.clone();
currency = payment_attempt.currency.get_required_value("currency")?;
- amount = payment_attempt.amount.into();
+ amount = payment_attempt.get_total_amount().into();
let shipping_address = helpers::get_address_by_id(
db,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 0440d5bc0e7..153ded14f4b 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -1,6 +1,6 @@
use std::marker::PhantomData;
-use api_models::enums::FrmSuggestion;
+use api_models::{enums::FrmSuggestion, payments::RequestSurchargeDetails};
use async_trait::async_trait;
use common_utils::ext_traits::{AsyncExt, Encode, ValueExt};
use error_stack::{report, IntoReport, ResultExt};
@@ -281,11 +281,25 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
})
.await
.transpose()?;
- let next_operation: BoxedOperation<'a, F, api::PaymentsRequest, Ctx> =
+ let (next_operation, amount): (BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, _) =
if request.confirm.unwrap_or(false) {
- Box::new(operations::PaymentConfirm)
+ let amount = {
+ let amount = request
+ .amount
+ .map(Into::into)
+ .unwrap_or(payment_attempt.amount);
+ payment_attempt.amount = amount;
+ payment_intent.amount = amount;
+ let surcharge_amount = request
+ .surcharge_details
+ .as_ref()
+ .map(RequestSurchargeDetails::get_total_surcharge_amount)
+ .or(payment_attempt.get_total_surcharge_amount());
+ (amount + surcharge_amount.unwrap_or(0)).into()
+ };
+ (Box::new(operations::PaymentConfirm), amount)
} else {
- Box::new(self)
+ (Box::new(self), amount)
};
payment_intent.status = match request.payment_method_data.as_ref() {
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 3a0dfd19a65..f707fe3a1da 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -92,7 +92,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let currency = payment_attempt.currency.get_required_value("currency")?;
- let amount = payment_attempt.amount;
+ let amount = payment_attempt.get_total_amount();
let profile_id = payment_intent
.profile_id
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 2aaf0b2957f..f0d8c9fd755 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1038,6 +1038,11 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
None
}
});
+ let amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.final_amount)
+ .unwrap_or(payment_data.amount.into());
Ok(Self {
payment_method_data: payment_method_data.get_required_value("payment_method_data")?,
setup_future_usage: payment_data.payment_intent.setup_future_usage,
@@ -1048,7 +1053,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
statement_descriptor: payment_data.payment_intent.statement_descriptor_name,
capture_method: payment_data.payment_attempt.capture_method,
- amount: payment_data.amount.into(),
+ amount,
currency: payment_data.currency,
browser_info,
email: payment_data.email,
@@ -1301,9 +1306,14 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD
.collect::<Result<Vec<_>, _>>()
})
.transpose()?;
+ let amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.final_amount)
+ .unwrap_or(payment_data.amount.into());
Ok(Self {
- amount: payment_data.amount.into(),
+ amount,
currency: payment_data.currency,
country: payment_data.address.billing.and_then(|billing_address| {
billing_address.address.and_then(|address| address.country)
@@ -1425,6 +1435,11 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
payload: redirect.json_payload,
}
});
+ let amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.final_amount)
+ .unwrap_or(payment_data.amount.into());
Ok(Self {
setup_future_usage: payment_data.payment_intent.setup_future_usage,
@@ -1434,7 +1449,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
confirm: payment_data.payment_attempt.confirm,
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
capture_method: payment_data.payment_attempt.capture_method,
- amount: payment_data.amount.into(),
+ amount,
currency: payment_data.currency,
browser_info,
email: payment_data.email,
@@ -1499,12 +1514,17 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProce
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "browser_info",
})?;
+ let amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.final_amount)
+ .unwrap_or(payment_data.amount.into());
Ok(Self {
payment_method_data,
email: payment_data.email,
currency: Some(payment_data.currency),
- amount: Some(payment_data.amount.into()),
+ amount: Some(amount),
payment_method_type: payment_data.payment_attempt.payment_method_type,
setup_mandate_details: payment_data.setup_mandate,
capture_method: payment_data.payment_attempt.capture_method,
diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs
index 001082d2c92..00160db9855 100644
--- a/crates/router/src/core/payments/types.rs
+++ b/crates/router/src/core/payments/types.rs
@@ -178,6 +178,8 @@ impl MultipleCaptureData {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct SurchargeDetails {
+ /// original_amount
+ pub original_amount: i64,
/// surcharge value
pub surcharge: common_types::Surcharge,
/// tax on surcharge value
@@ -198,6 +200,7 @@ impl From<(&RequestSurchargeDetails, &PaymentAttempt)> for SurchargeDetails {
let surcharge_amount = request_surcharge_details.surcharge_amount;
let tax_on_surcharge_amount = request_surcharge_details.tax_amount.unwrap_or(0);
Self {
+ original_amount: payment_attempt.amount,
surcharge: common_types::Surcharge::Fixed(request_surcharge_details.surcharge_amount),
tax_on_surcharge: None,
surcharge_amount,
@@ -219,13 +222,15 @@ impl ForeignTryFrom<(&SurchargeDetails, &PaymentAttempt)> for SurchargeDetailsRe
currency.to_currency_base_unit_asf64(surcharge_details.tax_on_surcharge_amount)?;
let display_final_amount =
currency.to_currency_base_unit_asf64(surcharge_details.final_amount)?;
+ let display_total_surcharge_amount = currency.to_currency_base_unit_asf64(
+ surcharge_details.surcharge_amount + surcharge_details.tax_on_surcharge_amount,
+ )?;
Ok(Self {
surcharge: surcharge_details.surcharge.clone().into(),
tax_on_surcharge: surcharge_details.tax_on_surcharge.clone().map(Into::into),
display_surcharge_amount,
display_tax_on_surcharge_amount,
- display_total_surcharge_amount: display_surcharge_amount
- + display_tax_on_surcharge_amount,
+ display_total_surcharge_amount,
display_final_amount,
})
}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 7680ff29d45..ea254ee4fab 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -100,10 +100,6 @@ pub trait ConnectorValidation: ConnectorCommon {
fn is_webhook_source_verification_mandatory(&self) -> bool {
false
}
-
- fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented(format!("Surcharge for {}", self.id())).into())
- }
}
#[async_trait::async_trait]
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index ecbea1e793c..cc14fe36a04 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -38,7 +38,7 @@ use crate::{
payments::{types, PaymentData, RecurringMandatePaymentData},
},
services,
- types::{storage::payment_attempt::PaymentAttemptExt, transformers::ForeignFrom},
+ types::transformers::ForeignFrom,
utils::OptionExt,
};
@@ -373,6 +373,14 @@ pub struct PayoutsFulfillResponseData {
#[derive(Debug, Clone)]
pub struct PaymentsAuthorizeData {
pub payment_method_data: payments::PaymentMethodData,
+ /// total amount (original_amount + surcharge_amount + tax_on_surcharge_amount)
+ /// If connector supports separate field for surcharge amount, consider using below functions defined on `PaymentsAuthorizeData` to fetch original amount and surcharge amount separately
+ /// ```
+ /// get_original_amount()
+ /// get_surcharge_amount()
+ /// get_tax_on_surcharge_amount()
+ /// get_total_surcharge_amount() // returns surcharge_amount + tax_on_surcharge_amount
+ /// ```
pub amount: i64,
pub email: Option<Email>,
pub currency: storage_enums::Currency,
|
feat
|
enable surcharge support for all connectors (#3109)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.