repo
stringclasses 1
value | instance_id
stringlengths 22
24
| problem_statement
stringlengths 24
24.1k
| patch
stringlengths 0
1.9M
| test_patch
stringclasses 1
value | created_at
stringdate 2022-11-25 05:12:07
2025-10-09 08:44:51
| hints_text
stringlengths 11
235k
| base_commit
stringlengths 40
40
|
|---|---|---|---|---|---|---|---|
juspay/hyperswitch
|
juspay__hyperswitch-7500
|
Bug: [REFACTOR][payment_methods] refactor network tokenization flow for v2
Refactor network tokenization flow for v2 payment method.
- moved the network tokenization req, response types from domain to router types, since the types are not generic for Hyperswitch but req and response types of token service.
- replaced hanging functions to impl based in the flow
- Update ListCustomerPaymentMethod response and Payment Method response with network token details.
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 77963ee90df..6b9b35ac2c0 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -11,7 +11,10 @@ use common_utils::{
id_type, link_utils, pii,
types::{MinorUnit, Percentage, Surcharge},
};
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use masking::PeekInterface;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use masking::{ExposeInterface, PeekInterface};
use serde::de;
use utoipa::{schema, ToSchema};
@@ -901,9 +904,8 @@ pub struct ConnectorTokenDetails {
pub metadata: Option<pii::SecretSerdeValue>,
/// The value of the connector token. This token can be used to make merchant initiated payments ( MIT ), directly with the connector.
- pub token: String,
+ pub token: masking::Secret<String>,
}
-
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, Clone)]
pub struct PaymentMethodResponse {
@@ -951,6 +953,8 @@ pub struct PaymentMethodResponse {
/// The connector token details if available
pub connector_tokens: Option<Vec<ConnectorTokenDetails>>,
+
+ pub network_token: Option<NetworkTokenResponse>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
@@ -976,6 +980,22 @@ pub struct CardDetailsPaymentMethod {
pub saved_to_locker: bool,
}
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct NetworkTokenDetailsPaymentMethod {
+ pub last4_digits: Option<String>,
+ pub issuer_country: Option<String>,
+ pub network_token_expiry_month: Option<masking::Secret<String>>,
+ pub network_token_expiry_year: Option<masking::Secret<String>>,
+ pub nick_name: Option<masking::Secret<String>>,
+ pub card_holder_name: Option<masking::Secret<String>>,
+ pub card_isin: Option<String>,
+ pub card_issuer: Option<String>,
+ pub card_network: Option<api_enums::CardNetwork>,
+ pub card_type: Option<String>,
+ #[serde(default = "saved_in_locker_default")]
+ pub saved_to_locker: bool,
+}
+
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodDataBankCreds {
pub mask: String,
@@ -1122,6 +1142,12 @@ pub struct CardDetailFromLocker {
pub saved_to_locker: bool,
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
+pub struct NetworkTokenResponse {
+ pub payment_method_data: NetworkTokenDetailsPaymentMethod,
+}
+
fn saved_in_locker_default() -> bool {
true
}
@@ -1990,6 +2016,9 @@ pub struct CustomerPaymentMethod {
/// The billing details of the payment method
#[schema(value_type = Option<Address>)]
pub billing: Option<payments::Address>,
+
+ ///The network token details for the payment method
+ pub network_tokenization: Option<NetworkTokenResponse>,
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index f2dddf39b03..fac251d8b68 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -31,6 +31,8 @@ pub mod router_request_types;
pub mod router_response_types;
pub mod type_encryption;
pub mod types;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub mod vault;
#[cfg(not(feature = "payouts"))]
pub trait PayoutAttemptInterface {}
diff --git a/crates/hyperswitch_domain_models/src/network_tokenization.rs b/crates/hyperswitch_domain_models/src/network_tokenization.rs
index a29792e969e..4dd54fe3323 100644
--- a/crates/hyperswitch_domain_models/src/network_tokenization.rs
+++ b/crates/hyperswitch_domain_models/src/network_tokenization.rs
@@ -1,6 +1,3 @@
-use std::fmt::Debug;
-
-use api_models::enums as api_enums;
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
@@ -8,218 +5,6 @@ use api_models::enums as api_enums;
use cards::CardNumber;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use cards::{CardNumber, NetworkToken};
-use common_utils::id_type;
-use masking::Secret;
-use serde::{Deserialize, Serialize};
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CardData {
- pub card_number: CardNumber,
- pub exp_month: Secret<String>,
- pub exp_year: Secret<String>,
- pub card_security_code: Option<Secret<String>>,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CardData {
- pub card_number: CardNumber,
- pub exp_month: Secret<String>,
- pub exp_year: Secret<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub card_security_code: Option<Secret<String>>,
-}
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct OrderData {
- pub consent_id: String,
- pub customer_id: id_type::CustomerId,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct OrderData {
- pub consent_id: String,
- pub customer_id: id_type::GlobalCustomerId,
-}
-
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ApiPayload {
- pub service: String,
- pub card_data: Secret<String>, //encrypted card data
- pub order_data: OrderData,
- pub key_id: String,
- pub should_send_token: bool,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct CardNetworkTokenResponse {
- pub payload: Secret<String>, //encrypted payload
-}
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CardNetworkTokenResponsePayload {
- pub card_brand: api_enums::CardNetwork,
- pub card_fingerprint: Option<Secret<String>>,
- pub card_reference: String,
- pub correlation_id: String,
- pub customer_id: String,
- pub par: String,
- pub token: CardNumber,
- pub token_expiry_month: Secret<String>,
- pub token_expiry_year: Secret<String>,
- pub token_isin: String,
- pub token_last_four: String,
- pub token_status: String,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GenerateNetworkTokenResponsePayload {
- pub card_brand: api_enums::CardNetwork,
- pub card_fingerprint: Option<Secret<String>>,
- pub card_reference: String,
- pub correlation_id: String,
- pub customer_id: String,
- pub par: String,
- pub token: NetworkToken,
- pub token_expiry_month: Secret<String>,
- pub token_expiry_year: Secret<String>,
- pub token_isin: String,
- pub token_last_four: String,
- pub token_status: String,
-}
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Serialize)]
-pub struct GetCardToken {
- pub card_reference: String,
- pub customer_id: id_type::CustomerId,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Serialize)]
-pub struct GetCardToken {
- pub card_reference: String,
- pub customer_id: id_type::GlobalCustomerId,
-}
-#[derive(Debug, Deserialize)]
-pub struct AuthenticationDetails {
- pub cryptogram: Secret<String>,
- pub token: CardNumber, //network token
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct TokenDetails {
- pub exp_month: Secret<String>,
- pub exp_year: Secret<String>,
-}
-
-#[derive(Debug, Deserialize)]
-pub struct TokenResponse {
- pub authentication_details: AuthenticationDetails,
- pub network: api_enums::CardNetwork,
- pub token_details: TokenDetails,
-}
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Serialize, Deserialize)]
-pub struct DeleteCardToken {
- pub card_reference: String, //network token requestor ref id
- pub customer_id: id_type::CustomerId,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Serialize, Deserialize)]
-pub struct DeleteCardToken {
- pub card_reference: String, //network token requestor ref id
- pub customer_id: id_type::GlobalCustomerId,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-#[serde(rename_all = "UPPERCASE")]
-pub enum DeleteNetworkTokenStatus {
- Success,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct NetworkTokenErrorInfo {
- pub code: String,
- pub developer_message: String,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct NetworkTokenErrorResponse {
- pub error_message: String,
- pub error_info: NetworkTokenErrorInfo,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct DeleteNetworkTokenResponse {
- pub status: DeleteNetworkTokenStatus,
-}
-
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "payment_methods_v2")
-))]
-#[derive(Debug, Serialize, Deserialize)]
-pub struct CheckTokenStatus {
- pub card_reference: String,
- pub customer_id: id_type::CustomerId,
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, Serialize, Deserialize)]
-pub struct CheckTokenStatus {
- pub card_reference: String,
- pub customer_id: id_type::GlobalCustomerId,
-}
-
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "UPPERCASE")]
-pub enum TokenStatus {
- Active,
- Inactive,
-}
-
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CheckTokenStatusResponsePayload {
- pub token_expiry_month: Secret<String>,
- pub token_expiry_year: Secret<String>,
- pub token_status: TokenStatus,
-}
-
-#[derive(Debug, Deserialize)]
-pub struct CheckTokenStatusResponse {
- pub payload: CheckTokenStatusResponsePayload,
-}
#[cfg(all(
any(feature = "v1", feature = "v2"),
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 64a95778af3..3f253f7cc31 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -1884,3 +1884,21 @@ impl From<NetworkTokenDetails> for NetworkTokenDetailsPaymentMethod {
}
}
}
+
+impl From<NetworkTokenDetailsPaymentMethod> for payment_methods::NetworkTokenDetailsPaymentMethod {
+ fn from(item: NetworkTokenDetailsPaymentMethod) -> Self {
+ Self {
+ last4_digits: item.last4_digits,
+ issuer_country: item.issuer_country,
+ network_token_expiry_month: item.network_token_expiry_month,
+ network_token_expiry_year: item.network_token_expiry_year,
+ nick_name: item.nick_name,
+ card_holder_name: item.card_holder_name,
+ card_isin: item.card_isin,
+ card_issuer: item.card_issuer,
+ card_network: item.card_network,
+ card_type: item.card_type,
+ saved_to_locker: item.saved_to_locker,
+ }
+ }
+}
diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs
index 963ec83e0be..66fc6214eaa 100644
--- a/crates/hyperswitch_domain_models/src/payment_methods.rs
+++ b/crates/hyperswitch_domain_models/src/payment_methods.rs
@@ -20,7 +20,10 @@ use serde_json::Value;
use time::PrimitiveDateTime;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-use crate::{address::Address, type_encryption::OptionalEncryptableJsonType};
+use crate::{
+ address::Address, payment_method_data as domain_payment_method_data,
+ type_encryption::OptionalEncryptableJsonType,
+};
use crate::{
errors,
mandates::{self, CommonMandateReference},
@@ -116,7 +119,8 @@ pub struct PaymentMethod {
pub network_token_requestor_reference_id: Option<String>,
pub network_token_locker_id: Option<String>,
#[encrypt(ty = Value)]
- pub network_token_payment_method_data: Option<Encryptable<Value>>,
+ pub network_token_payment_method_data:
+ Option<Encryptable<domain_payment_method_data::PaymentMethodsData>>,
}
impl PaymentMethod {
@@ -512,11 +516,16 @@ impl super::behaviour::Conversion for PaymentMethod {
.change_context(common_utils::errors::CryptoError::DecodingFailed)
.attach_printable("Error while deserializing Payment Method Data")?;
- let network_token_payment_method_data =
- data.network_token_payment_method_data
- .map(|network_token_payment_method_data| {
- network_token_payment_method_data.map(|value| value.expose())
- });
+ let network_token_payment_method_data = data
+ .network_token_payment_method_data
+ .map(|network_token_payment_method_data| {
+ network_token_payment_method_data.deserialize_inner_value(|value| {
+ value.parse_value("Network token Payment Method Data")
+ })
+ })
+ .transpose()
+ .change_context(common_utils::errors::CryptoError::DecodingFailed)
+ .attach_printable("Error while deserializing Network token Payment Method Data")?;
Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self {
customer_id: storage_model.customer_id,
diff --git a/crates/hyperswitch_domain_models/src/vault.rs b/crates/hyperswitch_domain_models/src/vault.rs
new file mode 100644
index 00000000000..9aac1e1f18e
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/vault.rs
@@ -0,0 +1,54 @@
+use api_models::payment_methods;
+use serde::{Deserialize, Serialize};
+
+use crate::payment_method_data;
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub enum PaymentMethodVaultingData {
+ Card(payment_methods::CardDetail),
+ NetworkToken(payment_method_data::NetworkTokenDetails),
+}
+
+impl PaymentMethodVaultingData {
+ pub fn get_card(&self) -> Option<&payment_methods::CardDetail> {
+ match self {
+ Self::Card(card) => Some(card),
+ _ => None,
+ }
+ }
+ pub fn get_payment_methods_data(&self) -> payment_method_data::PaymentMethodsData {
+ match self {
+ Self::Card(card) => payment_method_data::PaymentMethodsData::Card(
+ payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
+ ),
+ Self::NetworkToken(network_token) => {
+ payment_method_data::PaymentMethodsData::NetworkToken(
+ payment_method_data::NetworkTokenDetailsPaymentMethod::from(
+ network_token.clone(),
+ ),
+ )
+ }
+ }
+ }
+}
+
+pub trait VaultingDataInterface {
+ fn get_vaulting_data_key(&self) -> String;
+}
+
+impl VaultingDataInterface for PaymentMethodVaultingData {
+ fn get_vaulting_data_key(&self) -> String {
+ match &self {
+ Self::Card(card) => card.card_number.to_string(),
+ Self::NetworkToken(network_token) => network_token.network_token.to_string(),
+ }
+ }
+}
+
+impl From<payment_methods::PaymentMethodCreateData> for PaymentMethodVaultingData {
+ fn from(item: payment_methods::PaymentMethodCreateData) -> Self {
+ match item {
+ payment_methods::PaymentMethodCreateData::Card(card) => Self::Card(card),
+ }
+ }
+}
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index d82bef27d1f..64b2b817252 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -446,6 +446,12 @@ pub enum NetworkTokenizationError {
NetworkTokenizationServiceNotConfigured,
#[error("Failed while calling Network Token Service API")]
ApiError,
+ #[error("Network Tokenization is not enabled for profile")]
+ NetworkTokenizationNotEnabledForProfile,
+ #[error("Network Tokenization is not supported for {message}")]
+ NotSupported { message: String },
+ #[error("Failed to encrypt the NetworkToken payment method details")]
+ NetworkTokenDetailsEncryptionFailed,
}
#[derive(Debug, thiserror::Error)]
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 08968997243..5893fbc6853 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -933,11 +933,9 @@ pub async fn create_payment_method_core(
.await
.attach_printable("Failed to add Payment method to DB")?;
- let payment_method_data =
- pm_types::PaymentMethodVaultingData::from(req.payment_method_data.clone());
-
- let payment_method_data =
- populate_bin_details_for_payment_method(state, &payment_method_data).await;
+ let payment_method_data = domain::PaymentMethodVaultingData::from(req.payment_method_data)
+ .populate_bin_details_for_payment_method(state)
+ .await;
let vaulting_result = vault_payment_method(
state,
@@ -958,15 +956,7 @@ pub async fn create_payment_method_core(
profile.is_network_tokenization_enabled,
&customer_id,
)
- .await
- .map_err(|e| {
- services::logger::error!(
- "Failed to network tokenize the payment method for customer: {}. Error: {} ",
- customer_id.get_string_repr(),
- e
- );
- })
- .ok();
+ .await;
let (response, payment_method) = match vaulting_result {
Ok((vaulting_resp, fingerprint_id)) => {
@@ -1035,86 +1025,83 @@ pub struct NetworkTokenPaymentMethodDetails {
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn network_tokenize_and_vault_the_pmd(
state: &SessionState,
- payment_method_data: &pm_types::PaymentMethodVaultingData,
+ payment_method_data: &domain::PaymentMethodVaultingData,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
network_tokenization_enabled_for_profile: bool,
customer_id: &id_type::GlobalCustomerId,
-) -> RouterResult<NetworkTokenPaymentMethodDetails> {
- when(!network_tokenization_enabled_for_profile, || {
- Err(report!(errors::ApiErrorResponse::NotSupported {
- message: "Network Tokenization is not enabled for this payment method".to_string()
- }))
- })?;
-
- let is_network_tokenization_enabled_for_pm = network_tokenization
- .as_ref()
- .map(|nt| matches!(nt.enable, common_enums::NetworkTokenizationToggle::Enable))
- .unwrap_or(false);
-
- let card_data = match payment_method_data {
- pm_types::PaymentMethodVaultingData::Card(data)
- if is_network_tokenization_enabled_for_pm =>
- {
- Ok(data)
- }
- _ => Err(report!(errors::ApiErrorResponse::NotSupported {
- message: "Network Tokenization is not supported for this payment method".to_string()
- })),
- }?;
-
- let (resp, network_token_req_ref_id) =
- network_tokenization::make_card_network_tokenization_request(state, card_data, customer_id)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to generate network token")?;
+) -> Option<NetworkTokenPaymentMethodDetails> {
+ let network_token_pm_details_result: errors::CustomResult<
+ NetworkTokenPaymentMethodDetails,
+ errors::NetworkTokenizationError,
+ > = async {
+ when(!network_tokenization_enabled_for_profile, || {
+ Err(report!(
+ errors::NetworkTokenizationError::NetworkTokenizationNotEnabledForProfile
+ ))
+ })?;
- let network_token_vaulting_data = pm_types::PaymentMethodVaultingData::NetworkToken(resp);
- let vaulting_resp = vault::add_payment_method_to_vault(
- state,
- merchant_account,
- &network_token_vaulting_data,
- None,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to vault the network token data")?;
+ let is_network_tokenization_enabled_for_pm = network_tokenization
+ .as_ref()
+ .map(|nt| matches!(nt.enable, common_enums::NetworkTokenizationToggle::Enable))
+ .unwrap_or(false);
+
+ let card_data = payment_method_data
+ .get_card()
+ .and_then(|card| is_network_tokenization_enabled_for_pm.then_some(card))
+ .ok_or_else(|| {
+ report!(errors::NetworkTokenizationError::NotSupported {
+ message: "Payment method".to_string(),
+ })
+ })?;
- let key_manager_state = &(state).into();
- let network_token = match network_token_vaulting_data {
- pm_types::PaymentMethodVaultingData::Card(card) => {
- payment_method_data::PaymentMethodsData::Card(
- payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
- )
- }
- pm_types::PaymentMethodVaultingData::NetworkToken(network_token) => {
- payment_method_data::PaymentMethodsData::NetworkToken(
- payment_method_data::NetworkTokenDetailsPaymentMethod::from(network_token.clone()),
+ let (resp, network_token_req_ref_id) =
+ network_tokenization::make_card_network_tokenization_request(
+ state,
+ card_data,
+ customer_id,
)
- }
- };
+ .await?;
- let network_token_pmd =
- cards::create_encrypted_data(key_manager_state, key_store, network_token)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to encrypt Payment method data")?;
+ let network_token_vaulting_data = domain::PaymentMethodVaultingData::NetworkToken(resp);
+ let vaulting_resp = vault::add_payment_method_to_vault(
+ state,
+ merchant_account,
+ &network_token_vaulting_data,
+ None,
+ )
+ .await
+ .change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
+ .attach_printable("Failed to vault network token")?;
- Ok(NetworkTokenPaymentMethodDetails {
- network_token_requestor_reference_id: network_token_req_ref_id,
- network_token_locker_id: vaulting_resp.vault_id.get_string_repr().clone(),
- network_token_pmd,
- })
+ let key_manager_state = &(state).into();
+ let network_token_pmd = cards::create_encrypted_data(
+ key_manager_state,
+ key_store,
+ network_token_vaulting_data.get_payment_methods_data(),
+ )
+ .await
+ .change_context(errors::NetworkTokenizationError::NetworkTokenDetailsEncryptionFailed)
+ .attach_printable("Failed to encrypt PaymentMethodsData")?;
+
+ Ok(NetworkTokenPaymentMethodDetails {
+ network_token_requestor_reference_id: network_token_req_ref_id,
+ network_token_locker_id: vaulting_resp.vault_id.get_string_repr().clone(),
+ network_token_pmd,
+ })
+ }
+ .await;
+ network_token_pm_details_result.ok()
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn populate_bin_details_for_payment_method(
state: &SessionState,
- payment_method_data: &pm_types::PaymentMethodVaultingData,
-) -> pm_types::PaymentMethodVaultingData {
+ payment_method_data: &domain::PaymentMethodVaultingData,
+) -> domain::PaymentMethodVaultingData {
match payment_method_data {
- pm_types::PaymentMethodVaultingData::Card(card) => {
+ domain::PaymentMethodVaultingData::Card(card) => {
let card_isin = card.card_number.get_card_isin();
if card.card_issuer.is_some()
@@ -1122,7 +1109,7 @@ pub async fn populate_bin_details_for_payment_method(
&& card.card_type.is_some()
&& card.card_issuing_country.is_some()
{
- pm_types::PaymentMethodVaultingData::Card(card.clone())
+ domain::PaymentMethodVaultingData::Card(card.clone())
} else {
let card_info = state
.store
@@ -1132,7 +1119,7 @@ pub async fn populate_bin_details_for_payment_method(
.ok()
.flatten();
- pm_types::PaymentMethodVaultingData::Card(payment_methods::CardDetail {
+ domain::PaymentMethodVaultingData::Card(payment_methods::CardDetail {
card_number: card.card_number.clone(),
card_exp_month: card.card_exp_month.clone(),
card_exp_year: card.card_exp_year.clone(),
@@ -1163,6 +1150,67 @@ pub async fn populate_bin_details_for_payment_method(
_ => payment_method_data.clone(),
}
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[async_trait::async_trait]
+pub trait PaymentMethodExt {
+ async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self;
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[async_trait::async_trait]
+impl PaymentMethodExt for domain::PaymentMethodVaultingData {
+ async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self {
+ match self {
+ Self::Card(card) => {
+ let card_isin = card.card_number.get_card_isin();
+
+ if card.card_issuer.is_some()
+ && card.card_network.is_some()
+ && card.card_type.is_some()
+ && card.card_issuing_country.is_some()
+ {
+ Self::Card(card.clone())
+ } else {
+ let card_info = state
+ .store
+ .get_card_info(&card_isin)
+ .await
+ .map_err(|error| services::logger::error!(card_info_error=?error))
+ .ok()
+ .flatten();
+
+ Self::Card(payment_methods::CardDetail {
+ card_number: card.card_number.clone(),
+ card_exp_month: card.card_exp_month.clone(),
+ card_exp_year: card.card_exp_year.clone(),
+ card_holder_name: card.card_holder_name.clone(),
+ nick_name: card.nick_name.clone(),
+ card_issuing_country: card_info.as_ref().and_then(|val| {
+ val.card_issuing_country
+ .as_ref()
+ .map(|c| api_enums::CountryAlpha2::from_str(c))
+ .transpose()
+ .ok()
+ .flatten()
+ }),
+ card_network: card_info.as_ref().and_then(|val| val.card_network.clone()),
+ card_issuer: card_info.as_ref().and_then(|val| val.card_issuer.clone()),
+ card_type: card_info.as_ref().and_then(|val| {
+ val.card_type
+ .as_ref()
+ .map(|c| payment_methods::CardType::from_str(c))
+ .transpose()
+ .ok()
+ .flatten()
+ }),
+ card_cvc: card.card_cvc.clone(),
+ })
+ }
+ }
+ _ => self.clone(),
+ }
+ }
+}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[instrument(skip_all)]
@@ -1557,7 +1605,7 @@ fn create_connector_token_details_update(
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[allow(clippy::too_many_arguments)]
pub async fn create_pm_additional_data_update(
- payment_method_vaulting_data: Option<&pm_types::PaymentMethodVaultingData>,
+ pmd: Option<&domain::PaymentMethodVaultingData>,
state: &SessionState,
key_store: &domain::MerchantKeyStore,
vault_id: Option<String>,
@@ -1568,15 +1616,15 @@ pub async fn create_pm_additional_data_update(
payment_method_type: Option<common_enums::PaymentMethod>,
payment_method_subtype: Option<common_enums::PaymentMethodType>,
) -> RouterResult<storage::PaymentMethodUpdate> {
- let encrypted_payment_method_data = payment_method_vaulting_data
+ let encrypted_payment_method_data = pmd
.map(
|payment_method_vaulting_data| match payment_method_vaulting_data {
- pm_types::PaymentMethodVaultingData::Card(card) => {
+ domain::PaymentMethodVaultingData::Card(card) => {
payment_method_data::PaymentMethodsData::Card(
payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
)
}
- pm_types::PaymentMethodVaultingData::NetworkToken(network_token) => {
+ domain::PaymentMethodVaultingData::NetworkToken(network_token) => {
payment_method_data::PaymentMethodsData::NetworkToken(
payment_method_data::NetworkTokenDetailsPaymentMethod::from(
network_token.clone(),
@@ -1625,7 +1673,7 @@ pub async fn create_pm_additional_data_update(
#[instrument(skip_all)]
pub async fn vault_payment_method(
state: &SessionState,
- pmd: &pm_types::PaymentMethodVaultingData,
+ pmd: &domain::PaymentMethodVaultingData,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
existing_vault_id: Option<domain::VaultId>,
@@ -1893,11 +1941,12 @@ pub async fn update_payment_method_core(
},
)?;
- let pmd = vault::retrieve_payment_method_from_vault(state, merchant_account, &payment_method)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to retrieve payment method from vault")?
- .data;
+ let pmd: domain::PaymentMethodVaultingData =
+ vault::retrieve_payment_method_from_vault(state, merchant_account, &payment_method)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to retrieve payment method from vault")?
+ .data;
let vault_request_data = request.payment_method_data.map(|payment_method_data| {
pm_transforms::generate_pm_vaulting_req_from_update_request(pmd, payment_method_data)
diff --git a/crates/router/src/core/payment_methods/network_tokenization.rs b/crates/router/src/core/payment_methods/network_tokenization.rs
index 41a94402baf..8aa371e7a73 100644
--- a/crates/router/src/core/payment_methods/network_tokenization.rs
+++ b/crates/router/src/core/payment_methods/network_tokenization.rs
@@ -30,7 +30,7 @@ use crate::{
routes::{self, metrics},
services::{self, encryption},
settings,
- types::{api, domain},
+ types::{api, domain, payment_methods as pm_types},
};
pub const NETWORK_TOKEN_SERVICE: &str = "NETWORK_TOKEN";
@@ -45,7 +45,7 @@ pub async fn mk_tokenization_req(
customer_id: id_type::CustomerId,
tokenization_service: &settings::NetworkTokenizationService,
) -> CustomResult<
- (domain::CardNetworkTokenResponsePayload, Option<String>),
+ (pm_types::CardNetworkTokenResponsePayload, Option<String>),
errors::NetworkTokenizationError,
> {
let enc_key = tokenization_service.public_key.peek().clone();
@@ -62,12 +62,12 @@ pub async fn mk_tokenization_req(
.change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
.attach_printable("Error on jwe encrypt")?;
- let order_data = domain::OrderData {
+ let order_data = pm_types::OrderData {
consent_id: uuid::Uuid::new_v4().to_string(),
customer_id,
};
- let api_payload = domain::ApiPayload {
+ let api_payload = pm_types::ApiPayload {
service: NETWORK_TOKEN_SERVICE.to_string(),
card_data: Secret::new(jwt),
order_data,
@@ -103,7 +103,7 @@ pub async fn mk_tokenization_req(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -124,7 +124,7 @@ pub async fn mk_tokenization_req(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let network_response: domain::CardNetworkTokenResponse = res
+ let network_response: pm_types::CardNetworkTokenResponse = res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
@@ -143,7 +143,7 @@ pub async fn mk_tokenization_req(
"Failed to decrypt the tokenization response from the tokenization service",
)?;
- let cn_response: domain::CardNetworkTokenResponsePayload =
+ let cn_response: pm_types::CardNetworkTokenResponsePayload =
serde_json::from_str(&card_network_token_response)
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
Ok((cn_response.clone(), Some(cn_response.card_reference)))
@@ -156,7 +156,7 @@ pub async fn generate_network_token(
customer_id: id_type::GlobalCustomerId,
tokenization_service: &settings::NetworkTokenizationService,
) -> CustomResult<
- (domain::GenerateNetworkTokenResponsePayload, String),
+ (pm_types::GenerateNetworkTokenResponsePayload, String),
errors::NetworkTokenizationError,
> {
let enc_key = tokenization_service.public_key.peek().clone();
@@ -173,12 +173,12 @@ pub async fn generate_network_token(
.change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
.attach_printable("Error on jwe encrypt")?;
- let order_data = domain::OrderData {
+ let order_data = pm_types::OrderData {
consent_id: uuid::Uuid::new_v4().to_string(),
customer_id,
};
- let api_payload = domain::ApiPayload {
+ let api_payload = pm_types::ApiPayload {
service: NETWORK_TOKEN_SERVICE.to_string(),
card_data: Secret::new(jwt),
order_data,
@@ -214,7 +214,7 @@ pub async fn generate_network_token(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -235,7 +235,7 @@ pub async fn generate_network_token(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let network_response: domain::CardNetworkTokenResponse = res
+ let network_response: pm_types::CardNetworkTokenResponse = res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
@@ -255,7 +255,7 @@ pub async fn generate_network_token(
"Failed to decrypt the tokenization response from the tokenization service",
)?;
- let cn_response: domain::GenerateNetworkTokenResponsePayload =
+ let cn_response: pm_types::GenerateNetworkTokenResponsePayload =
serde_json::from_str(&card_network_token_response)
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
Ok((cn_response.clone(), cn_response.card_reference))
@@ -271,10 +271,10 @@ pub async fn make_card_network_tokenization_request(
optional_cvc: Option<Secret<String>>,
customer_id: &id_type::CustomerId,
) -> CustomResult<
- (domain::CardNetworkTokenResponsePayload, Option<String>),
+ (pm_types::CardNetworkTokenResponsePayload, Option<String>),
errors::NetworkTokenizationError,
> {
- let card_data = domain::CardData {
+ let card_data = pm_types::CardData {
card_number: card.card_number.clone(),
exp_month: card.card_exp_month.clone(),
exp_year: card.card_exp_year.clone(),
@@ -320,7 +320,7 @@ pub async fn make_card_network_tokenization_request(
card: &api_payment_methods::CardDetail,
customer_id: &id_type::GlobalCustomerId,
) -> CustomResult<(NetworkTokenDetails, String), errors::NetworkTokenizationError> {
- let card_data = domain::CardData {
+ let card_data = pm_types::CardData {
card_number: card.card_number.clone(),
exp_month: card.card_exp_month.clone(),
exp_year: card.card_exp_year.clone(),
@@ -376,12 +376,12 @@ pub async fn get_network_token(
customer_id: id_type::CustomerId,
network_token_requestor_ref_id: String,
tokenization_service: &settings::NetworkTokenizationService,
-) -> CustomResult<domain::TokenResponse, errors::NetworkTokenizationError> {
+) -> CustomResult<pm_types::TokenResponse, errors::NetworkTokenizationError> {
let mut request = services::Request::new(
services::Method::Post,
tokenization_service.fetch_token_url.as_str(),
);
- let payload = domain::GetCardToken {
+ let payload = pm_types::GetCardToken {
card_reference: network_token_requestor_ref_id,
customer_id,
};
@@ -411,7 +411,7 @@ pub async fn get_network_token(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -429,7 +429,7 @@ pub async fn get_network_token(
Ok(res) => Ok(res),
})?;
- let token_response: domain::TokenResponse = res
+ let token_response: pm_types::TokenResponse = res
.response
.parse_struct("Get Network Token Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
@@ -444,12 +444,12 @@ pub async fn get_network_token(
customer_id: &id_type::GlobalCustomerId,
network_token_requestor_ref_id: String,
tokenization_service: &settings::NetworkTokenizationService,
-) -> CustomResult<domain::TokenResponse, errors::NetworkTokenizationError> {
+) -> CustomResult<pm_types::TokenResponse, errors::NetworkTokenizationError> {
let mut request = services::Request::new(
services::Method::Post,
tokenization_service.fetch_token_url.as_str(),
);
- let payload = domain::GetCardToken {
+ let payload = pm_types::GetCardToken {
card_reference: network_token_requestor_ref_id,
customer_id: customer_id.clone(),
};
@@ -479,7 +479,7 @@ pub async fn get_network_token(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -497,7 +497,7 @@ pub async fn get_network_token(
Ok(res) => Ok(res),
})?;
- let token_response: domain::TokenResponse = res
+ let token_response: pm_types::TokenResponse = res
.response
.parse_struct("Get Network Token Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
@@ -656,7 +656,7 @@ pub async fn check_token_status_with_tokenization_service(
services::Method::Post,
tokenization_service.check_token_status_url.as_str(),
);
- let payload = domain::CheckTokenStatus {
+ let payload = pm_types::CheckTokenStatus {
card_reference: network_token_requestor_reference_id,
customer_id: customer_id.clone(),
};
@@ -683,7 +683,7 @@ pub async fn check_token_status_with_tokenization_service(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(
@@ -704,17 +704,17 @@ pub async fn check_token_status_with_tokenization_service(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let check_token_status_response: domain::CheckTokenStatusResponse = res
+ let check_token_status_response: pm_types::CheckTokenStatusResponse = res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
match check_token_status_response.payload.token_status {
- domain::TokenStatus::Active => Ok((
+ pm_types::TokenStatus::Active => Ok((
Some(check_token_status_response.payload.token_expiry_month),
Some(check_token_status_response.payload.token_expiry_year),
)),
- domain::TokenStatus::Inactive => Ok((None, None)),
+ pm_types::TokenStatus::Inactive => Ok((None, None)),
}
}
@@ -791,7 +791,7 @@ pub async fn delete_network_token_from_tokenization_service(
services::Method::Post,
tokenization_service.delete_token_url.as_str(),
);
- let payload = domain::DeleteCardToken {
+ let payload = pm_types::DeleteCardToken {
card_reference: network_token_requestor_reference_id,
customer_id: customer_id.clone(),
};
@@ -820,7 +820,7 @@ pub async fn delete_network_token_from_tokenization_service(
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ let parsed_error: pm_types::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(
@@ -841,14 +841,14 @@ pub async fn delete_network_token_from_tokenization_service(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let delete_token_response: domain::DeleteNetworkTokenResponse = res
+ let delete_token_response: pm_types::DeleteNetworkTokenResponse = res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
logger::info!("Delete Network Token Response: {:?}", delete_token_response);
- if delete_token_response.status == domain::DeleteNetworkTokenStatus::Success {
+ if delete_token_response.status == pm_types::DeleteNetworkTokenStatus::Success {
Ok(true)
} else {
Err(errors::NetworkTokenizationError::DeleteNetworkTokenFailed)
diff --git a/crates/router/src/core/payment_methods/tokenize.rs b/crates/router/src/core/payment_methods/tokenize.rs
index 853d3c0a2bd..bd0a5a2192b 100644
--- a/crates/router/src/core/payment_methods/tokenize.rs
+++ b/crates/router/src/core/payment_methods/tokenize.rs
@@ -7,9 +7,7 @@ use common_utils::{
transformers::{ForeignFrom, ForeignTryFrom},
};
use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::{
- network_tokenization as nt_domain_types, router_request_types as domain_request_types,
-};
+use hyperswitch_domain_models::router_request_types as domain_request_types;
use masking::{ExposeInterface, Secret};
use router_env::logger;
@@ -21,7 +19,7 @@ use crate::{
},
errors::{self, RouterResult},
services,
- types::{api, domain},
+ types::{api, domain, payment_methods as pm_types},
SessionState,
};
@@ -137,10 +135,7 @@ pub async fn tokenize_cards(
}
// Data types
-type NetworkTokenizationResponse = (
- nt_domain_types::CardNetworkTokenResponsePayload,
- Option<String>,
-);
+type NetworkTokenizationResponse = (pm_types::CardNetworkTokenResponsePayload, Option<String>);
pub struct StoreLockerResponse {
pub store_card_resp: pm_transformers::StoreCardRespPayload,
@@ -162,7 +157,7 @@ pub struct NetworkTokenizationBuilder<'a, S: State> {
pub card_cvc: Option<Secret<String>>,
/// Network token details
- pub network_token: Option<&'a nt_domain_types::CardNetworkTokenResponsePayload>,
+ pub network_token: Option<&'a pm_types::CardNetworkTokenResponsePayload>,
/// Stored card details
pub stored_card: Option<&'a pm_transformers::StoreCardRespPayload>,
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index 233dade651c..87f7e38c935 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -522,14 +522,14 @@ pub fn mk_add_card_response_hs(
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub fn generate_pm_vaulting_req_from_update_request(
- pm_create: pm_types::PaymentMethodVaultingData,
+ pm_create: domain::PaymentMethodVaultingData,
pm_update: api::PaymentMethodUpdateData,
-) -> pm_types::PaymentMethodVaultingData {
+) -> domain::PaymentMethodVaultingData {
match (pm_create, pm_update) {
(
- pm_types::PaymentMethodVaultingData::Card(card_create),
+ domain::PaymentMethodVaultingData::Card(card_create),
api::PaymentMethodUpdateData::Card(update_card),
- ) => pm_types::PaymentMethodVaultingData::Card(api::CardDetail {
+ ) => domain::PaymentMethodVaultingData::Card(api::CardDetail {
card_number: card_create.card_number,
card_exp_month: card_create.card_exp_month,
card_exp_year: card_create.card_exp_year,
@@ -571,6 +571,20 @@ pub fn generate_payment_method_response(
.map(transformers::ForeignFrom::foreign_from)
.collect::<Vec<_>>()
});
+ let network_token_pmd = payment_method
+ .network_token_payment_method_data
+ .clone()
+ .map(|data| data.into_inner())
+ .and_then(|data| match data {
+ domain::PaymentMethodsData::NetworkToken(token) => {
+ Some(api::NetworkTokenDetailsPaymentMethod::from(token))
+ }
+ _ => None,
+ });
+
+ let network_token = network_token_pmd.map(|pmd| api::NetworkTokenResponse {
+ payment_method_data: pmd,
+ });
let resp = api::PaymentMethodResponse {
merchant_id: payment_method.merchant_id.to_owned(),
@@ -583,6 +597,7 @@ pub fn generate_payment_method_response(
last_used_at: Some(payment_method.last_used_at),
payment_method_data: pmd,
connector_tokens,
+ network_token,
};
Ok(resp)
@@ -839,15 +854,6 @@ pub fn get_card_detail(
Ok(card_detail)
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-impl From<api::PaymentMethodCreateData> for pm_types::PaymentMethodVaultingData {
- fn from(item: api::PaymentMethodCreateData) -> Self {
- match item {
- api::PaymentMethodCreateData::Card(card) => Self::Card(card),
- }
- }
-}
-
//------------------------------------------------TokenizeService------------------------------------------------
pub fn mk_crud_locker_request(
locker: &settings::Locker,
@@ -961,6 +967,21 @@ impl transformers::ForeignTryFrom<domain::PaymentMethod> for api::CustomerPaymen
.map(|billing| billing.into_inner())
.map(From::from);
+ let network_token_pmd = item
+ .network_token_payment_method_data
+ .clone()
+ .map(|data| data.into_inner())
+ .and_then(|data| match data {
+ domain::PaymentMethodsData::NetworkToken(token) => {
+ Some(api::NetworkTokenDetailsPaymentMethod::from(token))
+ }
+ _ => None,
+ });
+
+ let network_token_resp = network_token_pmd.map(|pmd| api::NetworkTokenResponse {
+ payment_method_data: pmd,
+ });
+
// TODO: check how we can get this field
let recurring_enabled = true;
@@ -977,6 +998,7 @@ impl transformers::ForeignTryFrom<domain::PaymentMethod> for api::CustomerPaymen
requires_cvv: true,
is_default: false,
billing: payment_method_billing,
+ network_tokenization: network_token_resp,
})
}
}
@@ -1033,7 +1055,7 @@ impl transformers::ForeignFrom<api_models::payment_methods::ConnectorTokenDetail
} = item;
Self {
- connector_token: token,
+ connector_token: token.expose().clone(),
// TODO: check why do we need this field
payment_method_subtype: None,
original_payment_authorized_amount,
@@ -1075,7 +1097,7 @@ impl
original_payment_authorized_amount,
original_payment_authorized_currency,
metadata,
- token: connector_token,
+ token: Secret::new(connector_token),
// Token that is derived from payments mandate reference will always be multi use token
token_type: common_enums::TokenizationType::MultiUse,
}
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index f65f048885c..0325acd5991 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1252,9 +1252,7 @@ pub async fn call_to_vault<V: pm_types::VaultingInterface>(
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[instrument(skip_all)]
-pub async fn get_fingerprint_id_from_vault<
- D: pm_types::VaultingDataInterface + serde::Serialize,
->(
+pub async fn get_fingerprint_id_from_vault<D: domain::VaultingDataInterface + serde::Serialize>(
state: &routes::SessionState,
data: &D,
key: String,
@@ -1286,7 +1284,7 @@ pub async fn get_fingerprint_id_from_vault<
pub async fn add_payment_method_to_vault(
state: &routes::SessionState,
merchant_account: &domain::MerchantAccount,
- pmd: &pm_types::PaymentMethodVaultingData,
+ pmd: &domain::PaymentMethodVaultingData,
existing_vault_id: Option<domain::VaultId>,
) -> CustomResult<pm_types::AddVaultResponse, errors::VaultError> {
let payload = pm_types::AddVaultRequest {
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 1c69852a108..bcf0d624ff9 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -2613,7 +2613,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::SetupMandateRe
original_payment_authorized_amount: Some(net_amount),
original_payment_authorized_currency: Some(currency),
metadata: None,
- token,
+ token: masking::Secret::new(token),
token_type: common_enums::TokenizationType::MultiUse,
};
diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs
index 87475fcd89a..9c5030a30a0 100644
--- a/crates/router/src/types/api/payment_methods.rs
+++ b/crates/router/src/types/api/payment_methods.rs
@@ -4,14 +4,15 @@ pub use api_models::payment_methods::{
CardNetworkTokenizeResponse, CardType, CustomerPaymentMethod,
CustomerPaymentMethodsListResponse, DeleteTokenizeByTokenRequest, GetTokenizePayloadRequest,
GetTokenizePayloadResponse, ListCountriesCurrenciesRequest, MigrateCardDetail,
- PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, PaymentMethodCreate,
- PaymentMethodCreateData, PaymentMethodDeleteResponse, PaymentMethodId,
- PaymentMethodIntentConfirm, PaymentMethodIntentCreate, PaymentMethodListData,
- PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodMigrate,
- PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodResponseData,
- PaymentMethodUpdate, PaymentMethodUpdateData, PaymentMethodsData, TokenizePayloadEncrypted,
- TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1,
- TokenizedWalletValue2, TotalPaymentMethodCountResponse,
+ NetworkTokenDetailsPaymentMethod, NetworkTokenResponse, PaymentMethodCollectLinkRenderRequest,
+ PaymentMethodCollectLinkRequest, PaymentMethodCreate, PaymentMethodCreateData,
+ PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodIntentConfirm,
+ PaymentMethodIntentCreate, PaymentMethodListData, PaymentMethodListRequest,
+ PaymentMethodListResponse, PaymentMethodMigrate, PaymentMethodMigrateResponse,
+ PaymentMethodResponse, PaymentMethodResponseData, PaymentMethodUpdate, PaymentMethodUpdateData,
+ PaymentMethodsData, TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1,
+ TokenizedCardValue2, TokenizedWalletValue1, TokenizedWalletValue2,
+ TotalPaymentMethodCountResponse,
};
#[cfg(all(
any(feature = "v2", feature = "v1"),
diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs
index 51f07fd6d2e..88bc1bbd34f 100644
--- a/crates/router/src/types/domain.rs
+++ b/crates/router/src/types/domain.rs
@@ -40,6 +40,15 @@ pub mod payment_methods {
pub mod consts {
pub use hyperswitch_domain_models::consts::*;
}
+pub mod payment_method_data {
+ pub use hyperswitch_domain_models::payment_method_data::*;
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub mod vault {
+ pub use hyperswitch_domain_models::vault::*;
+}
+
pub mod payments;
pub mod types;
#[cfg(feature = "olap")]
@@ -54,8 +63,10 @@ pub use event::*;
pub use merchant_connector_account::*;
pub use merchant_key_store::*;
pub use network_tokenization::*;
+pub use payment_method_data::*;
pub use payment_methods::*;
-pub use payments::*;
#[cfg(feature = "olap")]
pub use user::*;
pub use user_key_store::*;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub use vault::*;
diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rs
index d639bc44bc8..2f580b7d3ee 100644
--- a/crates/router/src/types/payment_methods.rs
+++ b/crates/router/src/types/payment_methods.rs
@@ -1,9 +1,20 @@
+use std::fmt::Debug;
+
+use api_models::enums as api_enums;
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+use cards::CardNumber;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use cards::{CardNumber, NetworkToken};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use common_utils::generate_id;
+use common_utils::id_type;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use hyperswitch_domain_models::payment_method_data::NetworkTokenDetails;
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use masking::Secret;
+use serde::{Deserialize, Serialize};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use crate::{
@@ -18,11 +29,6 @@ pub trait VaultingInterface {
fn get_vaulting_flow_name() -> &'static str;
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-pub trait VaultingDataInterface {
- fn get_vaulting_data_key(&self) -> String;
-}
-
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultFingerprintRequest {
@@ -39,7 +45,7 @@ pub struct VaultFingerprintResponse {
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct AddVaultRequest<D> {
- pub entity_id: common_utils::id_type::MerchantId,
+ pub entity_id: id_type::MerchantId,
pub vault_id: domain::VaultId,
pub data: D,
pub ttl: i64,
@@ -48,7 +54,7 @@ pub struct AddVaultRequest<D> {
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct AddVaultResponse {
- pub entity_id: common_utils::id_type::MerchantId,
+ pub entity_id: id_type::MerchantId,
pub vault_id: domain::VaultId,
pub fingerprint_id: Option<String>,
}
@@ -113,23 +119,6 @@ impl VaultingInterface for VaultDelete {
}
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
-pub enum PaymentMethodVaultingData {
- Card(api::CardDetail),
- NetworkToken(NetworkTokenDetails),
-}
-
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-impl VaultingDataInterface for PaymentMethodVaultingData {
- fn get_vaulting_data_key(&self) -> String {
- match &self {
- Self::Card(card) => card.card_number.to_string(),
- Self::NetworkToken(network_token) => network_token.network_token.to_string(),
- }
- }
-}
-
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub struct SavedPMLPaymentsInfo {
pub payment_intent: storage::PaymentIntent,
@@ -142,26 +131,235 @@ pub struct SavedPMLPaymentsInfo {
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultRetrieveRequest {
- pub entity_id: common_utils::id_type::MerchantId,
+ pub entity_id: id_type::MerchantId,
pub vault_id: domain::VaultId,
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultRetrieveResponse {
- pub data: PaymentMethodVaultingData,
+ pub data: domain::PaymentMethodVaultingData,
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultDeleteRequest {
- pub entity_id: common_utils::id_type::MerchantId,
+ pub entity_id: id_type::MerchantId,
pub vault_id: domain::VaultId,
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultDeleteResponse {
- pub entity_id: common_utils::id_type::MerchantId,
+ pub entity_id: id_type::MerchantId,
pub vault_id: domain::VaultId,
}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardData {
+ pub card_number: CardNumber,
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+ pub card_security_code: Option<Secret<String>>,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardData {
+ pub card_number: CardNumber,
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub card_security_code: Option<Secret<String>>,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderData {
+ pub consent_id: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderData {
+ pub consent_id: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApiPayload {
+ pub service: String,
+ pub card_data: Secret<String>, //encrypted card data
+ pub order_data: OrderData,
+ pub key_id: String,
+ pub should_send_token: bool,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct CardNetworkTokenResponse {
+ pub payload: Secret<String>, //encrypted payload
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardNetworkTokenResponsePayload {
+ pub card_brand: api_enums::CardNetwork,
+ pub card_fingerprint: Option<Secret<String>>,
+ pub card_reference: String,
+ pub correlation_id: String,
+ pub customer_id: String,
+ pub par: String,
+ pub token: CardNumber,
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_isin: String,
+ pub token_last_four: String,
+ pub token_status: String,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GenerateNetworkTokenResponsePayload {
+ pub card_brand: api_enums::CardNetwork,
+ pub card_fingerprint: Option<Secret<String>>,
+ pub card_reference: String,
+ pub correlation_id: String,
+ pub customer_id: String,
+ pub par: String,
+ pub token: NetworkToken,
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_isin: String,
+ pub token_last_four: String,
+ pub token_status: String,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize)]
+pub struct GetCardToken {
+ pub card_reference: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize)]
+pub struct GetCardToken {
+ pub card_reference: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+#[derive(Debug, Deserialize)]
+pub struct AuthenticationDetails {
+ pub cryptogram: Secret<String>,
+ pub token: CardNumber, //network token
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TokenDetails {
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct TokenResponse {
+ pub authentication_details: AuthenticationDetails,
+ pub network: api_enums::CardNetwork,
+ pub token_details: TokenDetails,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DeleteCardToken {
+ pub card_reference: String, //network token requestor ref id
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DeleteCardToken {
+ pub card_reference: String, //network token requestor ref id
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum DeleteNetworkTokenStatus {
+ Success,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct NetworkTokenErrorInfo {
+ pub code: String,
+ pub developer_message: String,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct NetworkTokenErrorResponse {
+ pub error_message: String,
+ pub error_info: NetworkTokenErrorInfo,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct DeleteNetworkTokenResponse {
+ pub status: DeleteNetworkTokenStatus,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CheckTokenStatus {
+ pub card_reference: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CheckTokenStatus {
+ pub card_reference: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum TokenStatus {
+ Active,
+ Inactive,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CheckTokenStatusResponsePayload {
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_status: TokenStatus,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct CheckTokenStatusResponse {
+ pub payload: CheckTokenStatusResponsePayload,
+}
|
2025-02-19T10:30:38Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Refactor network tokenization flow for v2 payment method.
1. moved the network tokenization req, response types from domain to router types, since the types are not generic for Hyperswitch but req and response types of token service.
2. replaced hanging functions to impl based in the flow
3. Update ListCustomerPaymentMethod response and Payment Method response with network token details.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
4. `crates/router/src/configs`
5. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3667a7ffd216e165e1f51ad1ceac05d6901bb187
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7495
|
Bug: refactor(connector): [BILLWERK, FISERVEMEA, TSYS] use LazyLock instead of lazy_static!
Use LazyLock instead of lazy_static!
|
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
index 4d76dcd5706..4d5e324b39f 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
@@ -1,5 +1,7 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};
use base64::Engine;
use common_enums::enums;
@@ -44,7 +46,6 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
};
-use lazy_static::lazy_static;
use masking::{Mask, PeekInterface};
use transformers::{
self as billwerk, BillwerkAuthType, BillwerkCaptureRequest, BillwerkErrorResponse,
@@ -808,8 +809,8 @@ impl IncomingWebhook for Billwerk {
}
}
-lazy_static! {
- static ref BILLWERK_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+static BILLWERK_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
let supported_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::Manual,
@@ -833,7 +834,7 @@ lazy_static! {
billwerk_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Credit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -846,13 +847,13 @@ lazy_static! {
}
}),
),
- }
+ },
);
billwerk_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Debit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -865,24 +866,23 @@ lazy_static! {
}
}),
),
- }
+ },
);
billwerk_supported_payment_methods
- };
+ });
- static ref BILLWERK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
- display_name: "Billwerk",
- description: "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.",
- connector_type: enums::PaymentConnectorCategory::PaymentGateway,
- };
+static BILLWERK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Billwerk",
+ description: "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
- static ref BILLWERK_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
-}
+static BILLWERK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
impl ConnectorSpecifications for Billwerk {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
- Some(&*BILLWERK_CONNECTOR_INFO)
+ Some(&BILLWERK_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
@@ -890,6 +890,6 @@ impl ConnectorSpecifications for Billwerk {
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
- Some(&*BILLWERK_SUPPORTED_WEBHOOK_FLOWS)
+ Some(&BILLWERK_SUPPORTED_WEBHOOK_FLOWS)
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
index cb00c66a4fd..95c252cb685 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
@@ -1,5 +1,7 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use base64::Engine;
use common_enums::enums;
use common_utils::{
@@ -41,7 +43,6 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
-use lazy_static::lazy_static;
use masking::{ExposeInterface, Mask, PeekInterface};
use ring::hmac;
use time::OffsetDateTime;
@@ -784,8 +785,8 @@ impl webhooks::IncomingWebhook for Fiservemea {
}
}
-lazy_static! {
- static ref FISERVEMEA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+static FISERVEMEA_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
let supported_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::Manual,
@@ -809,7 +810,7 @@ lazy_static! {
fiservemea_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Credit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -822,13 +823,13 @@ lazy_static! {
}
}),
),
- }
+ },
);
fiservemea_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Debit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -841,24 +842,23 @@ lazy_static! {
}
}),
),
- }
+ },
);
fiservemea_supported_payment_methods
- };
+ });
- static ref FISERVEMEA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
- display_name: "Fiservemea",
- description: "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.",
- connector_type: enums::PaymentConnectorCategory::BankAcquirer,
- };
+static FISERVEMEA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Fiservemea",
+ description: "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+};
- static ref FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
-}
+static FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
impl ConnectorSpecifications for Fiservemea {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
- Some(&*FISERVEMEA_CONNECTOR_INFO)
+ Some(&FISERVEMEA_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
@@ -866,6 +866,6 @@ impl ConnectorSpecifications for Fiservemea {
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
- Some(&*FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS)
+ Some(&FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS)
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys.rs b/crates/hyperswitch_connectors/src/connectors/tsys.rs
index 7a0fe0bdc93..d5a6fd834e2 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys.rs
@@ -1,5 +1,7 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use common_enums::enums;
use common_utils::{
errors::CustomResult,
@@ -43,7 +45,6 @@ use hyperswitch_interfaces::{
},
webhooks,
};
-use lazy_static::lazy_static;
use transformers as tsys;
use crate::{constants::headers, types::ResponseRouterData, utils};
@@ -645,78 +646,76 @@ impl webhooks::IncomingWebhook for Tsys {
}
}
-lazy_static! {
- static ref TSYS_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
- let supported_capture_methods = vec![
- enums::CaptureMethod::Automatic,
- enums::CaptureMethod::Manual,
- enums::CaptureMethod::SequentialAutomatic,
- ];
-
- let supported_card_network = vec![
- common_enums::CardNetwork::Mastercard,
- common_enums::CardNetwork::Visa,
- common_enums::CardNetwork::AmericanExpress,
- common_enums::CardNetwork::Discover,
- common_enums::CardNetwork::JCB,
- common_enums::CardNetwork::UnionPay,
- ];
-
- let mut tsys_supported_payment_methods = SupportedPaymentMethods::new();
-
- tsys_supported_payment_methods.add(
- enums::PaymentMethod::Card,
- enums::PaymentMethodType::Credit,
- PaymentMethodDetails{
- mandates: enums::FeatureStatus::NotSupported,
- refunds: enums::FeatureStatus::Supported,
- supported_capture_methods: supported_capture_methods.clone(),
- specific_features: Some(
- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
- api_models::feature_matrix::CardSpecificFeatures {
- three_ds: common_enums::FeatureStatus::NotSupported,
- no_three_ds: common_enums::FeatureStatus::Supported,
- supported_card_networks: supported_card_network.clone(),
- }
- }),
- ),
- }
- );
-
- tsys_supported_payment_methods.add(
- enums::PaymentMethod::Card,
- enums::PaymentMethodType::Debit,
- PaymentMethodDetails{
- mandates: enums::FeatureStatus::NotSupported,
- refunds: enums::FeatureStatus::Supported,
- supported_capture_methods: supported_capture_methods.clone(),
- specific_features: Some(
- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
- api_models::feature_matrix::CardSpecificFeatures {
- three_ds: common_enums::FeatureStatus::NotSupported,
- no_three_ds: common_enums::FeatureStatus::Supported,
- supported_card_networks: supported_card_network.clone(),
- }
- }),
- ),
- }
- );
-
- tsys_supported_payment_methods
- };
-
- static ref TSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
- display_name: "Tsys",
- description: "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.",
- connector_type: enums::PaymentConnectorCategory::BankAcquirer,
- };
-
- static ref TSYS_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
-}
+static TSYS_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::UnionPay,
+ ];
+
+ let mut tsys_supported_payment_methods = SupportedPaymentMethods::new();
+
+ tsys_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ tsys_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ tsys_supported_payment_methods
+});
+
+static TSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Tsys",
+ description: "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+};
+
+static TSYS_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
impl ConnectorSpecifications for Tsys {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
- Some(&*TSYS_CONNECTOR_INFO)
+ Some(&TSYS_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
@@ -724,6 +723,6 @@ impl ConnectorSpecifications for Tsys {
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
- Some(&*TSYS_SUPPORTED_WEBHOOK_FLOWS)
+ Some(&TSYS_SUPPORTED_WEBHOOK_FLOWS)
}
}
|
2025-03-12T08:31:27Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/7495)
## Description
<!-- Describe your changes in detail -->
Refactored the feature matrix PR by using `LazyLock` instead of `lazy_static!`
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
Feature API curl:
```
curl --location 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api_key}}'
```
Response:
```
{
"connector_count": 3,
"connectors": [
{
"name": "BILLWERK",
"display_name": "Billwerk",
"description": "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"DK",
"DE",
"FR",
"SE"
],
"supported_currencies": [
"DKK",
"NOK"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"SE",
"FR",
"DE",
"DK"
],
"supported_currencies": [
"NOK",
"DKK"
]
}
],
"supported_webhook_flows": []
},
{
"name": "FISERVEMEA",
"display_name": "Fiservemea",
"description": "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"AE",
"PL",
"FR",
"ES",
"GB",
"ZA",
"DE",
"NL",
"IT"
],
"supported_currencies": [
"SSP",
"BIF",
"MOP",
"KMF",
"HNL",
"SYP",
"CVE",
"SGD",
"KHR",
"MXN",
"NPR",
"RUB",
"TMT",
"BRL",
"MRU",
"SHP",
"KPW",
"KZT",
"SLE",
"CZK",
"CAD",
"VUV",
"PYG",
"SOS",
"AFN",
"MVR",
"YER",
"ZAR",
"TTD",
"CHF",
"AMD",
"NGN",
"KYD",
"ERN",
"PKR",
"MZN",
"TJS",
"BTN",
"IDR",
"SCR",
"AED",
"MUR",
"CLP",
"XPF",
"TOP",
"PHP",
"THB",
"AZN",
"RON",
"DZD",
"SBD",
"PAB",
"HRK",
"KRW",
"SEK",
"BOB",
"LKR",
"SAR",
"KGS",
"NIO",
"RSD",
"PLN",
"NZD",
"BYN",
"SVC",
"GYD",
"SZL",
"USD",
"ISK",
"BMD",
"COP",
"SDG",
"TZS",
"KWD",
"UYU",
"JOD",
"CUP",
"LYD",
"LAK",
"DOP",
"AUD",
"VES",
"FJD",
"CRC",
"FKP",
"HKD",
"IRR",
"BDT",
"BBD",
"EUR",
"BHD",
"UAH",
"MGA",
"CNY",
"HTG",
"ALL",
"INR",
"GHS",
"MAD",
"TWD",
"MYR",
"BND",
"NAD",
"QAR",
"GIP",
"GEL",
"AOA",
"UGX",
"LSL",
"XAF",
"LBP",
"DJF",
"ETB",
"TND",
"XCD",
"SRD",
"GNF",
"BGN",
"GTQ",
"MWK",
"ZMW",
"MKD",
"HUF",
"PEN",
"RWF",
"DKK",
"BZD",
"IQD",
"ANG",
"ARS",
"GBP",
"WST",
"ZWL",
"PGK",
"TRY",
"KES",
"MDL",
"MNT",
"CDF",
"BAM",
"LRD",
"JPY",
"GMD",
"STN",
"VND",
"BWP",
"OMR",
"NOK",
"SLL",
"JMD",
"XOF",
"MMK",
"EGP",
"AWG",
"ILS",
"UZS",
"BSD"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"NL",
"ES",
"DE",
"PL",
"IT",
"AE",
"GB",
"ZA",
"FR"
],
"supported_currencies": [
"JOD",
"AED",
"ALL",
"BOB",
"ERN",
"LBP",
"PAB",
"HNL",
"AZN",
"TMT",
"DKK",
"AWG",
"PKR",
"LAK",
"PGK",
"JMD",
"CUP",
"PHP",
"BAM",
"THB",
"FKP",
"HRK",
"UYU",
"KZT",
"BYN",
"PLN",
"SDG",
"VND",
"NZD",
"KWD",
"CDF",
"SCR",
"VUV",
"CHF",
"USD",
"GYD",
"ANG",
"DOP",
"MKD",
"STN",
"SAR",
"QAR",
"PEN",
"RSD",
"BRL",
"KGS",
"SGD",
"TWD",
"BHD",
"KHR",
"MOP",
"GHS",
"UGX",
"XPF",
"SSP",
"CAD",
"TOP",
"OMR",
"MXN",
"BGN",
"RUB",
"MDL",
"GNF",
"PYG",
"SRD",
"AFN",
"MNT",
"NOK",
"XAF",
"BWP",
"NGN",
"GIP",
"CZK",
"MGA",
"DZD",
"YER",
"DJF",
"SBD",
"CNY",
"ZAR",
"LYD",
"BMD",
"MUR",
"NIO",
"UZS",
"GBP",
"VES",
"SVC",
"CVE",
"NPR",
"RON",
"KMF",
"BZD",
"KPW",
"SLL",
"LKR",
"AUD",
"LSL",
"XCD",
"TJS",
"KYD",
"UAH",
"ARS",
"NAD",
"SEK",
"GTQ",
"BSD",
"IDR",
"WST",
"AMD",
"BTN",
"HUF",
"ZMW",
"COP",
"BIF",
"FJD",
"INR",
"IRR",
"GEL",
"HTG",
"SOS",
"CLP",
"ISK",
"MVR",
"RWF",
"BBD",
"KRW",
"BDT",
"LRD",
"AOA",
"MMK",
"MWK",
"SLE",
"XOF",
"MRU",
"KES",
"MYR",
"MZN",
"SYP",
"SZL",
"TRY",
"SHP",
"TTD",
"GMD",
"TZS",
"ETB",
"ILS",
"IQD",
"CRC",
"BND",
"HKD",
"EGP",
"JPY",
"MAD",
"TND",
"EUR",
"ZWL"
]
}
],
"supported_webhook_flows": []
},
{
"name": "TSYS",
"display_name": "Tsys",
"description": "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay"
],
"supported_countries": [
"NA"
],
"supported_currencies": [
"CUP",
"SZL",
"GMD",
"AMD",
"MRU",
"BWP",
"SSP",
"QAR",
"XOF",
"VES",
"XAF",
"BBD",
"BSD",
"ETB",
"GBP",
"BHD",
"UYU",
"XCD",
"JPY",
"VUV",
"SAR",
"ZAR",
"MOP",
"MDL",
"IRR",
"SGD",
"MVR",
"BIF",
"BTN",
"STN",
"AED",
"TTD",
"TWD",
"UZS",
"KZT",
"ALL",
"UGX",
"DOP",
"BMD",
"FJD",
"KGS",
"KPW",
"ZMW",
"IQD",
"HRK",
"KMF",
"GTQ",
"LSL",
"NOK",
"MWK",
"CDF",
"KRW",
"ERN",
"RUB",
"GEL",
"MGA",
"OMR",
"HUF",
"HTG",
"PYG",
"MUR",
"HKD",
"BZD",
"LRD",
"SRD",
"THB",
"IDR",
"TJS",
"TRY",
"VND",
"JOD",
"PKR",
"GNF",
"LKR",
"TND",
"BDT",
"DJF",
"SDG",
"AOA",
"SVC",
"PEN",
"KYD",
"BRL",
"JMD",
"ISK",
"COP",
"BAM",
"BOB",
"CVE",
"INR",
"RWF",
"SCR",
"YER",
"LYD",
"MYR",
"LBP",
"CZK",
"NIO",
"SEK",
"DKK",
"UAH",
"USD",
"AZN",
"RON",
"HNL",
"SYP",
"CHF",
"PAB",
"NGN",
"NPR",
"AFN",
"CAD",
"ANG",
"GYD",
"MXN",
"BND",
"LAK",
"PGK",
"PLN",
"SHP",
"ARS",
"KWD",
"ILS",
"TMT",
"XPF",
"ZWL",
"FKP",
"CLP",
"AUD",
"DZD",
"GHS",
"PHP",
"NAD",
"TZS",
"CNY",
"MAD",
"NZD",
"MNT",
"WST",
"KHR",
"CRC",
"SLE",
"AWG",
"GIP",
"BGN",
"RSD",
"SOS",
"MKD",
"MMK",
"TOP",
"MZN",
"BYN",
"KES",
"EGP",
"EUR",
"SBD"
]
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay"
],
"supported_countries": [
"NA"
],
"supported_currencies": [
"AZN",
"SAR",
"ZWL",
"MRU",
"SZL",
"TRY",
"TOP",
"YER",
"LKR",
"ISK",
"NIO",
"TTD",
"BMD",
"PAB",
"MNT",
"BTN",
"SYP",
"HUF",
"CHF",
"UAH",
"DJF",
"DOP",
"XPF",
"MVR",
"WST",
"ZMW",
"TMT",
"TWD",
"LBP",
"PGK",
"XOF",
"ARS",
"PLN",
"MUR",
"MZN",
"NGN",
"MDL",
"SDG",
"SLE",
"VND",
"STN",
"KZT",
"THB",
"SGD",
"HRK",
"AUD",
"NAD",
"KHR",
"BSD",
"GEL",
"NOK",
"KPW",
"GNF",
"GHS",
"MWK",
"RUB",
"MAD",
"GMD",
"BWP",
"VUV",
"GTQ",
"BZD",
"MYR",
"BND",
"KMF",
"CVE",
"SSP",
"BBD",
"ALL",
"UZS",
"ERN",
"GYD",
"CUP",
"TJS",
"CZK",
"OMR",
"GIP",
"XCD",
"CNY",
"SBD",
"RON",
"KES",
"HKD",
"IQD",
"BDT",
"CDF",
"SEK",
"JPY",
"HNL",
"ETB",
"GBP",
"VES",
"TZS",
"MXN",
"XAF",
"CLP",
"AMD",
"LAK",
"EGP",
"NZD",
"SCR",
"SHP",
"ILS",
"KRW",
"SOS",
"MGA",
"JMD",
"ZAR",
"NPR",
"BAM",
"BIF",
"EUR",
"UYU",
"CRC",
"RSD",
"TND",
"PKR",
"SRD",
"AED",
"BOB",
"INR",
"MOP",
"USD",
"PEN",
"LRD",
"UGX",
"MMK",
"KGS",
"BRL",
"SVC",
"FKP",
"ANG",
"MKD",
"BGN",
"BHD",
"PHP",
"IRR",
"KYD",
"RWF",
"LSL",
"QAR",
"DKK",
"IDR",
"DZD",
"LYD",
"AWG",
"AFN",
"KWD",
"BYN",
"JOD",
"AOA",
"HTG",
"COP",
"FJD",
"CAD",
"PYG"
]
}
],
"supported_webhook_flows": []
},
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
662e45f0037c0aa039c1de72500c6004322f3ffb
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7469
|
Bug: [BUG] [WISE] Changed type of error status from i32 to String
### Bug Description
While creating payouts, Hyperswitch throws an error because the connector sends an error status as String, while Hyperswitch accepts it as i32.
### Expected Behavior
Hyperswitch should not throw error while creating payouts.
### Actual Behavior
While creating payouts, Hyperswitch throws an error because the connector sends an error status as String, while Hyperswitch accepts it as i32.
### Steps To Reproduce
Create payout for wise connector, and Hyperswitch will throw an error if error response is returned by connector.
### Context For The Bug
_No response_
### Environment
Integ, Sandbox, Prod
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/router/src/connector/wise/transformers.rs b/crates/router/src/connector/wise/transformers.rs
index 513a762bfd3..d3e9efa0f7f 100644
--- a/crates/router/src/connector/wise/transformers.rs
+++ b/crates/router/src/connector/wise/transformers.rs
@@ -56,7 +56,7 @@ impl TryFrom<&types::ConnectorAuthType> for WiseAuthType {
pub struct ErrorResponse {
pub timestamp: Option<String>,
pub errors: Option<Vec<SubError>>,
- pub status: Option<i32>,
+ pub status: Option<String>,
pub error: Option<String>,
pub error_description: Option<String>,
pub message: Option<String>,
|
2025-03-10T09:55:07Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
The error status was previously being accepted as i32, which was causing Hyperswitch to throw an error because the connector returns the status as a String. The status has been changed to type String in this PR.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Issue Link: https://github.com/juspay/hyperswitch/issues/7469
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
**Postman Tests**
**1. Payouts Create**
-Request
```
curl --location 'http://localhost:8080/payouts/create' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_gBOBAd2KdnQ2Sicn24ETzOLMqRjdMVtjSjy17FYmjQjmj26klfRIWLOnspqQX9YW' \
--data-raw '{
"amount": 10,
"currency": "GBP",
"customer_id": "cus_wtc11I3P4ObeIZk0FpBR",
"email": "payout_customer@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payout request",
"payout_type": "bank",
"connector": [
"wise"
],
"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",
"city": "San Fransico",
"state": "CA",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"entity_type": "Individual",
"recurring": true,
"metadata": {
"ref": "123"
},
"confirm": true,
"auto_fulfill": true,
"profile_id": "pro_U84OKvi5otdXGYq6tjlx"
}'
```
-Response
```
{
"payout_id": "5f7ac2b0-69cb-4916-9ad5-a901770bbc72",
"merchant_id": "merchant_1741598972",
"amount": 10,
"currency": "GBP",
"connector": "wise",
"payout_type": "bank",
"payout_method_data": {
"bank": {
"bank_sort_code": "23**70",
"bank_account_number": "****1822",
"bank_name": "Deutsche Bank",
"bank_country_code": "NL",
"bank_city": "Amsterdam"
}
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "CA",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"auto_fulfill": true,
"customer_id": "cus_wtc11I3P4ObeIZk0FpBR",
"customer": {
"id": "cus_wtc11I3P4ObeIZk0FpBR",
"name": "John Doe",
"email": "payout_customer@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"client_secret": "payout_5f7ac2b0-69cb-4916-9ad5-a901770bbc72_secret_B0h34yZciT2HwmmcHKgu",
"return_url": null,
"business_country": null,
"business_label": null,
"description": "Its my first payout request",
"entity_type": "Individual",
"recurring": true,
"metadata": {
"ref": "123"
},
"merchant_connector_id": "mca_d6VH9HeZfA07bVki7LMf",
"status": "failed",
"error_message": "",
"error_code": "REJECTED",
"profile_id": "pro_U84OKvi5otdXGYq6tjlx",
"created": "2025-03-10T09:48:10.143Z",
"connector_transaction_id": "54879667",
"priority": null,
"payout_link": null,
"email": "payout_customer@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"unified_code": null,
"unified_message": null,
"payout_method_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
617adfa33fd543131b5c4d8983319bfdcaa6c425
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7482
|
Bug: feat(analytics): modify authentication queries and add generate report for authentications
Need to modify the authentication analytics queries to differentiate between **frictionless flow** and **challenge flow** through the authentication_type field.
Introduce support for **authentication report generation**, similar to the existing reports for payments, refunds, and disputes.
|
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index a2640be6ead..bdcbdd86a94 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -165,6 +165,7 @@ pub async fn get_filters(
.filter_map(|fil: AuthEventFilterRow| match dim {
AuthEventDimensions::AuthenticationStatus => fil.authentication_status.map(|i| i.as_ref().to_string()),
AuthEventDimensions::TransactionStatus => fil.trans_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::AuthenticationType => fil.authentication_type.map(|i| i.as_ref().to_string()),
AuthEventDimensions::ErrorMessage => fil.error_message,
AuthEventDimensions::AuthenticationConnector => fil.authentication_connector.map(|i| i.as_ref().to_string()),
AuthEventDimensions::MessageVersion => fil.message_version,
diff --git a/crates/analytics/src/auth_events/filters.rs b/crates/analytics/src/auth_events/filters.rs
index da8e0b7cfa3..5f65eeaa279 100644
--- a/crates/analytics/src/auth_events/filters.rs
+++ b/crates/analytics/src/auth_events/filters.rs
@@ -1,4 +1,5 @@
use api_models::analytics::{auth_events::AuthEventDimensions, Granularity, TimeRange};
+use common_enums::DecoupledAuthenticationType;
use common_utils::errors::ReportSwitchExt;
use diesel_models::enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use error_stack::ResultExt;
@@ -54,6 +55,7 @@ where
pub struct AuthEventFilterRow {
pub authentication_status: Option<DBEnumWrapper<AuthenticationStatus>>,
pub trans_status: Option<DBEnumWrapper<TransactionStatus>>,
+ pub authentication_type: Option<DBEnumWrapper<DecoupledAuthenticationType>>,
pub error_message: Option<String>,
pub authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>>,
pub message_version: Option<String>,
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index fd94aac614c..a3d0fe7b683 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -41,6 +41,7 @@ pub struct AuthEventMetricRow {
pub count: Option<i64>,
pub authentication_status: Option<DBEnumWrapper<storage_enums::AuthenticationStatus>>,
pub trans_status: Option<DBEnumWrapper<storage_enums::TransactionStatus>>,
+ pub authentication_type: Option<DBEnumWrapper<storage_enums::DecoupledAuthenticationType>>,
pub error_message: Option<String>,
pub authentication_connector: Option<DBEnumWrapper<storage_enums::AuthenticationConnectors>>,
pub message_version: Option<String>,
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 32c76385409..b82d1ef4c35 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -70,7 +70,10 @@ where
.switch()?;
query_builder
- .add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
+ .add_filter_in_range_clause(
+ "authentication_status",
+ &[AuthenticationStatus::Success, AuthenticationStatus::Failed],
+ )
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
@@ -103,6 +106,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/authentication_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
index 39df41f53aa..682e8a07f6b 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -96,6 +96,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/authentication_error_message.rs b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
index cdb89b796dd..047511d477c 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
@@ -12,8 +12,8 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
query::{
- Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
- Window,
+ Aggregate, FilterTypes, GroupByClause, Order, QueryBuilder, QueryFilter, SeriesBucket,
+ ToSql, Window,
},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -45,11 +45,9 @@ where
for dim in dimensions.iter() {
query_builder.add_select_column(dim).switch()?;
}
+
query_builder
- .add_select_column(Aggregate::Count {
- field: None,
- alias: Some("count"),
- })
+ .add_select_column("sum(sign_flag) AS count")
.switch()?;
query_builder
@@ -94,6 +92,11 @@ where
.switch()?;
}
+ query_builder
+ .add_order_by_clause("count", Order::Descending)
+ .attach_printable("Error adding order by clause")
+ .switch()?;
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -112,6 +115,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/authentication_funnel.rs b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
index 37f9dfd1c1f..9342e9047e0 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
@@ -107,6 +107,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index 039ef00dd6e..984350efe6b 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -101,6 +101,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index beccc093b19..5a2a9400b20 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -4,6 +4,7 @@ use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
+use common_enums::{AuthenticationStatus, DecoupledAuthenticationType};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -67,11 +68,17 @@ where
.switch()?;
query_builder
- .add_filter_clause("trans_status", "C".to_string())
+ .add_filter_clause(
+ "authentication_type",
+ DecoupledAuthenticationType::Challenge,
+ )
.switch()?;
query_builder
- .add_negative_filter_clause("authentication_status", "pending")
+ .add_filter_in_range_clause(
+ "authentication_status",
+ &[AuthenticationStatus::Success, AuthenticationStatus::Failed],
+ )
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
@@ -104,6 +111,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index 4d07cffba94..279844388f2 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -4,6 +4,7 @@ use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
+use common_enums::DecoupledAuthenticationType;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -67,7 +68,10 @@ where
.switch()?;
query_builder
- .add_filter_clause("trans_status", "C".to_string())
+ .add_filter_clause(
+ "authentication_type",
+ DecoupledAuthenticationType::Challenge,
+ )
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
@@ -99,6 +103,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index 310a45f0530..91e8cc54289 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -4,7 +4,7 @@ use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
-use common_enums::AuthenticationStatus;
+use common_enums::{AuthenticationStatus, DecoupledAuthenticationType};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -72,7 +72,10 @@ where
.switch()?;
query_builder
- .add_filter_clause("trans_status", "C".to_string())
+ .add_filter_clause(
+ "authentication_type",
+ DecoupledAuthenticationType::Challenge,
+ )
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
@@ -105,6 +108,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index 24857bfb840..b08edb10113 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -4,6 +4,7 @@ use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
+use common_enums::DecoupledAuthenticationType;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -67,7 +68,10 @@ where
.switch()?;
query_builder
- .add_filter_clause("trans_status", "Y".to_string())
+ .add_filter_clause(
+ "authentication_type",
+ DecoupledAuthenticationType::Frictionless,
+ )
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
@@ -100,6 +104,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index 79fef8a16d0..80417ac64bf 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -4,7 +4,7 @@ use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
-use common_enums::AuthenticationStatus;
+use common_enums::{AuthenticationStatus, DecoupledAuthenticationType};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -68,7 +68,10 @@ where
.switch()?;
query_builder
- .add_filter_clause("trans_status", "Y".to_string())
+ .add_filter_clause(
+ "authentication_type",
+ DecoupledAuthenticationType::Frictionless,
+ )
.switch()?;
query_builder
@@ -105,6 +108,7 @@ where
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index f698b1161a0..89f5cbd5b9c 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -1123,6 +1123,7 @@ pub struct ReportConfig {
pub payment_function: String,
pub refund_function: String,
pub dispute_function: String,
+ pub authentication_function: String,
pub region: String,
}
@@ -1151,6 +1152,7 @@ pub enum AnalyticsFlow {
GeneratePaymentReport,
GenerateDisputeReport,
GenerateRefundReport,
+ GenerateAuthenticationReport,
GetApiEventMetrics,
GetApiEventFilters,
GetConnectorEvents,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index d483ce43605..5effd9e70a7 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -19,7 +19,9 @@ use api_models::{
},
refunds::RefundStatus,
};
-use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+use common_enums::{
+ AuthenticationConnectors, AuthenticationStatus, DecoupledAuthenticationType, TransactionStatus,
+};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -506,6 +508,7 @@ impl_to_sql_for_to_string!(
TransactionStatus,
AuthenticationStatus,
AuthenticationConnectors,
+ DecoupledAuthenticationType,
Flow,
&String,
&bool,
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index a6db92e753f..6a6237e6783 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -4,7 +4,9 @@ use api_models::{
analytics::{frm::FrmTransactionType, refunds::RefundType},
enums::{DisputeStage, DisputeStatus},
};
-use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+use common_enums::{
+ AuthenticationConnectors, AuthenticationStatus, DecoupledAuthenticationType, TransactionStatus,
+};
use common_utils::{
errors::{CustomResult, ParsingError},
DbConnectionParams,
@@ -100,6 +102,7 @@ db_type!(DisputeStatus);
db_type!(AuthenticationStatus);
db_type!(TransactionStatus);
db_type!(AuthenticationConnectors);
+db_type!(DecoupledAuthenticationType);
impl<'q, Type> Encode<'q, Postgres> for DBEnumWrapper<Type>
where
@@ -208,6 +211,11 @@ impl<'a> FromRow<'a, PgRow> for super::auth_events::metrics::AuthEventMetricRow
ColumnNotFound(_) => Ok(Default::default()),
e => Err(e),
})?;
+ let authentication_type: Option<DBEnumWrapper<DecoupledAuthenticationType>> =
+ row.try_get("authentication_type").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
ColumnNotFound(_) => Ok(Default::default()),
e => Err(e),
@@ -237,6 +245,7 @@ impl<'a> FromRow<'a, PgRow> for super::auth_events::metrics::AuthEventMetricRow
Ok(Self {
authentication_status,
trans_status,
+ authentication_type,
error_message,
authentication_connector,
message_version,
@@ -259,6 +268,11 @@ impl<'a> FromRow<'a, PgRow> for super::auth_events::filters::AuthEventFilterRow
ColumnNotFound(_) => Ok(Default::default()),
e => Err(e),
})?;
+ let authentication_type: Option<DBEnumWrapper<DecoupledAuthenticationType>> =
+ row.try_get("authentication_type").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
ColumnNotFound(_) => Ok(Default::default()),
e => Err(e),
@@ -277,6 +291,7 @@ impl<'a> FromRow<'a, PgRow> for super::auth_events::filters::AuthEventFilterRow
Ok(Self {
authentication_status,
trans_status,
+ authentication_type,
error_message,
authentication_connector,
message_version,
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 5c2d4ed2064..2360e564642 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -3,7 +3,9 @@ use std::{
hash::{Hash, Hasher},
};
-use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+use common_enums::{
+ AuthenticationConnectors, AuthenticationStatus, DecoupledAuthenticationType, TransactionStatus,
+};
use super::{NameDescription, TimeRange};
@@ -14,6 +16,8 @@ pub struct AuthEventFilters {
#[serde(default)]
pub trans_status: Vec<TransactionStatus>,
#[serde(default)]
+ pub authentication_type: Vec<DecoupledAuthenticationType>,
+ #[serde(default)]
pub error_message: Vec<String>,
#[serde(default)]
pub authentication_connector: Vec<AuthenticationConnectors>,
@@ -42,6 +46,7 @@ pub enum AuthEventDimensions {
#[strum(serialize = "trans_status")]
#[serde(rename = "trans_status")]
TransactionStatus,
+ AuthenticationType,
ErrorMessage,
AuthenticationConnector,
MessageVersion,
@@ -101,6 +106,7 @@ pub mod metric_behaviour {
pub struct ChallengeAttemptCount;
pub struct ChallengeSuccessCount;
pub struct AuthenticationErrorMessage;
+ pub struct AuthenticationFunnel;
}
impl From<AuthEventMetrics> for NameDescription {
@@ -125,6 +131,7 @@ impl From<AuthEventDimensions> for NameDescription {
pub struct AuthEventMetricsBucketIdentifier {
pub authentication_status: Option<AuthenticationStatus>,
pub trans_status: Option<TransactionStatus>,
+ pub authentication_type: Option<DecoupledAuthenticationType>,
pub error_message: Option<String>,
pub authentication_connector: Option<AuthenticationConnectors>,
pub message_version: Option<String>,
@@ -140,6 +147,7 @@ impl AuthEventMetricsBucketIdentifier {
pub fn new(
authentication_status: Option<AuthenticationStatus>,
trans_status: Option<TransactionStatus>,
+ authentication_type: Option<DecoupledAuthenticationType>,
error_message: Option<String>,
authentication_connector: Option<AuthenticationConnectors>,
message_version: Option<String>,
@@ -148,6 +156,7 @@ impl AuthEventMetricsBucketIdentifier {
Self {
authentication_status,
trans_status,
+ authentication_type,
error_message,
authentication_connector,
message_version,
@@ -161,6 +170,7 @@ impl Hash for AuthEventMetricsBucketIdentifier {
fn hash<H: Hasher>(&self, state: &mut H) {
self.authentication_status.hash(state);
self.trans_status.hash(state);
+ self.authentication_type.hash(state);
self.authentication_connector.hash(state);
self.message_version.hash(state);
self.error_message.hash(state);
diff --git a/crates/api_models/src/analytics/sdk_events.rs b/crates/api_models/src/analytics/sdk_events.rs
index b2abbbe00e1..9a749f1144e 100644
--- a/crates/api_models/src/analytics/sdk_events.rs
+++ b/crates/api_models/src/analytics/sdk_events.rs
@@ -114,6 +114,10 @@ pub enum SdkEventNames {
ThreeDsMethod,
LoaderChanged,
DisplayThreeDsSdk,
+ ThreeDsSdkInit,
+ AreqParamsGeneration,
+ ChallengePresented,
+ ChallengeComplete,
}
pub mod metric_behaviour {
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 858c16d052f..cc242f86a5b 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -90,6 +90,10 @@ pub mod routes {
web::resource("report/payments")
.route(web::post().to(generate_merchant_payment_report)),
)
+ .service(
+ web::resource("report/authentications")
+ .route(web::post().to(generate_merchant_authentication_report)),
+ )
.service(
web::resource("metrics/sdk_events")
.route(web::post().to(get_sdk_event_metrics)),
@@ -190,6 +194,11 @@ pub mod routes {
web::resource("report/payments")
.route(web::post().to(generate_merchant_payment_report)),
)
+ .service(
+ web::resource("report/authentications").route(
+ web::post().to(generate_merchant_authentication_report),
+ ),
+ )
.service(
web::resource("metrics/api_events")
.route(web::post().to(get_merchant_api_events_metrics)),
@@ -252,6 +261,10 @@ pub mod routes {
web::resource("report/payments")
.route(web::post().to(generate_org_payment_report)),
)
+ .service(
+ web::resource("report/authentications")
+ .route(web::post().to(generate_org_authentication_report)),
+ )
.service(
web::resource("metrics/sankey")
.route(web::post().to(get_org_sankey)),
@@ -306,6 +319,11 @@ pub mod routes {
web::resource("report/payments")
.route(web::post().to(generate_profile_payment_report)),
)
+ .service(
+ web::resource("report/authentications").route(
+ web::post().to(generate_profile_authentication_report),
+ ),
+ )
.service(
web::resource("api_event_logs")
.route(web::get().to(get_profile_api_events)),
@@ -1746,6 +1764,7 @@ pub mod routes {
))
.await
}
+
#[cfg(feature = "v1")]
pub async fn generate_org_payment_report(
state: web::Data<AppState>,
@@ -1850,6 +1869,161 @@ pub mod routes {
.await
}
+ #[cfg(feature = "v1")]
+ pub async fn generate_merchant_authentication_report(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<ReportRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GenerateAuthenticationReport;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ json_payload.into_inner(),
+ |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
+ let user = UserInterface::find_user_by_id(&*state.global_store, &user_id)
+ .await
+ .change_context(AnalyticsError::UnknownError)?;
+
+ let user_email = UserEmail::from_pii_email(user.email)
+ .change_context(AnalyticsError::UnknownError)?
+ .get_secret();
+
+ let org_id = auth.merchant_account.get_org_id();
+ let merchant_id = auth.merchant_account.get_id();
+ let lambda_req = GenerateReportRequest {
+ request: payload,
+ merchant_id: Some(merchant_id.clone()),
+ auth: AuthInfo::MerchantLevel {
+ org_id: org_id.clone(),
+ merchant_ids: vec![merchant_id.clone()],
+ },
+ email: user_email,
+ };
+
+ let json_bytes =
+ serde_json::to_vec(&lambda_req).map_err(|_| AnalyticsError::UnknownError)?;
+ invoke_lambda(
+ &state.conf.report_download_config.authentication_function,
+ &state.conf.report_download_config.region,
+ &json_bytes,
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::MerchantReportRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
+ #[cfg(feature = "v1")]
+ pub async fn generate_org_authentication_report(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<ReportRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GenerateAuthenticationReport;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ json_payload.into_inner(),
+ |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
+ let user = UserInterface::find_user_by_id(&*state.global_store, &user_id)
+ .await
+ .change_context(AnalyticsError::UnknownError)?;
+
+ let user_email = UserEmail::from_pii_email(user.email)
+ .change_context(AnalyticsError::UnknownError)?
+ .get_secret();
+
+ let org_id = auth.merchant_account.get_org_id();
+ let lambda_req = GenerateReportRequest {
+ request: payload,
+ merchant_id: None,
+ auth: AuthInfo::OrgLevel {
+ org_id: org_id.clone(),
+ },
+ email: user_email,
+ };
+
+ let json_bytes =
+ serde_json::to_vec(&lambda_req).map_err(|_| AnalyticsError::UnknownError)?;
+ invoke_lambda(
+ &state.conf.report_download_config.authentication_function,
+ &state.conf.report_download_config.region,
+ &json_bytes,
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::OrganizationReportRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
+ #[cfg(feature = "v1")]
+ pub async fn generate_profile_authentication_report(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<ReportRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GenerateAuthenticationReport;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ json_payload.into_inner(),
+ |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
+ let user = UserInterface::find_user_by_id(&*state.global_store, &user_id)
+ .await
+ .change_context(AnalyticsError::UnknownError)?;
+
+ let user_email = UserEmail::from_pii_email(user.email)
+ .change_context(AnalyticsError::UnknownError)?
+ .get_secret();
+ let org_id = auth.merchant_account.get_org_id();
+ let merchant_id = auth.merchant_account.get_id();
+ let profile_id = auth
+ .profile_id
+ .ok_or(report!(UserErrors::JwtProfileIdMissing))
+ .change_context(AnalyticsError::AccessForbiddenError)?;
+ let lambda_req = GenerateReportRequest {
+ request: payload,
+ merchant_id: Some(merchant_id.clone()),
+ auth: AuthInfo::ProfileLevel {
+ org_id: org_id.clone(),
+ merchant_id: merchant_id.clone(),
+ profile_ids: vec![profile_id.clone()],
+ },
+ email: user_email,
+ };
+
+ let json_bytes =
+ serde_json::to_vec(&lambda_req).map_err(|_| AnalyticsError::UnknownError)?;
+ invoke_lambda(
+ &state.conf.report_download_config.authentication_function,
+ &state.conf.report_download_config.region,
+ &json_bytes,
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::ProfileReportRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
/// # Panics
///
/// Panics if `json_payload` array does not contain one `GetApiEventMetricRequest` element.
|
2025-03-11T17:25:35Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR modifies authentication queries to improve the way we distinguish between authentication flows. Previously, `trans_status` was used for this purpose, but it has now been replaced with `authentication_type`, which more explicitly differentiates between **frictionless flow** and **challenge flow**.
Additionally, this PR introduces support for **authentication report generation**, similar to the existing reports for payments, refunds, and disputes.
## Key Changes
### 1. **Updated Authentication Queries**
- Replaced `trans_status` with `authentication_type` in authentication queries.
- Ensures a clearer distinction between **frictionless flow** and **challenge flow** during authentication.
### 2. **Added Authentication Report Generation**
- Introduced report generation for **authentications**, aligning with the existing reporting structure for `payments`, 'refunds` and `disputes`.
### Routes for the reporting service:
- **Org level report**: `/analytics/v1/org/report/authentications`
- **Merchant level report**: `/analytics/v1/merchant/report/authentications`
- **Profile level report**: `/analytics/v1/profile/report/authentications`
This PR resolves the data correctness issue raised here: [https://github.com/juspay/hyperswitch-cloud/issues/8727](https://github.com/juspay/hyperswitch-cloud/issues/8727)
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
- Using `authentication_type` instead of `trans_status` improves accuracy in flow differentiation.
- Authentication reporting enables better tracking and analytics for user authentication flows.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Can check the test cases from the `How did you test it?` section from these 2 PRs:
- [https://github.com/juspay/hyperswitch/pull/7451](https://github.com/juspay/hyperswitch/pull/7451)
- [https://github.com/juspay/hyperswitch/pull/7433](https://github.com/juspay/hyperswitch/pull/7433)
**Note**: The Response body should be validated from this PR for all the metrics: [https://github.com/juspay/hyperswitch/pull/7451](https://github.com/juspay/hyperswitch/pull/7451)
Curl for Authentication Report:
```bash
curl --location 'http://localhost:8080/analytics/v1/org/report/authentications' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: test_admin' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNmNkZTA0NzYtMTFlMi00NGE5LTlkMjUtOTA5M2QzNDQwZjhlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzM1MDQxMjkzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczNjYwNDY3OCwib3JnX2lkIjoib3JnX2pwanI5TkFEWlhqSENNYTU5MmF3IiwicHJvZmlsZV9pZCI6InByb19QRHUydVA3aWNuM2lXY0I3V0VVSSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.7_cuWH5XygVrtIDsbh7nusrjGcQ3jbcaPKhIOo3EbM8' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDU1MmY3YzctMmNjZC00ZmU3LThkM2ItY2U1M2ExMTJhZTIwIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNjk5OTg4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTg3MjgwMiwib3JnX2lkIjoib3JnX2hQamlOektmbmV6NG8wNjdVVlFwIiwicHJvZmlsZV9pZCI6InByb19kWWJpUm9NVkFkNDAwWEh6R3hYTiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.1bsDkYwwk8FtWrDEYdMIsjmH7DqWOVejX2GVseu68ZQ' \
--data-raw '{
"timeRange": {
"startTime": "2025-01-08T13:56:15Z",
"endTime": "2025-01-09T13:56:15.277Z"
},
"emails": [
"sandeep.kumar@juspay.in"
]
}'
```
Queries:
#### Authentication Attempt Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status IN ('success', 'failed') AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Authentication Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Authentication Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status = 'success' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Attempt Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_type = 'challenge' AND authentication_status in ('success', 'failed') AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Flow Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_type = 'challenge' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status = 'success' AND authentication_type = 'challenge' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Frictionless Flow Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_type = 'frictionless' AND created_at >= '1738402351' AND created_at <= '1740216751' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Frictionless Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_type = 'frictionless' AND authentication_status = 'success' AND created_at >= '1738402351' AND created_at <= '1740216751' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Authentication Funnel: (2nd step):
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status IS NOT NULL AND created_at >= '1738434600' AND created_at <= '1740734520' )
```
#### Authentication Funnel: (3rd step):
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status IS NOT NULL AND authentication_status IN ('success', 'failed') AND created_at >= '1738434600' AND created_at <= '1740734520' )
```
#### Authentication Error Message:
```bash
SELECT error_message, sum(sign_flag) AS count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1741712401' AND authentication_status = 'failed' AND error_message IS NOT NULL AND created_at >= '1738434600' AND created_at <= '1740734520' ) GROUP BY error_message HAVING sum(sign_flag) >= '1' ORDER BY count desc
```
Sample Output:
You should be able to receive an email with the authentication report to the email specified in the request.
Similarly, just replace `org` with `merchant` and `profile` in the URL for the corresponding authentication report at the merchant and profile level.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
5cdfe8325481909a8a1596f967303eff44ffbcec
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7492
|
Bug: ci: paypal ci failing
ref: https://developer.paypal.com/docs/multiparty/checkout/advanced/customize/3d-secure/test/
replacing visa card with the mastercard fixed it upon testing. also fixe the assertion. 65 != 60
|
2025-03-12T06:39:17Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
<img width="861" alt="image" src="https://github.com/user-attachments/assets/d85ea702-cd5d-444b-86bd-1f5f50363d40" />
connector throws above error when using VISA card. Replacing that with MasterCard fixes it:
<img width="1206" alt="image" src="https://github.com/user-attachments/assets/de44fa13-695b-4198-ba82-d603a9bafbe1" />
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
paypal ci is failing.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
`CYPRESS_CONNECTOR=paypal npm run cypress:payments`

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
833da1c3c5a0f006a689b05554c547205774c823
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7490
|
Bug: refactor(organization): add api version column
Add api version column to organization.
|
diff --git a/Cargo.lock b/Cargo.lock
index debcaf5d289..f0026e2d29a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6960,6 +6960,7 @@ name = "scheduler"
version = "0.1.0"
dependencies = [
"async-trait",
+ "common_types",
"common_utils",
"diesel_models",
"error-stack",
diff --git a/crates/common_types/src/consts.rs b/crates/common_types/src/consts.rs
new file mode 100644
index 00000000000..3550333443f
--- /dev/null
+++ b/crates/common_types/src/consts.rs
@@ -0,0 +1,9 @@
+//! Constants that are used in the domain level.
+
+/// API version
+#[cfg(feature = "v1")]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
+
+/// API version
+#[cfg(feature = "v2")]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs
index 589a77e3a50..7f3b44ecd9a 100644
--- a/crates/common_types/src/lib.rs
+++ b/crates/common_types/src/lib.rs
@@ -2,6 +2,7 @@
#![warn(missing_docs, missing_debug_implementations)]
+pub mod consts;
pub mod customers;
pub mod domain;
pub mod payment_methods;
diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml
index 94913571396..ca7e85628bd 100644
--- a/crates/diesel_models/Cargo.toml
+++ b/crates/diesel_models/Cargo.toml
@@ -10,8 +10,8 @@ license.workspace = true
[features]
default = ["kv_store"]
kv_store = []
-v1 = ["common_utils/v1"]
-v2 = ["common_utils/v2"]
+v1 = ["common_utils/v1", "common_types/v1"]
+v2 = ["common_utils/v2", "common_types/v2"]
customer_v2 = []
payment_methods_v2 = []
refunds_v2 = []
diff --git a/crates/diesel_models/src/organization.rs b/crates/diesel_models/src/organization.rs
index 753f1cf3c30..1ca86225934 100644
--- a/crates/diesel_models/src/organization.rs
+++ b/crates/diesel_models/src/organization.rs
@@ -28,6 +28,7 @@ pub struct Organization {
id: Option<id_type::OrganizationId>,
#[allow(dead_code)]
organization_name: Option<String>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v2")]
@@ -44,6 +45,7 @@ pub struct Organization {
pub modified_at: time::PrimitiveDateTime,
id: id_type::OrganizationId,
organization_name: Option<String>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v1")]
@@ -58,6 +60,7 @@ impl Organization {
modified_at,
id: _,
organization_name: _,
+ version,
} = org_new;
Self {
id: Some(org_id.clone()),
@@ -68,6 +71,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
}
}
}
@@ -82,6 +86,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
} = org_new;
Self {
id,
@@ -90,6 +95,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
}
}
}
@@ -106,6 +112,7 @@ pub struct OrganizationNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v2")]
@@ -118,6 +125,7 @@ pub struct OrganizationNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v1")]
@@ -132,6 +140,7 @@ impl OrganizationNew {
metadata: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
+ version: common_types::consts::API_VERSION,
}
}
}
@@ -146,6 +155,7 @@ impl OrganizationNew {
metadata: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
+ version: common_types::consts::API_VERSION,
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 96f734da108..56a0b670e52 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -817,6 +817,7 @@ diesel::table! {
#[max_length = 32]
id -> Nullable<Varchar>,
organization_name -> Nullable<Text>,
+ version -> ApiVersion,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index dea417f36dd..4ab5b5377e1 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -796,6 +796,7 @@ diesel::table! {
#[max_length = 32]
id -> Varchar,
organization_name -> Nullable<Text>,
+ version -> ApiVersion,
}
}
diff --git a/crates/hyperswitch_domain_models/Cargo.toml b/crates/hyperswitch_domain_models/Cargo.toml
index c27d1f6bf96..39aadb90db6 100644
--- a/crates/hyperswitch_domain_models/Cargo.toml
+++ b/crates/hyperswitch_domain_models/Cargo.toml
@@ -13,8 +13,8 @@ encryption_service = []
olap = []
payouts = ["api_models/payouts"]
frm = ["api_models/frm"]
-v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2"]
-v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1"]
+v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2", "common_types/v2"]
+v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1", "common_types/v1"]
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2"]
dummy_connector = []
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 5170bd3ce29..b7fa027bb06 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -15,10 +15,7 @@ use diesel_models::business_profile::{
use error_stack::ResultExt;
use masking::{PeekInterface, Secret};
-use crate::{
- consts,
- type_encryption::{crypto_operation, AsyncLift, CryptoOperation},
-};
+use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
#[cfg(feature = "v1")]
#[derive(Clone, Debug)]
@@ -162,7 +159,7 @@ impl From<ProfileSetter> for Profile {
.always_collect_shipping_details_from_wallet_connector,
tax_connector_id: value.tax_connector_id,
is_tax_connector_enabled: value.is_tax_connector_enabled,
- version: consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
dynamic_routing_algorithm: value.dynamic_routing_algorithm,
is_network_tokenization_enabled: value.is_network_tokenization_enabled,
is_auto_retries_enabled: value.is_auto_retries_enabled,
@@ -993,7 +990,7 @@ impl From<ProfileSetter> for Profile {
should_collect_cvv_during_payment: value.should_collect_cvv_during_payment,
tax_connector_id: value.tax_connector_id,
is_tax_connector_enabled: value.is_tax_connector_enabled,
- version: consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_network_tokenization_enabled: value.is_network_tokenization_enabled,
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
diff --git a/crates/hyperswitch_domain_models/src/consts.rs b/crates/hyperswitch_domain_models/src/consts.rs
index c2ebd839fe7..93fd63deb62 100644
--- a/crates/hyperswitch_domain_models/src/consts.rs
+++ b/crates/hyperswitch_domain_models/src/consts.rs
@@ -4,12 +4,6 @@ use std::collections::HashSet;
use router_env::once_cell::sync::Lazy;
-#[cfg(feature = "v1")]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
-
-#[cfg(feature = "v2")]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
-
pub static ROUTING_ENABLED_PAYMENT_METHODS: Lazy<HashSet<common_enums::PaymentMethod>> =
Lazy::new(|| {
let mut set = HashSet::new();
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index 384bc5ab427..65e17ace222 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -319,7 +319,7 @@ impl super::behaviour::Conversion for Customer {
updated_by: self.updated_by,
default_billing_address: self.default_billing_address,
default_shipping_address: self.default_shipping_address,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
status: self.status,
})
}
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index fef000a3954..8657af91c57 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -572,7 +572,7 @@ impl super::behaviour::Conversion for MerchantAccount {
modified_at: self.modified_at,
organization_id: self.organization_id,
recon_status: self.recon_status,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self.product_type,
};
@@ -657,7 +657,7 @@ impl super::behaviour::Conversion for MerchantAccount {
modified_at: now,
organization_id: self.organization_id,
recon_status: self.recon_status,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self
.product_type
@@ -820,7 +820,7 @@ impl super::behaviour::Conversion for MerchantAccount {
recon_status: self.recon_status,
payment_link_config: self.payment_link_config,
pm_collect_link_config: self.pm_collect_link_config,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self
.product_type
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index a984db70863..6be1be4b7d3 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -402,7 +402,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
recon_status: diesel_models::enums::ReconStatus::NotRequested,
payment_link_config: None,
pm_collect_link_config,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: false,
product_type: self.product_type,
},
@@ -673,7 +673,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
organization_id: organization.get_organization_id(),
recon_status: diesel_models::enums::ReconStatus::NotRequested,
is_platform_account: false,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
product_type: self.product_type,
}),
)
@@ -2608,7 +2608,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
status: connector_status,
connector_wallets_details: encrypted_data.connector_wallets_details,
additional_merchant_data: encrypted_data.additional_merchant_data,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
feature_metadata,
})
}
@@ -2813,7 +2813,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
business_label: self.business_label.clone(),
business_sub_label: self.business_sub_label.clone(),
additional_merchant_data: encrypted_data.additional_merchant_data,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
})
}
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index bb970a4956e..d76b338dc36 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -230,7 +230,7 @@ pub async fn add_api_key_expiry_task(
api_key_expiry_tracker,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct API key expiry process tracker task")?;
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index e9d9ffe2d75..c46cadd1e33 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -188,7 +188,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
modified_at: common_utils::date_time::now(),
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
})
}
@@ -284,7 +284,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
updated_by: None,
default_billing_address: encrypted_customer_billing_address.map(Into::into),
default_shipping_address: encrypted_customer_shipping_address.map(Into::into),
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
status: common_enums::DeleteStatus::Active,
})
}
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index f4ff34a2967..fee2061e675 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -495,7 +495,7 @@ pub async fn add_payment_method_status_update_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct PAYMENT_METHOD_STATUS_UPDATE process tracker task")?;
@@ -1550,7 +1550,7 @@ pub async fn create_payment_method_for_intent(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
locker_fingerprint_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 12e9c6e16e9..dc79cd68459 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -205,7 +205,7 @@ pub async fn create_payment_method(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id,
network_token_locker_id,
network_token_payment_method_data,
@@ -828,7 +828,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/payment_methods/tokenize/card_executor.rs b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
index 9b7f89c5199..eb9d3d6b6c6 100644
--- a/crates/router/src/core/payment_methods/tokenize/card_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
@@ -422,7 +422,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest> {
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
db.insert_customer(
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 8181df8c056..71d57ef7964 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1401,7 +1401,7 @@ pub async fn add_delete_tokenized_data_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct delete tokenized data process tracker task")?;
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e80c281fa4e..88e5cc7481f 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5967,7 +5967,7 @@ pub async fn add_process_sync_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5b7ead3f4f9..ee11dabd8a6 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1801,7 +1801,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
metrics::CUSTOMER_CREATED.add(1, &[]);
db.insert_customer(new_customer, key_manager_state, key_store, storage_scheme)
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 21a560e781b..7ddce4ccc14 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -3094,7 +3094,7 @@ pub async fn add_external_account_addition_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 45bd954190b..cdb021311e4 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -776,7 +776,7 @@ pub(super) async fn get_or_create_customer_details(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
Ok(Some(
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 0577b532cf0..eddacce99b3 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -550,7 +550,7 @@ async fn store_bank_details_in_payment_methods(
client_secret: None,
payment_method_billing_address: None,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
@@ -577,7 +577,7 @@ async fn store_bank_details_in_payment_methods(
payment_method_billing_address: None,
updated_by: None,
locker_fingerprint_id: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 7d663a48a1a..e81c7d025ae 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -1621,7 +1621,7 @@ pub async fn add_refund_sync_task(
refund_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct refund sync process tracker task")?;
@@ -1660,7 +1660,7 @@ pub async fn add_refund_execute_task(
refund_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct refund execute process tracker task")?;
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index b5d5e7a6cd6..b558bd8cbc4 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -163,7 +163,7 @@ async fn insert_psync_pcr_task(
psync_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct delete tokenized data process tracker task")?;
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index 92c29282b21..71b4e822a34 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -555,7 +555,7 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 92683beb289..213c2b19f6a 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -1680,7 +1680,7 @@ mod merchant_connector_account_cache_tests {
.unwrap(),
),
additional_merchant_data: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
db.insert_merchant_connector_account(key_manager_state, mca.clone(), &merchant_key)
@@ -1858,7 +1858,7 @@ mod merchant_connector_account_cache_tests {
.unwrap(),
),
additional_merchant_data: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
feature_metadata: None,
};
diff --git a/crates/scheduler/Cargo.toml b/crates/scheduler/Cargo.toml
index 176a4a99b23..5c2bc868ab0 100644
--- a/crates/scheduler/Cargo.toml
+++ b/crates/scheduler/Cargo.toml
@@ -10,8 +10,8 @@ default = ["kv_store", "olap"]
olap = ["storage_impl/olap", "hyperswitch_domain_models/olap"]
kv_store = []
email = ["external_services/email"]
-v1 = ["diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "common_utils/v1"]
-v2 = ["diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "common_utils/v2"]
+v1 = ["diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "common_utils/v1", "common_types/v1"]
+v2 = ["diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "common_utils/v2", "common_types/v2"]
[dependencies]
# Third party crates
@@ -31,6 +31,7 @@ uuid = { version = "1.8.0", features = ["v4"] }
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext"] }
+common_types = { version = "0.1.0", path = "../common_types" }
diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"], default-features = false }
external_services = { version = "0.1.0", path = "../external_services" }
hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }
diff --git a/crates/scheduler/src/db/process_tracker.rs b/crates/scheduler/src/db/process_tracker.rs
index 4cf516faa1e..1d721973764 100644
--- a/crates/scheduler/src/db/process_tracker.rs
+++ b/crates/scheduler/src/db/process_tracker.rs
@@ -101,7 +101,7 @@ impl ProcessTrackerInterface for Store {
time_upper_limit,
status,
limit,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
diff --git a/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql b/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql
new file mode 100644
index 00000000000..4e492ad0ef7
--- /dev/null
+++ b/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE organization DROP COLUMN version;
diff --git a/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql b/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql
new file mode 100644
index 00000000000..1569b53f9d1
--- /dev/null
+++ b/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE organization
+ADD COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1';
\ No newline at end of file
|
2025-03-04T09:12:22Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR adds version column to the organisation.
### Additional Changes
- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Test sanity of organization
- Create organization in v1
<img width="406" alt="image" src="https://github.com/user-attachments/assets/6c013b47-b1ac-4918-a14b-ff8a0f0725f7" />
- Create organization in v2
<img width="402" alt="image" src="https://github.com/user-attachments/assets/864caf2d-d845-4368-942b-c8fd2778876b" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
f3d6b15a2ade7dd98fec59777301f44d166f3be3
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7488
|
Bug: feat(core): Add V2 Authentication to all available endpoints
Introduces V2 authentication mechanisms for various admin and client-side APIs :
- [ ] Add V2AdminApiAuth and modified AdminApiAuthWithMerchantIdFromRoute for V2
- [ ] Add V2ApiKeyAuth , V2AdminApiAuth and V2ClientAuth to the endpoints
- [ ] Refactor functions to support V2 Auth as well as V1 Auth
|
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index b32fe76f5ec..d82bef27d1f 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -483,6 +483,6 @@ pub enum RevenueRecoveryError {
PaymentIntentCreateFailed,
#[error("Source verification failed for billing connector")]
WebhookAuthenticationFailed,
- #[error("Payment merchant connector account not found using acccount reference id")]
+ #[error("Payment merchant connector account not found using account reference id")]
PaymentMerchantConnectorAccountNotFound,
}
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index a38a9df72be..3cd959838a5 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -8,7 +8,7 @@ use crate::{
types::api::admin,
};
-#[cfg(feature = "olap")]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::OrganizationCreate))]
pub async fn organization_create(
state: web::Data<AppState>,
@@ -27,8 +27,26 @@ pub async fn organization_create(
))
.await
}
-
-#[cfg(feature = "olap")]
+#[cfg(all(feature = "olap", feature = "v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::OrganizationCreate))]
+pub async fn organization_create(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ json_payload: web::Json<admin::OrganizationCreateRequest>,
+) -> HttpResponse {
+ let flow = Flow::OrganizationCreate;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, _, req, _| create_organization(state, req),
+ &auth::V2AdminApiAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::OrganizationUpdate))]
pub async fn organization_update(
state: web::Data<AppState>,
@@ -59,8 +77,38 @@ pub async fn organization_update(
))
.await
}
-
-#[cfg(feature = "olap")]
+#[cfg(all(feature = "olap", feature = "v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::OrganizationUpdate))]
+pub async fn organization_update(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ org_id: web::Path<common_utils::id_type::OrganizationId>,
+ json_payload: web::Json<admin::OrganizationUpdateRequest>,
+) -> HttpResponse {
+ let flow = Flow::OrganizationUpdate;
+ let organization_id = org_id.into_inner();
+ let org_id = admin::OrganizationId {
+ organization_id: organization_id.clone(),
+ };
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, _, req, _| update_organization(state, org_id.clone(), req),
+ auth::auth_type(
+ &auth::V2AdminApiAuth,
+ &auth::JWTAuthOrganizationFromRoute {
+ organization_id,
+ required_permission: Permission::OrganizationAccountWrite,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::OrganizationRetrieve))]
pub async fn organization_retrieve(
state: web::Data<AppState>,
@@ -92,6 +140,38 @@ pub async fn organization_retrieve(
.await
}
+#[cfg(all(feature = "olap", feature = "v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::OrganizationRetrieve))]
+pub async fn organization_retrieve(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ org_id: web::Path<common_utils::id_type::OrganizationId>,
+) -> HttpResponse {
+ let flow = Flow::OrganizationRetrieve;
+ let organization_id = org_id.into_inner();
+ let payload = admin::OrganizationId {
+ organization_id: organization_id.clone(),
+ };
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, _, req, _| get_organization(state, req),
+ auth::auth_type(
+ &auth::V2AdminApiAuth,
+ &auth::JWTAuthOrganizationFromRoute {
+ organization_id,
+ required_permission: Permission::OrganizationAccountRead,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountCreate))]
pub async fn merchant_account_create(
@@ -144,15 +224,51 @@ pub async fn merchant_account_create(
&req,
new_request_payload_with_org_id,
|state, _, req, _| create_merchant_account(state, req),
- &auth::AdminApiAuth,
+ &auth::V2AdminApiAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
+#[cfg(feature = "v1")]
+#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountRetrieve))]
+pub async fn retrieve_merchant_account(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ mid: web::Path<common_utils::id_type::MerchantId>,
+) -> HttpResponse {
+ let flow = Flow::MerchantsAccountRetrieve;
+ let merchant_id = mid.into_inner();
+ let payload = admin::MerchantId {
+ merchant_id: merchant_id.clone(),
+ };
+ api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, _, req, _| get_merchant_account(state, req, None),
+ auth::auth_type(
+ &auth::AdminApiAuth,
+ &auth::JWTAuthMerchantFromRoute {
+ merchant_id,
+ // This should ideally be MerchantAccountRead, but since FE is calling this API for
+ // profile level users currently keeping this as ProfileAccountRead. FE is removing
+ // this API call for profile level users.
+ // TODO: Convert this to MerchantAccountRead once FE changes are done.
+ required_permission: Permission::ProfileAccountRead,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ )
+ .await
+}
+
/// Merchant Account - Retrieve
///
/// Retrieve a merchant account details.
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountRetrieve))]
pub async fn retrieve_merchant_account(
state: web::Data<AppState>,
@@ -171,7 +287,7 @@ pub async fn retrieve_merchant_account(
payload,
|state, _, req, _| get_merchant_account(state, req, None),
auth::auth_type(
- &auth::AdminApiAuth,
+ &auth::V2AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
merchant_id,
// This should ideally be MerchantAccountRead, but since FE is calling this API for
@@ -207,7 +323,7 @@ pub async fn merchant_account_list(
organization_id,
|state, _, request, _| list_merchant_account(state, request),
auth::auth_type(
- &auth::AdminApiAuth,
+ &auth::V2AdminApiAuth,
&auth::JWTAuthMerchantFromHeader {
required_permission: Permission::MerchantAccountRead,
},
@@ -248,6 +364,35 @@ pub async fn merchant_account_list(
/// Merchant Account - Update
///
/// To update an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountUpdate))]
+pub async fn update_merchant_account(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ mid: web::Path<common_utils::id_type::MerchantId>,
+ json_payload: web::Json<admin::MerchantAccountUpdate>,
+) -> HttpResponse {
+ let flow = Flow::MerchantsAccountUpdate;
+ let merchant_id = mid.into_inner();
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, _, req, _| merchant_account_update(state, &merchant_id, None, req),
+ auth::auth_type(
+ &auth::V2AdminApiAuth,
+ &auth::JWTAuthMerchantFromRoute {
+ merchant_id: merchant_id.clone(),
+ required_permission: Permission::MerchantAccountWrite,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountUpdate))]
pub async fn update_merchant_account(
state: web::Data<AppState>,
@@ -279,6 +424,30 @@ pub async fn update_merchant_account(
/// Merchant Account - Delete
///
/// To delete a merchant account
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountDelete))]
+pub async fn delete_merchant_account(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ mid: web::Path<common_utils::id_type::MerchantId>,
+) -> HttpResponse {
+ let flow = Flow::MerchantsAccountDelete;
+ let mid = mid.into_inner();
+
+ let payload = web::Json(admin::MerchantId { merchant_id: mid }).into_inner();
+ api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, _, req, _| merchant_account_delete(state, req.merchant_id),
+ &auth::V2AdminApiAuth,
+ api_locking::LockAction::NotApplicable,
+ )
+ .await
+}
+
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantsAccountDelete))]
pub async fn delete_merchant_account(
state: web::Data<AppState>,
@@ -712,7 +881,7 @@ pub async fn connector_update(
payload,
|state, _, req, _| update_connector(state, &merchant_id, None, &id, req),
auth::auth_type(
- &auth::AdminApiAuth,
+ &auth::V2AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
merchant_id: merchant_id.clone(),
required_permission: Permission::MerchantConnectorWrite,
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 8c0b7137662..911617753d4 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -268,7 +268,7 @@ pub async fn api_key_revoke(
(&merchant_id, &key_id),
|state, _, (merchant_id, key_id), _| api_keys::revoke_api_key(state, merchant_id, key_id),
auth::auth_type(
- &auth::AdminApiAuth,
+ &auth::V2AdminApiAuth,
&auth::JWTAuthMerchantFromRoute {
merchant_id: merchant_id.clone(),
required_permission: Permission::MerchantApiKeyWrite,
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index c793e3c85e5..c9ff466af00 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -8,7 +8,34 @@ use crate::{
services::{api, authentication as auth, authorization::permissions::Permission},
types::api::customers,
};
-
+#[cfg(all(feature = "v2", feature = "customer_v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::CustomersCreate))]
+pub async fn customers_create(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ json_payload: web::Json<customers::CustomerRequest>,
+) -> HttpResponse {
+ let flow = Flow::CustomersCreate;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, auth: auth::AuthenticationData, req, _| {
+ create_customer(state, auth.merchant_account, auth.key_store, req)
+ },
+ auth::auth_type(
+ &auth::V2ApiKeyAuth,
+ &auth::JWTAuth {
+ permission: Permission::MerchantCustomerWrite,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[instrument(skip_all, fields(flow = ?Flow::CustomersCreate))]
pub async fn customers_create(
state: web::Data<AppState>,
@@ -115,7 +142,42 @@ pub async fn customers_retrieve(
))
.await
}
+#[cfg(all(feature = "v2", feature = "customer_v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::CustomersList))]
+pub async fn customers_list(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ query: web::Query<customers::CustomerListRequest>,
+) -> HttpResponse {
+ let flow = Flow::CustomersList;
+ let payload = query.into_inner();
+ api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, auth: auth::AuthenticationData, request, _| {
+ list_customers(
+ state,
+ auth.merchant_account.get_id().to_owned(),
+ None,
+ auth.key_store,
+ request,
+ )
+ },
+ auth::auth_type(
+ &auth::V2ApiKeyAuth,
+ &auth::JWTAuth {
+ permission: Permission::MerchantCustomerRead,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ )
+ .await
+}
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[instrument(skip_all, fields(flow = ?Flow::CustomersList))]
pub async fn customers_list(
state: web::Data<AppState>,
@@ -219,7 +281,7 @@ pub async fn customers_update(
)
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
},
@@ -249,7 +311,7 @@ pub async fn customers_delete(
delete_customer(state, auth.merchant_account, id, auth.key_store)
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
},
diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs
index 64b46eb2f55..5a802cb4c5a 100644
--- a/crates/router/src/routes/ephemeral_key.rs
+++ b/crates/router/src/routes/ephemeral_key.rs
@@ -78,7 +78,7 @@ pub async fn client_secret_create(
req.headers(),
)
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -99,7 +99,7 @@ pub async fn client_secret_delete(
&req,
payload,
|state, _: auth::AuthenticationData, req, _| helpers::delete_client_secret(state, req),
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 92f16b6c4c7..ec5e1dacf0a 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -95,7 +95,7 @@ pub async fn create_payment_method_api(
))
.await
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -214,7 +214,7 @@ pub async fn payment_method_retrieve_api(
auth.merchant_account,
)
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -246,7 +246,7 @@ pub async fn payment_method_delete_api(
auth.merchant_account,
)
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -613,7 +613,7 @@ pub async fn list_customer_payment_method_api(
)
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
},
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 9708f34c53c..4e670a594a5 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -147,9 +147,9 @@ pub async fn payments_create_intent(
)
},
match env::which() {
- env::Env::Production => &auth::HeaderAuth(auth::ApiKeyAuth),
+ env::Env::Production => &auth::V2ApiKeyAuth,
_ => auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
},
@@ -210,7 +210,7 @@ pub async fn payments_get_intent(
auth.platform_merchant_account,
)
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -249,9 +249,9 @@ pub async fn payments_create_and_confirm_intent(
)
},
match env::which() {
- env::Env::Production => &auth::HeaderAuth(auth::ApiKeyAuth),
+ env::Env::Production => &auth::V2ApiKeyAuth,
_ => auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
},
@@ -313,7 +313,7 @@ pub async fn payments_update_intent(
auth.platform_merchant_account,
)
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -825,7 +825,7 @@ pub async fn payments_connector_session(
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
- global_payment_id,
+ global_payment_id: global_payment_id.clone(),
payload: json_payload.into_inner(),
};
@@ -868,7 +868,9 @@ pub async fn payments_connector_session(
auth.platform_merchant_account,
)
},
- &auth::HeaderAuth(auth::PublishableKeyAuth),
+ &auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
+ global_payment_id,
+ )),
locking_action,
))
.await
@@ -1247,7 +1249,7 @@ pub async fn payments_list(
payments::list_payments(state, auth.merchant_account, auth.key_store, req)
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::MerchantPaymentRead,
},
@@ -2423,7 +2425,7 @@ pub async fn payment_confirm_intent(
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
- global_payment_id,
+ global_payment_id: global_payment_id.clone(),
payload: json_payload.into_inner(),
};
@@ -2468,7 +2470,9 @@ pub async fn payment_confirm_intent(
))
.await
},
- &auth::PublishableKeyAuth,
+ &auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
+ global_payment_id,
+ )),
locking_action,
))
.await
@@ -2540,7 +2544,7 @@ pub async fn proxy_confirm_intent(
header_payload.clone(),
))
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
locking_action,
))
.await
@@ -2611,7 +2615,7 @@ pub async fn payment_status(
.await
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
},
@@ -2657,7 +2661,7 @@ pub async fn payment_get_intent_using_merchant_reference_id(
))
.await
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -2776,7 +2780,7 @@ pub async fn payments_capture(
.await
},
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
},
@@ -2802,7 +2806,7 @@ pub async fn list_payment_methods(
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
- global_payment_id,
+ global_payment_id: global_payment_id.clone(),
payload,
};
@@ -2829,7 +2833,9 @@ pub async fn list_payment_methods(
&header_payload,
)
},
- &auth::PublishableKeyAuth,
+ &auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
+ global_payment_id,
+ )),
api_locking::LockAction::NotApplicable,
))
.await
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index ac0f997a278..04a0d331688 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -82,7 +82,7 @@ pub async fn routing_create_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfileRoutingWrite,
},
@@ -170,7 +170,7 @@ pub async fn routing_link_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::ApiKeyAuth,
+ &auth::V2ApiKeyAuth,
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
required_permission: Permission::MerchantRoutingWrite,
@@ -252,7 +252,7 @@ pub async fn routing_retrieve_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
},
@@ -373,7 +373,7 @@ pub async fn routing_unlink_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::ApiKeyAuth,
+ &auth::V2ApiKeyAuth,
&auth::JWTAuthProfileFromRoute {
profile_id: path,
required_permission: Permission::MerchantRoutingWrite,
@@ -459,7 +459,7 @@ pub async fn routing_update_default_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::MerchantRoutingWrite,
},
@@ -535,7 +535,7 @@ pub async fn routing_retrieve_default_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuthProfileFromRoute {
profile_id: path,
required_permission: Permission::MerchantRoutingRead,
@@ -749,7 +749,7 @@ pub async fn upsert_decision_manager_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfileThreeDsDecisionManagerWrite,
},
@@ -818,7 +818,7 @@ pub async fn retrieve_decision_manager_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuth {
permission: Permission::ProfileThreeDsDecisionManagerWrite,
},
@@ -976,7 +976,7 @@ pub async fn routing_retrieve_linked_config(
},
#[cfg(not(feature = "release"))]
auth::auth_type(
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2ApiKeyAuth,
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
required_permission: Permission::ProfileRoutingRead,
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 502ebb5099f..4eb91756661 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -1064,6 +1064,44 @@ where
}
}
+#[derive(Debug, Default)]
+pub struct V2AdminApiAuth;
+
+#[async_trait]
+impl<A> AuthenticateAndFetch<(), A> for V2AdminApiAuth
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<((), AuthenticationType)> {
+ let header_map_struct = HeaderMapStruct::new(request_headers);
+ let auth_string = header_map_struct.get_auth_string_from_header()?;
+ let request_admin_api_key = auth_string
+ .split(',')
+ .find_map(|part| part.trim().strip_prefix("admin-api-key="))
+ .ok_or_else(|| {
+ report!(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Unable to parse admin_api_key")
+ })?;
+ if request_admin_api_key.is_empty() {
+ return Err(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Admin Api key is empty");
+ }
+ let conf = state.conf();
+
+ let admin_api_key = &conf.secrets.get_inner().admin_api_key;
+
+ if request_admin_api_key != admin_api_key.peek() {
+ Err(report!(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Admin Authentication Failure"))?;
+ }
+
+ Ok(((), AuthenticationType::AdminApiKey))
+ }
+}
#[derive(Debug)]
pub struct AdminApiAuthWithMerchantIdFromRoute(pub id_type::MerchantId);
@@ -1130,7 +1168,7 @@ where
throw_error_if_platform_merchant_authentication_required(request_headers)?;
}
- AdminApiAuth
+ V2AdminApiAuth
.authenticate_and_fetch(request_headers, state)
.await?;
@@ -1194,7 +1232,7 @@ where
throw_error_if_platform_merchant_authentication_required(request_headers)?;
}
- AdminApiAuth
+ V2AdminApiAuth
.authenticate_and_fetch(request_headers, state)
.await?;
@@ -1400,7 +1438,7 @@ where
throw_error_if_platform_merchant_authentication_required(request_headers)?;
}
- AdminApiAuth
+ V2AdminApiAuth
.authenticate_and_fetch(request_headers, state)
.await?;
@@ -1465,7 +1503,7 @@ where
throw_error_if_platform_merchant_authentication_required(request_headers)?;
}
- AdminApiAuth
+ V2AdminApiAuth
.authenticate_and_fetch(request_headers, state)
.await?;
|
2025-03-12T04:05:17Z
|
## Type of Change
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This commit introduces V2 authentication mechanisms for various admin and client-side APIs :
- [x] Added V2AdminApiAuth and modified AdminApiAuthWithMerchantIdFromRoute for V2
- [x] Added V2ApiKeyAuth , V2AdminApiAuth and V2ClientAuth to the endpoints
- [x] Refactored functions to support V2 Auth as well as V1 Auth
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Motivation and Context
## How did you test it?
For `/v2/merchant-accounts`
Request
```
curl --location 'http://localhost:8080/v2/merchant-accounts' \
--header 'x-organization-id: org_d2lZPiRPOGbIMmFcb59A' \
--header 'Content-Type: application/json' \
--header 'Authorization: admin-api-key=test_admin' \
--data '{
"merchant_name": "cloth_seller"
}'
```
Response
```
{
"id": "cloth_seller_KdjFPBxrxWyX09jri2VB",
"merchant_name": "cloth_seller",
"merchant_details": null,
"publishable_key": "pk_dev_735cafe5f43446e88d22bedec15b0139",
"metadata": null,
"organization_id": "org_d2lZPiRPOGbIMmFcb59A",
"recon_status": "not_requested",
"product_type": "orchestration"
}
```
For `/v2/organization`
Request
```
curl --location 'http://localhost:8080/v2/organization' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--data '{
"organization_name": "random_org_1741776562"
}'
```
Response
```
{
"id": "org_m4fLYdEFb7PNHynIfmZO",
"organization_name": "random_org_1741776558",
"organization_details": null,
"metadata": null,
"modified_at": "2025-03-12 10:49:18.475431",
"created_at": "2025-03-12 10:49:18.475424"
}
```
This is how V2AdminApiAuth looks like
```
pub struct V2AdminApiAuth;
#[async_trait]
impl<A> AuthenticateAndFetch<(), A> for V2AdminApiAuth
where
A: SessionStateInfo + Sync,
{
async fn authenticate_and_fetch(
&self,
request_headers: &HeaderMap,
state: &A,
) -> RouterResult<((), AuthenticationType)> {
let header_map_struct = HeaderMapStruct::new(&request_headers);
let auth_string = header_map_struct.get_auth_string_from_header()?;
let request_admin_api_key = auth_string
.split(',')
.find_map(|part| part.trim().strip_prefix("admin-api-key="))
.ok_or_else(|| {
report!(errors::ApiErrorResponse::Unauthorized)
.attach_printable("Unable to parse admin_api_key")
})?;
if request_admin_api_key.is_empty() {
return Err(errors::ApiErrorResponse::Unauthorized)
.attach_printable("Admin Api key is empty");
}
let conf = state.conf();
let admin_api_key = &conf.secrets.get_inner().admin_api_key;
if request_admin_api_key != admin_api_key.peek() {
Err(report!(errors::ApiErrorResponse::Unauthorized)
.attach_printable("Admin Authentication Failure"))?;
}
Ok(((), AuthenticationType::AdminApiKey))
}
}
```
### What changes are done in authorization header
How it was earlier?
```
api-key = {{api-key}}
client-secret={{client_secret}}
api-key = {{admin_api_key}}
```
Changed version
```
Authorization = api-key={{api-key}}
Authorization = admin-api-key={{admin_api_key}}
Authorization = publishable-key={{publishable_key}},client-secret={{client_secret}}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
4f6174d1bf6dd0713b0a3d8e005671c884555144
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7486
|
Bug: refactor(currency_conversion): add support for expiring forex data in redis
## Description
Adding a custom expiry time for Forex data saved in redis (172800 seconds ~ 2days).
A new config is added as well:
`redis_cache_expiry_in_seconds = 172800`
|
diff --git a/config/config.example.toml b/config/config.example.toml
index a52f7486cf5..caeb82c805a 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -74,10 +74,11 @@ max_feed_count = 200 # The maximum number of frames that will be fe
# This section provides configs for currency conversion api
[forex_api]
-call_delay = 21600 # Expiration time for data in cache as well as redis in seconds
api_key = "" # Api key for making request to foreign exchange Api
fallback_api_key = "" # Api key for the fallback service
-redis_lock_timeout = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
+redis_ttl_in_seconds = 172800 # Time to expire for forex data stored in Redis
+data_expiration_delay_in_seconds = 21600 # Expiration time for data in cache as well as redis in seconds
+redis_lock_timeout_in_seconds = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
# Logging configuration. Logging can be either to file or console or both.
@@ -888,4 +889,4 @@ primary_color = "#006DF9" # Primary color of email body
background_color = "#FFFFFF" # Background color of email body
[additional_revenue_recovery_details_call]
-connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-call
\ No newline at end of file
+connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-call
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 157e0aa3a42..b2ee7f39741 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -104,10 +104,11 @@ bucket_name = "bucket" # The AWS S3 bucket name for file storage
# This section provides configs for currency conversion api
[forex_api]
-call_delay = 21600 # Expiration time for data in cache as well as redis in seconds
api_key = "" # Api key for making request to foreign exchange Api
fallback_api_key = "" # Api key for the fallback service
-redis_lock_timeout = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
+data_expiration_delay_in_seconds = 21600 # Expiration time for data in cache as well as redis in seconds
+redis_lock_timeout_in_seconds = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
+redis_ttl_in_seconds = 172800 # Time to expire for forex data stored in Redis
[jwekey] # 3 priv/pub key pair
vault_encryption_key = "" # public key in pem format, corresponding private key in rust locker
diff --git a/config/development.toml b/config/development.toml
index 77a38f9d6e8..683b778dac2 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -77,10 +77,11 @@ locker_enabled = true
ttl_for_storage_in_secs = 220752000
[forex_api]
-call_delay = 21600
api_key = ""
fallback_api_key = ""
-redis_lock_timeout = 100
+data_expiration_delay_in_seconds = 21600
+redis_lock_timeout_in_seconds = 100
+redis_ttl_in_seconds = 172800
[jwekey]
vault_encryption_key = """
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 12242f485b7..9916ed0f3e1 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -30,10 +30,11 @@ dbname = "hyperswitch_db"
pool_size = 5
[forex_api]
-call_delay = 21600
api_key = ""
fallback_api_key = ""
-redis_lock_timeout = 100
+data_expiration_delay_in_seconds = 21600
+redis_lock_timeout_in_seconds = 100
+redis_ttl_in_seconds = 172800
[replica_database]
username = "db_user"
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 605b4b576f3..b1c92046d0e 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -409,10 +409,9 @@ pub struct PaymentLink {
pub struct ForexApi {
pub api_key: Secret<String>,
pub fallback_api_key: Secret<String>,
- /// in s
- pub call_delay: i64,
- /// in s
- pub redis_lock_timeout: u64,
+ pub data_expiration_delay_in_seconds: u32,
+ pub redis_lock_timeout_in_seconds: u32,
+ pub redis_ttl_in_seconds: u32,
}
#[derive(Debug, Deserialize, Clone, Default)]
diff --git a/crates/router/src/core/currency.rs b/crates/router/src/core/currency.rs
index 8c1a8512892..bc63dc878cc 100644
--- a/crates/router/src/core/currency.rs
+++ b/crates/router/src/core/currency.rs
@@ -15,7 +15,7 @@ pub async fn retrieve_forex(
) -> CustomResult<ApplicationResponse<currency::FxExchangeRatesCacheEntry>, ApiErrorResponse> {
let forex_api = state.conf.forex_api.get_inner();
Ok(ApplicationResponse::Json(
- get_forex_rates(&state, forex_api.call_delay)
+ get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds)
.await
.change_context(ApiErrorResponse::GenericNotFoundError {
message: "Unable to fetch forex rates".to_string(),
@@ -48,7 +48,7 @@ pub async fn get_forex_exchange_rates(
state: SessionState,
) -> CustomResult<ExchangeRates, AnalyticsError> {
let forex_api = state.conf.forex_api.get_inner();
- let rates = get_forex_rates(&state, forex_api.call_delay)
+ let rates = get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds)
.await
.change_context(AnalyticsError::ForexFetchFailed)?;
diff --git a/crates/router/src/utils/currency.rs b/crates/router/src/utils/currency.rs
index 4af9f3865f4..cd56382985b 100644
--- a/crates/router/src/utils/currency.rs
+++ b/crates/router/src/utils/currency.rs
@@ -38,7 +38,7 @@ static FX_EXCHANGE_RATES_CACHE: Lazy<RwLock<Option<FxExchangeRatesCacheEntry>>>
impl ApiEventMetric for FxExchangeRatesCacheEntry {}
#[derive(Debug, Clone, thiserror::Error)]
-pub enum ForexCacheError {
+pub enum ForexError {
#[error("API error")]
ApiError,
#[error("API timeout")]
@@ -107,8 +107,8 @@ impl FxExchangeRatesCacheEntry {
timestamp: date_time::now_unix_timestamp(),
}
}
- fn is_expired(&self, call_delay: i64) -> bool {
- self.timestamp + call_delay < date_time::now_unix_timestamp()
+ fn is_expired(&self, data_expiration_delay: u32) -> bool {
+ self.timestamp + i64::from(data_expiration_delay) < date_time::now_unix_timestamp()
}
}
@@ -118,7 +118,7 @@ async fn retrieve_forex_from_local_cache() -> Option<FxExchangeRatesCacheEntry>
async fn save_forex_data_to_local_cache(
exchange_rates_cache_entry: FxExchangeRatesCacheEntry,
-) -> CustomResult<(), ForexCacheError> {
+) -> CustomResult<(), ForexError> {
let mut local = FX_EXCHANGE_RATES_CACHE.write().await;
*local = Some(exchange_rates_cache_entry);
logger::debug!("forex_log: forex saved in cache");
@@ -126,17 +126,17 @@ async fn save_forex_data_to_local_cache(
}
impl TryFrom<DefaultExchangeRates> for ExchangeRates {
- type Error = error_stack::Report<ForexCacheError>;
+ type Error = error_stack::Report<ForexError>;
fn try_from(value: DefaultExchangeRates) -> Result<Self, Self::Error> {
let mut conversion_usable: HashMap<enums::Currency, CurrencyFactors> = HashMap::new();
for (curr, conversion) in value.conversion {
let enum_curr = enums::Currency::from_str(curr.as_str())
- .change_context(ForexCacheError::ConversionError)
+ .change_context(ForexError::ConversionError)
.attach_printable("Unable to Convert currency received")?;
conversion_usable.insert(enum_curr, CurrencyFactors::from(conversion));
}
let base_curr = enums::Currency::from_str(value.base_currency.as_str())
- .change_context(ForexCacheError::ConversionError)
+ .change_context(ForexError::ConversionError)
.attach_printable("Unable to convert base currency")?;
Ok(Self {
base_currency: base_curr,
@@ -157,10 +157,10 @@ impl From<Conversion> for CurrencyFactors {
#[instrument(skip_all)]
pub async fn get_forex_rates(
state: &SessionState,
- call_delay: i64,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
+ data_expiration_delay: u32,
+) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
if let Some(local_rates) = retrieve_forex_from_local_cache().await {
- if local_rates.is_expired(call_delay) {
+ if local_rates.is_expired(data_expiration_delay) {
// expired local data
logger::debug!("forex_log: Forex stored in cache is expired");
call_forex_api_and_save_data_to_cache_and_redis(state, Some(local_rates)).await
@@ -171,26 +171,28 @@ pub async fn get_forex_rates(
}
} else {
// No data in local
- call_api_if_redis_forex_data_expired(state, call_delay).await
+ call_api_if_redis_forex_data_expired(state, data_expiration_delay).await
}
}
async fn call_api_if_redis_forex_data_expired(
state: &SessionState,
- call_delay: i64,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
+ data_expiration_delay: u32,
+) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
match retrieve_forex_data_from_redis(state).await {
- Ok(Some(data)) => call_forex_api_if_redis_data_expired(state, data, call_delay).await,
+ Ok(Some(data)) => {
+ call_forex_api_if_redis_data_expired(state, data, data_expiration_delay).await
+ }
Ok(None) => {
// No data in local as well as redis
call_forex_api_and_save_data_to_cache_and_redis(state, None).await?;
- Err(ForexCacheError::ForexDataUnavailable.into())
+ Err(ForexError::ForexDataUnavailable.into())
}
Err(error) => {
// Error in deriving forex rates from redis
logger::error!("forex_error: {:?}", error);
call_forex_api_and_save_data_to_cache_and_redis(state, None).await?;
- Err(ForexCacheError::ForexDataUnavailable.into())
+ Err(ForexError::ForexDataUnavailable.into())
}
}
}
@@ -198,11 +200,11 @@ async fn call_api_if_redis_forex_data_expired(
async fn call_forex_api_and_save_data_to_cache_and_redis(
state: &SessionState,
stale_redis_data: Option<FxExchangeRatesCacheEntry>,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
+) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
// spawn a new thread and do the api fetch and write operations on redis.
let forex_api_key = state.conf.forex_api.get_inner().api_key.peek();
if forex_api_key.is_empty() {
- Err(ForexCacheError::ConfigurationError("api_keys not provided".into()).into())
+ Err(ForexError::ConfigurationError("api_keys not provided".into()).into())
} else {
let state = state.clone();
tokio::spawn(
@@ -216,16 +218,16 @@ async fn call_forex_api_and_save_data_to_cache_and_redis(
}
.in_current_span(),
);
- stale_redis_data.ok_or(ForexCacheError::EntryNotFound.into())
+ stale_redis_data.ok_or(ForexError::EntryNotFound.into())
}
}
async fn acquire_redis_lock_and_call_forex_api(
state: &SessionState,
-) -> CustomResult<(), ForexCacheError> {
+) -> CustomResult<(), ForexError> {
let lock_acquired = acquire_redis_lock(state).await?;
if !lock_acquired {
- Err(ForexCacheError::CouldNotAcquireLock.into())
+ Err(ForexError::CouldNotAcquireLock.into())
} else {
logger::debug!("forex_log: redis lock acquired");
let api_rates = fetch_forex_rates_from_primary_api(state).await;
@@ -250,7 +252,7 @@ async fn acquire_redis_lock_and_call_forex_api(
async fn save_forex_data_to_cache_and_redis(
state: &SessionState,
forex: FxExchangeRatesCacheEntry,
-) -> CustomResult<(), ForexCacheError> {
+) -> CustomResult<(), ForexError> {
save_forex_data_to_redis(state, &forex)
.await
.async_and_then(|_rates| release_redis_lock(state))
@@ -262,9 +264,9 @@ async fn save_forex_data_to_cache_and_redis(
async fn call_forex_api_if_redis_data_expired(
state: &SessionState,
redis_data: FxExchangeRatesCacheEntry,
- call_delay: i64,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- match is_redis_expired(Some(redis_data.clone()).as_ref(), call_delay).await {
+ data_expiration_delay: u32,
+) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
+ match is_redis_expired(Some(redis_data.clone()).as_ref(), data_expiration_delay).await {
Some(redis_forex) => {
// Valid data present in redis
let exchange_rates = FxExchangeRatesCacheEntry::new(redis_forex.as_ref().clone());
@@ -281,7 +283,7 @@ async fn call_forex_api_if_redis_data_expired(
async fn fetch_forex_rates_from_primary_api(
state: &SessionState,
-) -> Result<FxExchangeRatesCacheEntry, error_stack::Report<ForexCacheError>> {
+) -> Result<FxExchangeRatesCacheEntry, error_stack::Report<ForexError>> {
let forex_api_key = state.conf.forex_api.get_inner().api_key.peek();
logger::debug!("forex_log: Primary api call for forex fetch");
@@ -301,12 +303,12 @@ async fn fetch_forex_rates_from_primary_api(
false,
)
.await
- .change_context(ForexCacheError::ApiUnresponsive)
+ .change_context(ForexError::ApiUnresponsive)
.attach_printable("Primary forex fetch api unresponsive")?;
let forex_response = response
.json::<ForexResponse>()
.await
- .change_context(ForexCacheError::ParsingError)
+ .change_context(ForexError::ParsingError)
.attach_printable(
"Unable to parse response received from primary api into ForexResponse",
)?;
@@ -347,7 +349,7 @@ async fn fetch_forex_rates_from_primary_api(
pub async fn fetch_forex_rates_from_fallback_api(
state: &SessionState,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
+) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
let fallback_forex_api_key = state.conf.forex_api.get_inner().fallback_api_key.peek();
let fallback_forex_url: String =
@@ -367,13 +369,13 @@ pub async fn fetch_forex_rates_from_fallback_api(
false,
)
.await
- .change_context(ForexCacheError::ApiUnresponsive)
+ .change_context(ForexError::ApiUnresponsive)
.attach_printable("Fallback forex fetch api unresponsive")?;
let fallback_forex_response = response
.json::<FallbackForexResponse>()
.await
- .change_context(ForexCacheError::ParsingError)
+ .change_context(ForexError::ParsingError)
.attach_printable(
"Unable to parse response received from falback api into ForexResponse",
)?;
@@ -432,74 +434,76 @@ pub async fn fetch_forex_rates_from_fallback_api(
async fn release_redis_lock(
state: &SessionState,
-) -> Result<DelReply, error_stack::Report<ForexCacheError>> {
+) -> Result<DelReply, error_stack::Report<ForexError>> {
logger::debug!("forex_log: Releasing redis lock");
state
.store
.get_redis_conn()
- .change_context(ForexCacheError::RedisConnectionError)?
+ .change_context(ForexError::RedisConnectionError)?
.delete_key(&REDIX_FOREX_CACHE_KEY.into())
.await
- .change_context(ForexCacheError::RedisLockReleaseFailed)
+ .change_context(ForexError::RedisLockReleaseFailed)
.attach_printable("Unable to release redis lock")
}
-async fn acquire_redis_lock(state: &SessionState) -> CustomResult<bool, ForexCacheError> {
+async fn acquire_redis_lock(state: &SessionState) -> CustomResult<bool, ForexError> {
let forex_api = state.conf.forex_api.get_inner();
logger::debug!("forex_log: Acquiring redis lock");
state
.store
.get_redis_conn()
- .change_context(ForexCacheError::RedisConnectionError)?
+ .change_context(ForexError::RedisConnectionError)?
.set_key_if_not_exists_with_expiry(
&REDIX_FOREX_CACHE_KEY.into(),
"",
- Some(
- i64::try_from(forex_api.redis_lock_timeout)
- .change_context(ForexCacheError::ConversionError)?,
- ),
+ Some(i64::from(forex_api.redis_lock_timeout_in_seconds)),
)
.await
.map(|val| matches!(val, redis_interface::SetnxReply::KeySet))
- .change_context(ForexCacheError::CouldNotAcquireLock)
+ .change_context(ForexError::CouldNotAcquireLock)
.attach_printable("Unable to acquire redis lock")
}
async fn save_forex_data_to_redis(
app_state: &SessionState,
forex_exchange_cache_entry: &FxExchangeRatesCacheEntry,
-) -> CustomResult<(), ForexCacheError> {
+) -> CustomResult<(), ForexError> {
+ let forex_api = app_state.conf.forex_api.get_inner();
logger::debug!("forex_log: Saving forex to redis");
app_state
.store
.get_redis_conn()
- .change_context(ForexCacheError::RedisConnectionError)?
- .serialize_and_set_key(&REDIX_FOREX_CACHE_DATA.into(), forex_exchange_cache_entry)
+ .change_context(ForexError::RedisConnectionError)?
+ .serialize_and_set_key_with_expiry(
+ &REDIX_FOREX_CACHE_DATA.into(),
+ forex_exchange_cache_entry,
+ i64::from(forex_api.redis_ttl_in_seconds),
+ )
.await
- .change_context(ForexCacheError::RedisWriteError)
+ .change_context(ForexError::RedisWriteError)
.attach_printable("Unable to save forex data to redis")
}
async fn retrieve_forex_data_from_redis(
app_state: &SessionState,
-) -> CustomResult<Option<FxExchangeRatesCacheEntry>, ForexCacheError> {
+) -> CustomResult<Option<FxExchangeRatesCacheEntry>, ForexError> {
logger::debug!("forex_log: Retrieving forex from redis");
app_state
.store
.get_redis_conn()
- .change_context(ForexCacheError::RedisConnectionError)?
+ .change_context(ForexError::RedisConnectionError)?
.get_and_deserialize_key(&REDIX_FOREX_CACHE_DATA.into(), "FxExchangeRatesCache")
.await
- .change_context(ForexCacheError::EntryNotFound)
+ .change_context(ForexError::EntryNotFound)
.attach_printable("Forex entry not found in redis")
}
async fn is_redis_expired(
redis_cache: Option<&FxExchangeRatesCacheEntry>,
- call_delay: i64,
+ data_expiration_delay: u32,
) -> Option<Arc<ExchangeRates>> {
redis_cache.and_then(|cache| {
- if cache.timestamp + call_delay > date_time::now_unix_timestamp() {
+ if cache.timestamp + i64::from(data_expiration_delay) > date_time::now_unix_timestamp() {
Some(cache.data.clone())
} else {
logger::debug!("forex_log: Forex stored in redis is expired");
@@ -514,23 +518,23 @@ pub async fn convert_currency(
amount: i64,
to_currency: String,
from_currency: String,
-) -> CustomResult<api_models::currency::CurrencyConversionResponse, ForexCacheError> {
+) -> CustomResult<api_models::currency::CurrencyConversionResponse, ForexError> {
let forex_api = state.conf.forex_api.get_inner();
- let rates = get_forex_rates(&state, forex_api.call_delay)
+ let rates = get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds)
.await
- .change_context(ForexCacheError::ApiError)?;
+ .change_context(ForexError::ApiError)?;
let to_currency = enums::Currency::from_str(to_currency.as_str())
- .change_context(ForexCacheError::CurrencyNotAcceptable)
+ .change_context(ForexError::CurrencyNotAcceptable)
.attach_printable("The provided currency is not acceptable")?;
let from_currency = enums::Currency::from_str(from_currency.as_str())
- .change_context(ForexCacheError::CurrencyNotAcceptable)
+ .change_context(ForexError::CurrencyNotAcceptable)
.attach_printable("The provided currency is not acceptable")?;
let converted_amount =
currency_conversion::conversion::convert(&rates.data, from_currency, to_currency, amount)
- .change_context(ForexCacheError::ConversionError)
+ .change_context(ForexError::ConversionError)
.attach_printable("Unable to perform currency conversion")?;
Ok(api_models::currency::CurrencyConversionResponse {
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index a85ca141281..960d94bf7e4 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -47,10 +47,11 @@ locker_enabled = true
ttl_for_storage_in_secs = 220752000
[forex_api]
-call_delay = 21600
api_key = ""
fallback_api_key = ""
-redis_lock_timeout = 100
+data_expiration_delay_in_seconds = 21600
+redis_lock_timeout_in_seconds = 100
+redis_ttl_in_seconds = 172800
[eph_key]
validity = 1
|
2025-03-06T19:18:34Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Adding a custom expiry time for Forex data saved in redis (172800 seconds ~ 2days).
A new config is added as well:
`redis_cache_expiry_in_seconds = 172800`
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
```
curl --location 'http://localhost:8080/forex/rates' \
--header 'api-key: dev_Gt1XtwvVZ9bw94pn30Cvs3Oc5buVwgAxPEIyNwz1hFjyNUIYEHC7NDSWzHlFc84H' \
--data ''
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
5cdfe8325481909a8a1596f967303eff44ffbcec
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7460
|
Bug: fix(postman): nmi manual capture state
Previously the manually captured payments through `nmi` connector stayed in processing state after confirming the payment. Now, it goes to `requires_capture` state. So, the necessary changes are required.
|
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.test.js
index eedc017da1b..df0080dff2f 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.test.js
@@ -63,12 +63,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "processing" for "status"
+// Response body should have value "requires_capture" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'",
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_capture'",
function () {
- pm.expect(jsonData.status).to.eql("processing");
+ pm.expect(jsonData.status).to.eql("requires_capture");
},
);
}
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js
index e13c466cc26..2043a80f570 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js
@@ -65,9 +65,9 @@ if (jsonData?.client_secret) {
// Response body should have value "requires_capture" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'processing'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
function () {
- pm.expect(jsonData.status).to.eql("processing");
+ pm.expect(jsonData.status).to.eql("requires_capture");
},
);
}
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js
index cee98b477bd..d683186aa00 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "requires_capture" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'processing'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
function () {
- pm.expect(jsonData.status).to.eql("processing");
+ pm.expect(jsonData.status).to.eql("requires_capture");
},
);
}
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.test.js
index d03ed16ff56..b7a6220b0f1 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.test.js
@@ -20,10 +20,10 @@ pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () {
pm.response.to.have.jsonBody();
});
-//// Response body should have value "processing" for "status"
+//// Response body should have value "requires_capture" for "status"
if (jsonData?.status) {
-pm.test("[POST]::/payments - Content check if value for 'status' matches 'processing'", function() {
- pm.expect(jsonData.status).to.eql("processing");
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
+ pm.expect(jsonData.status).to.eql("requires_capture");
})};
diff --git a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js
index cee98b477bd..d683186aa00 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "requires_capture" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'processing'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
function () {
- pm.expect(jsonData.status).to.eql("processing");
+ pm.expect(jsonData.status).to.eql("requires_capture");
},
);
}
|
2025-03-07T10:12:51Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
The Postman Testcases for `nmi` connector was failing in case of Manual Capture
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
_**Before**_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/b22d850f-ad64-4fce-a7c2-26a946db3c52" />
<details>
<summary>Changes</summary>
- Previously the manually captured payments through `nmi` connector stayed in `processing` state after confirming the payment. But now, it goes to `requires_capture` state. So, making the necessary changes.
</details>
_**After**_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/e31e373a-158c-42e3-a324-e5f55827300a" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
15ad6da0793be4bc149ae2e92f4805735be8712a
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7464
|
Bug: Handle optional fields in nexixpay payments requests.
Optional billing details should be used for non-mandatory billing fields.
|
diff --git a/config/config.example.toml b/config/config.example.toml
index ad910ef415a..a95cc7c1405 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -618,8 +618,8 @@ debit = { country = "US, CA", currency = "USD, CAD" }
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" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 47b65efabc4..c84a68e0573 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -378,8 +378,8 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index fc4bca222a9..6d12d8b467a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -334,8 +334,8 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 37346fc3467..58d298e9c5c 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -336,8 +336,8 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/config/development.toml b/config/development.toml
index eab89187a46..1062cdc64f7 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -553,8 +553,8 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 9a24adcd5e9..1cc35e9b799 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -526,8 +526,8 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index fd504a7a412..27eebf78dfb 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -158,18 +158,18 @@ pub struct Order {
#[serde(rename_all = "camelCase")]
pub struct CustomerInfo {
card_holder_name: Secret<String>,
- billing_address: BillingAddress,
+ billing_address: Option<BillingAddress>,
shipping_address: Option<ShippingAddress>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BillingAddress {
- name: Secret<String>,
- street: Secret<String>,
- city: String,
- post_code: Secret<String>,
- country: enums::CountryAlpha2,
+ name: Option<Secret<String>>,
+ street: Option<Secret<String>>,
+ city: Option<String>,
+ post_code: Option<Secret<String>>,
+ country: Option<enums::CountryAlpha2>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -445,19 +445,29 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym
fn try_from(
item: &NexixpayRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
- let billing_address_street = format!(
- "{}, {}",
- item.router_data.get_billing_line1()?.expose(),
- item.router_data.get_billing_line2()?.expose()
- );
-
- let billing_address = BillingAddress {
- name: item.router_data.get_billing_full_name()?,
- street: Secret::new(billing_address_street),
- city: item.router_data.get_billing_city()?,
- post_code: item.router_data.get_billing_zip()?,
- country: item.router_data.get_billing_country()?,
+ let billing_address_street = match (
+ item.router_data.get_optional_billing_line1(),
+ item.router_data.get_optional_billing_line2(),
+ ) {
+ (Some(line1), Some(line2)) => Some(Secret::new(format!(
+ "{}, {}",
+ line1.expose(),
+ line2.expose()
+ ))),
+ (Some(line1), None) => Some(line1),
+ (None, Some(line2)) => Some(line2),
+ (None, None) => None,
};
+ let billing_address = item
+ .router_data
+ .get_optional_billing()
+ .map(|_| BillingAddress {
+ name: item.router_data.get_optional_billing_full_name(),
+ street: billing_address_street,
+ city: item.router_data.get_optional_billing_city(),
+ post_code: item.router_data.get_optional_billing_zip(),
+ country: item.router_data.get_optional_billing_country(),
+ });
let shipping_address_street = match (
item.router_data.get_optional_shipping_line1(),
item.router_data.get_optional_shipping_line2(),
@@ -474,7 +484,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym
let shipping_address = item
.router_data
- .get_optional_billing()
+ .get_optional_shipping()
.map(|_| ShippingAddress {
name: item.router_data.get_optional_shipping_full_name(),
street: shipping_address_street,
@@ -995,19 +1005,29 @@ impl TryFrom<&NexixpayRouterData<&PaymentsCompleteAuthorizeRouterData>>
let order_id = item.router_data.connector_request_reference_id.clone();
let amount = item.amount.clone();
- let billing_address_street = format!(
- "{}, {}",
- item.router_data.get_billing_line1()?.expose(),
- item.router_data.get_billing_line2()?.expose()
- );
-
- let billing_address = BillingAddress {
- name: item.router_data.get_billing_full_name()?,
- street: Secret::new(billing_address_street),
- city: item.router_data.get_billing_city()?,
- post_code: item.router_data.get_billing_zip()?,
- country: item.router_data.get_billing_country()?,
+ let billing_address_street = match (
+ item.router_data.get_optional_billing_line1(),
+ item.router_data.get_optional_billing_line2(),
+ ) {
+ (Some(line1), Some(line2)) => Some(Secret::new(format!(
+ "{}, {}",
+ line1.expose(),
+ line2.expose()
+ ))),
+ (Some(line1), None) => Some(line1),
+ (None, Some(line2)) => Some(line2),
+ (None, None) => None,
};
+ let billing_address = item
+ .router_data
+ .get_optional_billing()
+ .map(|_| BillingAddress {
+ name: item.router_data.get_optional_billing_full_name(),
+ street: billing_address_street,
+ city: item.router_data.get_optional_billing_city(),
+ post_code: item.router_data.get_optional_billing_zip(),
+ country: item.router_data.get_optional_billing_country(),
+ });
let shipping_address_street = match (
item.router_data.get_optional_shipping_line1(),
item.router_data.get_optional_shipping_line2(),
@@ -1024,7 +1044,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsCompleteAuthorizeRouterData>>
let shipping_address = item
.router_data
- .get_optional_billing()
+ .get_optional_shipping()
.map(|_| ShippingAddress {
name: item.router_data.get_optional_shipping_full_name(),
street: shipping_address_street,
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 3849054045c..f31ea0c9d80 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -2239,42 +2239,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "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: "line1".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 {
@@ -5746,42 +5710,6 @@ impl Default for settings::RequiredFields {
value: None,
}
),
- (
- "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: "line1".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 {
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index bdf46a8ee40..dc7a310b6b8 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -310,8 +310,8 @@ credit = { country = "US,CA", currency = "USD" }
debit = { country = "US,CA", currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
-debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
[pm_filters.square]
credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
|
2025-03-09T03:32:45Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Optional billing details should be used for non-mandatory billing fields. Billing address is optional field for making requests to nexixpay. Either billing.first_name or billing.second_name should be present mandatorily.
Includes ENV changes related to support of currency and country for nexixpay connector.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Curl to test the optional billing address.
```
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_RFY4WCFOFu2eEmA13QTQGzHyyjIvaTgdTqKsp2yBy4ofwyZ7fdyIMIJKHcHzGbC5' \
--data-raw '{
"amount": 3545,
"currency": "EUR",
"amount_to_capture": 3545,
"confirm": true,
"profile_id": "pro_56hlX3G8qT0Fz4qlqO2J",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
"setup_future_usage": "off_session",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"customer_id": "customer123",
"phone_country_code": "+1",
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4349940199004549",
"card_exp_month": "12",
"card_exp_year": "30",
"card_cvc": "396"
}
},
"billing": {
"address": {
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 3545,
"account_name": "transaction_processing"
}
],
"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"
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at":"1963-05-03T04:07:52.723Z",
"online": {
"ip_address":"127.0.0.1",
"user_agent": "amet irure esse"
}
},
"connector":["nexixpay"],
"connector_metadata": {
"noon": {
"order_category": "pay"
}
},
"payment_link": false,
"payment_link_config": {
"theme": "",
"logo": "",
"seller_name": "",
"sdk_layout": "",
"display_sdk_only": false,
"enabled_saved_payment_method": false
},
"payment_type": "normal",
"request_incremental_authorization": false,
"merchant_order_reference_id": "test_ord",
"session_expiry": 900
}'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
833da1c3c5a0f006a689b05554c547205774c823
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7463
|
Bug: feat(router):add connector field to PaymentRevenueRecoveryMetadata and update related logic
Add connector field in PaymentRevenueRecoveryMetadata and make insert_execute_pcr_task function
which creates and inserts a process tracker entry for executing a PCR (Payment Control & Reconciliation) workflow. It generates a unique process_tracker_id, fetches the schedule time for retrying MIT payments, and validates the presence of a payment_attempt_id. If any step fails, it returns an Internal Server Error. After constructing a PcrWorkflowTrackingData object with payment details, it inserts the process tracker entry into the database. If successful, it increments a task metrics counter and returns the inserted entry; otherwise, it returns an error.
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f9540fd08fc..c55ef483287 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -7473,6 +7473,15 @@ pub struct FeatureMetadata {
pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
}
+#[cfg(feature = "v2")]
+impl FeatureMetadata {
+ pub fn get_retry_count(&self) -> Option<u16> {
+ self.payment_revenue_recovery_metadata
+ .as_ref()
+ .map(|metadata| metadata.total_retry_count)
+ }
+}
+
/// additional data that might be required by hyperswitch
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -8378,6 +8387,9 @@ pub struct PaymentRevenueRecoveryMetadata {
/// PaymentMethod Subtype
#[schema(example = "klarna", value_type = PaymentMethodType)]
pub payment_method_subtype: common_enums::PaymentMethodType,
+ /// The name of the payment connector through which the payment attempt was made.
+ #[schema(value_type = Connector, example = "stripe")]
+ pub connector: common_enums::connector_enums::Connector,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[cfg(feature = "v2")]
diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rs
index 64b9a66afba..294fb33c662 100644
--- a/crates/diesel_models/src/process_tracker.rs
+++ b/crates/diesel_models/src/process_tracker.rs
@@ -69,12 +69,14 @@ pub struct ProcessTrackerNew {
}
impl ProcessTrackerNew {
+ #[allow(clippy::too_many_arguments)]
pub fn new<T>(
process_tracker_id: impl Into<String>,
task: impl Into<String>,
runner: ProcessTrackerRunner,
tag: impl IntoIterator<Item = impl Into<String>>,
tracking_data: T,
+ retry_count: Option<i32>,
schedule_time: PrimitiveDateTime,
api_version: ApiVersion,
) -> StorageResult<Self>
@@ -87,7 +89,7 @@ impl ProcessTrackerNew {
name: Some(task.into()),
tag: tag.into_iter().map(Into::into).collect(),
runner: Some(runner.to_string()),
- retry_count: 0,
+ retry_count: retry_count.unwrap_or(0),
schedule_time: Some(schedule_time),
rule: String::new(),
tracking_data: tracking_data
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index b79974c33fd..b1fa2197034 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -159,6 +159,8 @@ pub struct PaymentRevenueRecoveryMetadata {
pub payment_method_type: common_enums::enums::PaymentMethod,
/// PaymentMethod Subtype
pub payment_method_subtype: common_enums::enums::PaymentMethodType,
+ /// The name of the payment connector through which the payment attempt was made.
+ pub connector: common_enums::connector_enums::Connector,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index f2dddf39b03..bb8cc6b50ca 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -272,6 +272,7 @@ impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for PaymentReven
),
payment_method_type: from.payment_method_type,
payment_method_subtype: from.payment_method_subtype,
+ connector: from.connector,
}
}
@@ -286,6 +287,7 @@ impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for PaymentReven
.convert_back(),
payment_method_type: self.payment_method_type,
payment_method_subtype: self.payment_method_subtype,
+ connector: self.connector,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 36cc1c5f808..9921cee8a63 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -424,24 +424,6 @@ impl PaymentIntent {
.and_then(|metadata| metadata.get_payment_method_type())
}
- pub fn set_payment_connector_transmission(
- &self,
- feature_metadata: Option<FeatureMetadata>,
- status: bool,
- ) -> Option<Box<FeatureMetadata>> {
- feature_metadata.map(|fm| {
- let mut updated_metadata = fm;
- if let Some(ref mut rrm) = updated_metadata.payment_revenue_recovery_metadata {
- rrm.payment_connector_transmission = if status {
- common_enums::PaymentConnectorTransmission::ConnectorCallFailed
- } else {
- common_enums::PaymentConnectorTransmission::ConnectorCallSucceeded
- };
- }
- Box::new(updated_metadata)
- })
- }
-
pub fn get_connector_customer_id_from_feature_metadata(&self) -> Option<String> {
self.feature_metadata
.as_ref()
@@ -774,11 +756,13 @@ where
let payment_intent_feature_metadata = self.payment_intent.get_feature_metadata();
let revenue_recovery = self.payment_intent.get_revenue_recovery_metadata();
-
- let payment_revenue_recovery_metadata =
- Some(diesel_models::types::PaymentRevenueRecoveryMetadata {
+ let payment_attempt_connector = self.payment_attempt.connector.clone();
+ let payment_revenue_recovery_metadata = match payment_attempt_connector {
+ Some(connector) => Some(diesel_models::types::PaymentRevenueRecoveryMetadata {
// Update retry count by one.
- total_retry_count: revenue_recovery.map_or(1, |data| (data.total_retry_count + 1)),
+ total_retry_count: revenue_recovery
+ .as_ref()
+ .map_or(1, |data| (data.total_retry_count + 1)),
// Since this is an external system call, marking this payment_connector_transmission to ConnectorCallSucceeded.
payment_connector_transmission:
common_enums::PaymentConnectorTransmission::ConnectorCallSucceeded,
@@ -799,7 +783,14 @@ where
},
payment_method_type: self.payment_attempt.payment_method_type,
payment_method_subtype: self.payment_attempt.payment_method_subtype,
- });
+ connector: connector.parse().map_err(|err| {
+ router_env::logger::error!(?err, "Failed to parse connector string to enum");
+ errors::api_error_response::ApiErrorResponse::InternalServerError
+ })?,
+ }),
+ None => Err(errors::api_error_response::ApiErrorResponse::InternalServerError)
+ .attach_printable("Connector not found in payment attempt")?,
+ };
Ok(Some(FeatureMetadata {
redirect_response: payment_intent_feature_metadata
.as_ref()
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index 8adf5676f97..3e1bc93d91c 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -61,7 +61,6 @@ pub enum RecoveryAction {
/// Invalid event has been received.
InvalidAction,
}
-
pub struct RecoveryPaymentIntent {
pub payment_id: id_type::GlobalPaymentId,
pub status: common_enums::IntentStatus,
@@ -75,10 +74,11 @@ pub struct RecoveryPaymentAttempt {
}
impl RecoveryPaymentAttempt {
- pub fn get_attempt_triggered_by(self) -> Option<common_enums::TriggeredBy> {
- self.feature_metadata.and_then(|metadata| {
+ pub fn get_attempt_triggered_by(&self) -> Option<common_enums::TriggeredBy> {
+ self.feature_metadata.as_ref().and_then(|metadata| {
metadata
.revenue_recovery
+ .as_ref()
.map(|recovery| recovery.attempt_triggered_by)
})
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index ae17e69710a..7eb8a8091aa 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -475,12 +475,24 @@ impl
) -> PaymentIntentUpdate {
let amount_captured = self.get_captured_amount(payment_data);
let status = payment_data.payment_attempt.status.is_terminal_status();
- let updated_feature_metadata = payment_data
- .payment_intent
- .set_payment_connector_transmission(
- payment_data.payment_intent.feature_metadata.clone(),
- status,
- );
+ let updated_feature_metadata =
+ payment_data
+ .payment_intent
+ .feature_metadata
+ .clone()
+ .map(|mut feature_metadata| {
+ if let Some(ref mut payment_revenue_recovery_metadata) =
+ feature_metadata.payment_revenue_recovery_metadata
+ {
+ payment_revenue_recovery_metadata.payment_connector_transmission =
+ if self.response.is_ok() {
+ common_enums::PaymentConnectorTransmission::ConnectorCallSucceeded
+ } else {
+ common_enums::PaymentConnectorTransmission::ConnectorCallFailed
+ };
+ }
+ Box::new(feature_metadata)
+ });
match self.response {
Ok(ref _response) => PaymentIntentUpdate::ConfirmIntentPostUpdate {
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index fc87a490b65..bb970a4956e 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -228,6 +228,7 @@ pub async fn add_api_key_expiry_task(
API_KEY_EXPIRY_RUNNER,
[API_KEY_EXPIRY_TAG],
api_key_expiry_tracker,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index b32fe76f5ec..d922a9bc526 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -475,6 +475,8 @@ pub enum RevenueRecoveryError {
PaymentIntentFetchFailed,
#[error("Failed to fetch payment attempt")]
PaymentAttemptFetchFailed,
+ #[error("Failed to fetch payment attempt")]
+ PaymentAttemptIdNotFound,
#[error("Failed to get revenue recovery invoice webhook")]
InvoiceWebhookProcessingFailed,
#[error("Failed to get revenue recovery invoice transaction")]
@@ -485,4 +487,10 @@ pub enum RevenueRecoveryError {
WebhookAuthenticationFailed,
#[error("Payment merchant connector account not found using acccount reference id")]
PaymentMerchantConnectorAccountNotFound,
+ #[error("Failed to fetch primitive date_time")]
+ ScheduleTimeFetchFailed,
+ #[error("Failed to create process tracker")]
+ ProcessTrackerCreationError,
+ #[error("Failed to get the response from process tracker")]
+ ProcessTrackerResponseError,
}
diff --git a/crates/router/src/core/passive_churn_recovery.rs b/crates/router/src/core/passive_churn_recovery.rs
index 958baeee3f9..3b4ca0d7af6 100644
--- a/crates/router/src/core/passive_churn_recovery.rs
+++ b/crates/router/src/core/passive_churn_recovery.rs
@@ -142,6 +142,7 @@ async fn insert_psync_pcr_task(
runner,
tag,
psync_workflow_tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index f9a6f9a9eb9..85b66f291d8 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -493,6 +493,7 @@ pub async fn add_payment_method_status_update_task(
runner,
tag,
tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index f65f048885c..93c61793c16 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1401,6 +1401,7 @@ pub async fn add_delete_tokenized_data_task(
runner,
tag,
tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index d072463020a..0ab33dedf68 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5941,6 +5941,7 @@ pub async fn add_process_sync_task(
runner,
tag,
tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index c029f1439e1..bdf20635dfa 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -160,12 +160,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ProxyPaymentsR
self.validate_status_for_operation(payment_intent.status)?;
- let client_secret = header_payload
- .client_secret
- .as_ref()
- .get_required_value("client_secret header")?;
- payment_intent.validate_client_secret(client_secret)?;
-
let cell_id = state.conf.cell_information.id.clone();
let batch_encrypted_data = domain_types::crypto_operation(
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index f1c8d29ca61..21a560e781b 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -3092,6 +3092,7 @@ pub async fn add_external_account_addition_task(
runner,
tag,
tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 1057f47b4c5..b850420dfd7 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -1605,6 +1605,7 @@ pub async fn add_refund_sync_task(
runner,
tag,
refund_workflow_tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
@@ -1643,6 +1644,7 @@ pub async fn add_refund_execute_task(
runner,
tag,
refund_workflow_tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index 595171114f7..92c29282b21 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -553,6 +553,7 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker(
runner,
tag,
tracking_data,
+ None,
schedule_time,
hyperswitch_domain_models::consts::API_VERSION,
)
diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs
index f27ee47d6aa..60e06ab0782 100644
--- a/crates/router/src/core/webhooks/recovery_incoming.rs
+++ b/crates/router/src/core/webhooks/recovery_incoming.rs
@@ -1,18 +1,22 @@
use api_models::{payments as api_payments, webhooks};
-use common_utils::ext_traits::AsyncExt;
+use common_utils::{ext_traits::AsyncExt, id_type};
+use diesel_models::{process_tracker as storage, schema::process_tracker::retry_count};
use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::revenue_recovery;
+use hyperswitch_domain_models::{errors::api_error_response, revenue_recovery};
use hyperswitch_interfaces::webhooks as interface_webhooks;
use router_env::{instrument, tracing};
+use serde_with::rust::unwrap_or_skip;
use crate::{
core::{
errors::{self, CustomResult},
payments,
},
- routes::{app::ReqState, SessionState},
+ db::StorageInterface,
+ routes::{app::ReqState, metrics, SessionState},
services::{self, connector_integration_interface},
- types::{api, domain},
+ types::{api, domain, storage::passive_churn_recovery as storage_churn_recovery},
+ workflows::passive_churn_recovery_workflow,
};
#[allow(clippy::too_many_arguments)]
@@ -122,6 +126,7 @@ pub async fn recovery_incoming_webhook_flow(
};
let attempt_triggered_by = payment_attempt
+ .as_ref()
.and_then(revenue_recovery::RecoveryPaymentAttempt::get_attempt_triggered_by);
let action = revenue_recovery::RecoveryAction::get_action(event_type, attempt_triggered_by);
@@ -129,10 +134,21 @@ pub async fn recovery_incoming_webhook_flow(
match action {
revenue_recovery::RecoveryAction::CancelInvoice => todo!(),
revenue_recovery::RecoveryAction::ScheduleFailedPayment => {
- todo!()
+ Ok(RevenueRecoveryAttempt::insert_execute_pcr_task(
+ &*state.store,
+ merchant_account.get_id().to_owned(),
+ payment_intent,
+ business_profile.get_id().to_owned(),
+ payment_attempt.map(|attempt| attempt.attempt_id.clone()),
+ storage::ProcessTrackerRunner::PassiveRecoveryWorkflow,
+ )
+ .await
+ .change_context(errors::RevenueRecoveryError::InvoiceWebhookProcessingFailed)?)
}
revenue_recovery::RecoveryAction::SuccessPaymentExternal => {
- todo!()
+ // Need to add recovery stop flow for this scenario
+ router_env::logger::info!("Payment has been succeeded via external system");
+ Ok(webhooks::WebhookResponseTracker::NoEffect)
}
revenue_recovery::RecoveryAction::PendingPayment => {
router_env::logger::info!(
@@ -217,8 +233,7 @@ impl RevenueRecoveryInvoice {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<revenue_recovery::RecoveryPaymentIntent, errors::RevenueRecoveryError> {
let payload = api_payments::PaymentsCreateIntentRequest::from(&self.0);
- let global_payment_id =
- common_utils::id_type::GlobalPaymentId::generate(&state.conf.cell_information.id);
+ let global_payment_id = id_type::GlobalPaymentId::generate(&state.conf.cell_information.id);
let create_intent_response = Box::pin(payments::payments_intent_core::<
hyperswitch_domain_models::router_flow_types::payments::PaymentCreateIntent,
@@ -264,7 +279,7 @@ impl RevenueRecoveryAttempt {
merchant_account: &domain::MerchantAccount,
profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
- payment_id: common_utils::id_type::GlobalPaymentId,
+ payment_id: id_type::GlobalPaymentId,
) -> CustomResult<Option<revenue_recovery::RecoveryPaymentAttempt>, errors::RevenueRecoveryError>
{
let attempt_response = Box::pin(payments::payments_core::<
@@ -332,8 +347,8 @@ impl RevenueRecoveryAttempt {
merchant_account: &domain::MerchantAccount,
profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
- payment_id: common_utils::id_type::GlobalPaymentId,
- billing_connector_account_id: &common_utils::id_type::MerchantConnectorAccountId,
+ payment_id: id_type::GlobalPaymentId,
+ billing_connector_account_id: &id_type::MerchantConnectorAccountId,
payment_connector_account: Option<domain::MerchantConnectorAccount>,
) -> CustomResult<revenue_recovery::RecoveryPaymentAttempt, errors::RevenueRecoveryError> {
let request_payload = self
@@ -372,7 +387,7 @@ impl RevenueRecoveryAttempt {
pub fn create_payment_record_request(
&self,
- billing_merchant_connector_account_id: &common_utils::id_type::MerchantConnectorAccountId,
+ billing_merchant_connector_account_id: &id_type::MerchantConnectorAccountId,
payment_merchant_connector_account: Option<domain::MerchantConnectorAccount>,
) -> api_payments::PaymentsAttemptRecordRequest {
let amount_details = api_payments::PaymentAttemptAmountDetails::from(&self.0);
@@ -431,4 +446,80 @@ impl RevenueRecoveryAttempt {
)?;
Ok(payment_merchant_connector_account)
}
+
+ async fn insert_execute_pcr_task(
+ db: &dyn StorageInterface,
+ merchant_id: id_type::MerchantId,
+ payment_intent: revenue_recovery::RecoveryPaymentIntent,
+ profile_id: id_type::ProfileId,
+ payment_attempt_id: Option<id_type::GlobalAttemptId>,
+ runner: storage::ProcessTrackerRunner,
+ ) -> CustomResult<webhooks::WebhookResponseTracker, errors::RevenueRecoveryError> {
+ let task = "EXECUTE_WORKFLOW";
+
+ let payment_id = payment_intent.payment_id.clone();
+
+ let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr());
+
+ let total_retry_count = payment_intent
+ .feature_metadata
+ .and_then(|feature_metadata| feature_metadata.get_retry_count())
+ .unwrap_or(0);
+
+ let schedule_time =
+ passive_churn_recovery_workflow::get_schedule_time_to_retry_mit_payments(
+ db,
+ &merchant_id,
+ (total_retry_count + 1).into(),
+ )
+ .await
+ .map_or_else(
+ || {
+ Err(
+ report!(errors::RevenueRecoveryError::ScheduleTimeFetchFailed)
+ .attach_printable("Failed to get schedule time for pcr workflow"),
+ )
+ },
+ Ok, // Simply returns `time` wrapped in `Ok`
+ )?;
+
+ let payment_attempt_id = payment_attempt_id
+ .ok_or(report!(
+ errors::RevenueRecoveryError::PaymentAttemptIdNotFound
+ ))
+ .attach_printable("payment attempt id is required for pcr workflow tracking")?;
+
+ let execute_workflow_tracking_data = storage_churn_recovery::PcrWorkflowTrackingData {
+ global_payment_id: payment_id.clone(),
+ merchant_id,
+ profile_id,
+ payment_attempt_id,
+ };
+
+ let tag = ["PCR"];
+
+ let process_tracker_entry = storage::ProcessTrackerNew::new(
+ process_tracker_id,
+ task,
+ runner,
+ tag,
+ execute_workflow_tracking_data,
+ Some(total_retry_count.into()),
+ schedule_time,
+ common_enums::ApiVersion::V2,
+ )
+ .change_context(errors::RevenueRecoveryError::ProcessTrackerCreationError)
+ .attach_printable("Failed to construct process tracker entry")?;
+
+ db.insert_process(process_tracker_entry)
+ .await
+ .change_context(errors::RevenueRecoveryError::ProcessTrackerResponseError)
+ .attach_printable("Failed to enter process_tracker_entry in DB")?;
+ metrics::TASKS_ADDED_COUNT.add(1, router_env::metric_attributes!(("flow", "ExecutePCR")));
+
+ Ok(webhooks::WebhookResponseTracker::Payment {
+ payment_id,
+ status: payment_intent.status,
+ })
+ }
}
|
2025-03-08T10:28:12Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Dependency updates
- [ ] Refactoring
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added connector field in `PaymentRevenueRecoveryMetadata` and made `insert_execute_pcr_task` function
which creates and inserts a process tracker entry for executing a PCR (Payment Control & Reconciliation) workflow. It generates a unique `process_tracker_id`, fetches the schedule time for retrying MIT payments, and validates the presence of a payment_attempt_id. If any step fails, it returns an Internal Server Error. After constructing a `PcrWorkflowTrackingData` object with payment details, it inserts the process tracker entry into the database. If successful, it increments a task metrics counter and returns the inserted entry; otherwise, it returns an error.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Testcase 1:
create payment connector mca
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_FFzEuYGiJhp3SfL7AXoZ' \
--header 'x-profile-id: pro_upiJkbJOOOTQny6DRwAF' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "payment_processor",
"connector_name": "stripe",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "stripe apikey"
},
"connector_webhook_details": {
"merchant_secret": ""
},
"profile_id": "pro_upiJkbJOOOTQny6DRwAF"
}'
```
response :
```
{
"connector_type": "payment_processor",
"connector_name": "stripe",
"connector_label": "stripe_business",
"id": "mca_LGU3THy8GsYCwNmIY226",
"profile_id": "pro_upiJkbJOOOTQny6DRwAF",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "{{*****************}}"
},
"payment_methods_enabled": null,
"connector_webhook_details": {
"merchant_secret": "",
"additional_secret": null
},
"metadata": null,
"disabled": false,
"frm_configs": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null,
"feature_metadata": null
}
```
get the payment connector mca and create billing connector mca
Create billing connector mca:-
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_43a1PFUTB0Ga8Fk4pMfy' \
--header 'x-profile-id: pro_upiJkbJOOOTQny6DRwAF' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "billing_processor",
"connector_name": "chargebee",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "{{connector_api_key}}"
},
"connector_webhook_details": {
"merchant_secret": "chargebee",
"additional_secret" : "password"
},
"profile_id": "pro_upiJkbJOOOTQny6DRwAF",
"feature_metadata" : {
"revenue_recovery" : {
"max_retry_count" : 27,
"billing_connector_retry_threshold" : 16,
"billing_account_reference" :{
"mca_LGU3THy8GsYCwNmIY226" : "gw_17BlyOUaPA0eq12MZ"
}
}
}
}'
```
response:-
```
{
"connector_type": "billing_processor",
"connector_name": "chargebee",
"connector_label": "chargebee_business",
"id": "mca_JbxRy7MozRPhluRWOcWs",
"profile_id": "pro_U7N6Id4cHXirpSZfTG08",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "{{*****************}}"
},
"payment_methods_enabled": null,
"connector_webhook_details": {
"merchant_secret": "chargebee",
"additional_secret": "password"
},
"metadata": null,
"disabled": false,
"frm_configs": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null,
"feature_metadata": {
"revenue_recovery": {
"max_retry_count": 27,
"billing_connector_retry_threshold": 16,
"billing_account_reference": {
"mca_B16pBbm16yn5Ud2pnOQx": "gw_16BlyOUaPA0eq12MZ"
}
}
}
}
```
Send chargebee simulated webhook either from dashboard or postman
request :
```
curl --location 'http://localhost:8080/v2/webhooks/cloth_seller_nIw80EwT6E01JF4OC7SQ/pro_U7N6Id4cHXirpSZfTG08/mca_JbxRy7MozRPhluRWOcWs' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data-raw '{
"id": "ev_169vy3UaPFn4L4mf",
"occurred_at": 1737361021,
"source": "admin_console",
"user": "ns22eem1r18@student.nitw.ac.in",
"object": "event",
"api_version": "v2",
"content": {
"transaction": {
"id": "txn_169vy3UaPFmC44me",
"customer_id": "Azq8o5UaLqWWvyGd",
"subscription_id": "Azq8o5UaLr2WnyHG",
"gateway_account_id": "gw_16BlyOUaPA0eq12MZ",
"payment_source_id": "pm_169vy3UaPDo0t4hL",
"payment_method": "card",
"gateway": "stripe",
"type": "payment",
"date": 1737361019,
"exchange_rate": 1,
"amount": 5,
"id_at_gateway": "ch_3QjGAJSHworDX2hs0B120C0A",
"status": "failure",
"updated_at": 1737361021,
"fraud_reason": "Payment complete.",
"resource_version": 1737361021397,
"deleted": false,
"object": "transaction",
"masked_card_number": "************4242",
"currency_code": "INR",
"base_currency_code": "INR",
"amount_unused": 0,
"linked_invoices": [
{
"invoice_id": "9",
"applied_amount": 500000,
"applied_at": 1737361021,
"invoice_date": 1737361018,
"invoice_total": 500000,
"invoice_status": "paid"
}
],
"linked_refunds": [],
"initiator_type": "merchant",
"three_d_secure": false,
"payment_method_details": "{\"card\":{\"first_name\":\"test2\",\"last_name\":\"name2\",\"iin\":\"424242\",\"last4\":\"4242\",\"funding_type\":\"credit\",\"expiry_month\":12,\"expiry_year\":2026,\"billing_addr1\":\"asdf\",\"billing_addr2\":\"asd\",\"billing_city\":\"asdf\",\"billing_state\":\"asdfaf\",\"billing_country\":\"AF\",\"billing_zip\":\"12345\",\"masked_number\":\"************4242\",\"object\":\"card\",\"brand\":\"visa\"}}"
},
"invoice": {
"id": "invoice_1234",
"customer_id": "Azq8o5UaLqWWvyGd",
"subscription_id": "Azq8o5UaLr2WnyHG",
"recurring": false,
"status": "paid",
"price_type": "tax_exclusive",
"date": 1737361018,
"due_date": 1737361018,
"net_term_days": 0,
"exchange_rate": 1,
"total": 5,
"amount_paid": 0,
"amount_adjusted": 0,
"write_off_amount": 0,
"credits_applied": 0,
"amount_due": 0,
"paid_at": 1737361019,
"updated_at": 1737361021,
"resource_version": 1737361021401,
"deleted": false,
"object": "invoice",
"first_invoice": false,
"amount_to_collect": 0,
"round_off_amount": 0,
"has_advance_charges": false,
"currency_code": "INR",
"base_currency_code": "INR",
"generated_at": 1737361018,
"is_gifted": false,
"term_finalized": true,
"channel": "web",
"tax": 0,
"line_items": [
{
"id": "li_169vy3UaPFmBR4md",
"date_from": 1737361004,
"date_to": 1737361004,
"unit_amount": 500000,
"quantity": 1,
"amount": 500000,
"pricing_model": "flat_fee",
"is_taxed": false,
"tax_amount": 0,
"object": "line_item",
"subscription_id": "Azq8o5UaLr2WnyHG",
"customer_id": "Azq8o5UaLqWWvyGd",
"description": "Implementation Charge",
"entity_type": "charge_item_price",
"entity_id": "cbdemo_implementation-charge-INR",
"tax_exempt_reason": "tax_not_configured",
"discount_amount": 0,
"item_level_discount_amount": 0
}
],
"sub_total": 500000,
"linked_payments": [
{
"txn_id": "txn_169vy3UaPFmC44me",
"applied_amount": 500000,
"applied_at": 1737361021,
"txn_status": "success",
"txn_date": 1737361019,
"txn_amount": 500000
}
],
"applied_credits": [],
"adjustment_credit_notes": [],
"issued_credit_notes": [],
"linked_orders": [],
"dunning_attempts": [],
"billing_address": {
"first_name": "test1",
"last_name": "name",
"email": "johndoe@gmail.com",
"company": "johndoe",
"phone": "+91 83 17 575848",
"line1": "asdf",
"line2": "asd",
"line3": "ahjkd",
"city": "asdf",
"state_code": "TG",
"state": "Telangana",
"country": "IN",
"zip": "561432",
"validation_status": "not_validated",
"object": "billing_address"
},
"site_details_at_creation": {
"timezone": "Asia/Calcutta"
}
},
"customer": {
"id": "Azq8o5UaLqWWvyGd",
"first_name": "john",
"last_name": "doe",
"email": "john@gmail.com",
"phone": "831 757 5848",
"company": "johndoe",
"auto_collection": "on",
"net_term_days": 0,
"allow_direct_debit": false,
"created_at": 1737310670,
"created_from_ip": "205.254.163.189",
"taxability": "taxable",
"updated_at": 1737360899,
"pii_cleared": "active",
"channel": "web",
"resource_version": 1737360899990,
"deleted": false,
"object": "customer",
"billing_address": {
"first_name": "test1",
"last_name": "name",
"email": "johndoe@gmail.com",
"company": "johndoe",
"phone": "+91 83 17 575848",
"line1": "asdf",
"line2": "asd",
"line3": "ahjkd",
"city": "asdf",
"state_code": "TG",
"state": "Telangana",
"country": "IN",
"zip": "561432",
"validation_status": "not_validated",
"object": "billing_address"
},
"card_status": "valid",
"promotional_credits": 0,
"refundable_credits": 0,
"excess_payments": 0,
"unbilled_charges": 0,
"preferred_currency_code": "INR",
"mrr": 0,
"primary_payment_source_id": "pm_169vy3UaPDo0t4hL",
"payment_method": {
"object": "payment_method",
"type": "card",
"reference_id": "cus_RcUo8xTwe0sHP7/card_1QjG2dSHworDX2hs6YIjKdML",
"gateway": "stripe",
"gateway_account_id": "gw_16BlyOUaPA0eq12MZ",
"status": "valid"
}
},
"subscription": {
"id": "Azq8o5UaLr2WnyHG",
"billing_period": 1,
"billing_period_unit": "month",
"customer_id": "Azq8o5UaLqWWvyGd",
"status": "active",
"current_term_start": 1737310793,
"current_term_end": 1739989193,
"next_billing_at": 1739989193,
"created_at": 1737310793,
"started_at": 1737310793,
"activated_at": 1737310793,
"created_from_ip": "205.254.163.189",
"updated_at": 1737310799,
"has_scheduled_changes": false,
"channel": "web",
"resource_version": 1737310799688,
"deleted": false,
"object": "subscription",
"currency_code": "INR",
"subscription_items": [
{
"item_price_id": "cbdemo_premium-INR-monthly",
"item_type": "plan",
"quantity": 1,
"unit_price": 100000,
"amount": 0,
"free_quantity": 3,
"object": "subscription_item"
}
],
"shipping_address": {
"first_name": "test1",
"last_name": "name",
"email": "johndoe@gmail.com",
"company": "johndoe",
"phone": "+91 83 17 575848",
"line1": "asdf",
"line2": "asd",
"line3": "ahjkd",
"city": "asdf",
"state_code": "TG",
"state": "Telangana",
"country": "IN",
"zip": "561432",
"validation_status": "not_validated",
"object": "shipping_address"
},
"due_invoices_count": 0,
"mrr": 0,
"exchange_rate": 1,
"base_currency_code": "INR",
"has_scheduled_advance_invoices": false
}
},
"event_type": "payment_failed",
"webhook_status": "scheduled",
"webhooks": [
{
"id": "whv2_6oZfZUaLmtchA5Bl",
"webhook_status": "scheduled",
"object": "webhook"
}
]
}'
```
Response:-
200 OK (Postman)
This should create Payment intent, payment attempt in our system with right values in DB
Payment intent details in DB
<img width="1199" alt="Screenshot 2025-03-10 at 14 08 56" src="https://github.com/user-attachments/assets/baa26e0f-dd6b-42bb-90d8-2f0ce6a1aab7" />
Payment attempt details in DB
<img width="1138" alt="Screenshot 2025-03-10 at 14 09 53" src="https://github.com/user-attachments/assets/101f79e1-67a8-4aad-b8f7-dd20c565bfcc" />
Test case 2 :
change the transaction id in above simulated webhooks and hit the request again, it should create new payment attempt but update the payment intent feature metadata.
<img width="1177" alt="Screenshot 2025-03-10 at 14 26 53" src="https://github.com/user-attachments/assets/29873c6d-79b8-43b4-8ec8-fec1bb755d8f" />
Scheduling to failed payments in log(schedule_time: Some(2025-03-10 8:46:43.815835)):-
<img width="858" alt="Screenshot 2025-03-10 at 14 52 45" src="https://github.com/user-attachments/assets/c9b7f9b2-41c3-44f7-9249-a34747fe0b28" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
d1f53036c75771d8387a9579a544c1e2b3c17353
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7413
|
Bug: [FEATURE] Add support for Google Pay Mandates in `Authorize.Net`
At present, `Authorize.Net` connector only support normal payments via Google Pay.
We need to add support for making Mandate payments via Google Pay.
Just modify the `transformers.rs` and `authorizedotnet.rs` file to add support to it.
|
diff --git a/config/config.example.toml b/config/config.example.toml
index a52f7486cf5..448d65bb6ee 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -474,9 +474,9 @@ bank_debit.bacs = { connector_list = "adyen" }
bank_debit.sepa = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = { connector_list = "stripe,globalpay" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet" }
wallet.samsung_pay = { connector_list = "cybersource" }
-wallet.google_pay = { connector_list = "bankofamerica" }
+wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet" }
bank_redirect.giropay = { connector_list = "globalpay" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 1feedf8f1cd..1f4a8dd3b81 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -177,9 +177,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 712df253a94..98d3b4d31ec 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -177,9 +177,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index a9f20670ca7..d9d98beab75 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -177,9 +177,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/development.toml b/config/development.toml
index 77a38f9d6e8..a21a5f090b9 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -739,9 +739,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 12242f485b7..4c91078b490 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -588,8 +588,8 @@ adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,hal
[mandates.supported_payment_methods]
pay_later.klarna = { connector_list = "adyen" }
-wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
+wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotnet" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet" }
wallet.samsung_pay = { connector_list = "cybersource" }
wallet.paypal = { connector_list = "adyen" }
card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" }
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
index 29af20a9570..3bd39fd38b5 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
@@ -117,7 +117,11 @@ impl ConnectorValidation for Authorizedotnet {
pm_type: Option<enums::PaymentMethodType>,
pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
- let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]);
+ let mandate_supported_pmd = std::collections::HashSet::from([
+ PaymentMethodDataType::Card,
+ PaymentMethodDataType::GooglePay,
+ PaymentMethodDataType::ApplePay,
+ ]);
connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
index 626d6d76599..d7f50aa7405 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
@@ -31,8 +31,8 @@ use serde_json::Value;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, CardData, ForeignTryFrom, PaymentsSyncRequestData, RefundsRequestData,
- RouterData as OtherRouterData, WalletData as OtherWalletData,
+ self, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData, PaymentsSyncRequestData,
+ RefundsRequestData, RouterData as OtherRouterData, WalletData as OtherWalletData,
},
};
@@ -376,8 +376,92 @@ impl TryFrom<&SetupMandateRouterData> for CreateCustomerProfileRequest {
},
})
}
+ PaymentMethodData::Wallet(wallet_data) => match wallet_data {
+ WalletData::GooglePay(_) => {
+ let merchant_authentication =
+ AuthorizedotnetAuthType::try_from(&item.connector_auth_type)?;
+ let validation_mode = match item.test_mode {
+ Some(true) | None => ValidationMode::TestMode,
+ Some(false) => ValidationMode::LiveMode,
+ };
+ Ok(Self {
+ create_customer_profile_request: AuthorizedotnetZeroMandateRequest {
+ merchant_authentication,
+ profile: Profile {
+ // The payment ID is included in the description because the connector requires unique description when creating a mandate.
+ description: item.payment_id.clone(),
+ payment_profiles: PaymentProfiles {
+ customer_type: CustomerType::Individual,
+ payment: PaymentDetails::OpaqueData(WalletDetails {
+ data_descriptor: WalletMethod::Googlepay,
+ data_value: Secret::new(
+ wallet_data.get_encoded_wallet_token()?,
+ ),
+ }),
+ },
+ },
+ validation_mode,
+ },
+ })
+ }
+ WalletData::ApplePay(applepay_token) => {
+ let merchant_authentication =
+ AuthorizedotnetAuthType::try_from(&item.connector_auth_type)?;
+ let validation_mode = match item.test_mode {
+ Some(true) | None => ValidationMode::TestMode,
+ Some(false) => ValidationMode::LiveMode,
+ };
+ Ok(Self {
+ create_customer_profile_request: AuthorizedotnetZeroMandateRequest {
+ merchant_authentication,
+ profile: Profile {
+ // The payment ID is included in the description because the connector requires unique description when creating a mandate.
+ description: item.payment_id.clone(),
+ payment_profiles: PaymentProfiles {
+ customer_type: CustomerType::Individual,
+ payment: PaymentDetails::OpaqueData(WalletDetails {
+ data_descriptor: WalletMethod::Applepay,
+ data_value: Secret::new(
+ applepay_token.payment_data.clone(),
+ ),
+ }),
+ },
+ },
+ validation_mode,
+ },
+ })
+ }
+ WalletData::AliPayQr(_)
+ | WalletData::AliPayRedirect(_)
+ | WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
+ | WalletData::MomoRedirect(_)
+ | WalletData::KakaoPayRedirect(_)
+ | WalletData::GoPayRedirect(_)
+ | WalletData::GcashRedirect(_)
+ | WalletData::ApplePayRedirect(_)
+ | WalletData::ApplePayThirdPartySdk(_)
+ | WalletData::DanaRedirect {}
+ | WalletData::GooglePayRedirect(_)
+ | WalletData::GooglePayThirdPartySdk(_)
+ | WalletData::MbWayRedirect(_)
+ | WalletData::MobilePayRedirect(_)
+ | WalletData::PaypalRedirect(_)
+ | WalletData::PaypalSdk(_)
+ | WalletData::Paze(_)
+ | WalletData::SamsungPay(_)
+ | WalletData::TwintRedirect {}
+ | WalletData::VippsRedirect {}
+ | WalletData::TouchNGoRedirect(_)
+ | WalletData::WeChatPayRedirect(_)
+ | WalletData::WeChatPayQr(_)
+ | WalletData::CashappQr(_)
+ | WalletData::SwishQr(_)
+ | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("authorizedotnet"),
+ ))?,
+ },
PaymentMethodData::CardRedirect(_)
- | PaymentMethodData::Wallet(_)
| PaymentMethodData::PayLater(_)
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankDebit(_)
@@ -748,41 +832,24 @@ impl
&Card,
),
) -> Result<Self, Self::Error> {
- let (profile, customer) =
- if item
- .router_data
- .request
- .setup_future_usage
- .is_some_and(|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()
- .is_some_and(|mandate_details| {
- mandate_details.customer_acceptance.is_some()
- }))
- {
- (
- Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
- create_profile: true,
- })),
- Some(CustomerDetails {
- //The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate.
- //If the length exceeds 20 characters, a random alphanumeric string is used instead.
- id: if item.router_data.payment_id.len() <= 20 {
- item.router_data.payment_id.clone()
- } else {
- Alphanumeric.sample_string(&mut rand::thread_rng(), 20)
- },
- }),
- )
- } else {
- (None, None)
- };
+ let (profile, customer) = if item.router_data.request.is_mandate_payment() {
+ (
+ Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
+ create_profile: true,
+ })),
+ Some(CustomerDetails {
+ //The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate.
+ //If the length exceeds 20 characters, a random alphanumeric string is used instead.
+ id: if item.router_data.payment_id.len() <= 20 {
+ item.router_data.payment_id.clone()
+ } else {
+ Alphanumeric.sample_string(&mut rand::thread_rng(), 20)
+ },
+ }),
+ )
+ } else {
+ (None, None)
+ };
Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount,
@@ -841,6 +908,23 @@ impl
&WalletData,
),
) -> Result<Self, Self::Error> {
+ let (profile, customer) = if item.router_data.request.is_mandate_payment() {
+ (
+ Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
+ create_profile: true,
+ })),
+ Some(CustomerDetails {
+ id: if item.router_data.payment_id.len() <= 20 {
+ item.router_data.payment_id.clone()
+ } else {
+ Alphanumeric.sample_string(&mut rand::thread_rng(), 20)
+ },
+ }),
+ )
+ } else {
+ (None, None)
+ };
+
Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount,
@@ -849,11 +933,11 @@ impl
wallet_data,
&item.router_data.request.complete_authorize_url,
)?),
- profile: None,
+ profile,
order: Order {
description: item.router_data.connector_request_reference_id.clone(),
},
- customer: None,
+ customer,
bill_to: item
.router_data
.get_optional_billing()
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index a85ca141281..f575a22f2e0 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -279,8 +279,8 @@ cards = [
]
[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
+credit = { country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW" }
+debit = { country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW" }
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
@@ -386,9 +386,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
|
2025-03-03T17:54:29Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR adds mandates support for Google Pay and Apple Pay Payment Method via `Authorize.Net` connector. It also supports Zero Auth Mandates.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
First of all, it is a merchant requirement and also, `Authorize.Net` previously did not have mandates support. So we were throwing `501` every time some one tried to create a mandate payment via Google Pay or Apple Pay.
Also closes https://github.com/juspay/hyperswitch/issues/7413
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
**Google Pay (confirm: `true`)**
<details>
<summary>0. Generate Token</summary>
Generated with jsfiddle. A snippet from it has been attached below:
```js
paymentToken = paymentData.paymentMethodData.tokenizationData.token;
// Stringified payment token is passed in the request
console.log("STRINGIFIED_TOKEN: ", JSON.stringify(paymentToken));
```
</details>
**Normal Payment**
<details>
<summary>1. Google Pay Payment Create</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 7000,
"currency": "USD",
"confirm": true,
"business_country":"US",
"business_label":"default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "StripeCustomer",
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay": {
"description": "Visa •••• 1111",
"tokenization_data": {
"type": "PAYMENT_GATEWAY",
"token": "{\"signature\":\"MEYCIQD4IOPmA38TEwyc2MydkgUkk/qVM2sMCS7EmUPNP2NpIAIhAJKXI2JdZSjQRBEAZ6LNmXVPv7j80i9iuTeAWM4+f/2Y\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"HUriM67+LViEdMAtrwfcyxiOuQIEAI9WKzJYZ6AqAh8Zx4c673vNN7ni/tddZLoID1Jv1ly1a3brPvWtvGLaoshh0BKqKRX/talksIBBQceTUbnPYVwC4vUK+PakLCGK1gOAmfaMnoHVmiKDZQs5Lnu1zJ1xww2Wm0M/YzGTx12njDmLuVsA2qU8fgkQiW6aJnPePiA+4Rx6ykDI1mDcALoU+gmSftSBkibAY9igkpmJkS6SCxTZ/5ihwXayBZTaGWBGKVIU2CrwwbECIWvaldvlWaHC0T/Iual1o4zAIsmbeqIejYa2TZtCMhiLI3kX+3FaS4LrcTn5/RyjD9ZurVXfdXJ/2XPhSMzHj14RE0Axf+ZabZsf9UxZzGVtsBw2kfCnSNZ9v2BEjPNxwGy4w3giumUHlqaQWv5RGg\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BJOyfPwG44zKn/eIEAO9On1Huuo+5aiwAolhqoDObl3yX8tQrjwtMk3eTUJOfuKG+fkGs5IIgYPARlpt/SEwOos\\\\u003d\\\",\\\"tag\\\":\\\"nKgFcEDO0LGzngqIsx/myAI8+TshLBvKkNxn8HdoBCw\\\\u003d\\\"}\"}"
},
"type": "CARD",
"info": {
"card_network": "VISA",
"card_details": "1111"
}
}
}
}
}'
```
```json
{
"payment_id": "pay_Ycjdrhh70tgbCzFUovom",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 7000,
"net_amount": 7000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 7000,
"connector": "authorizedotnet",
"client_secret": "pay_Ycjdrhh70tgbCzFUovom_secret_pGJFgpSIthkYEqIryDYm",
"created": "2025-03-04T10:28:48.398Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741084128,
"expires": 1741087728,
"secret": "epk_cbc6c778677e4a1988dea5ff96be7a49"
},
"manual_retry_allowed": false,
"connector_transaction_id": "0",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "0",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T10:43:48.398Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-04T10:28:50.381Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
</details>
**Mandate Payment**
Prior to make 0 Auth mandate, make sure that the Test Mode is turned off on connector dashboard and Live mode is turned on:

If not, you'll be greeted with below mentioned error:
```log
2025-03-04T11:47:15.392668Z ERROR router::services::api: error: {"error":{"type":"invalid_request","message":"Payment failed during authorization with connector. Retry payment","code":"CE_01"}}
├╴at crates/router/src/services/api.rs:790:14
│
├─▶ {"error":{"type":"processing_error","code":"CE_01","message":"Payment failed during authorization with connector. Retry payment","data":null}}
│ ╰╴at crates/router/src/core/errors/utils.rs:418:17
│
├─▶ Failed to deserialize connector response
│ ╰╴at crates/router/src/connector/authorizedotnet.rs:199:14
│
├─▶ Failed to parse struct: AuthorizedotnetPaymentsResponse
│ ├╴at /orca/crates/common_utils/src/ext_traits.rs:175:14
│ ╰╴Unable to parse router::connector::authorizedotnet::transformers::AuthorizedotnetSetupMandateResponse from bytes b"{\"messages\":{\"resultCode\":\"Error\",\"message\":[{\"code\":\"E00009\",\"text\":\"The payment gateway account is in Test Mode. The request cannot be processed.\"}]}}"
│
╰─▶ missing field `customerPaymentProfileIdList` at line 1 column 152
╰╴at /orca/crates/common_utils/src/ext_traits.rs:175:14
```
<details>
<summary>2. 0 Auth mandate Google Pay Payment Create (CIT)</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": true,
"business_country":"US",
"business_label":"default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "StripeCustomer",
"email": "likhin.bopanna@gmail.com",
"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",
"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": 8000,
"currency": "USD"
}
}
},
"payment_type": "setup_mandate",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay": {
"description": "Visa •••• 1111",
"tokenization_data": {
"type": "PAYMENT_GATEWAY",
"token": "{\"signature\":\"MEYCIQDXSxykX6QsEf6OfbBt6JeZRV0fKMfdGqLMWW09SVTIiQIhAL1AQ4oCeX09uK//SZotBysxb1VJocA9UFjRj3E2f90+\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"j/yT6NHHmADowqcEBoC58j99OyIEqOIJc6uWFwXAV2duIjI838Rl7U+4XYjpKfSViaNhPoW9KJ8rAKy04XAVxx9iEM4sgIeP3cgZXq5T28ivWLbGiKI+iVBvgkd6TFq9OCWvo2WD+xhg0gZshkKmuq50QzELQuoNeIbmgehXQgD2QizIcxfr/1bKLWYU46DsR+nbN/I8L8of6TbbHsTlyN3A36+uq24uQGMoWloWj9A6ZEGbiPox9ljdZiYTfqXEkBd/LoRCYp8yuDPrGFOYBCCWq7tZ8TR8EBWOvAzfWpwQLMBpuFR+P22S2fM3lvbcJoHgMimsAlCRmcdS9G/knoV32KhkVLsMz3zMvqXPMRxGa9yxbHbopYSPpu8HoXZMgv867GtMHguzqNkSas0r+WFg3GAR/ZxKnwK7sQ\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BAkY6NwItLszcKq2mX4tgTwqYpP1bJkSQ5nJhWPEaPE7OhlSMMNjikCwRFQqq1qEyvDJjiNopuHmEwUTMDY5GRE\\\\u003d\\\",\\\"tag\\\":\\\"yRNDiUqscYJDSzhe3NozPDftfR6MTy83iui6Hru/F3g\\\\u003d\\\"}\"}"
},
"type": "CARD",
"info": {
"card_network": "VISA",
"card_details": "1111"
}
}
}
}
}'
```
```json
{
"payment_id": "pay_mIpw378Mk8zHlAjiMMMP",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "authorizedotnet",
"client_secret": "pay_mIpw378Mk8zHlAjiMMMP_secret_ifCWgJ3idLvIOSNl3diR",
"created": "2025-03-04T11:51:57.766Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": "man_P4lMkUEfHZL1so7BT7vL",
"mandate_data": {
"update_mandate_id": null,
"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": 8000,
"currency": "USD",
"start_date": null,
"end_date": null,
"metadata": null
}
}
},
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741089117,
"expires": 1741092717,
"secret": "epk_14f46a89c0324250855f4ffdb66b6393"
},
"manual_retry_allowed": false,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T12:06:57.766Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_uiXIl346CEL1MNsb1Itz",
"payment_method_status": "active",
"updated": "2025-03-04T11:51:59.981Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929556579-928947232",
"card_discovery": null
}
```
</details>
<details>
<summary>3. 0 Auth mandate Google Pay Payment Create (MIT)</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"amount": 1000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "StripeCustomer",
"client_secret": "pay_Yjz0to0D2SWrvMnu9YYJ_secret_dww4J2IkgUS375Qp14DD",
"recurring_details": {
"type": "payment_method_id",
"data": "pm_uiXIl346CEL1MNsb1Itz"
},
"off_session": true,
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"payment_method": "wallet",
"payment_method_type": "google_pay",
"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"
}
}
}'
```
```json
{
"payment_id": "pay_Yjz0to0D2SWrvMnu9YYJ",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_Yjz0to0D2SWrvMnu9YYJ_secret_dww4J2IkgUS375Qp14DD",
"created": "2025-03-04T12:41:24.421Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741092084,
"expires": 1741095684,
"secret": "epk_33afe25ebfdb438099126de2170ac062"
},
"manual_retry_allowed": false,
"connector_transaction_id": "120058112387",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058112387",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T12:56:24.421Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_uiXIl346CEL1MNsb1Itz",
"payment_method_status": "active",
"updated": "2025-03-04T12:41:26.065Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929556579-928947232",
"card_discovery": null
}
```
</details>
____
**Google Pay (confirm: `false`)**
<details>
<summary>0. Generate Token</summary>
Generated with jsfiddle. A snippet from it has been attached below:
```js
paymentToken = paymentData.paymentMethodData.tokenizationData.token;
// Stringified payment token is passed in the request
console.log("STRINGIFIED_TOKEN: ", JSON.stringify(paymentToken));
```
</details>
**Normal Payment**
<details>
<summary>1. Google Pay Payment Create</summary>
Create a payment with Google Pay as payment method:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 1000,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "StripeCustomer",
"email": "likhin.bopanna@gmail.com",
"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",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
```json
{
"payment_id": "pay_bfeoigMGZuwS8e93al9S",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "requires_payment_method",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_bfeoigMGZuwS8e93al9S_secret_YSFWpewZeiZM981x31QF",
"created": "2025-03-04T16:17:55.833Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741105075,
"expires": 1741108675,
"secret": "epk_19957b6804bd446fa6fd0e64e110bb38"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T16:32:55.833Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-04T16:17:55.849Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Confirm the payment with the payment tokenizated data in the previous step:
```curl
curl --location 'http://Localhost:8080/payments/pay_i0kBWoWf2WhaxDmCb0Kr/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"confirm": true,
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay": {
"description": "Visa •••• 1111",
"tokenization_data": {
"type": "PAYMENT_GATEWAY",
"token": "{\"signature\":\"MEUCIQCwtiXZxhnLtPm8HSpM4nes1xsgMGUXj/mejNJdHdYSwAIgWS/Rpx42PBTsmFB0Ypw3WFiSkHhJIKfhDCZ4D1EJe2g\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"HqOYpkcOVnkNMjHAAGQnNU82ZNzREewVB6cJNusCjSK8q5C/wumXuatl+8Hs78m/GD1km10onXLCiCkLs429taWyCpMKPMdeZH2aGU5S347RCRzn+hTCxHn0Erh2RQeyUBQ4/hdekdLhg53fLZOm0ORXqc/2cz9m98c0Gdjqjc/Ladhm2+r5WL1AEIbHwGZVVnBB1bzgbL8El5aF6FhdG3iAltVDIzjCUvsX2WXP+vxCXRtwE+xtyN3iUcCxLSshoPDkWEFcmT3aTTlfk6ss9iU6b0KDo2fWDk3PAQKqbQeog0QiWNSZgACqhtTKfV21JxfozlMZ5J6Z/7hROkENHLLNstQa+NeOls0Q7g9f0AvbwkpvF401CXa+jvKgUWnwJ4QTmIt5ogfOUDihK/A54U20LLNxzHZ9Ts5kdw\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BLg8yDGYj+1Iu6bNXK+gcvGdDpfha252FT/yzqrTA37WMuXgoEHoq6dOzDmbwORV5x25Z+TiwourpASRgMEDqw4\\\\u003d\\\",\\\"tag\\\":\\\"lshmH3K28uQMBSsvRlYHEeH77WZWV6cplNfdNegWEZY\\\\u003d\\\"}\"}"
},
"type": "CARD",
"info": {
"card_network": "VISA",
"card_details": "1111"
}
}
}
},
"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"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"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"
}
}
}'
```
```json
{
"payment_id": "pay_bfeoigMGZuwS8e93al9S",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_bfeoigMGZuwS8e93al9S_secret_YSFWpewZeiZM981x31QF",
"created": "2025-03-04T16:17:55.833Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "120058141907",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058141907",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T16:32:55.833Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"os_version": null,
"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",
"color_depth": 24,
"device_model": null,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"accept_language": "en",
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-04T16:17:59.047Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
</details>
**Mandate Payment**
<details>
<summary>2. 0 Auth mandate Google Pay Payment Create (CIT)</summary>
Create a payment with Google Pay as payment method:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"email": "likhin.bopanna@gmail.com",
"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",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
```json
{
"payment_id": "pay_i0kBWoWf2WhaxDmCb0Kr",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "requires_payment_method",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_i0kBWoWf2WhaxDmCb0Kr_secret_X9DDaLKrgZ3EnuGBeGVq",
"created": "2025-03-04T17:07:43.928Z",
"currency": "USD",
"customer_id": null,
"customer": {
"id": null,
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T17:22:43.928Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-04T17:07:43.934Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Confirm the payment with the payment tokenizated data in the previous step:
```curl
curl --location 'http://Localhost:8080/payments/pay_i0kBWoWf2WhaxDmCb0Kr/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"confirm": true,
"payment_type": "setup_mandate",
"setup_future_usage": "off_session",
"customer_id": "userId",
"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": 8000,
"currency": "USD"
}
}
},
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay": {
"description": "Visa •••• 1111",
"tokenization_data": {
"type": "PAYMENT_GATEWAY",
"token": "{\"signature\":\"MEYCIQDiQ33RYZBOIPG/gJccPcESROy/aiC1WvtTcIDd53EXeAIhAJS6t5bnsO36+RAR1vEIFAgofOjftLDdvIlRNiQILbYO\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"H9KoqlToBs0ulMI0MA4yTjYW+ha9iuwkSBnG/nvoYSJtDsAs+LiESg9gd9ucGvVYm2YO3ZBTFFIFjF+1+jeITmVGZ8H8n/zoBxHQtzAUuvxSLdPIE1hGgLYDApvX9iZBXQ/BDFbnPCWc5vza/OMHzeSbXAv3xa/5AOEFIQqcsSXymfvNGSkObHAOOl8EYbWV3+trYhs7jqUU92SMYTytqepubq6fRGH3ShaCC1wh2GiAs3wyldbVLCzAXQWwpg0D+YtUUCWIrb6/le09FTyIvZILdZZYCV8en5AzLPaeV24g8JzSq9n4iVlEIMk2Z5XOn2iQbh+czSjEaayyasBs1iwcSvmlsqwA5MjOZOeL6NLEltqX+UylpZfzozwjn6oYfJsOuRwFkW2Bu13jXIo02DS24GVuh17FErvIeQ\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BJuTS/Sz6nreFjQE6KCvF8LtbKc2+jUrZZdvd1euYamxps5s+cvCdosar/uHPWRKgUFuNGrwj262aFw85gOFxNQ\\\\u003d\\\",\\\"tag\\\":\\\"vXk0kI20KevUYBEjuXFN6k1U91NEeGx/trlcXG2r3B0\\\\u003d\\\"}\"}"
},
"type": "CARD",
"info": {
"card_network": "VISA",
"card_details": "1111"
}
}
}
},
"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"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"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"
}
}
}'
```
```json
{
"payment_id": "pay_8lXtsxjVVnXyW3qYwwGL",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "authorizedotnet",
"client_secret": "pay_8lXtsxjVVnXyW3qYwwGL_secret_vV4VAArRJGYOeB1b76nx",
"created": "2025-03-04T17:04:40.633Z",
"currency": "USD",
"customer_id": "userId",
"customer": {
"id": "userId",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": "man_7Kl62g9g2ddIAmINxRdB",
"mandate_data": {
"update_mandate_id": null,
"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": 8000,
"currency": "USD",
"start_date": null,
"end_date": null,
"metadata": null
}
}
},
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T17:19:40.633Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"os_version": null,
"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",
"color_depth": 24,
"device_model": null,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"accept_language": "en",
"java_script_enabled": true
},
"payment_method_id": "pm_Y5eD5ietWpQzEP4acuJp",
"payment_method_status": "active",
"updated": "2025-03-04T17:04:45.377Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929566202-928957413",
"card_discovery": null
}
```
</details>
<details>
<summary>3. 0 Auth mandate Google Pay Payment Create (MIT)</summary>
Create + Confirm:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"amount": 1000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "userId",
"client_secret": "pay_Gfr2ciHSGx2abiThwEeb_secret_RCNmYv7Vm6YA915Kj2fR",
"recurring_details": {
"type": "payment_method_id",
"data": "pm_Y5eD5ietWpQzEP4acuJp"
},
"off_session": true,
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"payment_method": "wallet",
"payment_method_type": "google_pay",
"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"
}
}
}'
```
```json
{
"payment_id": "pay_Gfr2ciHSGx2abiThwEeb",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_Gfr2ciHSGx2abiThwEeb_secret_RCNmYv7Vm6YA915Kj2fR",
"created": "2025-03-04T17:12:50.614Z",
"currency": "USD",
"customer_id": "userId",
"customer": {
"id": "userId",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "1111",
"card_network": "VISA",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "userId",
"created_at": 1741108370,
"expires": 1741111970,
"secret": "epk_9d2e899d1aae4a1eb19730fadd7cd51a"
},
"manual_retry_allowed": false,
"connector_transaction_id": "120058147194",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058147194",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-04T17:27:50.614Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_Y5eD5ietWpQzEP4acuJp",
"payment_method_status": "active",
"updated": "2025-03-04T17:12:52.243Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929566110-928957293",
"card_discovery": null
}
```
</details>
____
**Apple Pay (confirm: `true`)**
**Normal Payment**
<details>
<summary>0. Apple Pay Payment Create</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"amount": 100,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "StripeCustomer",
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay": {
"payment_data": "eyJkYXRhIjoiRWQ0UjZYYzVuTk85ZjVZZHc2Z0RVTzlZRE9qSlpxdFg4ME9acEtVNWxNMFNVSU9xbEEvdDU3TDNyV09mNHNTZjZqaGIvKzhiZXFvNFlCM21wU0U5emUrZzAyY0w2S1hOaWlGN2pqbE81eC9FOFFYWW0vRjNNK2lJdmtrcVlzYzBmZWlLandzSkI3SGFoOWJpUW5oOFhJQ2dpREhUSXpZcFIwaUlyVi9rdjFSbGxGT21NNlZDQkM3QVhhenhqUTJ4NEtOVzVIZUw1c2lkdHhia3ZsS2xpa1ZDeloxK2kzYjcwaEw2ZUFlamVsUno3UlEyLzNDbTVScVVqTWZnaHMvd25PVUNZb280UGVwN1BUdHdXdXdid3VMV3lkM0ZRYzdMMjlIcE5STVhCckFFd1RLN2RMTjdTc1VGSGczaTF6N0kxeVM1N1FjQ0d1aGo2dGR6clNOWW1PRmk2Nm03NzZ4M3VVc2kwM3hwdlU2bGdjMVlneUFnT2VSelBlcTRNL0Z4dzU4SlZXVGxYdnY4M09ibXJPbzZrVk0vbDJLRlRZSEszK0hjL2Y1SEZhST0iLCJzaWduYXR1cmUiOiJNSUFHQ1NxR1NJYjNEUUVIQXFDQU1JQUNBUUV4RFRBTEJnbGdoa2dCWlFNRUFnRXdnQVlKS29aSWh2Y05BUWNCQUFDZ2dEQ0NBK1F3Z2dPTG9BTUNBUUlDQ0ZuWW9ieXE5T1BOTUFvR0NDcUdTTTQ5QkFNQ01Ib3hMakFzQmdOVkJBTU1KVUZ3Y0d4bElFRndjR3hwWTJGMGFXOXVJRWx1ZEdWbmNtRjBhVzl1SUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHlNVEEwTWpBeE9UTTNNREJhRncweU5qQTBNVGt4T1RNMk5UbGFNR0l4S0RBbUJnTlZCQU1NSDJWall5MXpiWEF0WW5KdmEyVnlMWE5wWjI1ZlZVTTBMVk5CVGtSQ1QxZ3hGREFTQmdOVkJBc01DMmxQVXlCVGVYTjBaVzF6TVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1Rc3dDUVlEVlFRR0V3SlZVekJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSUl3L2F2RG5QZGVJQ3hRMlp0RkV1WTM0cWtCM1d5ejRMSE5TMUpubVBqUFRyM29HaVdvd2g1TU05M09qaXFXd3Zhdm9aTURSY1RvZWtRbXpwVWJFcFdqZ2dJUk1JSUNEVEFNQmdOVkhSTUJBZjhFQWpBQU1COEdBMVVkSXdRWU1CYUFGQ1B5U2NSUGsrVHZKK2JFOWloc1A2SzcvUzVMTUVVR0NDc0dBUVVGQndFQkJEa3dOekExQmdnckJnRUZCUWN3QVlZcGFIUjBjRG92TDI5amMzQXVZWEJ3YkdVdVkyOXRMMjlqYzNBd05DMWhjSEJzWldGcFkyRXpNREl3Z2dFZEJnTlZIU0FFZ2dFVU1JSUJFRENDQVF3R0NTcUdTSWIzWTJRRkFUQ0IvakNCd3dZSUt3WUJCUVVIQWdJd2diWU1nYk5TWld4cFlXNWpaU0J2YmlCMGFHbHpJR05sY25ScFptbGpZWFJsSUdKNUlHRnVlU0J3WVhKMGVTQmhjM04xYldWeklHRmpZMlZ3ZEdGdVkyVWdiMllnZEdobElIUm9aVzRnWVhCd2JHbGpZV0pzWlNCemRHRnVaR0Z5WkNCMFpYSnRjeUJoYm1RZ1kyOXVaR2wwYVc5dWN5QnZaaUIxYzJVc0lHTmxjblJwWm1sallYUmxJSEJ2YkdsamVTQmhibVFnWTJWeWRHbG1hV05oZEdsdmJpQndjbUZqZEdsalpTQnpkR0YwWlcxbGJuUnpMakEyQmdnckJnRUZCUWNDQVJZcWFIUjBjRG92TDNkM2R5NWhjSEJzWlM1amIyMHZZMlZ5ZEdsbWFXTmhkR1ZoZFhSb2IzSnBkSGt2TURRR0ExVWRId1F0TUNzd0thQW5vQ1dHSTJoMGRIQTZMeTlqY213dVlYQndiR1V1WTI5dEwyRndjR3hsWVdsallUTXVZM0pzTUIwR0ExVWREZ1FXQkJRQ0pEQUxtdTd0UmpHWHBLWmFLWjVDY1lJY1JUQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0R3WUpLb1pJaHZkalpBWWRCQUlGQURBS0JnZ3Foa2pPUFFRREFnTkhBREJFQWlCMG9iTWsyMEpKUXczVEoweFFkTVNBalpvZlNBNDZoY1hCTmlWbU1sKzhvd0lnYVRhUVU2djFDMXBTK2ZZQVRjV0tyV3hRcDlZSWFEZVE0S2M2MEI1SzJZRXdnZ0x1TUlJQ2RhQURBZ0VDQWdoSmJTKy9PcGphbHpBS0JnZ3Foa2pPUFFRREFqQm5NUnN3R1FZRFZRUUREQkpCY0hCc1pTQlNiMjkwSUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHhOREExTURZeU16UTJNekJhRncweU9UQTFNRFl5TXpRMk16QmFNSG94TGpBc0JnTlZCQU1NSlVGd2NHeGxJRUZ3Y0d4cFkyRjBhVzl1SUVsdWRHVm5jbUYwYVc5dUlFTkJJQzBnUnpNeEpqQWtCZ05WQkFzTUhVRndjR3hsSUVObGNuUnBabWxqWVhScGIyNGdRWFYwYUc5eWFYUjVNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVFzd0NRWURWUVFHRXdKVlV6QlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJQQVhFWVFaMTJTRjFScGVKWUVIZHVpQW91L2VlNjVONEkzOFM1UGhNMWJWWmxzMXJpTFFsM1lOSWs1N3VnajlkaGZPaU10MnUyWnd2c2pvS1lUL1ZFV2pnZmN3Z2ZRd1JnWUlLd1lCQlFVSEFRRUVPakE0TURZR0NDc0dBUVVGQnpBQmhpcG9kSFJ3T2k4dmIyTnpjQzVoY0hCc1pTNWpiMjB2YjJOemNEQTBMV0Z3Y0d4bGNtOXZkR05oWnpNd0hRWURWUjBPQkJZRUZDUHlTY1JQaytUdkorYkU5aWhzUDZLNy9TNUxNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdId1lEVlIwakJCZ3dGb0FVdTdEZW9WZ3ppSnFraXBuZXZyM3JyOXJMSktzd053WURWUjBmQkRBd0xqQXNvQ3FnS0lZbWFIUjBjRG92TDJOeWJDNWhjSEJzWlM1amIyMHZZWEJ3YkdWeWIyOTBZMkZuTXk1amNtd3dEZ1lEVlIwUEFRSC9CQVFEQWdFR01CQUdDaXFHU0liM1kyUUdBZzRFQWdVQU1Bb0dDQ3FHU000OUJBTUNBMmNBTUdRQ01EclBjb05SRnBteGh2czF3MWJLWXIvMEYrM1pEM1ZOb282KzhaeUJYa0szaWZpWTk1dFpuNWpWUVEyUG5lbkMvZ0l3TWkzVlJDR3dvd1YzYkYzek9EdVFaLzBYZkN3aGJaWlB4bkpwZ2hKdlZQaDZmUnVaeTVzSmlTRmhCcGtQQ1pJZEFBQXhnZ0dJTUlJQmhBSUJBVENCaGpCNk1TNHdMQVlEVlFRRERDVkJjSEJzWlNCQmNIQnNhV05oZEdsdmJpQkpiblJsWjNKaGRHbHZiaUJEUVNBdElFY3pNU1l3SkFZRFZRUUxEQjFCY0hCc1pTQkRaWEowYVdacFkyRjBhVzl1SUVGMWRHaHZjbWwwZVRFVE1CRUdBMVVFQ2d3S1FYQndiR1VnU1c1akxqRUxNQWtHQTFVRUJoTUNWVk1DQ0ZuWW9ieXE5T1BOTUFzR0NXQ0dTQUZsQXdRQ0FhQ0JrekFZQmdrcWhraUc5dzBCQ1FNeEN3WUpLb1pJaHZjTkFRY0JNQndHQ1NxR1NJYjNEUUVKQlRFUEZ3MHlOVEF6TURZeE1URXlOVFZhTUNnR0NTcUdTSWIzRFFFSk5ERWJNQmt3Q3dZSllJWklBV1VEQkFJQm9Rb0dDQ3FHU000OUJBTUNNQzhHQ1NxR1NJYjNEUUVKQkRFaUJDQS9FemxmRUhtbk5uSW9uS2FwOUpBVkNEdld3dmlMRkhuY0IwdmpaY21WN3pBS0JnZ3Foa2pPUFFRREFnUkhNRVVDSVFEeWV0MUdwSU9QcXkyRjFzYkY3M1hOSDRJTEp6WWozSDdXR1Zzd0huRzFBQUlnQVJYZG5HY0hERkI1LzNhc1I5bm9PNVdkMy95NlZKRFpmZXQ3WWV6RjFEMEFBQUFBQUFBPSIsImhlYWRlciI6eyJwdWJsaWNLZXlIYXNoIjoiVzFOT3JTbWhwTVdDQlg0cWE3NEZBeTNEMnNWZDZ3YWFzOEdHMWdYQ21Pdz0iLCJlcGhlbWVyYWxQdWJsaWNLZXkiOiJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVaUmdaNGkveUhwK3d3ckxtRGpDanJyTkJkQnB5b0tEU1VvamV0enBuVk4wdDNXajZiNjhnUWkvempTS3hsOUZ0eXdkb0lJSUFvWm9Sa0ZuMFpseTBMZz09IiwidHJhbnNhY3Rpb25JZCI6ImE3OWVjMjYyMThiZmZjNDNmYzlkZDZlMTg0ZDI4NDNmNzQ2MjNhNWE5ODJhZTY5YWM2NmU3ZjQ1ZDNiNzhiZDUifSwidmVyc2lvbiI6IkVDX3YxIn0=",
"payment_method": {
"display_name": "Visa 4228",
"network": "Visa",
"type": "debit"
},
"transaction_identifier": "a79ec26218bffc43fc9dd6e184d2843f74623a5a982ae69ac66e7f45d3b78bd5"
}
},
"billing": null
},
"billing": {
"address": {
"first_name": "John",
"last_name": "Doe",
"line1": "Harrison Street",
"city": "San Francisco",
"state": "California",
"zip": "94016",
"country": "US"
}
}
}'
```
```json
{
"payment_id": "pay_pQplkw03E65IspKj5Pgl",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 100,
"net_amount": 100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 100,
"connector": "authorizedotnet",
"client_secret": "pay_pQplkw03E65IspKj5Pgl_secret_HIQ1AUupmzls5u5dlpV7",
"created": "2025-03-06T16:51:49.667Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"apple_pay": {
"last4": "4228",
"card_network": "Visa",
"type": "debit"
}
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "Harrison Street",
"line2": null,
"line3": null,
"zip": "94016",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741279909,
"expires": 1741283509,
"secret": "epk_8d33224b35174c7696b267531b5f1b10"
},
"manual_retry_allowed": false,
"connector_transaction_id": "120058500499",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058500499",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:06:49.667Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-06T16:51:50.402Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
</details>
**Mandate Payment**
<details>
<summary>1. 0 Auth mandate Apple Pay Payment Create (CIT)</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "cus_1741281436",
"email": "likhin.bopanna@gmail.com",
"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",
"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": 8000,
"currency": "USD"
}
}
},
"payment_type": "setup_mandate",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay": {
"payment_data": "eyJkYXRhIjoiRWQ0UjZYYzVuTk85ZjVZZHc2Z0RVTzlZRE9qSlpxdFg4ME9acEtVNWxNMFNVSU9xbEEvdDU3TDNyV09mNHNTZjZqaGIvKzhiZXFvNFlCM21wU0U5emUrZzAyY0w2S1hOaWlGN2pqbE81eC9FOFFYWW0vRjNNK2lJdmtrcVlzYzBmZWlLandzSkI3SGFoOWJpUW5oOFhJQ2dpREhUSXpZcFIwaUlyVi9rdjFSbGxGT21NNlZDQkM3QVhhenhqUTJ4NEtOVzVIZUw1c2lkdHhia3ZsS2xpa1ZDeloxK2kzYjcwaEw2ZUFlamVsUno3UlEyLzNDbTVScVVqTWZnaHMvd25PVUNZb280UGVwN1BUdHdXdXdid3VMV3lkM0ZRYzdMMjlIcE5STVhCckFFd1RLN2RMTjdTc1VGSGczaTF6N0kxeVM1N1FjQ0d1aGo2dGR6clNOWW1PRmk2Nm03NzZ4M3VVc2kwM3hwdlU2bGdjMVlneUFnT2VSelBlcTRNL0Z4dzU4SlZXVGxYdnY4M09ibXJPbzZrVk0vbDJLRlRZSEszK0hjL2Y1SEZhST0iLCJzaWduYXR1cmUiOiJNSUFHQ1NxR1NJYjNEUUVIQXFDQU1JQUNBUUV4RFRBTEJnbGdoa2dCWlFNRUFnRXdnQVlKS29aSWh2Y05BUWNCQUFDZ2dEQ0NBK1F3Z2dPTG9BTUNBUUlDQ0ZuWW9ieXE5T1BOTUFvR0NDcUdTTTQ5QkFNQ01Ib3hMakFzQmdOVkJBTU1KVUZ3Y0d4bElFRndjR3hwWTJGMGFXOXVJRWx1ZEdWbmNtRjBhVzl1SUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHlNVEEwTWpBeE9UTTNNREJhRncweU5qQTBNVGt4T1RNMk5UbGFNR0l4S0RBbUJnTlZCQU1NSDJWall5MXpiWEF0WW5KdmEyVnlMWE5wWjI1ZlZVTTBMVk5CVGtSQ1QxZ3hGREFTQmdOVkJBc01DMmxQVXlCVGVYTjBaVzF6TVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1Rc3dDUVlEVlFRR0V3SlZVekJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSUl3L2F2RG5QZGVJQ3hRMlp0RkV1WTM0cWtCM1d5ejRMSE5TMUpubVBqUFRyM29HaVdvd2g1TU05M09qaXFXd3Zhdm9aTURSY1RvZWtRbXpwVWJFcFdqZ2dJUk1JSUNEVEFNQmdOVkhSTUJBZjhFQWpBQU1COEdBMVVkSXdRWU1CYUFGQ1B5U2NSUGsrVHZKK2JFOWloc1A2SzcvUzVMTUVVR0NDc0dBUVVGQndFQkJEa3dOekExQmdnckJnRUZCUWN3QVlZcGFIUjBjRG92TDI5amMzQXVZWEJ3YkdVdVkyOXRMMjlqYzNBd05DMWhjSEJzWldGcFkyRXpNREl3Z2dFZEJnTlZIU0FFZ2dFVU1JSUJFRENDQVF3R0NTcUdTSWIzWTJRRkFUQ0IvakNCd3dZSUt3WUJCUVVIQWdJd2diWU1nYk5TWld4cFlXNWpaU0J2YmlCMGFHbHpJR05sY25ScFptbGpZWFJsSUdKNUlHRnVlU0J3WVhKMGVTQmhjM04xYldWeklHRmpZMlZ3ZEdGdVkyVWdiMllnZEdobElIUm9aVzRnWVhCd2JHbGpZV0pzWlNCemRHRnVaR0Z5WkNCMFpYSnRjeUJoYm1RZ1kyOXVaR2wwYVc5dWN5QnZaaUIxYzJVc0lHTmxjblJwWm1sallYUmxJSEJ2YkdsamVTQmhibVFnWTJWeWRHbG1hV05oZEdsdmJpQndjbUZqZEdsalpTQnpkR0YwWlcxbGJuUnpMakEyQmdnckJnRUZCUWNDQVJZcWFIUjBjRG92TDNkM2R5NWhjSEJzWlM1amIyMHZZMlZ5ZEdsbWFXTmhkR1ZoZFhSb2IzSnBkSGt2TURRR0ExVWRId1F0TUNzd0thQW5vQ1dHSTJoMGRIQTZMeTlqY213dVlYQndiR1V1WTI5dEwyRndjR3hsWVdsallUTXVZM0pzTUIwR0ExVWREZ1FXQkJRQ0pEQUxtdTd0UmpHWHBLWmFLWjVDY1lJY1JUQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0R3WUpLb1pJaHZkalpBWWRCQUlGQURBS0JnZ3Foa2pPUFFRREFnTkhBREJFQWlCMG9iTWsyMEpKUXczVEoweFFkTVNBalpvZlNBNDZoY1hCTmlWbU1sKzhvd0lnYVRhUVU2djFDMXBTK2ZZQVRjV0tyV3hRcDlZSWFEZVE0S2M2MEI1SzJZRXdnZ0x1TUlJQ2RhQURBZ0VDQWdoSmJTKy9PcGphbHpBS0JnZ3Foa2pPUFFRREFqQm5NUnN3R1FZRFZRUUREQkpCY0hCc1pTQlNiMjkwSUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHhOREExTURZeU16UTJNekJhRncweU9UQTFNRFl5TXpRMk16QmFNSG94TGpBc0JnTlZCQU1NSlVGd2NHeGxJRUZ3Y0d4cFkyRjBhVzl1SUVsdWRHVm5jbUYwYVc5dUlFTkJJQzBnUnpNeEpqQWtCZ05WQkFzTUhVRndjR3hsSUVObGNuUnBabWxqWVhScGIyNGdRWFYwYUc5eWFYUjVNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVFzd0NRWURWUVFHRXdKVlV6QlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJQQVhFWVFaMTJTRjFScGVKWUVIZHVpQW91L2VlNjVONEkzOFM1UGhNMWJWWmxzMXJpTFFsM1lOSWs1N3VnajlkaGZPaU10MnUyWnd2c2pvS1lUL1ZFV2pnZmN3Z2ZRd1JnWUlLd1lCQlFVSEFRRUVPakE0TURZR0NDc0dBUVVGQnpBQmhpcG9kSFJ3T2k4dmIyTnpjQzVoY0hCc1pTNWpiMjB2YjJOemNEQTBMV0Z3Y0d4bGNtOXZkR05oWnpNd0hRWURWUjBPQkJZRUZDUHlTY1JQaytUdkorYkU5aWhzUDZLNy9TNUxNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdId1lEVlIwakJCZ3dGb0FVdTdEZW9WZ3ppSnFraXBuZXZyM3JyOXJMSktzd053WURWUjBmQkRBd0xqQXNvQ3FnS0lZbWFIUjBjRG92TDJOeWJDNWhjSEJzWlM1amIyMHZZWEJ3YkdWeWIyOTBZMkZuTXk1amNtd3dEZ1lEVlIwUEFRSC9CQVFEQWdFR01CQUdDaXFHU0liM1kyUUdBZzRFQWdVQU1Bb0dDQ3FHU000OUJBTUNBMmNBTUdRQ01EclBjb05SRnBteGh2czF3MWJLWXIvMEYrM1pEM1ZOb282KzhaeUJYa0szaWZpWTk1dFpuNWpWUVEyUG5lbkMvZ0l3TWkzVlJDR3dvd1YzYkYzek9EdVFaLzBYZkN3aGJaWlB4bkpwZ2hKdlZQaDZmUnVaeTVzSmlTRmhCcGtQQ1pJZEFBQXhnZ0dJTUlJQmhBSUJBVENCaGpCNk1TNHdMQVlEVlFRRERDVkJjSEJzWlNCQmNIQnNhV05oZEdsdmJpQkpiblJsWjNKaGRHbHZiaUJEUVNBdElFY3pNU1l3SkFZRFZRUUxEQjFCY0hCc1pTQkRaWEowYVdacFkyRjBhVzl1SUVGMWRHaHZjbWwwZVRFVE1CRUdBMVVFQ2d3S1FYQndiR1VnU1c1akxqRUxNQWtHQTFVRUJoTUNWVk1DQ0ZuWW9ieXE5T1BOTUFzR0NXQ0dTQUZsQXdRQ0FhQ0JrekFZQmdrcWhraUc5dzBCQ1FNeEN3WUpLb1pJaHZjTkFRY0JNQndHQ1NxR1NJYjNEUUVKQlRFUEZ3MHlOVEF6TURZeE1URXlOVFZhTUNnR0NTcUdTSWIzRFFFSk5ERWJNQmt3Q3dZSllJWklBV1VEQkFJQm9Rb0dDQ3FHU000OUJBTUNNQzhHQ1NxR1NJYjNEUUVKQkRFaUJDQS9FemxmRUhtbk5uSW9uS2FwOUpBVkNEdld3dmlMRkhuY0IwdmpaY21WN3pBS0JnZ3Foa2pPUFFRREFnUkhNRVVDSVFEeWV0MUdwSU9QcXkyRjFzYkY3M1hOSDRJTEp6WWozSDdXR1Zzd0huRzFBQUlnQVJYZG5HY0hERkI1LzNhc1I5bm9PNVdkMy95NlZKRFpmZXQ3WWV6RjFEMEFBQUFBQUFBPSIsImhlYWRlciI6eyJwdWJsaWNLZXlIYXNoIjoiVzFOT3JTbWhwTVdDQlg0cWE3NEZBeTNEMnNWZDZ3YWFzOEdHMWdYQ21Pdz0iLCJlcGhlbWVyYWxQdWJsaWNLZXkiOiJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVaUmdaNGkveUhwK3d3ckxtRGpDanJyTkJkQnB5b0tEU1VvamV0enBuVk4wdDNXajZiNjhnUWkvempTS3hsOUZ0eXdkb0lJSUFvWm9Sa0ZuMFpseTBMZz09IiwidHJhbnNhY3Rpb25JZCI6ImE3OWVjMjYyMThiZmZjNDNmYzlkZDZlMTg0ZDI4NDNmNzQ2MjNhNWE5ODJhZTY5YWM2NmU3ZjQ1ZDNiNzhiZDUifSwidmVyc2lvbiI6IkVDX3YxIn0=",
"payment_method": {
"display_name": "Visa 4228",
"network": "Visa",
"type": "debit"
},
"transaction_identifier": "a79ec26218bffc43fc9dd6e184d2843f74623a5a982ae69ac66e7f45d3b78bd5"
}
},
"billing": null
}
}'
```
```json
{
"payment_id": "pay_q6QI3s5EftuPHiXweHO8",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "authorizedotnet",
"client_secret": "pay_q6QI3s5EftuPHiXweHO8_secret_iaQ0TCvv3cJEPx6C2H4T",
"created": "2025-03-06T17:17:11.969Z",
"currency": "USD",
"customer_id": "cus_1741281432",
"customer": {
"id": "cus_1741281432",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": "man_aSSagnsnEwx26GJmmv4D",
"mandate_data": {
"update_mandate_id": null,
"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": 8000,
"currency": "USD",
"start_date": null,
"end_date": null,
"metadata": null
}
}
},
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"apple_pay": {
"last4": "4228",
"card_network": "Visa",
"type": "debit"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cus_1741281432",
"created_at": 1741281431,
"expires": 1741285031,
"secret": "epk_652599a411dc4037b07fdb5ff70c05cd"
},
"manual_retry_allowed": false,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:32:11.969Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_PvC6MYhxwlUucL32HX4C",
"payment_method_status": "active",
"updated": "2025-03-06T17:17:13.973Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929610853-929002308",
"card_discovery": null
}
```
</details>
<details>
<summary>2. 0 Auth mandate Apple Pay Payment Create (MIT)</summary>
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"amount": 1000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "cus_1741281432",
"client_secret": "pay_ldeENuwjOHvyLJ0xq5RS_secret_C5IomwEVgCsWGrQ8QOqV",
"recurring_details": {
"type": "payment_method_id",
"data": "pm_PvC6MYhxwlUucL32HX4C"
},
"off_session": true,
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"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"
}
}
}'
```
```json
{
"payment_id": "pay_ldeENuwjOHvyLJ0xq5RS",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_ldeENuwjOHvyLJ0xq5RS_secret_C5IomwEVgCsWGrQ8QOqV",
"created": "2025-03-06T17:17:40.740Z",
"currency": "USD",
"customer_id": "cus_1741281432",
"customer": {
"id": "cus_1741281432",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": null,
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cus_1741281432",
"created_at": 1741281460,
"expires": 1741285060,
"secret": "epk_22f2d7c3c4b44c36aa837b5286c3bac4"
},
"manual_retry_allowed": false,
"connector_transaction_id": "120058501970",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058501970",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:32:40.740Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_PvC6MYhxwlUucL32HX4C",
"payment_method_status": "active",
"updated": "2025-03-06T17:17:41.481Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929610853-929002308",
"card_discovery": null
}
```
</details>
____
**Apple Pay (confirm: `false`)**
**Normal Payment**
<details>
<summary>0. Apple Pay Payment Create</summary>
Create a payment with Apple Pay as payment method:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 1000,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "StripeCustomer",
"email": "likhin.bopanna@gmail.com",
"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",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
```json
{
"payment_id": "pay_I1yph8Vzm5LYUKWYLeGE",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "requires_payment_method",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_I1yph8Vzm5LYUKWYLeGE_secret_HYK6Yj7wDW5bSe2HUMAS",
"created": "2025-03-06T17:27:47.474Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1741282067,
"expires": 1741285667,
"secret": "epk_188e2a750ea84059913ebd8490860258"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:42:47.474Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-06T17:27:47.483Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Confirm the payment with the payment tokenizated data in the previous step:
```curl
curl --location 'http://Localhost:8080/payments/pay_I1yph8Vzm5LYUKWYLeGE/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"confirm": true,
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay": {
"payment_data": "eyJkYXRhIjoiRWQ0UjZYYzVuTk85ZjVZZHc2Z0RVTzlZRE9qSlpxdFg4ME9acEtVNWxNMFNVSU9xbEEvdDU3TDNyV09mNHNTZjZqaGIvKzhiZXFvNFlCM21wU0U5emUrZzAyY0w2S1hOaWlGN2pqbE81eC9FOFFYWW0vRjNNK2lJdmtrcVlzYzBmZWlLandzSkI3SGFoOWJpUW5oOFhJQ2dpREhUSXpZcFIwaUlyVi9rdjFSbGxGT21NNlZDQkM3QVhhenhqUTJ4NEtOVzVIZUw1c2lkdHhia3ZsS2xpa1ZDeloxK2kzYjcwaEw2ZUFlamVsUno3UlEyLzNDbTVScVVqTWZnaHMvd25PVUNZb280UGVwN1BUdHdXdXdid3VMV3lkM0ZRYzdMMjlIcE5STVhCckFFd1RLN2RMTjdTc1VGSGczaTF6N0kxeVM1N1FjQ0d1aGo2dGR6clNOWW1PRmk2Nm03NzZ4M3VVc2kwM3hwdlU2bGdjMVlneUFnT2VSelBlcTRNL0Z4dzU4SlZXVGxYdnY4M09ibXJPbzZrVk0vbDJLRlRZSEszK0hjL2Y1SEZhST0iLCJzaWduYXR1cmUiOiJNSUFHQ1NxR1NJYjNEUUVIQXFDQU1JQUNBUUV4RFRBTEJnbGdoa2dCWlFNRUFnRXdnQVlKS29aSWh2Y05BUWNCQUFDZ2dEQ0NBK1F3Z2dPTG9BTUNBUUlDQ0ZuWW9ieXE5T1BOTUFvR0NDcUdTTTQ5QkFNQ01Ib3hMakFzQmdOVkJBTU1KVUZ3Y0d4bElFRndjR3hwWTJGMGFXOXVJRWx1ZEdWbmNtRjBhVzl1SUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHlNVEEwTWpBeE9UTTNNREJhRncweU5qQTBNVGt4T1RNMk5UbGFNR0l4S0RBbUJnTlZCQU1NSDJWall5MXpiWEF0WW5KdmEyVnlMWE5wWjI1ZlZVTTBMVk5CVGtSQ1QxZ3hGREFTQmdOVkJBc01DMmxQVXlCVGVYTjBaVzF6TVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1Rc3dDUVlEVlFRR0V3SlZVekJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSUl3L2F2RG5QZGVJQ3hRMlp0RkV1WTM0cWtCM1d5ejRMSE5TMUpubVBqUFRyM29HaVdvd2g1TU05M09qaXFXd3Zhdm9aTURSY1RvZWtRbXpwVWJFcFdqZ2dJUk1JSUNEVEFNQmdOVkhSTUJBZjhFQWpBQU1COEdBMVVkSXdRWU1CYUFGQ1B5U2NSUGsrVHZKK2JFOWloc1A2SzcvUzVMTUVVR0NDc0dBUVVGQndFQkJEa3dOekExQmdnckJnRUZCUWN3QVlZcGFIUjBjRG92TDI5amMzQXVZWEJ3YkdVdVkyOXRMMjlqYzNBd05DMWhjSEJzWldGcFkyRXpNREl3Z2dFZEJnTlZIU0FFZ2dFVU1JSUJFRENDQVF3R0NTcUdTSWIzWTJRRkFUQ0IvakNCd3dZSUt3WUJCUVVIQWdJd2diWU1nYk5TWld4cFlXNWpaU0J2YmlCMGFHbHpJR05sY25ScFptbGpZWFJsSUdKNUlHRnVlU0J3WVhKMGVTQmhjM04xYldWeklHRmpZMlZ3ZEdGdVkyVWdiMllnZEdobElIUm9aVzRnWVhCd2JHbGpZV0pzWlNCemRHRnVaR0Z5WkNCMFpYSnRjeUJoYm1RZ1kyOXVaR2wwYVc5dWN5QnZaaUIxYzJVc0lHTmxjblJwWm1sallYUmxJSEJ2YkdsamVTQmhibVFnWTJWeWRHbG1hV05oZEdsdmJpQndjbUZqZEdsalpTQnpkR0YwWlcxbGJuUnpMakEyQmdnckJnRUZCUWNDQVJZcWFIUjBjRG92TDNkM2R5NWhjSEJzWlM1amIyMHZZMlZ5ZEdsbWFXTmhkR1ZoZFhSb2IzSnBkSGt2TURRR0ExVWRId1F0TUNzd0thQW5vQ1dHSTJoMGRIQTZMeTlqY213dVlYQndiR1V1WTI5dEwyRndjR3hsWVdsallUTXVZM0pzTUIwR0ExVWREZ1FXQkJRQ0pEQUxtdTd0UmpHWHBLWmFLWjVDY1lJY1JUQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0R3WUpLb1pJaHZkalpBWWRCQUlGQURBS0JnZ3Foa2pPUFFRREFnTkhBREJFQWlCMG9iTWsyMEpKUXczVEoweFFkTVNBalpvZlNBNDZoY1hCTmlWbU1sKzhvd0lnYVRhUVU2djFDMXBTK2ZZQVRjV0tyV3hRcDlZSWFEZVE0S2M2MEI1SzJZRXdnZ0x1TUlJQ2RhQURBZ0VDQWdoSmJTKy9PcGphbHpBS0JnZ3Foa2pPUFFRREFqQm5NUnN3R1FZRFZRUUREQkpCY0hCc1pTQlNiMjkwSUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHhOREExTURZeU16UTJNekJhRncweU9UQTFNRFl5TXpRMk16QmFNSG94TGpBc0JnTlZCQU1NSlVGd2NHeGxJRUZ3Y0d4cFkyRjBhVzl1SUVsdWRHVm5jbUYwYVc5dUlFTkJJQzBnUnpNeEpqQWtCZ05WQkFzTUhVRndjR3hsSUVObGNuUnBabWxqWVhScGIyNGdRWFYwYUc5eWFYUjVNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVFzd0NRWURWUVFHRXdKVlV6QlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJQQVhFWVFaMTJTRjFScGVKWUVIZHVpQW91L2VlNjVONEkzOFM1UGhNMWJWWmxzMXJpTFFsM1lOSWs1N3VnajlkaGZPaU10MnUyWnd2c2pvS1lUL1ZFV2pnZmN3Z2ZRd1JnWUlLd1lCQlFVSEFRRUVPakE0TURZR0NDc0dBUVVGQnpBQmhpcG9kSFJ3T2k4dmIyTnpjQzVoY0hCc1pTNWpiMjB2YjJOemNEQTBMV0Z3Y0d4bGNtOXZkR05oWnpNd0hRWURWUjBPQkJZRUZDUHlTY1JQaytUdkorYkU5aWhzUDZLNy9TNUxNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdId1lEVlIwakJCZ3dGb0FVdTdEZW9WZ3ppSnFraXBuZXZyM3JyOXJMSktzd053WURWUjBmQkRBd0xqQXNvQ3FnS0lZbWFIUjBjRG92TDJOeWJDNWhjSEJzWlM1amIyMHZZWEJ3YkdWeWIyOTBZMkZuTXk1amNtd3dEZ1lEVlIwUEFRSC9CQVFEQWdFR01CQUdDaXFHU0liM1kyUUdBZzRFQWdVQU1Bb0dDQ3FHU000OUJBTUNBMmNBTUdRQ01EclBjb05SRnBteGh2czF3MWJLWXIvMEYrM1pEM1ZOb282KzhaeUJYa0szaWZpWTk1dFpuNWpWUVEyUG5lbkMvZ0l3TWkzVlJDR3dvd1YzYkYzek9EdVFaLzBYZkN3aGJaWlB4bkpwZ2hKdlZQaDZmUnVaeTVzSmlTRmhCcGtQQ1pJZEFBQXhnZ0dJTUlJQmhBSUJBVENCaGpCNk1TNHdMQVlEVlFRRERDVkJjSEJzWlNCQmNIQnNhV05oZEdsdmJpQkpiblJsWjNKaGRHbHZiaUJEUVNBdElFY3pNU1l3SkFZRFZRUUxEQjFCY0hCc1pTQkRaWEowYVdacFkyRjBhVzl1SUVGMWRHaHZjbWwwZVRFVE1CRUdBMVVFQ2d3S1FYQndiR1VnU1c1akxqRUxNQWtHQTFVRUJoTUNWVk1DQ0ZuWW9ieXE5T1BOTUFzR0NXQ0dTQUZsQXdRQ0FhQ0JrekFZQmdrcWhraUc5dzBCQ1FNeEN3WUpLb1pJaHZjTkFRY0JNQndHQ1NxR1NJYjNEUUVKQlRFUEZ3MHlOVEF6TURZeE1URXlOVFZhTUNnR0NTcUdTSWIzRFFFSk5ERWJNQmt3Q3dZSllJWklBV1VEQkFJQm9Rb0dDQ3FHU000OUJBTUNNQzhHQ1NxR1NJYjNEUUVKQkRFaUJDQS9FemxmRUhtbk5uSW9uS2FwOUpBVkNEdld3dmlMRkhuY0IwdmpaY21WN3pBS0JnZ3Foa2pPUFFRREFnUkhNRVVDSVFEeWV0MUdwSU9QcXkyRjFzYkY3M1hOSDRJTEp6WWozSDdXR1Zzd0huRzFBQUlnQVJYZG5HY0hERkI1LzNhc1I5bm9PNVdkMy95NlZKRFpmZXQ3WWV6RjFEMEFBQUFBQUFBPSIsImhlYWRlciI6eyJwdWJsaWNLZXlIYXNoIjoiVzFOT3JTbWhwTVdDQlg0cWE3NEZBeTNEMnNWZDZ3YWFzOEdHMWdYQ21Pdz0iLCJlcGhlbWVyYWxQdWJsaWNLZXkiOiJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVaUmdaNGkveUhwK3d3ckxtRGpDanJyTkJkQnB5b0tEU1VvamV0enBuVk4wdDNXajZiNjhnUWkvempTS3hsOUZ0eXdkb0lJSUFvWm9Sa0ZuMFpseTBMZz09IiwidHJhbnNhY3Rpb25JZCI6ImE3OWVjMjYyMThiZmZjNDNmYzlkZDZlMTg0ZDI4NDNmNzQ2MjNhNWE5ODJhZTY5YWM2NmU3ZjQ1ZDNiNzhiZDUifSwidmVyc2lvbiI6IkVDX3YxIn0=",
"payment_method": {
"display_name": "Visa 4228",
"network": "Visa",
"type": "debit"
},
"transaction_identifier": "a79ec26218bffc43fc9dd6e184d2843f74623a5a982ae69ac66e7f45d3b78bd5"
}
},
"billing": null
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"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"
}
}
}'
```
```json
{
"payment_id": "pay_I1yph8Vzm5LYUKWYLeGE",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_I1yph8Vzm5LYUKWYLeGE_secret_HYK6Yj7wDW5bSe2HUMAS",
"created": "2025-03-06T17:27:47.474Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"apple_pay": {
"last4": "4228",
"card_network": "Visa",
"type": "debit"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "likhin.bopanna@gmail.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "120058504003",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058504003",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:42:47.474Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"os_version": null,
"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",
"color_depth": 24,
"device_model": null,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"accept_language": "en",
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-06T17:28:06.643Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
</details>
**Mandate Payment**
<details>
<summary>1. 0 Auth mandate Apple Pay Payment Create (CIT)</summary>
Create a payment with Apple Pay as payment method:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"email": "likhin.bopanna@gmail.com",
"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",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"setup_future_usage": "off_session"
}'
```
```json
{
"payment_id": "pay_2tnZM8hO4nIxl6gox8rI",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "requires_payment_method",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_2tnZM8hO4nIxl6gox8rI_secret_wEWXQgZ7k7Rod2MdN7Kf",
"created": "2025-03-06T17:28:21.551Z",
"currency": "USD",
"customer_id": null,
"customer": {
"id": null,
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:43:21.551Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-06T17:28:21.561Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Confirm the payment with the payment tokenizated data in the previous step:
```curl
curl --location 'http://Localhost:8080/payments/pay_2tnZM8hO4nIxl6gox8rI/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"confirm": true,
"payment_type": "setup_mandate",
"customer_id": "cus_1741282119",
"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": 8000,
"currency": "USD"
}
}
},
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay": {
"payment_data": "eyJkYXRhIjoiRWQ0UjZYYzVuTk85ZjVZZHc2Z0RVTzlZRE9qSlpxdFg4ME9acEtVNWxNMFNVSU9xbEEvdDU3TDNyV09mNHNTZjZqaGIvKzhiZXFvNFlCM21wU0U5emUrZzAyY0w2S1hOaWlGN2pqbE81eC9FOFFYWW0vRjNNK2lJdmtrcVlzYzBmZWlLandzSkI3SGFoOWJpUW5oOFhJQ2dpREhUSXpZcFIwaUlyVi9rdjFSbGxGT21NNlZDQkM3QVhhenhqUTJ4NEtOVzVIZUw1c2lkdHhia3ZsS2xpa1ZDeloxK2kzYjcwaEw2ZUFlamVsUno3UlEyLzNDbTVScVVqTWZnaHMvd25PVUNZb280UGVwN1BUdHdXdXdid3VMV3lkM0ZRYzdMMjlIcE5STVhCckFFd1RLN2RMTjdTc1VGSGczaTF6N0kxeVM1N1FjQ0d1aGo2dGR6clNOWW1PRmk2Nm03NzZ4M3VVc2kwM3hwdlU2bGdjMVlneUFnT2VSelBlcTRNL0Z4dzU4SlZXVGxYdnY4M09ibXJPbzZrVk0vbDJLRlRZSEszK0hjL2Y1SEZhST0iLCJzaWduYXR1cmUiOiJNSUFHQ1NxR1NJYjNEUUVIQXFDQU1JQUNBUUV4RFRBTEJnbGdoa2dCWlFNRUFnRXdnQVlKS29aSWh2Y05BUWNCQUFDZ2dEQ0NBK1F3Z2dPTG9BTUNBUUlDQ0ZuWW9ieXE5T1BOTUFvR0NDcUdTTTQ5QkFNQ01Ib3hMakFzQmdOVkJBTU1KVUZ3Y0d4bElFRndjR3hwWTJGMGFXOXVJRWx1ZEdWbmNtRjBhVzl1SUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHlNVEEwTWpBeE9UTTNNREJhRncweU5qQTBNVGt4T1RNMk5UbGFNR0l4S0RBbUJnTlZCQU1NSDJWall5MXpiWEF0WW5KdmEyVnlMWE5wWjI1ZlZVTTBMVk5CVGtSQ1QxZ3hGREFTQmdOVkJBc01DMmxQVXlCVGVYTjBaVzF6TVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1Rc3dDUVlEVlFRR0V3SlZVekJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSUl3L2F2RG5QZGVJQ3hRMlp0RkV1WTM0cWtCM1d5ejRMSE5TMUpubVBqUFRyM29HaVdvd2g1TU05M09qaXFXd3Zhdm9aTURSY1RvZWtRbXpwVWJFcFdqZ2dJUk1JSUNEVEFNQmdOVkhSTUJBZjhFQWpBQU1COEdBMVVkSXdRWU1CYUFGQ1B5U2NSUGsrVHZKK2JFOWloc1A2SzcvUzVMTUVVR0NDc0dBUVVGQndFQkJEa3dOekExQmdnckJnRUZCUWN3QVlZcGFIUjBjRG92TDI5amMzQXVZWEJ3YkdVdVkyOXRMMjlqYzNBd05DMWhjSEJzWldGcFkyRXpNREl3Z2dFZEJnTlZIU0FFZ2dFVU1JSUJFRENDQVF3R0NTcUdTSWIzWTJRRkFUQ0IvakNCd3dZSUt3WUJCUVVIQWdJd2diWU1nYk5TWld4cFlXNWpaU0J2YmlCMGFHbHpJR05sY25ScFptbGpZWFJsSUdKNUlHRnVlU0J3WVhKMGVTQmhjM04xYldWeklHRmpZMlZ3ZEdGdVkyVWdiMllnZEdobElIUm9aVzRnWVhCd2JHbGpZV0pzWlNCemRHRnVaR0Z5WkNCMFpYSnRjeUJoYm1RZ1kyOXVaR2wwYVc5dWN5QnZaaUIxYzJVc0lHTmxjblJwWm1sallYUmxJSEJ2YkdsamVTQmhibVFnWTJWeWRHbG1hV05oZEdsdmJpQndjbUZqZEdsalpTQnpkR0YwWlcxbGJuUnpMakEyQmdnckJnRUZCUWNDQVJZcWFIUjBjRG92TDNkM2R5NWhjSEJzWlM1amIyMHZZMlZ5ZEdsbWFXTmhkR1ZoZFhSb2IzSnBkSGt2TURRR0ExVWRId1F0TUNzd0thQW5vQ1dHSTJoMGRIQTZMeTlqY213dVlYQndiR1V1WTI5dEwyRndjR3hsWVdsallUTXVZM0pzTUIwR0ExVWREZ1FXQkJRQ0pEQUxtdTd0UmpHWHBLWmFLWjVDY1lJY1JUQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0R3WUpLb1pJaHZkalpBWWRCQUlGQURBS0JnZ3Foa2pPUFFRREFnTkhBREJFQWlCMG9iTWsyMEpKUXczVEoweFFkTVNBalpvZlNBNDZoY1hCTmlWbU1sKzhvd0lnYVRhUVU2djFDMXBTK2ZZQVRjV0tyV3hRcDlZSWFEZVE0S2M2MEI1SzJZRXdnZ0x1TUlJQ2RhQURBZ0VDQWdoSmJTKy9PcGphbHpBS0JnZ3Foa2pPUFFRREFqQm5NUnN3R1FZRFZRUUREQkpCY0hCc1pTQlNiMjkwSUVOQklDMGdSek14SmpBa0JnTlZCQXNNSFVGd2NHeGxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1STXdFUVlEVlFRS0RBcEJjSEJzWlNCSmJtTXVNUXN3Q1FZRFZRUUdFd0pWVXpBZUZ3MHhOREExTURZeU16UTJNekJhRncweU9UQTFNRFl5TXpRMk16QmFNSG94TGpBc0JnTlZCQU1NSlVGd2NHeGxJRUZ3Y0d4cFkyRjBhVzl1SUVsdWRHVm5jbUYwYVc5dUlFTkJJQzBnUnpNeEpqQWtCZ05WQkFzTUhVRndjR3hsSUVObGNuUnBabWxqWVhScGIyNGdRWFYwYUc5eWFYUjVNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVFzd0NRWURWUVFHRXdKVlV6QlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJQQVhFWVFaMTJTRjFScGVKWUVIZHVpQW91L2VlNjVONEkzOFM1UGhNMWJWWmxzMXJpTFFsM1lOSWs1N3VnajlkaGZPaU10MnUyWnd2c2pvS1lUL1ZFV2pnZmN3Z2ZRd1JnWUlLd1lCQlFVSEFRRUVPakE0TURZR0NDc0dBUVVGQnpBQmhpcG9kSFJ3T2k4dmIyTnpjQzVoY0hCc1pTNWpiMjB2YjJOemNEQTBMV0Z3Y0d4bGNtOXZkR05oWnpNd0hRWURWUjBPQkJZRUZDUHlTY1JQaytUdkorYkU5aWhzUDZLNy9TNUxNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdId1lEVlIwakJCZ3dGb0FVdTdEZW9WZ3ppSnFraXBuZXZyM3JyOXJMSktzd053WURWUjBmQkRBd0xqQXNvQ3FnS0lZbWFIUjBjRG92TDJOeWJDNWhjSEJzWlM1amIyMHZZWEJ3YkdWeWIyOTBZMkZuTXk1amNtd3dEZ1lEVlIwUEFRSC9CQVFEQWdFR01CQUdDaXFHU0liM1kyUUdBZzRFQWdVQU1Bb0dDQ3FHU000OUJBTUNBMmNBTUdRQ01EclBjb05SRnBteGh2czF3MWJLWXIvMEYrM1pEM1ZOb282KzhaeUJYa0szaWZpWTk1dFpuNWpWUVEyUG5lbkMvZ0l3TWkzVlJDR3dvd1YzYkYzek9EdVFaLzBYZkN3aGJaWlB4bkpwZ2hKdlZQaDZmUnVaeTVzSmlTRmhCcGtQQ1pJZEFBQXhnZ0dJTUlJQmhBSUJBVENCaGpCNk1TNHdMQVlEVlFRRERDVkJjSEJzWlNCQmNIQnNhV05oZEdsdmJpQkpiblJsWjNKaGRHbHZiaUJEUVNBdElFY3pNU1l3SkFZRFZRUUxEQjFCY0hCc1pTQkRaWEowYVdacFkyRjBhVzl1SUVGMWRHaHZjbWwwZVRFVE1CRUdBMVVFQ2d3S1FYQndiR1VnU1c1akxqRUxNQWtHQTFVRUJoTUNWVk1DQ0ZuWW9ieXE5T1BOTUFzR0NXQ0dTQUZsQXdRQ0FhQ0JrekFZQmdrcWhraUc5dzBCQ1FNeEN3WUpLb1pJaHZjTkFRY0JNQndHQ1NxR1NJYjNEUUVKQlRFUEZ3MHlOVEF6TURZeE1URXlOVFZhTUNnR0NTcUdTSWIzRFFFSk5ERWJNQmt3Q3dZSllJWklBV1VEQkFJQm9Rb0dDQ3FHU000OUJBTUNNQzhHQ1NxR1NJYjNEUUVKQkRFaUJDQS9FemxmRUhtbk5uSW9uS2FwOUpBVkNEdld3dmlMRkhuY0IwdmpaY21WN3pBS0JnZ3Foa2pPUFFRREFnUkhNRVVDSVFEeWV0MUdwSU9QcXkyRjFzYkY3M1hOSDRJTEp6WWozSDdXR1Zzd0huRzFBQUlnQVJYZG5HY0hERkI1LzNhc1I5bm9PNVdkMy95NlZKRFpmZXQ3WWV6RjFEMEFBQUFBQUFBPSIsImhlYWRlciI6eyJwdWJsaWNLZXlIYXNoIjoiVzFOT3JTbWhwTVdDQlg0cWE3NEZBeTNEMnNWZDZ3YWFzOEdHMWdYQ21Pdz0iLCJlcGhlbWVyYWxQdWJsaWNLZXkiOiJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVaUmdaNGkveUhwK3d3ckxtRGpDanJyTkJkQnB5b0tEU1VvamV0enBuVk4wdDNXajZiNjhnUWkvempTS3hsOUZ0eXdkb0lJSUFvWm9Sa0ZuMFpseTBMZz09IiwidHJhbnNhY3Rpb25JZCI6ImE3OWVjMjYyMThiZmZjNDNmYzlkZDZlMTg0ZDI4NDNmNzQ2MjNhNWE5ODJhZTY5YWM2NmU3ZjQ1ZDNiNzhiZDUifSwidmVyc2lvbiI6IkVDX3YxIn0=",
"payment_method": {
"display_name": "Visa 4228",
"network": "Visa",
"type": "debit"
},
"transaction_identifier": "a79ec26218bffc43fc9dd6e184d2843f74623a5a982ae69ac66e7f45d3b78bd5"
}
},
"billing": null
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"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"
}
}
}'
```
```json
{
"payment_id": "pay_2tnZM8hO4nIxl6gox8rI",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "authorizedotnet",
"client_secret": "pay_2tnZM8hO4nIxl6gox8rI_secret_wEWXQgZ7k7Rod2MdN7Kf",
"created": "2025-03-06T17:28:21.551Z",
"currency": "USD",
"customer_id": "cus_1741282115",
"customer": {
"id": "cus_1741282115",
"name": "John Doe",
"email": "likhin.bopanna@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": "man_f3nDuo2P2PnTlqkUuMQs",
"mandate_data": {
"update_mandate_id": null,
"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": 8000,
"currency": "USD",
"start_date": null,
"end_date": null,
"metadata": null
}
}
},
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"apple_pay": {
"last4": "4228",
"card_network": "Visa",
"type": "debit"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": "authorizedotnet_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:43:21.551Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"os_version": null,
"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",
"color_depth": 24,
"device_model": null,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"accept_language": "en",
"java_script_enabled": true
},
"payment_method_id": "pm_EpXi7jTd8DzFIG5Vj2y7",
"payment_method_status": "active",
"updated": "2025-03-06T17:28:36.364Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929611432-929002945",
"card_discovery": null
}
```
</details>
<details>
<summary>2. 0 Auth mandate Apple Pay Payment Create (MIT)</summary>
Create + Confirm:
```curl
curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_a0e1Cq93U9sDLfUgilzlEJqg4eBRZI4Y021Hqj6bTXhAZTC7gjLij6aqolpvM9Gn' \
--data '{
"amount": 1000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "cus_1741282115",
"client_secret": "pay_Jc0FhbExingoDJPnrOAQ_secret_eBhCpq9mBPOSajNH3Kpl",
"recurring_details": {
"type": "payment_method_id",
"data": "pm_EpXi7jTd8DzFIG5Vj2y7"
},
"off_session": true,
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"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"
}
}
}'
```
```json
{
"payment_id": "pay_Jc0FhbExingoDJPnrOAQ",
"merchant_id": "postman_merchant_GHAction_1741082806",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "authorizedotnet",
"client_secret": "pay_Jc0FhbExingoDJPnrOAQ_secret_eBhCpq9mBPOSajNH3Kpl",
"created": "2025-03-06T17:28:53.109Z",
"currency": "USD",
"customer_id": "cus_1741282115",
"customer": {
"id": "cus_1741282115",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": null,
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cus_1741282115",
"created_at": 1741282133,
"expires": 1741285733,
"secret": "epk_7b3fdc77c6c8443cb2d6ce57a1d7c4c1"
},
"manual_retry_allowed": false,
"connector_transaction_id": "120058504115",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "120058504115",
"payment_link": null,
"profile_id": "pro_oHA88TJXvZtdcosjZFkq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_C6aMBB2E0kNICU09mSCP",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-06T17:43:53.109Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_EpXi7jTd8DzFIG5Vj2y7",
"payment_method_status": "active",
"updated": "2025-03-06T17:28:53.762Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "929611432-929002945",
"card_discovery": null
}
```
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
586adea99275df7032d276552688da6012728f3c
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7436
|
Bug: [CYPRESS] Fix lints and address code duplication
- [ ] Fix lints that is resulting in checks to fail on every PRs
- [ ] Reduce duplicate code in connector configs
|
2025-03-05T16:07:30Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR is just a minor refactor of removing duplicate / redundant `customer_acceptance` object by re-using it.
Moved the object to `Commons` and imported the object where ever the duplicate code exist.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Reduce code duplication
closes https://github.com/juspay/hyperswitch/issues/7436
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
CI should pass
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
6df1578922b7bdc3d0b20ef1bc0b8714f43cc4bf
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7406
|
Bug: refactor(core): filter default routing config response based on connector type
## Description
<!-- Describe your changes in detail -->
We are filtering the response for payment and payout processors.
|
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 8d03e82a328..64207b4b5d7 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -1,6 +1,6 @@
pub mod helpers;
pub mod transformers;
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use api_models::routing::DynamicRoutingAlgoAccessor;
@@ -11,6 +11,7 @@ use api_models::{
use async_trait::async_trait;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use common_utils::ext_traits::AsyncExt;
+use common_utils::id_type::MerchantConnectorAccountId;
use diesel_models::routing_algorithm::RoutingAlgorithm;
use error_stack::ResultExt;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
@@ -18,7 +19,9 @@ use external_services::grpc_client::dynamic_routing::{
contract_routing_client::ContractBasedDynamicRouting,
success_rate_client::SuccessBasedDynamicRouting,
};
-use hyperswitch_domain_models::{mandates, payment_address};
+use hyperswitch_domain_models::{
+ mandates, merchant_connector_account::MerchantConnectorAccount, payment_address,
+};
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use router_env::logger;
use rustc_hash::FxHashSet;
@@ -976,16 +979,66 @@ pub async fn retrieve_default_routing_config(
) -> RouterResponse<Vec<routing_types::RoutableConnectorChoice>> {
metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG.add(1, &[]);
let db = state.store.as_ref();
+ let key_manager_state = &(&state).into();
+ let key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ merchant_account.get_id(),
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+
let id = profile_id
.map(|profile_id| profile_id.get_string_repr().to_owned())
.unwrap_or_else(|| merchant_account.get_id().get_string_repr().to_string());
- helpers::get_merchant_default_config(db, &id, transaction_type)
+ let mut merchant_connector_details: HashMap<
+ MerchantConnectorAccountId,
+ MerchantConnectorAccount,
+ > = HashMap::new();
+ state
+ .store
+ .find_merchant_connector_account_by_merchant_id_and_disabled_list(
+ key_manager_state,
+ merchant_account.get_id(),
+ false,
+ &key_store,
+ )
.await
- .map(|conn_choice| {
- metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG_SUCCESS_RESPONSE.add(1, &[]);
- service_api::ApplicationResponse::Json(conn_choice)
+ .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
+ message: format!(
+ "Unable to find merchant_connector_accounts associate with merchant_id: {}",
+ merchant_account.get_id().get_string_repr()
+ ),
+ })?
+ .iter()
+ .for_each(|mca| {
+ merchant_connector_details.insert(mca.get_id(), mca.clone());
+ });
+
+ let connectors = helpers::get_merchant_default_config(db, &id, transaction_type)
+ .await?
+ .iter()
+ .filter(|connector| {
+ connector
+ .merchant_connector_id
+ .as_ref()
+ .is_some_and(|mca_id| {
+ merchant_connector_details.get(mca_id).is_some_and(|mca| {
+ (*transaction_type == common_enums::TransactionType::Payment
+ && mca.connector_type == common_enums::ConnectorType::PaymentProcessor)
+ || (*transaction_type == common_enums::TransactionType::Payout
+ && mca.connector_type
+ == common_enums::ConnectorType::PayoutProcessor)
+ })
+ })
})
+ .cloned()
+ .collect::<Vec<routing_types::RoutableConnectorChoice>>();
+ metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG_SUCCESS_RESPONSE.add(1, &[]);
+ Ok(service_api::ApplicationResponse::Json(connectors))
}
#[cfg(feature = "v2")]
|
2025-02-05T21:11:16Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
We are filtering the response for payment and payout processors.
So this works as follows:
If Payment's route is hit only PaymentProcessors will be listed and nothing else like PayoutConnectors etc.
Payment :
```
curl --location 'http://localhost:8080/routing/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk'
```
If Payout's route is hit, only Payout's connector will be shown and nothing else.
Payout :
```
curl --location 'http://localhost:8080/routing/payout/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk'
```

<img width="1333" alt="Screenshot 2025-03-04 at 1 02 15 PM" src="https://github.com/user-attachments/assets/a587b7c3-ee87-4caf-8b29-dcb281a1e6f4" />
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested after creating JWT locally and adding 1 payment and 1 payout connector.
Payment :
```
curl --location 'http://localhost:8080/routing/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk'
```
Payout :
```
curl --location 'http://localhost:8080/routing/payout/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWMyMTJhODgtOGFmYy00YjJjLWIwYWQtODY3MmQ2NTI3MzdlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxMDAzMjgwIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTE3NjE1Miwib3JnX2lkIjoib3JnX1c4MkFMNTZ6VVE1dXFHcEEyYzFkIiwicHJvZmlsZV9pZCI6InByb19NcUlMcDAwdUFJeW5JZDdtUTNUTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.RoPyIG-JGrH6QmM6Gqd9gh03hOqy6MuC9Our9EHYGNk'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
d6e13dd0c87537e6696dd6dfc02280f825d116ab
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7450
|
Bug: feat(analytics): add new filters, dimensions and metrics for authentication analytics
Add support for filters and dimensions for authentication analytics.
Create new metrics:
- Authentication Error Message
- Authentication Funnel
|
diff --git a/crates/analytics/src/auth_events.rs b/crates/analytics/src/auth_events.rs
index e708c3c8830..3aa23d0793d 100644
--- a/crates/analytics/src/auth_events.rs
+++ b/crates/analytics/src/auth_events.rs
@@ -1,6 +1,8 @@
pub mod accumulator;
mod core;
+pub mod filters;
pub mod metrics;
+pub mod types;
pub use accumulator::{AuthEventMetricAccumulator, AuthEventMetricsAccumulator};
-pub use self::core::get_metrics;
+pub use self::core::{get_filters, get_metrics};
diff --git a/crates/analytics/src/auth_events/accumulator.rs b/crates/analytics/src/auth_events/accumulator.rs
index 446ac6ac8c2..13818d2bd43 100644
--- a/crates/analytics/src/auth_events/accumulator.rs
+++ b/crates/analytics/src/auth_events/accumulator.rs
@@ -6,12 +6,14 @@ use super::metrics::AuthEventMetricRow;
pub struct AuthEventMetricsAccumulator {
pub authentication_count: CountAccumulator,
pub authentication_attempt_count: CountAccumulator,
+ pub authentication_error_message: AuthenticationErrorMessageAccumulator,
pub authentication_success_count: CountAccumulator,
pub challenge_flow_count: CountAccumulator,
pub challenge_attempt_count: CountAccumulator,
pub challenge_success_count: CountAccumulator,
pub frictionless_flow_count: CountAccumulator,
pub frictionless_success_count: CountAccumulator,
+ pub authentication_funnel: CountAccumulator,
}
#[derive(Debug, Default)]
@@ -20,6 +22,11 @@ pub struct CountAccumulator {
pub count: Option<i64>,
}
+#[derive(Debug, Default)]
+pub struct AuthenticationErrorMessageAccumulator {
+ pub count: Option<i64>,
+}
+
pub trait AuthEventMetricAccumulator {
type MetricOutput;
@@ -44,6 +51,22 @@ impl AuthEventMetricAccumulator for CountAccumulator {
}
}
+impl AuthEventMetricAccumulator for AuthenticationErrorMessageAccumulator {
+ type MetricOutput = Option<u64>;
+ #[inline]
+ fn add_metrics_bucket(&mut self, metrics: &AuthEventMetricRow) {
+ 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 AuthEventMetricsAccumulator {
pub fn collect(self) -> AuthEventMetricsBucketValue {
AuthEventMetricsBucketValue {
@@ -55,6 +78,8 @@ impl AuthEventMetricsAccumulator {
challenge_success_count: self.challenge_success_count.collect(),
frictionless_flow_count: self.frictionless_flow_count.collect(),
frictionless_success_count: self.frictionless_success_count.collect(),
+ error_message_count: self.authentication_error_message.collect(),
+ authentication_funnel: self.authentication_funnel.collect(),
}
}
}
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 75bdf4de149..a2640be6ead 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -1,13 +1,20 @@
use std::collections::HashMap;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier, MetricsBucketResponse},
- AnalyticsMetadata, GetAuthEventMetricRequest, MetricsResponse,
+ auth_events::{
+ AuthEventDimensions, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ MetricsBucketResponse,
+ },
+ AuthEventFilterValue, AuthEventFiltersResponse, AuthEventMetricsResponse,
+ AuthEventsAnalyticsMetadata, GetAuthEventFilterRequest, GetAuthEventMetricRequest,
};
-use error_stack::ResultExt;
+use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
-use super::AuthEventMetricsAccumulator;
+use super::{
+ filters::{get_auth_events_filter_for_dimension, AuthEventFilterRow},
+ AuthEventMetricsAccumulator,
+};
use crate::{
auth_events::AuthEventMetricAccumulator,
errors::{AnalyticsError, AnalyticsResult},
@@ -19,7 +26,7 @@ pub async fn get_metrics(
pool: &AnalyticsProvider,
merchant_id: &common_utils::id_type::MerchantId,
req: GetAuthEventMetricRequest,
-) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
+) -> AnalyticsResult<AuthEventMetricsResponse<MetricsBucketResponse>> {
let mut metrics_accumulator: HashMap<
AuthEventMetricsBucketIdentifier,
AuthEventMetricsAccumulator,
@@ -34,7 +41,9 @@ pub async fn get_metrics(
let data = pool
.get_auth_event_metrics(
&metric_type,
+ &req.group_by_names.clone(),
&merchant_id_scoped,
+ &req.filters,
req.time_series.map(|t| t.granularity),
&req.time_range,
)
@@ -77,22 +86,94 @@ pub async fn get_metrics(
AuthEventMetrics::FrictionlessSuccessCount => metrics_builder
.frictionless_success_count
.add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationErrorMessage => metrics_builder
+ .authentication_error_message
+ .add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationFunnel => metrics_builder
+ .authentication_funnel
+ .add_metrics_bucket(&value),
}
}
}
+ let mut total_error_message_count = 0;
let query_data: Vec<MetricsBucketResponse> = metrics_accumulator
.into_iter()
- .map(|(id, val)| MetricsBucketResponse {
- values: val.collect(),
- dimensions: id,
+ .map(|(id, val)| {
+ let collected_values = val.collect();
+ if let Some(count) = collected_values.error_message_count {
+ total_error_message_count += count;
+ }
+ MetricsBucketResponse {
+ values: collected_values,
+ dimensions: id,
+ }
})
.collect();
-
- Ok(MetricsResponse {
+ Ok(AuthEventMetricsResponse {
query_data,
- meta_data: [AnalyticsMetadata {
- current_time_range: req.time_range,
+ meta_data: [AuthEventsAnalyticsMetadata {
+ total_error_message_count: Some(total_error_message_count),
}],
})
}
+
+pub async fn get_filters(
+ pool: &AnalyticsProvider,
+ req: GetAuthEventFilterRequest,
+ merchant_id: &common_utils::id_type::MerchantId,
+) -> AnalyticsResult<AuthEventFiltersResponse> {
+ let mut res = AuthEventFiltersResponse::default();
+ for dim in req.group_by_names {
+ let values = match pool {
+ AnalyticsProvider::Sqlx(_pool) => {
+ Err(report!(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::Clickhouse(pool) => {
+ get_auth_events_filter_for_dimension(dim, merchant_id, &req.time_range, pool)
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::CombinedCkh(sqlx_pool, ckh_pool) | AnalyticsProvider::CombinedSqlx(sqlx_pool, ckh_pool) => {
+ let ckh_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ ckh_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ let sqlx_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ sqlx_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ 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 refunds analytics filters")
+ },
+ _ => {}
+ };
+ ckh_result
+ }
+ }
+ .change_context(AnalyticsError::UnknownError)?
+ .into_iter()
+ .filter_map(|fil: AuthEventFilterRow| match dim {
+ AuthEventDimensions::AuthenticationStatus => fil.authentication_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::TransactionStatus => fil.trans_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::ErrorMessage => fil.error_message,
+ AuthEventDimensions::AuthenticationConnector => fil.authentication_connector.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::MessageVersion => fil.message_version,
+ })
+ .collect::<Vec<String>>();
+ res.query_data.push(AuthEventFilterValue {
+ dimension: dim,
+ values,
+ })
+ }
+ Ok(res)
+}
diff --git a/crates/analytics/src/auth_events/filters.rs b/crates/analytics/src/auth_events/filters.rs
new file mode 100644
index 00000000000..da8e0b7cfa3
--- /dev/null
+++ b/crates/analytics/src/auth_events/filters.rs
@@ -0,0 +1,60 @@
+use api_models::analytics::{auth_events::AuthEventDimensions, Granularity, TimeRange};
+use common_utils::errors::ReportSwitchExt;
+use diesel_models::enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+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 AuthEventFilterAnalytics: LoadRow<AuthEventFilterRow> {}
+
+pub async fn get_auth_events_filter_for_dimension<T>(
+ dimension: AuthEventDimensions,
+ merchant_id: &common_utils::id_type::MerchantId,
+ time_range: &TimeRange,
+ pool: &T,
+) -> FiltersResult<Vec<AuthEventFilterRow>>
+where
+ T: AnalyticsDataSource + AuthEventFilterAnalytics,
+ 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::Authentications);
+
+ 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_id)
+ .switch()?;
+
+ query_builder.set_distinct();
+
+ query_builder
+ .execute_query::<AuthEventFilterRow, _>(pool)
+ .await
+ .change_context(FiltersError::QueryBuildingError)?
+ .change_context(FiltersError::QueryExecutionFailure)
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq, serde::Deserialize)]
+pub struct AuthEventFilterRow {
+ pub authentication_status: Option<DBEnumWrapper<AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+}
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index f3f0354818c..fd94aac614c 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -1,18 +1,23 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
Granularity, TimeRange,
};
+use diesel_models::enums as storage_enums;
use time::PrimitiveDateTime;
use crate::{
query::{Aggregate, GroupByClause, ToSql, Window},
- types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult},
+ types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
};
mod authentication_attempt_count;
mod authentication_count;
+mod authentication_error_message;
+mod authentication_funnel;
mod authentication_success_count;
mod challenge_attempt_count;
mod challenge_flow_count;
@@ -22,6 +27,8 @@ mod frictionless_success_count;
use authentication_attempt_count::AuthenticationAttemptCount;
use authentication_count::AuthenticationCount;
+use authentication_error_message::AuthenticationErrorMessage;
+use authentication_funnel::AuthenticationFunnel;
use authentication_success_count::AuthenticationSuccessCount;
use challenge_attempt_count::ChallengeAttemptCount;
use challenge_flow_count::ChallengeFlowCount;
@@ -32,7 +39,15 @@ use frictionless_success_count::FrictionlessSuccessCount;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct AuthEventMetricRow {
pub count: Option<i64>,
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<DBEnumWrapper<storage_enums::AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<storage_enums::TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<storage_enums::AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+ #[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 AuthEventMetricAnalytics: LoadRow<AuthEventMetricRow> {}
@@ -45,6 +60,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -64,6 +81,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -71,42 +90,122 @@ where
match self {
Self::AuthenticationCount => {
AuthenticationCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationAttemptCount => {
AuthenticationAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationSuccessCount => {
AuthenticationSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeFlowCount => {
ChallengeFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeAttemptCount => {
ChallengeAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeSuccessCount => {
ChallengeSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessFlowCount => {
FrictionlessFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessSuccessCount => {
FrictionlessSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationErrorMessage => {
+ AuthenticationErrorMessage
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationFunnel => {
+ AuthenticationFunnel
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 2d34344905e..32c76385409 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,6 +31,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -37,6 +40,10 @@ where
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +72,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +100,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
index 9f2311f5638..39df41f53aa 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -60,12 +65,19 @@ where
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -81,7 +93,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_error_message.rs b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
new file mode 100644
index 00000000000..cdb89b796dd
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
@@ -0,0 +1,138 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_enums::AuthenticationStatus;
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationErrorMessage;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationErrorMessage
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ 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()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("authentication_status", AuthenticationStatus::Failed)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::ErrorMessage,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).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 {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_funnel.rs b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
new file mode 100644
index 00000000000..37f9dfd1c1f
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
@@ -0,0 +1,133 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationFunnel;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationFunnel
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ 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()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::TransactionStatus,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).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 {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index e887807f41c..039ef00dd6e 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +70,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +98,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index f1f6a397994..beccc093b19 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -68,12 +73,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", "pending")
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -89,7 +101,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index c08618cc0d0..4d07cffba94 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,18 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +96,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index 3fb75efd562..310a45f0530 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index 8859c60fc37..24857bfb840 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,19 @@ where
query_builder
.add_filter_clause("trans_status", "Y".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +97,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index 3d5d894e7dd..79fef8a16d0 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/types.rs b/crates/analytics/src/auth_events/types.rs
new file mode 100644
index 00000000000..ac7ee2462ee
--- /dev/null
+++ b/crates/analytics/src/auth_events/types.rs
@@ -0,0 +1,58 @@
+use api_models::analytics::auth_events::{AuthEventDimensions, AuthEventFilters};
+use error_stack::ResultExt;
+
+use crate::{
+ query::{QueryBuilder, QueryFilter, QueryResult, ToSql},
+ types::{AnalyticsCollection, AnalyticsDataSource},
+};
+
+impl<T> QueryFilter<T> for AuthEventFilters
+where
+ T: AnalyticsDataSource,
+ AnalyticsCollection: ToSql<T>,
+{
+ fn set_filter_clause(&self, builder: &mut QueryBuilder<T>) -> QueryResult<()> {
+ if !self.authentication_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationStatus,
+ &self.authentication_status,
+ )
+ .attach_printable("Error adding authentication status filter")?;
+ }
+
+ if !self.trans_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::TransactionStatus,
+ &self.trans_status,
+ )
+ .attach_printable("Error adding transaction status filter")?;
+ }
+
+ if !self.error_message.is_empty() {
+ builder
+ .add_filter_in_range_clause(AuthEventDimensions::ErrorMessage, &self.error_message)
+ .attach_printable("Error adding error message filter")?;
+ }
+
+ if !self.authentication_connector.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationConnector,
+ &self.authentication_connector,
+ )
+ .attach_printable("Error adding authentication connector filter")?;
+ }
+
+ if !self.message_version.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::MessageVersion,
+ &self.message_version,
+ )
+ .attach_printable("Error adding message version filter")?;
+ }
+ Ok(())
+ }
+}
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index 1c86e7cbcf6..1d52cc9e761 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -28,6 +28,7 @@ use crate::{
filters::ApiEventFilter,
metrics::{latency::LatencyAvg, ApiEventMetricRow},
},
+ auth_events::filters::AuthEventFilterRow,
connector_events::events::ConnectorEventsResult,
disputes::{filters::DisputeFilterRow, metrics::DisputeMetricRow},
outgoing_webhook_event::events::OutgoingWebhookLogsResult,
@@ -181,6 +182,7 @@ impl super::sdk_events::metrics::SdkEventMetricAnalytics for ClickhouseClient {}
impl super::sdk_events::events::SdkEventsFilterAnalytics for ClickhouseClient {}
impl super::active_payments::metrics::ActivePaymentsMetricAnalytics for ClickhouseClient {}
impl super::auth_events::metrics::AuthEventMetricAnalytics for ClickhouseClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::events::ApiLogsFilterAnalytics for ClickhouseClient {}
impl super::api_event::filters::ApiEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::metrics::ApiEventMetricAnalytics for ClickhouseClient {}
@@ -403,6 +405,16 @@ impl TryInto<AuthEventMetricRow> for serde_json::Value {
}
}
+impl TryInto<AuthEventFilterRow> for serde_json::Value {
+ type Error = Report<ParsingError>;
+
+ fn try_into(self) -> Result<AuthEventFilterRow, Self::Error> {
+ serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
+ "Failed to parse AuthEventFilterRow in clickhouse results",
+ ))
+ }
+}
+
impl TryInto<ApiEventFilter> for serde_json::Value {
type Error = Report<ParsingError>;
diff --git a/crates/analytics/src/core.rs b/crates/analytics/src/core.rs
index 0e3ced7993d..980e17bc90a 100644
--- a/crates/analytics/src/core.rs
+++ b/crates/analytics/src/core.rs
@@ -34,7 +34,7 @@ pub async fn get_domain_info(
AnalyticsDomain::AuthEvents => GetInfoResponse {
metrics: utils::get_auth_event_metrics_info(),
download_dimensions: None,
- dimensions: Vec::new(),
+ dimensions: utils::get_auth_event_dimensions(),
},
AnalyticsDomain::ApiEvents => GetInfoResponse {
metrics: utils::get_api_event_metrics_info(),
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index ef7108e8ef7..f698b1161a0 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -41,7 +41,9 @@ use api_models::analytics::{
api_event::{
ApiEventDimensions, ApiEventFilters, ApiEventMetrics, ApiEventMetricsBucketIdentifier,
},
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
disputes::{DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier},
frm::{FrmDimensions, FrmFilters, FrmMetrics, FrmMetricsBucketIdentifier},
payment_intents::{
@@ -908,7 +910,9 @@ impl AnalyticsProvider {
pub async fn get_auth_event_metrics(
&self,
metric: &AuthEventMetrics,
+ dimensions: &[AuthEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -916,13 +920,22 @@ impl AnalyticsProvider {
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
Self::Clickhouse(pool) => {
metric
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::CombinedCkh(_sqlx_pool, ckh_pool) | Self::CombinedSqlx(_sqlx_pool, ckh_pool) => {
metric
.load_metrics(
merchant_id,
+ dimensions,
+ filters,
granularity,
// Since API events are ckh only use ckh here
time_range,
@@ -1126,6 +1139,7 @@ pub enum AnalyticsFlow {
GetFrmMetrics,
GetSdkMetrics,
GetAuthMetrics,
+ GetAuthEventFilters,
GetActivePaymentsMetrics,
GetPaymentFilters,
GetPaymentIntentFilters,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index 59cb8743448..d483ce43605 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -4,7 +4,7 @@ use api_models::{
analytics::{
self as analytics_api,
api_event::ApiEventDimensions,
- auth_events::AuthEventFlows,
+ auth_events::{AuthEventDimensions, AuthEventFlows},
disputes::DisputeDimensions,
frm::{FrmDimensions, FrmTransactionType},
payment_intents::PaymentIntentDimensions,
@@ -19,7 +19,7 @@ use api_models::{
},
refunds::RefundStatus,
};
-use common_enums::{AuthenticationStatus, TransactionStatus};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -505,6 +505,7 @@ impl_to_sql_for_to_string!(
FrmTransactionType,
TransactionStatus,
AuthenticationStatus,
+ AuthenticationConnectors,
Flow,
&String,
&bool,
@@ -522,7 +523,9 @@ impl_to_sql_for_to_string!(
ApiEventDimensions,
&DisputeDimensions,
DisputeDimensions,
- DisputeStage
+ DisputeStage,
+ AuthEventDimensions,
+ &AuthEventDimensions
);
#[derive(Debug, Clone, Copy)]
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index f3143840f34..a6db92e753f 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -4,6 +4,7 @@ use api_models::{
analytics::{frm::FrmTransactionType, refunds::RefundType},
enums::{DisputeStage, DisputeStatus},
};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
DbConnectionParams,
@@ -96,6 +97,9 @@ db_type!(FraudCheckStatus);
db_type!(FrmTransactionType);
db_type!(DisputeStage);
db_type!(DisputeStatus);
+db_type!(AuthenticationStatus);
+db_type!(TransactionStatus);
+db_type!(AuthenticationConnectors);
impl<'q, Type> Encode<'q, Postgres> for DBEnumWrapper<Type>
where
@@ -159,6 +163,8 @@ impl super::disputes::filters::DisputeFilterAnalytics for SqlxClient {}
impl super::disputes::metrics::DisputeMetricAnalytics for SqlxClient {}
impl super::frm::metrics::FrmMetricAnalytics for SqlxClient {}
impl super::frm::filters::FrmFilterAnalytics for SqlxClient {}
+impl super::auth_events::metrics::AuthEventMetricAnalytics for SqlxClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for SqlxClient {}
#[async_trait::async_trait]
impl AnalyticsDataSource for SqlxClient {
@@ -190,6 +196,94 @@ impl HealthCheck for SqlxClient {
}
}
+impl<'a> FromRow<'a, PgRow> for super::auth_events::metrics::AuthEventMetricRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").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 {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ count,
+ start_bucket,
+ end_bucket,
+ })
+ }
+}
+
+impl<'a> FromRow<'a, PgRow> for super::auth_events::filters::AuthEventFilterRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ Ok(Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ })
+ }
+}
+
impl<'a> FromRow<'a, PgRow> for super::refunds::metrics::RefundMetricRow {
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
let currency: Option<DBEnumWrapper<Currency>> =
diff --git a/crates/analytics/src/utils.rs b/crates/analytics/src/utils.rs
index fc21bf09819..a0ddead1363 100644
--- a/crates/analytics/src/utils.rs
+++ b/crates/analytics/src/utils.rs
@@ -1,6 +1,6 @@
use api_models::analytics::{
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -47,6 +47,16 @@ pub fn get_payment_intent_dimensions() -> Vec<NameDescription> {
.collect()
}
+pub fn get_auth_event_dimensions() -> Vec<NameDescription> {
+ vec![
+ AuthEventDimensions::AuthenticationConnector,
+ AuthEventDimensions::MessageVersion,
+ ]
+ .into_iter()
+ .map(Into::into)
+ .collect()
+}
+
pub fn get_refund_dimensions() -> Vec<NameDescription> {
RefundDimensions::iter().map(Into::into).collect()
}
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 132272f0e49..71d7f80eb7c 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -7,7 +7,7 @@ use masking::Secret;
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -226,6 +226,10 @@ pub struct GetAuthEventMetricRequest {
pub time_series: Option<TimeSeries>,
pub time_range: TimeRange,
#[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+ #[serde(default)]
+ pub filters: AuthEventFilters,
+ #[serde(default)]
pub metrics: HashSet<AuthEventMetrics>,
#[serde(default)]
pub delta: bool,
@@ -509,3 +513,36 @@ pub struct SankeyResponse {
pub dispute_status: Option<String>,
pub first_attempt: i64,
}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GetAuthEventFilterRequest {
+ pub time_range: TimeRange,
+ #[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+}
+
+#[derive(Debug, Default, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFiltersResponse {
+ pub query_data: Vec<AuthEventFilterValue>,
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFilterValue {
+ pub dimension: AuthEventDimensions,
+ pub values: Vec<String>,
+}
+
+#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventMetricsResponse<T> {
+ pub query_data: Vec<T>,
+ pub meta_data: [AuthEventsAnalyticsMetadata; 1],
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct AuthEventsAnalyticsMetadata {
+ pub total_error_message_count: Option<u64>,
+}
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 6f527551348..5c2d4ed2064 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -3,7 +3,23 @@ use std::{
hash::{Hash, Hasher},
};
-use super::NameDescription;
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+
+use super::{NameDescription, TimeRange};
+
+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
+pub struct AuthEventFilters {
+ #[serde(default)]
+ pub authentication_status: Vec<AuthenticationStatus>,
+ #[serde(default)]
+ pub trans_status: Vec<TransactionStatus>,
+ #[serde(default)]
+ pub error_message: Vec<String>,
+ #[serde(default)]
+ pub authentication_connector: Vec<AuthenticationConnectors>,
+ #[serde(default)]
+ pub message_version: Vec<String>,
+}
#[derive(
Debug,
@@ -22,10 +38,13 @@ use super::NameDescription;
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum AuthEventDimensions {
- #[serde(rename = "authentication_status")]
AuthenticationStatus,
+ #[strum(serialize = "trans_status")]
#[serde(rename = "trans_status")]
TransactionStatus,
+ ErrorMessage,
+ AuthenticationConnector,
+ MessageVersion,
}
#[derive(
@@ -51,6 +70,8 @@ pub enum AuthEventMetrics {
FrictionlessSuccessCount,
ChallengeAttemptCount,
ChallengeSuccessCount,
+ AuthenticationErrorMessage,
+ AuthenticationFunnel,
}
#[derive(
@@ -79,6 +100,7 @@ pub mod metric_behaviour {
pub struct FrictionlessSuccessCount;
pub struct ChallengeAttemptCount;
pub struct ChallengeSuccessCount;
+ pub struct AuthenticationErrorMessage;
}
impl From<AuthEventMetrics> for NameDescription {
@@ -90,19 +112,58 @@ impl From<AuthEventMetrics> for NameDescription {
}
}
+impl From<AuthEventDimensions> for NameDescription {
+ fn from(value: AuthEventDimensions) -> Self {
+ Self {
+ name: value.to_string(),
+ desc: String::new(),
+ }
+ }
+}
+
#[derive(Debug, serde::Serialize, Eq)]
pub struct AuthEventMetricsBucketIdentifier {
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<AuthenticationStatus>,
+ pub trans_status: Option<TransactionStatus>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<AuthenticationConnectors>,
+ pub message_version: Option<String>,
+ #[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 AuthEventMetricsBucketIdentifier {
- pub fn new(time_bucket: Option<String>) -> Self {
- Self { time_bucket }
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ authentication_status: Option<AuthenticationStatus>,
+ trans_status: Option<TransactionStatus>,
+ error_message: Option<String>,
+ authentication_connector: Option<AuthenticationConnectors>,
+ message_version: Option<String>,
+ normalized_time_range: TimeRange,
+ ) -> Self {
+ Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ time_bucket: normalized_time_range,
+ start_time: normalized_time_range.start_time,
+ }
}
}
impl Hash for AuthEventMetricsBucketIdentifier {
fn hash<H: Hasher>(&self, state: &mut H) {
+ self.authentication_status.hash(state);
+ self.trans_status.hash(state);
+ self.authentication_connector.hash(state);
+ self.message_version.hash(state);
+ self.error_message.hash(state);
self.time_bucket.hash(state);
}
}
@@ -127,6 +188,8 @@ pub struct AuthEventMetricsBucketValue {
pub challenge_success_count: Option<u64>,
pub frictionless_flow_count: Option<u64>,
pub frictionless_success_count: Option<u64>,
+ pub error_message_count: Option<u64>,
+ pub authentication_funnel: Option<u64>,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index bf7544f7c01..31b0c1d8dce 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -113,10 +113,12 @@ impl_api_event_type!(
GetActivePaymentsMetricRequest,
GetSdkEventMetricRequest,
GetAuthEventMetricRequest,
+ GetAuthEventFilterRequest,
GetPaymentFiltersRequest,
PaymentFiltersResponse,
GetRefundFilterRequest,
RefundFiltersResponse,
+ AuthEventFiltersResponse,
GetSdkEventFiltersRequest,
SdkEventFiltersResponse,
ApiLogsRequest,
@@ -180,6 +182,13 @@ impl<T> ApiEventMetric for DisputesMetricsResponse<T> {
Some(ApiEventsType::Miscellaneous)
}
}
+
+impl<T> ApiEventMetric for AuthEventMetricsResponse<T> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Miscellaneous)
+ }
+}
+
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
impl ApiEventMetric for PaymentMethodIntentConfirmInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index dbbee9764f2..296bdbd9ddc 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -6686,6 +6686,7 @@ impl From<RoleScope> for EntityType {
serde::Serialize,
serde::Deserialize,
Eq,
+ Hash,
PartialEq,
ToSchema,
strum::Display,
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index deaf84bb009..858c16d052f 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -19,11 +19,11 @@ pub mod routes {
GetGlobalSearchRequest, GetSearchRequest, GetSearchRequestWithIndex, SearchIndex,
},
AnalyticsRequest, GenerateReportRequest, GetActivePaymentsMetricRequest,
- GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventMetricRequest,
- GetDisputeMetricRequest, GetFrmFilterRequest, GetFrmMetricRequest,
- GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest, GetPaymentIntentMetricRequest,
- GetPaymentMetricRequest, GetRefundFilterRequest, GetRefundMetricRequest,
- GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
+ GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventFilterRequest,
+ GetAuthEventMetricRequest, GetDisputeMetricRequest, GetFrmFilterRequest,
+ GetFrmMetricRequest, GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest,
+ GetPaymentIntentMetricRequest, GetPaymentMetricRequest, GetRefundFilterRequest,
+ GetRefundMetricRequest, GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
};
use common_enums::EntityType;
use common_utils::types::TimeRange;
@@ -106,6 +106,10 @@ pub mod routes {
web::resource("metrics/auth_events")
.route(web::post().to(get_auth_event_metrics)),
)
+ .service(
+ web::resource("filters/auth_events")
+ .route(web::post().to(get_merchant_auth_events_filters)),
+ )
.service(
web::resource("metrics/frm").route(web::post().to(get_frm_metrics)),
)
@@ -1018,6 +1022,34 @@ pub mod routes {
.await
}
+ pub async fn get_merchant_auth_events_filters(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<GetAuthEventFilterRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GetAuthEventFilters;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, auth: AuthenticationData, req, _| async move {
+ analytics::auth_events::get_filters(
+ &state.pool,
+ req,
+ auth.merchant_account.get_id(),
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::MerchantAnalyticsRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
pub async fn get_org_payment_filters(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
|
2025-03-06T14:57:01Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added support for filters and dimensions for authentication analytics.
Filters added:
- AuthenticationConnector
- MessageVersion
Dimensions added:
- AuthenticationStatus,
- TransactionStatus,
- ErrorMessage,
- AuthenticationConnector,
- MessageVersion,
New metrics added:
- AuthenticationErrorMessage
- AuthenticationFunnel
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Get better insights into authentication data.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Hit the curls:
#### AuthenticationErrorMessage:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"groupByNames": [
"error_message"
],
"metrics": [
"authentication_error_message"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"error_message_count": 1,
"authentication_funnel": null,
"authentication_status": null,
"trans_status": null,
"error_message": "Failed to authenticate",
"authentication_connector": null,
"message_version": null,
"time_range": {
"start_time": "2025-02-10T00:00:00.000Z",
"end_time": "2025-02-10T23:00:00.000Z"
},
"time_bucket": "2025-02-10 00:00:00"
},
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"error_message_count": 1,
"authentication_funnel": null,
"authentication_status": null,
"trans_status": null,
"error_message": "Something went wrong",
"authentication_connector": null,
"message_version": null,
"time_range": {
"start_time": "2025-02-20T00:00:00.000Z",
"end_time": "2025-02-20T23:00:00.000Z"
},
"time_bucket": "2025-02-20 00:00:00"
}
],
"metaData": [
{
"total_error_message_count": 2
}
]
}
```
#### Authentication Funnel:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"filters": {
"authentication_status": [
"success", "failed"
]
},
"metrics": [
"authentication_funnel"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"error_message_count": null,
"authentication_funnel": 3,
"authentication_status": null,
"trans_status": null,
"error_message": null,
"authentication_connector": null,
"message_version": null,
"time_range": {
"start_time": "2025-02-11T00:00:00.000Z",
"end_time": "2025-02-11T23:00:00.000Z"
},
"time_bucket": "2025-02-11 00:00:00"
},
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"error_message_count": null,
"authentication_funnel": 64,
"authentication_status": null,
"trans_status": null,
"error_message": null,
"authentication_connector": null,
"message_version": null,
"time_range": {
"start_time": "2025-02-10T00:00:00.000Z",
"end_time": "2025-02-10T23:00:00.000Z"
},
"time_bucket": "2025-02-10 00:00:00"
},
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"error_message_count": null,
"authentication_funnel": 11,
"authentication_status": null,
"trans_status": null,
"error_message": null,
"authentication_connector": null,
"message_version": null,
"time_range": {
"start_time": "2025-02-20T00:00:00.000Z",
"end_time": "2025-02-20T23:00:00.000Z"
},
"time_bucket": "2025-02-20 00:00:00"
}
],
"metaData": [
{
"total_error_message_count": 0
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
957a22852522a10378fc06dd30521a3a0c530ee5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7452
|
Bug: feat(analytics): add new filters, dimensions and metrics for authentication analytics hotfix
Add support for filters and dimensions for authentication analytics.
Create new metrics:
- Authentication Error Message
- Authentication Funnel
|
diff --git a/crates/analytics/src/auth_events.rs b/crates/analytics/src/auth_events.rs
index e708c3c8830..3aa23d0793d 100644
--- a/crates/analytics/src/auth_events.rs
+++ b/crates/analytics/src/auth_events.rs
@@ -1,6 +1,8 @@
pub mod accumulator;
mod core;
+pub mod filters;
pub mod metrics;
+pub mod types;
pub use accumulator::{AuthEventMetricAccumulator, AuthEventMetricsAccumulator};
-pub use self::core::get_metrics;
+pub use self::core::{get_filters, get_metrics};
diff --git a/crates/analytics/src/auth_events/accumulator.rs b/crates/analytics/src/auth_events/accumulator.rs
index 446ac6ac8c2..13818d2bd43 100644
--- a/crates/analytics/src/auth_events/accumulator.rs
+++ b/crates/analytics/src/auth_events/accumulator.rs
@@ -6,12 +6,14 @@ use super::metrics::AuthEventMetricRow;
pub struct AuthEventMetricsAccumulator {
pub authentication_count: CountAccumulator,
pub authentication_attempt_count: CountAccumulator,
+ pub authentication_error_message: AuthenticationErrorMessageAccumulator,
pub authentication_success_count: CountAccumulator,
pub challenge_flow_count: CountAccumulator,
pub challenge_attempt_count: CountAccumulator,
pub challenge_success_count: CountAccumulator,
pub frictionless_flow_count: CountAccumulator,
pub frictionless_success_count: CountAccumulator,
+ pub authentication_funnel: CountAccumulator,
}
#[derive(Debug, Default)]
@@ -20,6 +22,11 @@ pub struct CountAccumulator {
pub count: Option<i64>,
}
+#[derive(Debug, Default)]
+pub struct AuthenticationErrorMessageAccumulator {
+ pub count: Option<i64>,
+}
+
pub trait AuthEventMetricAccumulator {
type MetricOutput;
@@ -44,6 +51,22 @@ impl AuthEventMetricAccumulator for CountAccumulator {
}
}
+impl AuthEventMetricAccumulator for AuthenticationErrorMessageAccumulator {
+ type MetricOutput = Option<u64>;
+ #[inline]
+ fn add_metrics_bucket(&mut self, metrics: &AuthEventMetricRow) {
+ 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 AuthEventMetricsAccumulator {
pub fn collect(self) -> AuthEventMetricsBucketValue {
AuthEventMetricsBucketValue {
@@ -55,6 +78,8 @@ impl AuthEventMetricsAccumulator {
challenge_success_count: self.challenge_success_count.collect(),
frictionless_flow_count: self.frictionless_flow_count.collect(),
frictionless_success_count: self.frictionless_success_count.collect(),
+ error_message_count: self.authentication_error_message.collect(),
+ authentication_funnel: self.authentication_funnel.collect(),
}
}
}
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 75bdf4de149..a2640be6ead 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -1,13 +1,20 @@
use std::collections::HashMap;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier, MetricsBucketResponse},
- AnalyticsMetadata, GetAuthEventMetricRequest, MetricsResponse,
+ auth_events::{
+ AuthEventDimensions, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ MetricsBucketResponse,
+ },
+ AuthEventFilterValue, AuthEventFiltersResponse, AuthEventMetricsResponse,
+ AuthEventsAnalyticsMetadata, GetAuthEventFilterRequest, GetAuthEventMetricRequest,
};
-use error_stack::ResultExt;
+use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
-use super::AuthEventMetricsAccumulator;
+use super::{
+ filters::{get_auth_events_filter_for_dimension, AuthEventFilterRow},
+ AuthEventMetricsAccumulator,
+};
use crate::{
auth_events::AuthEventMetricAccumulator,
errors::{AnalyticsError, AnalyticsResult},
@@ -19,7 +26,7 @@ pub async fn get_metrics(
pool: &AnalyticsProvider,
merchant_id: &common_utils::id_type::MerchantId,
req: GetAuthEventMetricRequest,
-) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
+) -> AnalyticsResult<AuthEventMetricsResponse<MetricsBucketResponse>> {
let mut metrics_accumulator: HashMap<
AuthEventMetricsBucketIdentifier,
AuthEventMetricsAccumulator,
@@ -34,7 +41,9 @@ pub async fn get_metrics(
let data = pool
.get_auth_event_metrics(
&metric_type,
+ &req.group_by_names.clone(),
&merchant_id_scoped,
+ &req.filters,
req.time_series.map(|t| t.granularity),
&req.time_range,
)
@@ -77,22 +86,94 @@ pub async fn get_metrics(
AuthEventMetrics::FrictionlessSuccessCount => metrics_builder
.frictionless_success_count
.add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationErrorMessage => metrics_builder
+ .authentication_error_message
+ .add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationFunnel => metrics_builder
+ .authentication_funnel
+ .add_metrics_bucket(&value),
}
}
}
+ let mut total_error_message_count = 0;
let query_data: Vec<MetricsBucketResponse> = metrics_accumulator
.into_iter()
- .map(|(id, val)| MetricsBucketResponse {
- values: val.collect(),
- dimensions: id,
+ .map(|(id, val)| {
+ let collected_values = val.collect();
+ if let Some(count) = collected_values.error_message_count {
+ total_error_message_count += count;
+ }
+ MetricsBucketResponse {
+ values: collected_values,
+ dimensions: id,
+ }
})
.collect();
-
- Ok(MetricsResponse {
+ Ok(AuthEventMetricsResponse {
query_data,
- meta_data: [AnalyticsMetadata {
- current_time_range: req.time_range,
+ meta_data: [AuthEventsAnalyticsMetadata {
+ total_error_message_count: Some(total_error_message_count),
}],
})
}
+
+pub async fn get_filters(
+ pool: &AnalyticsProvider,
+ req: GetAuthEventFilterRequest,
+ merchant_id: &common_utils::id_type::MerchantId,
+) -> AnalyticsResult<AuthEventFiltersResponse> {
+ let mut res = AuthEventFiltersResponse::default();
+ for dim in req.group_by_names {
+ let values = match pool {
+ AnalyticsProvider::Sqlx(_pool) => {
+ Err(report!(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::Clickhouse(pool) => {
+ get_auth_events_filter_for_dimension(dim, merchant_id, &req.time_range, pool)
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::CombinedCkh(sqlx_pool, ckh_pool) | AnalyticsProvider::CombinedSqlx(sqlx_pool, ckh_pool) => {
+ let ckh_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ ckh_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ let sqlx_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ sqlx_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ 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 refunds analytics filters")
+ },
+ _ => {}
+ };
+ ckh_result
+ }
+ }
+ .change_context(AnalyticsError::UnknownError)?
+ .into_iter()
+ .filter_map(|fil: AuthEventFilterRow| match dim {
+ AuthEventDimensions::AuthenticationStatus => fil.authentication_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::TransactionStatus => fil.trans_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::ErrorMessage => fil.error_message,
+ AuthEventDimensions::AuthenticationConnector => fil.authentication_connector.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::MessageVersion => fil.message_version,
+ })
+ .collect::<Vec<String>>();
+ res.query_data.push(AuthEventFilterValue {
+ dimension: dim,
+ values,
+ })
+ }
+ Ok(res)
+}
diff --git a/crates/analytics/src/auth_events/filters.rs b/crates/analytics/src/auth_events/filters.rs
new file mode 100644
index 00000000000..da8e0b7cfa3
--- /dev/null
+++ b/crates/analytics/src/auth_events/filters.rs
@@ -0,0 +1,60 @@
+use api_models::analytics::{auth_events::AuthEventDimensions, Granularity, TimeRange};
+use common_utils::errors::ReportSwitchExt;
+use diesel_models::enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+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 AuthEventFilterAnalytics: LoadRow<AuthEventFilterRow> {}
+
+pub async fn get_auth_events_filter_for_dimension<T>(
+ dimension: AuthEventDimensions,
+ merchant_id: &common_utils::id_type::MerchantId,
+ time_range: &TimeRange,
+ pool: &T,
+) -> FiltersResult<Vec<AuthEventFilterRow>>
+where
+ T: AnalyticsDataSource + AuthEventFilterAnalytics,
+ 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::Authentications);
+
+ 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_id)
+ .switch()?;
+
+ query_builder.set_distinct();
+
+ query_builder
+ .execute_query::<AuthEventFilterRow, _>(pool)
+ .await
+ .change_context(FiltersError::QueryBuildingError)?
+ .change_context(FiltersError::QueryExecutionFailure)
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq, serde::Deserialize)]
+pub struct AuthEventFilterRow {
+ pub authentication_status: Option<DBEnumWrapper<AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+}
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index f3f0354818c..fd94aac614c 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -1,18 +1,23 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
Granularity, TimeRange,
};
+use diesel_models::enums as storage_enums;
use time::PrimitiveDateTime;
use crate::{
query::{Aggregate, GroupByClause, ToSql, Window},
- types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult},
+ types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
};
mod authentication_attempt_count;
mod authentication_count;
+mod authentication_error_message;
+mod authentication_funnel;
mod authentication_success_count;
mod challenge_attempt_count;
mod challenge_flow_count;
@@ -22,6 +27,8 @@ mod frictionless_success_count;
use authentication_attempt_count::AuthenticationAttemptCount;
use authentication_count::AuthenticationCount;
+use authentication_error_message::AuthenticationErrorMessage;
+use authentication_funnel::AuthenticationFunnel;
use authentication_success_count::AuthenticationSuccessCount;
use challenge_attempt_count::ChallengeAttemptCount;
use challenge_flow_count::ChallengeFlowCount;
@@ -32,7 +39,15 @@ use frictionless_success_count::FrictionlessSuccessCount;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct AuthEventMetricRow {
pub count: Option<i64>,
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<DBEnumWrapper<storage_enums::AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<storage_enums::TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<storage_enums::AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+ #[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 AuthEventMetricAnalytics: LoadRow<AuthEventMetricRow> {}
@@ -45,6 +60,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -64,6 +81,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -71,42 +90,122 @@ where
match self {
Self::AuthenticationCount => {
AuthenticationCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationAttemptCount => {
AuthenticationAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationSuccessCount => {
AuthenticationSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeFlowCount => {
ChallengeFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeAttemptCount => {
ChallengeAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeSuccessCount => {
ChallengeSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessFlowCount => {
FrictionlessFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessSuccessCount => {
FrictionlessSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationErrorMessage => {
+ AuthenticationErrorMessage
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationFunnel => {
+ AuthenticationFunnel
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 2d34344905e..32c76385409 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,6 +31,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -37,6 +40,10 @@ where
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +72,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +100,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
index 9f2311f5638..39df41f53aa 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -60,12 +65,19 @@ where
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -81,7 +93,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_error_message.rs b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
new file mode 100644
index 00000000000..cdb89b796dd
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
@@ -0,0 +1,138 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_enums::AuthenticationStatus;
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationErrorMessage;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationErrorMessage
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ 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()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("authentication_status", AuthenticationStatus::Failed)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::ErrorMessage,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).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 {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_funnel.rs b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
new file mode 100644
index 00000000000..37f9dfd1c1f
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
@@ -0,0 +1,133 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationFunnel;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationFunnel
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ 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()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::TransactionStatus,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).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 {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index e887807f41c..039ef00dd6e 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +70,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +98,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index f1f6a397994..beccc093b19 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -68,12 +73,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", "pending")
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -89,7 +101,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index c08618cc0d0..4d07cffba94 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,18 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +96,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index 3fb75efd562..310a45f0530 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index 8859c60fc37..24857bfb840 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,19 @@ where
query_builder
.add_filter_clause("trans_status", "Y".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +97,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index 3d5d894e7dd..79fef8a16d0 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).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 {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ 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,
))
})
diff --git a/crates/analytics/src/auth_events/types.rs b/crates/analytics/src/auth_events/types.rs
new file mode 100644
index 00000000000..ac7ee2462ee
--- /dev/null
+++ b/crates/analytics/src/auth_events/types.rs
@@ -0,0 +1,58 @@
+use api_models::analytics::auth_events::{AuthEventDimensions, AuthEventFilters};
+use error_stack::ResultExt;
+
+use crate::{
+ query::{QueryBuilder, QueryFilter, QueryResult, ToSql},
+ types::{AnalyticsCollection, AnalyticsDataSource},
+};
+
+impl<T> QueryFilter<T> for AuthEventFilters
+where
+ T: AnalyticsDataSource,
+ AnalyticsCollection: ToSql<T>,
+{
+ fn set_filter_clause(&self, builder: &mut QueryBuilder<T>) -> QueryResult<()> {
+ if !self.authentication_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationStatus,
+ &self.authentication_status,
+ )
+ .attach_printable("Error adding authentication status filter")?;
+ }
+
+ if !self.trans_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::TransactionStatus,
+ &self.trans_status,
+ )
+ .attach_printable("Error adding transaction status filter")?;
+ }
+
+ if !self.error_message.is_empty() {
+ builder
+ .add_filter_in_range_clause(AuthEventDimensions::ErrorMessage, &self.error_message)
+ .attach_printable("Error adding error message filter")?;
+ }
+
+ if !self.authentication_connector.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationConnector,
+ &self.authentication_connector,
+ )
+ .attach_printable("Error adding authentication connector filter")?;
+ }
+
+ if !self.message_version.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::MessageVersion,
+ &self.message_version,
+ )
+ .attach_printable("Error adding message version filter")?;
+ }
+ Ok(())
+ }
+}
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index 1c86e7cbcf6..1d52cc9e761 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -28,6 +28,7 @@ use crate::{
filters::ApiEventFilter,
metrics::{latency::LatencyAvg, ApiEventMetricRow},
},
+ auth_events::filters::AuthEventFilterRow,
connector_events::events::ConnectorEventsResult,
disputes::{filters::DisputeFilterRow, metrics::DisputeMetricRow},
outgoing_webhook_event::events::OutgoingWebhookLogsResult,
@@ -181,6 +182,7 @@ impl super::sdk_events::metrics::SdkEventMetricAnalytics for ClickhouseClient {}
impl super::sdk_events::events::SdkEventsFilterAnalytics for ClickhouseClient {}
impl super::active_payments::metrics::ActivePaymentsMetricAnalytics for ClickhouseClient {}
impl super::auth_events::metrics::AuthEventMetricAnalytics for ClickhouseClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::events::ApiLogsFilterAnalytics for ClickhouseClient {}
impl super::api_event::filters::ApiEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::metrics::ApiEventMetricAnalytics for ClickhouseClient {}
@@ -403,6 +405,16 @@ impl TryInto<AuthEventMetricRow> for serde_json::Value {
}
}
+impl TryInto<AuthEventFilterRow> for serde_json::Value {
+ type Error = Report<ParsingError>;
+
+ fn try_into(self) -> Result<AuthEventFilterRow, Self::Error> {
+ serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
+ "Failed to parse AuthEventFilterRow in clickhouse results",
+ ))
+ }
+}
+
impl TryInto<ApiEventFilter> for serde_json::Value {
type Error = Report<ParsingError>;
diff --git a/crates/analytics/src/core.rs b/crates/analytics/src/core.rs
index 0e3ced7993d..980e17bc90a 100644
--- a/crates/analytics/src/core.rs
+++ b/crates/analytics/src/core.rs
@@ -34,7 +34,7 @@ pub async fn get_domain_info(
AnalyticsDomain::AuthEvents => GetInfoResponse {
metrics: utils::get_auth_event_metrics_info(),
download_dimensions: None,
- dimensions: Vec::new(),
+ dimensions: utils::get_auth_event_dimensions(),
},
AnalyticsDomain::ApiEvents => GetInfoResponse {
metrics: utils::get_api_event_metrics_info(),
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index ef7108e8ef7..f698b1161a0 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -41,7 +41,9 @@ use api_models::analytics::{
api_event::{
ApiEventDimensions, ApiEventFilters, ApiEventMetrics, ApiEventMetricsBucketIdentifier,
},
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
disputes::{DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier},
frm::{FrmDimensions, FrmFilters, FrmMetrics, FrmMetricsBucketIdentifier},
payment_intents::{
@@ -908,7 +910,9 @@ impl AnalyticsProvider {
pub async fn get_auth_event_metrics(
&self,
metric: &AuthEventMetrics,
+ dimensions: &[AuthEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -916,13 +920,22 @@ impl AnalyticsProvider {
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
Self::Clickhouse(pool) => {
metric
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::CombinedCkh(_sqlx_pool, ckh_pool) | Self::CombinedSqlx(_sqlx_pool, ckh_pool) => {
metric
.load_metrics(
merchant_id,
+ dimensions,
+ filters,
granularity,
// Since API events are ckh only use ckh here
time_range,
@@ -1126,6 +1139,7 @@ pub enum AnalyticsFlow {
GetFrmMetrics,
GetSdkMetrics,
GetAuthMetrics,
+ GetAuthEventFilters,
GetActivePaymentsMetrics,
GetPaymentFilters,
GetPaymentIntentFilters,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index 59cb8743448..d483ce43605 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -4,7 +4,7 @@ use api_models::{
analytics::{
self as analytics_api,
api_event::ApiEventDimensions,
- auth_events::AuthEventFlows,
+ auth_events::{AuthEventDimensions, AuthEventFlows},
disputes::DisputeDimensions,
frm::{FrmDimensions, FrmTransactionType},
payment_intents::PaymentIntentDimensions,
@@ -19,7 +19,7 @@ use api_models::{
},
refunds::RefundStatus,
};
-use common_enums::{AuthenticationStatus, TransactionStatus};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -505,6 +505,7 @@ impl_to_sql_for_to_string!(
FrmTransactionType,
TransactionStatus,
AuthenticationStatus,
+ AuthenticationConnectors,
Flow,
&String,
&bool,
@@ -522,7 +523,9 @@ impl_to_sql_for_to_string!(
ApiEventDimensions,
&DisputeDimensions,
DisputeDimensions,
- DisputeStage
+ DisputeStage,
+ AuthEventDimensions,
+ &AuthEventDimensions
);
#[derive(Debug, Clone, Copy)]
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index f3143840f34..a6db92e753f 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -4,6 +4,7 @@ use api_models::{
analytics::{frm::FrmTransactionType, refunds::RefundType},
enums::{DisputeStage, DisputeStatus},
};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
DbConnectionParams,
@@ -96,6 +97,9 @@ db_type!(FraudCheckStatus);
db_type!(FrmTransactionType);
db_type!(DisputeStage);
db_type!(DisputeStatus);
+db_type!(AuthenticationStatus);
+db_type!(TransactionStatus);
+db_type!(AuthenticationConnectors);
impl<'q, Type> Encode<'q, Postgres> for DBEnumWrapper<Type>
where
@@ -159,6 +163,8 @@ impl super::disputes::filters::DisputeFilterAnalytics for SqlxClient {}
impl super::disputes::metrics::DisputeMetricAnalytics for SqlxClient {}
impl super::frm::metrics::FrmMetricAnalytics for SqlxClient {}
impl super::frm::filters::FrmFilterAnalytics for SqlxClient {}
+impl super::auth_events::metrics::AuthEventMetricAnalytics for SqlxClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for SqlxClient {}
#[async_trait::async_trait]
impl AnalyticsDataSource for SqlxClient {
@@ -190,6 +196,94 @@ impl HealthCheck for SqlxClient {
}
}
+impl<'a> FromRow<'a, PgRow> for super::auth_events::metrics::AuthEventMetricRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").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 {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ count,
+ start_bucket,
+ end_bucket,
+ })
+ }
+}
+
+impl<'a> FromRow<'a, PgRow> for super::auth_events::filters::AuthEventFilterRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ Ok(Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ })
+ }
+}
+
impl<'a> FromRow<'a, PgRow> for super::refunds::metrics::RefundMetricRow {
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
let currency: Option<DBEnumWrapper<Currency>> =
diff --git a/crates/analytics/src/utils.rs b/crates/analytics/src/utils.rs
index fc21bf09819..a0ddead1363 100644
--- a/crates/analytics/src/utils.rs
+++ b/crates/analytics/src/utils.rs
@@ -1,6 +1,6 @@
use api_models::analytics::{
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -47,6 +47,16 @@ pub fn get_payment_intent_dimensions() -> Vec<NameDescription> {
.collect()
}
+pub fn get_auth_event_dimensions() -> Vec<NameDescription> {
+ vec![
+ AuthEventDimensions::AuthenticationConnector,
+ AuthEventDimensions::MessageVersion,
+ ]
+ .into_iter()
+ .map(Into::into)
+ .collect()
+}
+
pub fn get_refund_dimensions() -> Vec<NameDescription> {
RefundDimensions::iter().map(Into::into).collect()
}
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 132272f0e49..71d7f80eb7c 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -7,7 +7,7 @@ use masking::Secret;
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -226,6 +226,10 @@ pub struct GetAuthEventMetricRequest {
pub time_series: Option<TimeSeries>,
pub time_range: TimeRange,
#[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+ #[serde(default)]
+ pub filters: AuthEventFilters,
+ #[serde(default)]
pub metrics: HashSet<AuthEventMetrics>,
#[serde(default)]
pub delta: bool,
@@ -509,3 +513,36 @@ pub struct SankeyResponse {
pub dispute_status: Option<String>,
pub first_attempt: i64,
}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GetAuthEventFilterRequest {
+ pub time_range: TimeRange,
+ #[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+}
+
+#[derive(Debug, Default, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFiltersResponse {
+ pub query_data: Vec<AuthEventFilterValue>,
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFilterValue {
+ pub dimension: AuthEventDimensions,
+ pub values: Vec<String>,
+}
+
+#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventMetricsResponse<T> {
+ pub query_data: Vec<T>,
+ pub meta_data: [AuthEventsAnalyticsMetadata; 1],
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct AuthEventsAnalyticsMetadata {
+ pub total_error_message_count: Option<u64>,
+}
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 6f527551348..5c2d4ed2064 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -3,7 +3,23 @@ use std::{
hash::{Hash, Hasher},
};
-use super::NameDescription;
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+
+use super::{NameDescription, TimeRange};
+
+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
+pub struct AuthEventFilters {
+ #[serde(default)]
+ pub authentication_status: Vec<AuthenticationStatus>,
+ #[serde(default)]
+ pub trans_status: Vec<TransactionStatus>,
+ #[serde(default)]
+ pub error_message: Vec<String>,
+ #[serde(default)]
+ pub authentication_connector: Vec<AuthenticationConnectors>,
+ #[serde(default)]
+ pub message_version: Vec<String>,
+}
#[derive(
Debug,
@@ -22,10 +38,13 @@ use super::NameDescription;
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum AuthEventDimensions {
- #[serde(rename = "authentication_status")]
AuthenticationStatus,
+ #[strum(serialize = "trans_status")]
#[serde(rename = "trans_status")]
TransactionStatus,
+ ErrorMessage,
+ AuthenticationConnector,
+ MessageVersion,
}
#[derive(
@@ -51,6 +70,8 @@ pub enum AuthEventMetrics {
FrictionlessSuccessCount,
ChallengeAttemptCount,
ChallengeSuccessCount,
+ AuthenticationErrorMessage,
+ AuthenticationFunnel,
}
#[derive(
@@ -79,6 +100,7 @@ pub mod metric_behaviour {
pub struct FrictionlessSuccessCount;
pub struct ChallengeAttemptCount;
pub struct ChallengeSuccessCount;
+ pub struct AuthenticationErrorMessage;
}
impl From<AuthEventMetrics> for NameDescription {
@@ -90,19 +112,58 @@ impl From<AuthEventMetrics> for NameDescription {
}
}
+impl From<AuthEventDimensions> for NameDescription {
+ fn from(value: AuthEventDimensions) -> Self {
+ Self {
+ name: value.to_string(),
+ desc: String::new(),
+ }
+ }
+}
+
#[derive(Debug, serde::Serialize, Eq)]
pub struct AuthEventMetricsBucketIdentifier {
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<AuthenticationStatus>,
+ pub trans_status: Option<TransactionStatus>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<AuthenticationConnectors>,
+ pub message_version: Option<String>,
+ #[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 AuthEventMetricsBucketIdentifier {
- pub fn new(time_bucket: Option<String>) -> Self {
- Self { time_bucket }
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ authentication_status: Option<AuthenticationStatus>,
+ trans_status: Option<TransactionStatus>,
+ error_message: Option<String>,
+ authentication_connector: Option<AuthenticationConnectors>,
+ message_version: Option<String>,
+ normalized_time_range: TimeRange,
+ ) -> Self {
+ Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ time_bucket: normalized_time_range,
+ start_time: normalized_time_range.start_time,
+ }
}
}
impl Hash for AuthEventMetricsBucketIdentifier {
fn hash<H: Hasher>(&self, state: &mut H) {
+ self.authentication_status.hash(state);
+ self.trans_status.hash(state);
+ self.authentication_connector.hash(state);
+ self.message_version.hash(state);
+ self.error_message.hash(state);
self.time_bucket.hash(state);
}
}
@@ -127,6 +188,8 @@ pub struct AuthEventMetricsBucketValue {
pub challenge_success_count: Option<u64>,
pub frictionless_flow_count: Option<u64>,
pub frictionless_success_count: Option<u64>,
+ pub error_message_count: Option<u64>,
+ pub authentication_funnel: Option<u64>,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index bf7544f7c01..31b0c1d8dce 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -113,10 +113,12 @@ impl_api_event_type!(
GetActivePaymentsMetricRequest,
GetSdkEventMetricRequest,
GetAuthEventMetricRequest,
+ GetAuthEventFilterRequest,
GetPaymentFiltersRequest,
PaymentFiltersResponse,
GetRefundFilterRequest,
RefundFiltersResponse,
+ AuthEventFiltersResponse,
GetSdkEventFiltersRequest,
SdkEventFiltersResponse,
ApiLogsRequest,
@@ -180,6 +182,13 @@ impl<T> ApiEventMetric for DisputesMetricsResponse<T> {
Some(ApiEventsType::Miscellaneous)
}
}
+
+impl<T> ApiEventMetric for AuthEventMetricsResponse<T> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Miscellaneous)
+ }
+}
+
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
impl ApiEventMetric for PaymentMethodIntentConfirmInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index c30fe62f829..96afca926c7 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -6685,6 +6685,7 @@ impl From<RoleScope> for EntityType {
serde::Serialize,
serde::Deserialize,
Eq,
+ Hash,
PartialEq,
ToSchema,
strum::Display,
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index deaf84bb009..858c16d052f 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -19,11 +19,11 @@ pub mod routes {
GetGlobalSearchRequest, GetSearchRequest, GetSearchRequestWithIndex, SearchIndex,
},
AnalyticsRequest, GenerateReportRequest, GetActivePaymentsMetricRequest,
- GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventMetricRequest,
- GetDisputeMetricRequest, GetFrmFilterRequest, GetFrmMetricRequest,
- GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest, GetPaymentIntentMetricRequest,
- GetPaymentMetricRequest, GetRefundFilterRequest, GetRefundMetricRequest,
- GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
+ GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventFilterRequest,
+ GetAuthEventMetricRequest, GetDisputeMetricRequest, GetFrmFilterRequest,
+ GetFrmMetricRequest, GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest,
+ GetPaymentIntentMetricRequest, GetPaymentMetricRequest, GetRefundFilterRequest,
+ GetRefundMetricRequest, GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
};
use common_enums::EntityType;
use common_utils::types::TimeRange;
@@ -106,6 +106,10 @@ pub mod routes {
web::resource("metrics/auth_events")
.route(web::post().to(get_auth_event_metrics)),
)
+ .service(
+ web::resource("filters/auth_events")
+ .route(web::post().to(get_merchant_auth_events_filters)),
+ )
.service(
web::resource("metrics/frm").route(web::post().to(get_frm_metrics)),
)
@@ -1018,6 +1022,34 @@ pub mod routes {
.await
}
+ pub async fn get_merchant_auth_events_filters(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<GetAuthEventFilterRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GetAuthEventFilters;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, auth: AuthenticationData, req, _| async move {
+ analytics::auth_events::get_filters(
+ &state.pool,
+ req,
+ auth.merchant_account.get_id(),
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::MerchantAnalyticsRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
pub async fn get_org_payment_filters(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
|
2025-03-06T17:03:44Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Hotfix PR
Original PR: [https://github.com/juspay/hyperswitch/pull/7451](https://github.com/juspay/hyperswitch/pull/7451)
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ec0718f31edf165def85aa71e5d63711d31b4c36
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7447
|
Bug: feat(analytics): refactor and rewrite authentication related analytics hotfix
Need to refactor and re-write the authentication related analytics.
The table which should be queried is authentications.
The existing metrics need to be modified and a few new metrics should be created to provide enhanced insights into authentication related data.
|
diff --git a/crates/analytics/src/auth_events/accumulator.rs b/crates/analytics/src/auth_events/accumulator.rs
index 2958030c8da..446ac6ac8c2 100644
--- a/crates/analytics/src/auth_events/accumulator.rs
+++ b/crates/analytics/src/auth_events/accumulator.rs
@@ -4,7 +4,7 @@ use super::metrics::AuthEventMetricRow;
#[derive(Debug, Default)]
pub struct AuthEventMetricsAccumulator {
- pub three_ds_sdk_count: CountAccumulator,
+ pub authentication_count: CountAccumulator,
pub authentication_attempt_count: CountAccumulator,
pub authentication_success_count: CountAccumulator,
pub challenge_flow_count: CountAccumulator,
@@ -47,7 +47,7 @@ impl AuthEventMetricAccumulator for CountAccumulator {
impl AuthEventMetricsAccumulator {
pub fn collect(self) -> AuthEventMetricsBucketValue {
AuthEventMetricsBucketValue {
- three_ds_sdk_count: self.three_ds_sdk_count.collect(),
+ authentication_count: self.authentication_count.collect(),
authentication_attempt_count: self.authentication_attempt_count.collect(),
authentication_success_count: self.authentication_success_count.collect(),
challenge_flow_count: self.challenge_flow_count.collect(),
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 3fd134bc498..75bdf4de149 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -18,7 +18,6 @@ use crate::{
pub async fn get_metrics(
pool: &AnalyticsProvider,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &String,
req: GetAuthEventMetricRequest,
) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
let mut metrics_accumulator: HashMap<
@@ -30,14 +29,12 @@ pub async fn get_metrics(
for metric_type in req.metrics.iter().cloned() {
let req = req.clone();
let merchant_id_scoped = merchant_id.to_owned();
- let publishable_key_scoped = publishable_key.to_owned();
let pool = pool.clone();
set.spawn(async move {
let data = pool
.get_auth_event_metrics(
&metric_type,
&merchant_id_scoped,
- &publishable_key_scoped,
req.time_series.map(|t| t.granularity),
&req.time_range,
)
@@ -56,8 +53,8 @@ pub async fn get_metrics(
for (id, value) in data? {
let metrics_builder = metrics_accumulator.entry(id).or_default();
match metric {
- AuthEventMetrics::ThreeDsSdkCount => metrics_builder
- .three_ds_sdk_count
+ AuthEventMetrics::AuthenticationCount => metrics_builder
+ .authentication_count
.add_metrics_bucket(&value),
AuthEventMetrics::AuthenticationAttemptCount => metrics_builder
.authentication_attempt_count
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index 4a1fbd0e147..f3f0354818c 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -12,22 +12,22 @@ use crate::{
};
mod authentication_attempt_count;
+mod authentication_count;
mod authentication_success_count;
mod challenge_attempt_count;
mod challenge_flow_count;
mod challenge_success_count;
mod frictionless_flow_count;
mod frictionless_success_count;
-mod three_ds_sdk_count;
use authentication_attempt_count::AuthenticationAttemptCount;
+use authentication_count::AuthenticationCount;
use authentication_success_count::AuthenticationSuccessCount;
use challenge_attempt_count::ChallengeAttemptCount;
use challenge_flow_count::ChallengeFlowCount;
use challenge_success_count::ChallengeSuccessCount;
use frictionless_flow_count::FrictionlessFlowCount;
use frictionless_success_count::FrictionlessSuccessCount;
-use three_ds_sdk_count::ThreeDsSdkCount;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct AuthEventMetricRow {
@@ -45,7 +45,6 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -65,50 +64,49 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
match self {
- Self::ThreeDsSdkCount => {
- ThreeDsSdkCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ Self::AuthenticationCount => {
+ AuthenticationCount
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::AuthenticationAttemptCount => {
AuthenticationAttemptCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::AuthenticationSuccessCount => {
AuthenticationSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeFlowCount => {
ChallengeFlowCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeAttemptCount => {
ChallengeAttemptCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeSuccessCount => {
ChallengeSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::FrictionlessFlowCount => {
FrictionlessFlowCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::FrictionlessSuccessCount => {
FrictionlessSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 5faeefec686..2d34344905e 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -29,14 +29,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +44,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::AuthenticationCallInit)
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("category", "API")
+ .add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
.switch()?;
time_range
@@ -76,9 +71,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
similarity index 69%
rename from crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
rename to crates/analytics/src/auth_events/metrics/authentication_count.rs
index 4ce10c9aad3..9f2311f5638 100644
--- a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -15,10 +14,10 @@ use crate::{
};
#[derive(Default)]
-pub(super) struct ThreeDsSdkCount;
+pub(super) struct AuthenticationCount;
#[async_trait::async_trait]
-impl<T> super::AuthEventMetric<T> for ThreeDsSdkCount
+impl<T> super::AuthEventMetric<T> for AuthenticationCount
where
T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +43,22 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
- .switch()?;
-
- query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::ThreeDsMethod)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
time_range
@@ -76,9 +66,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index 663473c2d89..e887807f41c 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -29,14 +29,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +44,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::AuthenticationCall)
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("category", "API")
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
time_range
@@ -76,9 +71,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index 15cd86e5cc8..f1f6a397994 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -10,7 +9,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +29,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +43,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .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()?;
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::IncomingWebhookReceive)
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
query_builder
- .add_custom_filter_clause("request", "threeDSServerTransID", FilterTypes::Like)
+ .add_negative_filter_clause("authentication_status", "pending")
.switch()?;
time_range
@@ -68,9 +74,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index 61b10e6fb9e..c08618cc0d0 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,42 +43,36 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
- query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk)
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
- query_builder.add_filter_clause("value", "C").switch()?;
-
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index c5bf7bf81ce..3fb75efd562 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -30,13 +30,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +44,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .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()?;
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::IncomingWebhookReceive)
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
query_builder
- .add_filter_clause("visitParamExtractRaw(request, 'transStatus')", "\"Y\"")
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
time_range
@@ -68,9 +75,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index c08cc511e16..8859c60fc37 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,34 +43,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
- .switch()?;
-
- query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_negative_filter_clause("value", "C")
+ .add_filter_clause("trans_status", "Y".to_string())
.switch()?;
time_range
@@ -80,9 +70,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index b310567c9db..3d5d894e7dd 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -30,13 +30,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +44,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
query_builder
- .add_filter_clause("merchant_id", merchant_id.get_string_repr())
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::PaymentsExternalAuthentication)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("visitParamExtractRaw(response, 'transStatus')", "\"Y\"")
+ .add_filter_clause("trans_status", "Y".to_string())
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
time_range
@@ -68,9 +75,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index cd870c12b23..1c86e7cbcf6 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -138,6 +138,7 @@ impl AnalyticsDataSource for ClickhouseClient {
| AnalyticsCollection::FraudCheck
| AnalyticsCollection::PaymentIntent
| AnalyticsCollection::PaymentIntentSessionized
+ | AnalyticsCollection::Authentications
| AnalyticsCollection::Dispute => {
TableEngine::CollapsingMergeTree { sign: "sign_flag" }
}
@@ -457,6 +458,7 @@ impl ToSql<ClickhouseClient> for AnalyticsCollection {
Self::Dispute => Ok("dispute".to_string()),
Self::DisputeSessionized => Ok("sessionizer_dispute".to_string()),
Self::ActivePaymentsAnalytics => Ok("active_payments".to_string()),
+ Self::Authentications => Ok("authentications".to_string()),
}
}
}
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index 0ad8886b820..ef7108e8ef7 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -909,7 +909,6 @@ impl AnalyticsProvider {
&self,
metric: &AuthEventMetrics,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -917,14 +916,13 @@ impl AnalyticsProvider {
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
Self::Clickhouse(pool) => {
metric
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::CombinedCkh(_sqlx_pool, ckh_pool) | Self::CombinedSqlx(_sqlx_pool, ckh_pool) => {
metric
.load_metrics(
merchant_id,
- publishable_key,
granularity,
// Since API events are ckh only use ckh here
time_range,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index f449ba2f9b5..59cb8743448 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -19,6 +19,7 @@ use api_models::{
},
refunds::RefundStatus,
};
+use common_enums::{AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -502,6 +503,8 @@ impl_to_sql_for_to_string!(
Currency,
RefundType,
FrmTransactionType,
+ TransactionStatus,
+ AuthenticationStatus,
Flow,
&String,
&bool,
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 653d019adeb..f3143840f34 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -1034,6 +1034,8 @@ impl ToSql<SqlxClient> for AnalyticsCollection {
Self::Dispute => Ok("dispute".to_string()),
Self::DisputeSessionized => Err(error_stack::report!(ParsingError::UnknownError)
.attach_printable("DisputeSessionized table is not implemented for Sqlx"))?,
+ Self::Authentications => Err(error_stack::report!(ParsingError::UnknownError)
+ .attach_printable("Authentications table is not implemented for Sqlx"))?,
}
}
}
diff --git a/crates/analytics/src/types.rs b/crates/analytics/src/types.rs
index 86056338106..7bf8fc7d3c3 100644
--- a/crates/analytics/src/types.rs
+++ b/crates/analytics/src/types.rs
@@ -37,6 +37,7 @@ pub enum AnalyticsCollection {
PaymentIntentSessionized,
ConnectorEvents,
OutgoingWebhookEvent,
+ Authentications,
Dispute,
DisputeSessionized,
ApiEventsAnalytics,
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 7791a2f3cd5..6f527551348 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -5,6 +5,29 @@ use std::{
use super::NameDescription;
+#[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 AuthEventDimensions {
+ #[serde(rename = "authentication_status")]
+ AuthenticationStatus,
+ #[serde(rename = "trans_status")]
+ TransactionStatus,
+}
+
#[derive(
Clone,
Debug,
@@ -20,7 +43,7 @@ use super::NameDescription;
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum AuthEventMetrics {
- ThreeDsSdkCount,
+ AuthenticationCount,
AuthenticationAttemptCount,
AuthenticationSuccessCount,
ChallengeFlowCount,
@@ -48,7 +71,7 @@ pub enum AuthEventFlows {
}
pub mod metric_behaviour {
- pub struct ThreeDsSdkCount;
+ pub struct AuthenticationCount;
pub struct AuthenticationAttemptCount;
pub struct AuthenticationSuccessCount;
pub struct ChallengeFlowCount;
@@ -96,7 +119,7 @@ impl PartialEq for AuthEventMetricsBucketIdentifier {
#[derive(Debug, serde::Serialize)]
pub struct AuthEventMetricsBucketValue {
- pub three_ds_sdk_count: Option<u64>,
+ pub authentication_count: Option<u64>,
pub authentication_attempt_count: Option<u64>,
pub authentication_success_count: Option<u64>,
pub challenge_flow_count: Option<u64>,
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 8fb4f2ac2c1..deaf84bb009 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -975,7 +975,6 @@ pub mod routes {
analytics::auth_events::get_metrics(
&state.pool,
auth.merchant_account.get_id(),
- &auth.merchant_account.publishable_key,
req,
)
.await
|
2025-03-06T12:31:40Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Hotfix PR
Original PR: [https://github.com/juspay/hyperswitch/pull/7433](https://github.com/juspay/hyperswitch/pull/7433)
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
bf0b9bb9ebd58b85f1f92bd9cb00d8f29cec5d57
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7432
|
Bug: feat(analytics): refactor and rewrite authentication related analytics
Need to refactor and re-write the authentication related analytics.
The table which should be queried is `authentications`.
The existing metrics need to be modified and a few new metrics should be created to provide enhanced insights into authentication related data.
|
diff --git a/crates/analytics/src/auth_events/accumulator.rs b/crates/analytics/src/auth_events/accumulator.rs
index 2958030c8da..446ac6ac8c2 100644
--- a/crates/analytics/src/auth_events/accumulator.rs
+++ b/crates/analytics/src/auth_events/accumulator.rs
@@ -4,7 +4,7 @@ use super::metrics::AuthEventMetricRow;
#[derive(Debug, Default)]
pub struct AuthEventMetricsAccumulator {
- pub three_ds_sdk_count: CountAccumulator,
+ pub authentication_count: CountAccumulator,
pub authentication_attempt_count: CountAccumulator,
pub authentication_success_count: CountAccumulator,
pub challenge_flow_count: CountAccumulator,
@@ -47,7 +47,7 @@ impl AuthEventMetricAccumulator for CountAccumulator {
impl AuthEventMetricsAccumulator {
pub fn collect(self) -> AuthEventMetricsBucketValue {
AuthEventMetricsBucketValue {
- three_ds_sdk_count: self.three_ds_sdk_count.collect(),
+ authentication_count: self.authentication_count.collect(),
authentication_attempt_count: self.authentication_attempt_count.collect(),
authentication_success_count: self.authentication_success_count.collect(),
challenge_flow_count: self.challenge_flow_count.collect(),
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 3fd134bc498..75bdf4de149 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -18,7 +18,6 @@ use crate::{
pub async fn get_metrics(
pool: &AnalyticsProvider,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &String,
req: GetAuthEventMetricRequest,
) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
let mut metrics_accumulator: HashMap<
@@ -30,14 +29,12 @@ pub async fn get_metrics(
for metric_type in req.metrics.iter().cloned() {
let req = req.clone();
let merchant_id_scoped = merchant_id.to_owned();
- let publishable_key_scoped = publishable_key.to_owned();
let pool = pool.clone();
set.spawn(async move {
let data = pool
.get_auth_event_metrics(
&metric_type,
&merchant_id_scoped,
- &publishable_key_scoped,
req.time_series.map(|t| t.granularity),
&req.time_range,
)
@@ -56,8 +53,8 @@ pub async fn get_metrics(
for (id, value) in data? {
let metrics_builder = metrics_accumulator.entry(id).or_default();
match metric {
- AuthEventMetrics::ThreeDsSdkCount => metrics_builder
- .three_ds_sdk_count
+ AuthEventMetrics::AuthenticationCount => metrics_builder
+ .authentication_count
.add_metrics_bucket(&value),
AuthEventMetrics::AuthenticationAttemptCount => metrics_builder
.authentication_attempt_count
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index 4a1fbd0e147..f3f0354818c 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -12,22 +12,22 @@ use crate::{
};
mod authentication_attempt_count;
+mod authentication_count;
mod authentication_success_count;
mod challenge_attempt_count;
mod challenge_flow_count;
mod challenge_success_count;
mod frictionless_flow_count;
mod frictionless_success_count;
-mod three_ds_sdk_count;
use authentication_attempt_count::AuthenticationAttemptCount;
+use authentication_count::AuthenticationCount;
use authentication_success_count::AuthenticationSuccessCount;
use challenge_attempt_count::ChallengeAttemptCount;
use challenge_flow_count::ChallengeFlowCount;
use challenge_success_count::ChallengeSuccessCount;
use frictionless_flow_count::FrictionlessFlowCount;
use frictionless_success_count::FrictionlessSuccessCount;
-use three_ds_sdk_count::ThreeDsSdkCount;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct AuthEventMetricRow {
@@ -45,7 +45,6 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -65,50 +64,49 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
match self {
- Self::ThreeDsSdkCount => {
- ThreeDsSdkCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ Self::AuthenticationCount => {
+ AuthenticationCount
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::AuthenticationAttemptCount => {
AuthenticationAttemptCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::AuthenticationSuccessCount => {
AuthenticationSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeFlowCount => {
ChallengeFlowCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeAttemptCount => {
ChallengeAttemptCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::ChallengeSuccessCount => {
ChallengeSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::FrictionlessFlowCount => {
FrictionlessFlowCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::FrictionlessSuccessCount => {
FrictionlessSuccessCount
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 5faeefec686..2d34344905e 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -29,14 +29,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +44,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::AuthenticationCallInit)
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("category", "API")
+ .add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
.switch()?;
time_range
@@ -76,9 +71,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
similarity index 69%
rename from crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
rename to crates/analytics/src/auth_events/metrics/authentication_count.rs
index 4ce10c9aad3..9f2311f5638 100644
--- a/crates/analytics/src/auth_events/metrics/three_ds_sdk_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -15,10 +14,10 @@ use crate::{
};
#[derive(Default)]
-pub(super) struct ThreeDsSdkCount;
+pub(super) struct AuthenticationCount;
#[async_trait::async_trait]
-impl<T> super::AuthEventMetric<T> for ThreeDsSdkCount
+impl<T> super::AuthEventMetric<T> for AuthenticationCount
where
T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +43,22 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
- .switch()?;
-
- query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::ThreeDsMethod)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
time_range
@@ -76,9 +66,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index 663473c2d89..e887807f41c 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -29,14 +29,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,30 +44,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::AuthenticationCall)
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("category", "API")
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
time_range
@@ -76,9 +71,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index 15cd86e5cc8..f1f6a397994 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -10,7 +9,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +29,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +43,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .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()?;
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::IncomingWebhookReceive)
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
query_builder
- .add_custom_filter_clause("request", "threeDSServerTransID", FilterTypes::Like)
+ .add_negative_filter_clause("authentication_status", "pending")
.switch()?;
time_range
@@ -68,9 +74,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index 61b10e6fb9e..c08618cc0d0 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,42 +43,36 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
- query_builder
- .add_bool_filter_clause("first_event", 1)
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk)
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
- query_builder.add_filter_clause("value", "C").switch()?;
-
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index c5bf7bf81ce..3fb75efd562 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -30,13 +30,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +44,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .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()?;
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::IncomingWebhookReceive)
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
query_builder
- .add_filter_clause("visitParamExtractRaw(request, 'transStatus')", "\"Y\"")
+ .add_filter_clause("trans_status", "C".to_string())
.switch()?;
time_range
@@ -68,9 +75,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index c08cc511e16..8859c60fc37 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, sdk_events::SdkEventNames, Granularity,
- TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -29,14 +28,13 @@ where
{
async fn load_metrics(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
+ merchant_id: &common_utils::id_type::MerchantId,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::SdkEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,34 +43,26 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
-
- query_builder
- .add_filter_clause("merchant_id", publishable_key)
- .switch()?;
-
query_builder
- .add_bool_filter_clause("first_event", 1)
- .switch()?;
-
- query_builder
- .add_filter_clause("category", "USER_EVENT")
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("log_type", "INFO")
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_negative_filter_clause("value", "C")
+ .add_filter_clause("trans_status", "Y".to_string())
.switch()?;
time_range
@@ -80,9 +70,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index b310567c9db..3d5d894e7dd 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventFlows, AuthEventMetricsBucketIdentifier},
- Granularity, TimeRange,
+ auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
};
+use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
@@ -30,13 +30,12 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- _publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
- QueryBuilder::new(AnalyticsCollection::ApiEventsAnalytics);
+ QueryBuilder::new(AnalyticsCollection::Authentications);
query_builder
.add_select_column(Aggregate::Count {
@@ -45,22 +44,30 @@ where
})
.switch()?;
- if let Some(granularity) = granularity {
- query_builder
- .add_granularity_in_mins(granularity)
- .switch()?;
- }
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
query_builder
- .add_filter_clause("merchant_id", merchant_id.get_string_repr())
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
.switch()?;
query_builder
- .add_filter_clause("api_flow", AuthEventFlows::PaymentsExternalAuthentication)
+ .add_filter_clause("merchant_id", merchant_id)
.switch()?;
query_builder
- .add_filter_clause("visitParamExtractRaw(response, 'transStatus')", "\"Y\"")
+ .add_filter_clause("trans_status", "Y".to_string())
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
time_range
@@ -68,9 +75,9 @@ where
.attach_printable("Error filtering time range")
.switch()?;
- if let Some(_granularity) = granularity.as_ref() {
- query_builder
- .add_group_by_clause("time_bucket")
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index cd870c12b23..1c86e7cbcf6 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -138,6 +138,7 @@ impl AnalyticsDataSource for ClickhouseClient {
| AnalyticsCollection::FraudCheck
| AnalyticsCollection::PaymentIntent
| AnalyticsCollection::PaymentIntentSessionized
+ | AnalyticsCollection::Authentications
| AnalyticsCollection::Dispute => {
TableEngine::CollapsingMergeTree { sign: "sign_flag" }
}
@@ -457,6 +458,7 @@ impl ToSql<ClickhouseClient> for AnalyticsCollection {
Self::Dispute => Ok("dispute".to_string()),
Self::DisputeSessionized => Ok("sessionizer_dispute".to_string()),
Self::ActivePaymentsAnalytics => Ok("active_payments".to_string()),
+ Self::Authentications => Ok("authentications".to_string()),
}
}
}
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index 0ad8886b820..ef7108e8ef7 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -909,7 +909,6 @@ impl AnalyticsProvider {
&self,
metric: &AuthEventMetrics,
merchant_id: &common_utils::id_type::MerchantId,
- publishable_key: &str,
granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -917,14 +916,13 @@ impl AnalyticsProvider {
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
Self::Clickhouse(pool) => {
metric
- .load_metrics(merchant_id, publishable_key, granularity, time_range, pool)
+ .load_metrics(merchant_id, granularity, time_range, pool)
.await
}
Self::CombinedCkh(_sqlx_pool, ckh_pool) | Self::CombinedSqlx(_sqlx_pool, ckh_pool) => {
metric
.load_metrics(
merchant_id,
- publishable_key,
granularity,
// Since API events are ckh only use ckh here
time_range,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index f449ba2f9b5..59cb8743448 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -19,6 +19,7 @@ use api_models::{
},
refunds::RefundStatus,
};
+use common_enums::{AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -502,6 +503,8 @@ impl_to_sql_for_to_string!(
Currency,
RefundType,
FrmTransactionType,
+ TransactionStatus,
+ AuthenticationStatus,
Flow,
&String,
&bool,
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 653d019adeb..f3143840f34 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -1034,6 +1034,8 @@ impl ToSql<SqlxClient> for AnalyticsCollection {
Self::Dispute => Ok("dispute".to_string()),
Self::DisputeSessionized => Err(error_stack::report!(ParsingError::UnknownError)
.attach_printable("DisputeSessionized table is not implemented for Sqlx"))?,
+ Self::Authentications => Err(error_stack::report!(ParsingError::UnknownError)
+ .attach_printable("Authentications table is not implemented for Sqlx"))?,
}
}
}
diff --git a/crates/analytics/src/types.rs b/crates/analytics/src/types.rs
index 86056338106..7bf8fc7d3c3 100644
--- a/crates/analytics/src/types.rs
+++ b/crates/analytics/src/types.rs
@@ -37,6 +37,7 @@ pub enum AnalyticsCollection {
PaymentIntentSessionized,
ConnectorEvents,
OutgoingWebhookEvent,
+ Authentications,
Dispute,
DisputeSessionized,
ApiEventsAnalytics,
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 7791a2f3cd5..6f527551348 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -5,6 +5,29 @@ use std::{
use super::NameDescription;
+#[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 AuthEventDimensions {
+ #[serde(rename = "authentication_status")]
+ AuthenticationStatus,
+ #[serde(rename = "trans_status")]
+ TransactionStatus,
+}
+
#[derive(
Clone,
Debug,
@@ -20,7 +43,7 @@ use super::NameDescription;
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum AuthEventMetrics {
- ThreeDsSdkCount,
+ AuthenticationCount,
AuthenticationAttemptCount,
AuthenticationSuccessCount,
ChallengeFlowCount,
@@ -48,7 +71,7 @@ pub enum AuthEventFlows {
}
pub mod metric_behaviour {
- pub struct ThreeDsSdkCount;
+ pub struct AuthenticationCount;
pub struct AuthenticationAttemptCount;
pub struct AuthenticationSuccessCount;
pub struct ChallengeFlowCount;
@@ -96,7 +119,7 @@ impl PartialEq for AuthEventMetricsBucketIdentifier {
#[derive(Debug, serde::Serialize)]
pub struct AuthEventMetricsBucketValue {
- pub three_ds_sdk_count: Option<u64>,
+ pub authentication_count: Option<u64>,
pub authentication_attempt_count: Option<u64>,
pub authentication_success_count: Option<u64>,
pub challenge_flow_count: Option<u64>,
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 8fb4f2ac2c1..deaf84bb009 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -975,7 +975,6 @@ pub mod routes {
analytics::auth_events::get_metrics(
&state.pool,
auth.merchant_account.get_id(),
- &auth.merchant_account.publishable_key,
req,
)
.await
|
2025-03-05T09:12:15Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Refactored and re-wrote the authentication related analytics.
The table being queried is now `authentications`.
The following metrics were modified:
- Authentication Attempt Count
- Authentication Count
- Authentication Success Count
- Challenge Attempt Count
- Challenge Flow Count
- Challenge Success Count
- Frictionless Flow Count
- Frictionless Success Count
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Get better insights into authentications related data through analytics
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Hit the following curls:
#### Authentication Attempt Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"authentication_attempt_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": 80,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Authentication Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"authentication_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": 95,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Authentication Success Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"authentication_success_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": 75,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Challenge Flow Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"challenge_flow_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": 1,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Challenge Attempt Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"challenge_attempt_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": 1,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Challenge Sccess Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"challenge_success_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": 1,
"frictionless_flow_count": null,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Frictionless Flow Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"frictionless_flow_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": 74,
"frictionless_success_count": null,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
#### Frictionless Success Count:
```bash
curl --location 'http://localhost:8080/analytics/v1/metrics/auth_events' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWFiNWIxNDEtNjQwOC00YTUyLTk2MjMtNTVhNTgxMTU1M2U4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQwNDE0OTA5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTI3NDY4NSwib3JnX2lkIjoib3JnX1QwSEtYNHYyRGFRT2lHUDVwRk52IiwicHJvZmlsZV9pZCI6InByb19xOWc2ZW1xcGM3YjQxTG83VVhweCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.LIExs1jjG6N5AFu5_S3oiuy77fWF0IbJmNGbK8HHLXI' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
{
"timeRange": {
"startTime": "2025-02-01T18:30:00Z",
"endTime": "2025-02-28T09:22:00Z"
},
"source": "BATCH",
"timeSeries": {
"granularity": "G_ONEDAY"
},
"metrics": [
"frictionless_success_count"
],
"delta": true
}
]'
```
Sample Output:
```json
{
"queryData": [
{
"authentication_count": null,
"authentication_attempt_count": null,
"authentication_success_count": null,
"challenge_flow_count": null,
"challenge_attempt_count": null,
"challenge_success_count": null,
"frictionless_flow_count": null,
"frictionless_success_count": 74,
"time_bucket": null
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2025-02-01T18:30:00.000Z",
"end_time": "2025-02-28T09:22:00.000Z"
}
}
]
}
```
Queries:
#### Authentication Attempt Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status != 'pending' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Authentication Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Authentication Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status = 'success' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Attempt Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status = 'C' AND authentication_status != 'pending' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Flow Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status = 'C' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Challenge Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND authentication_status = 'success' AND trans_status = 'C' AND created_at >= '1726079400' AND created_at <= '1727256120' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Frictionless Flow Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status = 'Y' AND created_at >= '1738402351' AND created_at <= '1740216751' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
#### Frictionless Success Count:
```bash
SELECT sum(sign_flag) as count, min(created_at) as start_bucket, max(created_at) as end_bucket FROM authentications WHERE ( merchant_id = 'merchant_1740414909' AND trans_status = 'Y' AND authentication_status = 'success' AND created_at >= '1738402351' AND created_at <= '1740216751' ) GROUP BY toStartOfDay(created_at) HAVING sum(sign_flag) >= '1'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
30f321bc2001264f5197172428ecae79896ad2f5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7407
|
Bug: [FEATURE]: Add `Payment Method - Delete` endpoint to payment methods session for V2
Required for Payment Methods Service
|
diff --git a/api-reference-v2/api-reference/payment-method-session/payment-method-session--delete-a-saved-payment-method.mdx b/api-reference-v2/api-reference/payment-method-session/payment-method-session--delete-a-saved-payment-method.mdx
new file mode 100644
index 00000000000..2f9e800ebe8
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-method-session/payment-method-session--delete-a-saved-payment-method.mdx
@@ -0,0 +1,3 @@
+---
+openapi: delete /v2/payment-method-session/:id
+---
diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json
index 2b0997326d8..d0ad2e87996 100644
--- a/api-reference-v2/mint.json
+++ b/api-reference-v2/mint.json
@@ -67,7 +67,8 @@
"api-reference/payment-method-session/payment-method-session--retrieve",
"api-reference/payment-method-session/payment-method-session--list-payment-methods",
"api-reference/payment-method-session/payment-method-session--update-a-saved-payment-method",
- "api-reference/payment-method-session/payment-method-session--confirm-a-payment-method-session"
+ "api-reference/payment-method-session/payment-method-session--confirm-a-payment-method-session",
+ "api-reference/payment-method-session/payment-method-session--delete-a-saved-payment-method"
]
},
{
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 9467ac0820b..e2cfb06b6e4 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -2960,6 +2960,62 @@
"ephemeral_key": []
}
]
+ },
+ "delete": {
+ "tags": [
+ "Payment Method Session"
+ ],
+ "summary": "Payment Method Session - Delete a saved payment method",
+ "description": "Delete a saved payment method from the given payment method session.",
+ "operationId": "Delete a saved payment method",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The unique identifier for the Payment Method Session",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodSessionDeleteSavedPaymentMethod"
+ },
+ "examples": {
+ "Update the card holder name": {
+ "value": {
+ "payment_method_id": "12345_pm_0194b1ecabc172e28aeb71f70a4daba3"
+ }
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "The payment method has been updated successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodDeleteResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "The request is invalid"
+ }
+ },
+ "security": [
+ {
+ "ephemeral_key": []
+ }
+ ]
}
},
"/v2/payment-method-session/:id/list-payment-methods": {
@@ -4457,15 +4513,19 @@
"AuthenticationDetails": {
"type": "object",
"required": [
- "status",
- "error"
+ "status"
],
"properties": {
"status": {
"$ref": "#/components/schemas/IntentStatus"
},
"error": {
- "$ref": "#/components/schemas/ErrorDetails"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ErrorDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -15602,6 +15662,19 @@
}
}
},
+ "PaymentMethodSessionDeleteSavedPaymentMethod": {
+ "type": "object",
+ "required": [
+ "payment_method_id"
+ ],
+ "properties": {
+ "payment_method_id": {
+ "type": "string",
+ "description": "The payment method id of the payment method to be updated",
+ "example": "12345_pm_01926c58bc6e77c09e809964e72af8c8"
+ }
+ }
+ },
"PaymentMethodSessionRequest": {
"type": "object",
"required": [
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index d665337fda0..2dbe16bfaa6 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -2781,6 +2781,14 @@ pub struct PaymentMethodSessionUpdateSavedPaymentMethod {
pub payment_method_update_request: PaymentMethodUpdate,
}
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct PaymentMethodSessionDeleteSavedPaymentMethod {
+ /// The payment method id of the payment method to be updated
+ #[schema(value_type = String, example = "12345_pm_01926c58bc6e77c09e809964e72af8c8")]
+ pub payment_method_id: id_type::GlobalPaymentMethodId,
+}
+
#[cfg(feature = "v2")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaymentMethodSessionConfirmRequest {
@@ -2858,6 +2866,6 @@ pub struct AuthenticationDetails {
pub status: common_enums::IntentStatus,
/// Error details of the authentication
- #[schema(value_type = ErrorDetails)]
+ #[schema(value_type = Option<ErrorDetails>)]
pub error: Option<payments::ErrorDetails>,
}
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index ff4459ac56f..a84f04dc6c5 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -143,6 +143,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payment_method::payment_method_session_retrieve,
routes::payment_method::payment_method_session_list_payment_methods,
routes::payment_method::payment_method_session_update_saved_payment_method,
+ routes::payment_method::payment_method_session_delete_saved_payment_method,
routes::payment_method::payment_method_session_confirm,
//Routes for refunds
@@ -212,6 +213,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payment_methods::PaymentMethodCreate,
api_models::payment_methods::PaymentMethodIntentCreate,
api_models::payment_methods::PaymentMethodIntentConfirm,
+ api_models::payment_methods::AuthenticationDetails,
api_models::payment_methods::PaymentMethodResponse,
api_models::payment_methods::PaymentMethodResponseData,
api_models::payment_methods::CustomerPaymentMethod,
@@ -697,6 +699,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::feature_matrix::CardSpecificFeatures,
api_models::feature_matrix::SupportedPaymentMethod,
api_models::payment_methods::PaymentMethodSessionUpdateSavedPaymentMethod,
+ api_models::payment_methods::PaymentMethodSessionDeleteSavedPaymentMethod,
common_utils::types::BrowserInformation,
api_models::enums::TokenizationType,
api_models::enums::NetworkTokenizationToggle,
diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs
index cf1cd15346f..6dcf3b67753 100644
--- a/crates/openapi/src/routes/payment_method.rs
+++ b/crates/openapi/src/routes/payment_method.rs
@@ -444,6 +444,35 @@ pub fn payment_method_session_list_payment_methods() {}
)]
pub fn payment_method_session_update_saved_payment_method() {}
+/// Payment Method Session - Delete a saved payment method
+///
+/// Delete a saved payment method from the given payment method session.
+#[cfg(feature = "v2")]
+#[utoipa::path(
+ delete,
+ path = "/v2/payment-method-session/:id",
+ params (
+ ("id" = String, Path, description = "The unique identifier for the Payment Method Session"),
+ ),
+ request_body(
+ content = PaymentMethodSessionDeleteSavedPaymentMethod,
+ examples(( "Update the card holder name" = (
+ value =json!( {
+ "payment_method_id": "12345_pm_0194b1ecabc172e28aeb71f70a4daba3",
+ }
+ )
+ )))
+ ),
+ responses(
+ (status = 200, description = "The payment method has been updated successfully", body = PaymentMethodDeleteResponse),
+ (status = 404, description = "The request is invalid")
+ ),
+ tag = "Payment Method Session",
+ operation_id = "Delete a saved payment method",
+ security(("ephemeral_key" = []))
+)]
+pub fn payment_method_session_delete_saved_payment_method() {}
+
/// Card network tokenization - Create using raw card data
///
/// Create a card network token for a customer and store it as a payment method.
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index eec47ca6255..86e4d8e1646 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -2021,12 +2021,24 @@ pub async fn delete_payment_method(
key_store: domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
) -> RouterResponse<api::PaymentMethodDeleteResponse> {
- let db = state.store.as_ref();
- let key_manager_state = &(&state).into();
-
let pm_id = id_type::GlobalPaymentMethodId::generate_from_string(pm_id.payment_method_id)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to generate GlobalPaymentMethodId")?;
+ let response = delete_payment_method_core(state, pm_id, key_store, merchant_account).await?;
+
+ Ok(services::ApplicationResponse::Json(response))
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[instrument(skip_all)]
+pub async fn delete_payment_method_core(
+ state: SessionState,
+ pm_id: id_type::GlobalPaymentMethodId,
+ key_store: domain::MerchantKeyStore,
+ merchant_account: domain::MerchantAccount,
+) -> RouterResult<api::PaymentMethodDeleteResponse> {
+ let db = state.store.as_ref();
+ let key_manager_state = &(&state).into();
let payment_method = db
.find_payment_method(
@@ -2084,7 +2096,7 @@ pub async fn delete_payment_method(
let response = api::PaymentMethodDeleteResponse { id: pm_id };
- Ok(services::ApplicationResponse::Json(response))
+ Ok(response)
}
#[cfg(feature = "v2")]
@@ -2415,6 +2427,32 @@ pub async fn payment_methods_session_update_payment_method(
Ok(services::ApplicationResponse::Json(updated_payment_method))
}
+#[cfg(feature = "v2")]
+pub async fn payment_methods_session_delete_payment_method(
+ state: SessionState,
+ key_store: domain::MerchantKeyStore,
+ merchant_account: domain::MerchantAccount,
+ pm_id: id_type::GlobalPaymentMethodId,
+ payment_method_session_id: id_type::GlobalPaymentMethodSessionId,
+) -> RouterResponse<api::PaymentMethodDeleteResponse> {
+ let db = state.store.as_ref();
+ let key_manager_state = &(&state).into();
+
+ // Validate if the session still exists
+ db.get_payment_methods_session(key_manager_state, &key_store, &payment_method_session_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
+ message: "payment methods session does not exist or has expired".to_string(),
+ })
+ .attach_printable("Failed to retrieve payment methods session from db")?;
+
+ let response = delete_payment_method_core(state, pm_id, key_store, merchant_account)
+ .await
+ .attach_printable("Failed to delete saved payment method")?;
+
+ Ok(services::ApplicationResponse::Json(response))
+}
+
#[cfg(feature = "v2")]
fn construct_zero_auth_payments_request(
confirm_request: &payment_methods::PaymentMethodSessionConfirmRequest,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index c4896bed498..c6ba89dd8de 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1332,7 +1332,10 @@ impl PaymentMethodSession {
.service(
web::resource("")
.route(web::get().to(payment_methods::payment_methods_session_retrieve))
- .route(web::put().to(payment_methods::payment_methods_session_update)),
+ .route(web::put().to(payment_methods::payment_methods_session_update))
+ .route(web::delete().to(
+ payment_methods::payment_method_session_delete_saved_payment_method,
+ )),
)
.service(web::resource("/list-payment-methods").route(
web::get().to(payment_methods::payment_method_session_list_payment_methods),
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 1cc3442b74b..1c3e23c2b03 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -331,6 +331,7 @@ impl From<Flow> for ApiIdentifier {
| Flow::PaymentMethodSessionRetrieve
| Flow::PaymentMethodSessionConfirm
| Flow::PaymentMethodSessionUpdateSavedPaymentMethod
+ | Flow::PaymentMethodSessionDeleteSavedPaymentMethod
| Flow::PaymentMethodSessionUpdate => Self::PaymentMethodSession,
}
}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index ec5e1dacf0a..6b60a05c6c1 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -1327,3 +1327,46 @@ pub async fn payment_method_session_update_saved_payment_method(
))
.await
}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSessionUpdateSavedPaymentMethod))]
+pub async fn payment_method_session_delete_saved_payment_method(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ path: web::Path<id_type::GlobalPaymentMethodSessionId>,
+ json_payload: web::Json<
+ api_models::payment_methods::PaymentMethodSessionDeleteSavedPaymentMethod,
+ >,
+) -> HttpResponse {
+ let flow = Flow::PaymentMethodSessionDeleteSavedPaymentMethod;
+ let payload = json_payload.into_inner();
+ let payment_method_session_id = path.into_inner();
+
+ let request = PaymentMethodsSessionGenericRequest {
+ payment_method_session_id: payment_method_session_id.clone(),
+ request: payload,
+ };
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ request,
+ |state, auth: auth::AuthenticationData, request, _| {
+ payment_methods_routes::payment_methods_session_delete_payment_method(
+ state,
+ auth.key_store,
+ auth.merchant_account,
+ request.request.payment_method_id,
+ request.payment_method_session_id,
+ )
+ },
+ &auth::V2ClientAuth(
+ common_utils::types::authentication::ResourceId::PaymentMethodSession(
+ payment_method_session_id,
+ ),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 26f88217e4a..890dcae12c6 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -566,6 +566,8 @@ pub enum Flow {
PaymentMethodSessionUpdate,
/// Update a saved payment method using the payment methods session
PaymentMethodSessionUpdateSavedPaymentMethod,
+ /// Delete a saved payment method using the payment methods session
+ PaymentMethodSessionDeleteSavedPaymentMethod,
/// Confirm a payment method session with payment method data
PaymentMethodSessionConfirm,
/// Create Cards Info flow
|
2025-03-03T12:56:33Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This endpoint allows deleting saved payment methods for a customer
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #7407
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Request:
```
curl --location --request DELETE 'http://localhost:8080/v2/payment-methods-session/12345_pms_01955b8bed367ee09f81e053cde47593' \
--header 'Authorization: publishable-key=pk_dev_16fea0a9bf5447ed9f25aa835565f285,client-secret=cs_01955b8bed37771282694611c1db81e5' \
--header 'X-Profile-Id: pro_0xaQT1sPjecc284Qtf5N' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_DfzEs7oHcqmWiWeKTPZ8RqHnWyuuPkEheYExXkY1AO1H5EMdkgNcfTFe3JU4vFLt' \
--data '{
"payment_method_id": "12345_pm_01955b8c21d37b53b999e934b53fffae"
}'
```
2. Response:
```json
{"id":"12345_pm_01955b8c21d37b53b999e934b53fffae"}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
8bf0f8df35dccc07749df380d183ed21b0bc6c8e
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7467
|
Bug: [FEATURE] scheme error code and messages in /payments API response
### Feature Description
If the payment is declined for a card transaction, the card scheme or issuer can send a raw response explaining why. These are the raw acquirer responses which helps in understanding why a card transaction was declined.
Some connectors like Adyen supports this - [reference](https://docs.adyen.com/development-resources/raw-acquirer-responses/#search-modal).
HyperSwitch today sends back `error_code` and `error_message` in the payments API response which are connector's error code and messages. Payments API response has to be extended to send back issuer specific error codes and messages.
### Possible Implementation
Issuer's error code and messages are received in payments API response or through webhooks. Considering this, below steps are to be followed
1. Ensure issuer's error code and messages are sent back from connector integration to core layer in `ErrorResponse`
2. Ensure this is handled in `IncomingWebhook` flows
3. Ensure this is stored in `payment_attempt` table
4. Ensure this is sent back in payments response
##### Changes required
1. Add below fields in `payment_attempt` table
- `issuer_error_code`
- `issuer_error_message`
2. Add below fields to payments API response
- `issuer_error_code`
- `issuer_error_message`
This maintains the existing naming convention. Today, HyperSwitch has -
- `error_code` and `unified_code`
- `error_message` and `unified_message`
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index d93208fb665..081ec577185 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7633,6 +7633,7 @@
"globepay",
"gocardless",
"gpayments",
+ "hipay",
"helcim",
"inespay",
"iatapay",
@@ -8720,6 +8721,14 @@
}
],
"nullable": true
+ },
+ "network_tokenization": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NetworkTokenResponse"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -11583,6 +11592,14 @@
"type": "object",
"description": "Metadata is useful for storing additional, unstructured information about the merchant account.",
"nullable": true
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -11717,6 +11734,14 @@
},
"recon_status": {
"$ref": "#/components/schemas/ReconStatus"
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -15350,6 +15375,14 @@
},
"description": "The connector token details if available",
"nullable": true
+ },
+ "network_token": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NetworkTokenResponse"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -15883,7 +15916,8 @@
"active_attempt_payment_connector_id",
"billing_connector_payment_details",
"payment_method_type",
- "payment_method_subtype"
+ "payment_method_subtype",
+ "connector"
],
"properties": {
"total_retry_count": {
@@ -15914,6 +15948,9 @@
},
"payment_method_subtype": {
"$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "connector": {
+ "$ref": "#/components/schemas/Connector"
}
}
},
@@ -20300,6 +20337,7 @@
"globalpay",
"globepay",
"gocardless",
+ "hipay",
"helcim",
"iatapay",
"inespay",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 651b0096566..2e21de61083 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5036,6 +5036,12 @@ pub struct PaymentsResponse {
/// Method through which card was discovered
#[schema(value_type = Option<CardDiscovery>, example = "manual")]
pub card_discovery: Option<enums::CardDiscovery>,
+
+ /// Error code received from the issuer in case of failed payments
+ pub issuer_error_code: Option<String>,
+
+ /// Error message received from the issuer in case of failed payments
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v2")]
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index ad09c333ea7..ece1edb72bd 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -210,6 +210,10 @@ pub struct RefundResponse {
/// Charge specific fields for controlling the revert of funds from either platform or connected account
#[schema(value_type = Option<SplitRefund>,)]
pub split_refunds: Option<common_types::refunds::SplitRefund>,
+ /// Error code received from the issuer in case of failed refunds
+ pub issuer_error_code: Option<String>,
+ /// Error message received from the issuer in case of failed refunds
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 7409b722653..8fb4afeb8ed 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -187,6 +187,8 @@ pub struct PaymentAttempt {
pub processor_transaction_data: Option<String>,
pub card_discovery: Option<storage_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -547,6 +549,8 @@ pub enum PaymentAttemptUpdate {
connector_transaction_id: Option<String>,
payment_method_data: Option<serde_json::Value>,
authentication_type: Option<storage_enums::AuthenticationType>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
CaptureUpdate {
amount_to_capture: Option<MinorUnit>,
@@ -898,6 +902,8 @@ pub struct PaymentAttemptUpdateInternal {
pub processor_transaction_data: Option<String>,
pub card_discovery: Option<common_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -1082,6 +1088,8 @@ impl PaymentAttemptUpdate {
connector_mandate_detail,
card_discovery,
charges,
+ issuer_error_code,
+ issuer_error_message,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
PaymentAttempt {
amount: amount.unwrap_or(source.amount),
@@ -1141,6 +1149,8 @@ impl PaymentAttemptUpdate {
connector_mandate_detail: connector_mandate_detail.or(source.connector_mandate_detail),
card_discovery: card_discovery.or(source.card_discovery),
charges: charges.or(source.charges),
+ issuer_error_code: issuer_error_code.or(source.issuer_error_code),
+ issuer_error_message: issuer_error_message.or(source.issuer_error_message),
..source
}
}
@@ -2194,6 +2204,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AuthenticationTypeUpdate {
authentication_type,
@@ -2251,6 +2263,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConfirmUpdate {
amount,
@@ -2340,6 +2354,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail,
card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::VoidUpdate {
status,
@@ -2398,6 +2414,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::RejectUpdate {
status,
@@ -2457,6 +2475,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::BlocklistUpdate {
status,
@@ -2516,6 +2536,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConnectorMandateDetailUpdate {
connector_mandate_detail,
@@ -2573,6 +2595,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::PaymentMethodDetailsUpdate {
payment_method_id,
@@ -2630,6 +2654,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ResponseUpdate {
status,
@@ -2712,6 +2738,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
shipping_cost: None,
order_tax_amount: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::ErrorUpdate {
@@ -2727,6 +2755,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
} => {
let (connector_transaction_id, processor_transaction_data) =
connector_transaction_id
@@ -2748,6 +2778,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
payment_method_data,
authentication_type,
processor_transaction_data,
+ issuer_error_code,
+ issuer_error_message,
amount: None,
net_amount: None,
currency: None,
@@ -2841,6 +2873,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::UpdateTrackers {
payment_token,
@@ -2904,6 +2938,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::UnresolvedResponseUpdate {
status,
@@ -2974,6 +3010,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::PreprocessingUpdate {
@@ -3043,6 +3081,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::CaptureUpdate {
@@ -3102,6 +3142,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AmountToCaptureUpdate {
status,
@@ -3160,6 +3202,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConnectorResponse {
authentication_data,
@@ -3227,6 +3271,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {
@@ -3285,6 +3331,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AuthenticationUpdate {
status,
@@ -3345,6 +3393,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ManualUpdate {
status,
@@ -3414,6 +3464,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::PostSessionTokensUpdate {
@@ -3472,6 +3524,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
}
}
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index f19c3252c60..ee598bebd2f 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -60,6 +60,8 @@ pub struct Refund {
pub unified_message: Option<String>,
pub processor_refund_data: Option<String>,
pub processor_transaction_data: Option<String>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[derive(
@@ -140,6 +142,8 @@ pub enum RefundUpdate {
processor_refund_data: Option<String>,
unified_code: Option<String>,
unified_message: Option<String>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
ManualUpdate {
refund_status: Option<storage_enums::RefundStatus>,
@@ -165,6 +169,8 @@ pub struct RefundUpdateInternal {
processor_refund_data: Option<String>,
unified_code: Option<String>,
unified_message: Option<String>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
}
impl RefundUpdateInternal {
@@ -213,6 +219,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::MetadataAndReasonUpdate {
metadata,
@@ -232,6 +240,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::StatusUpdate {
connector_refund_id,
@@ -253,6 +263,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::ErrorUpdate {
refund_status,
@@ -263,6 +275,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
updated_by,
connector_refund_id,
processor_refund_data,
+ issuer_error_code,
+ issuer_error_message,
} => Self {
refund_status,
refund_error_message,
@@ -277,6 +291,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code,
unified_message,
+ issuer_error_code,
+ issuer_error_message,
},
RefundUpdate::ManualUpdate {
refund_status,
@@ -297,6 +313,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
}
}
@@ -318,6 +336,8 @@ impl RefundUpdate {
processor_refund_data,
unified_code,
unified_message,
+ issuer_error_code,
+ issuer_error_message,
} = self.into();
Refund {
connector_refund_id: connector_refund_id.or(source.connector_refund_id),
@@ -333,6 +353,8 @@ impl RefundUpdate {
processor_refund_data: processor_refund_data.or(source.processor_refund_data),
unified_code: unified_code.or(source.unified_code),
unified_message: unified_message.or(source.unified_message),
+ issuer_error_code: issuer_error_code.or(source.issuer_error_code),
+ issuer_error_message: issuer_error_message.or(source.issuer_error_message),
..source
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index ae01a54bd43..4e2ba4811b1 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -922,6 +922,9 @@ diesel::table! {
processor_transaction_data -> Nullable<Text>,
card_discovery -> Nullable<CardDiscovery>,
charges -> Nullable<Jsonb>,
+ #[max_length = 64]
+ issuer_error_code -> Nullable<Varchar>,
+ issuer_error_message -> Nullable<Text>,
}
}
@@ -1276,6 +1279,9 @@ diesel::table! {
unified_message -> Nullable<Varchar>,
processor_refund_data -> Nullable<Text>,
processor_transaction_data -> Nullable<Text>,
+ #[max_length = 64]
+ issuer_error_code -> Nullable<Varchar>,
+ issuer_error_message -> Nullable<Text>,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs
index f4fce668ee0..8219105ed2f 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci.rs
@@ -121,6 +121,8 @@ impl ConnectorCommon for Aci {
}),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index 1e57cbbcf65..8e0694336b5 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Adyen {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: response.psp_reference,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -988,6 +990,8 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
status_code: res.status_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(response.psp_reference),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 13a29f16a0d..793a33e1fc1 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -144,6 +144,8 @@ pub struct AdditionalData {
#[cfg(feature = "payouts")]
payout_eligible: Option<PayoutEligibility>,
funds_availability: Option<String>,
+ refusal_reason_raw: Option<String>,
+ refusal_code_raw: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -444,6 +446,10 @@ pub struct AdyenWebhookResponse {
refusal_reason: Option<String>,
refusal_reason_code: Option<String>,
event_code: WebhookEventCode,
+ // Raw acquirer refusal code
+ refusal_code_raw: Option<String>,
+ // Raw acquirer refusal reason
+ refusal_reason_raw: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -453,6 +459,7 @@ pub struct RedirectionErrorResponse {
refusal_reason: Option<String>,
psp_reference: Option<String>,
merchant_reference: Option<String>,
+ additional_data: Option<AdditionalData>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -466,6 +473,7 @@ pub struct RedirectionResponse {
merchant_reference: Option<String>,
store: Option<String>,
splits: Option<Vec<AdyenSplitData>>,
+ additional_data: Option<AdditionalData>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -3461,6 +3469,14 @@ pub fn get_adyen_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.psp_reference.clone()),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
})
} else {
None
@@ -3533,6 +3549,8 @@ pub fn get_webhook_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_id.clone()),
+ issuer_error_code: response.refusal_code_raw.clone(),
+ issuer_error_message: response.refusal_reason_raw.clone(),
})
} else {
None
@@ -3598,6 +3616,14 @@ pub fn get_redirection_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
})
} else {
None
@@ -3674,6 +3700,8 @@ pub fn get_present_to_shopper_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -3739,6 +3767,8 @@ pub fn get_qr_code_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -3796,6 +3826,14 @@ pub fn get_redirection_error_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
});
// We don't get connector transaction id for redirections in Adyen.
let payments_response_data = PaymentsResponseData::TransactionResponse {
@@ -4307,6 +4345,10 @@ pub struct AdyenAdditionalDataWH {
#[serde(rename = "recurring.recurringDetailReference")]
pub recurring_detail_reference: Option<Secret<String>>,
pub network_tx_reference: Option<Secret<String>>,
+ /// [only for cards] Enable raw acquirer from Adyen dashboard to receive this (https://docs.adyen.com/development-resources/raw-acquirer-responses/#search-modal)
+ pub refusal_reason_raw: Option<String>,
+ /// [only for cards] This is only available for Visa and Mastercard
+ pub refusal_code_raw: Option<String>,
}
#[derive(Debug, Deserialize)]
@@ -4592,6 +4634,8 @@ impl From<AdyenNotificationRequestItemWH> for AdyenWebhookResponse {
refusal_reason,
refusal_reason_code,
event_code: notif.event_code,
+ refusal_code_raw: notif.additional_data.refusal_code_raw,
+ refusal_reason_raw: notif.additional_data.refusal_reason_raw,
}
}
}
@@ -5307,6 +5351,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for AcceptDisputeRouterData {
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -5345,6 +5391,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for SubmitEvidenceRouterData
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -5385,6 +5433,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for DefendDisputeRouterData {
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
index f37bef83026..c7482236264 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
@@ -122,6 +122,8 @@ impl ConnectorCommon for Airwallex {
reason: response.source,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
index f8959541574..d383bb59b74 100644
--- a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
@@ -145,6 +145,8 @@ impl ConnectorCommon for Amazonpay {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
index 3bd39fd38b5..de72dbe2aeb 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
@@ -1000,6 +1000,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
})
.unwrap_or_else(|| ErrorResponse {
@@ -1009,6 +1011,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})),
Some(authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponseError(_))
| None => {
@@ -1025,6 +1029,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
index d7f50aa7405..6481d41748c 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
@@ -551,6 +551,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -1219,6 +1221,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
let metadata = transaction_response
@@ -1310,6 +1314,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, AuthorizedotnetVoidResponse, T, Payment
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
let metadata = transaction_response
@@ -1458,6 +1464,8 @@ impl<F> TryFrom<RefundsResponseRouterData<F, AuthorizedotnetRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
@@ -1735,6 +1743,8 @@ fn get_err_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rs
index c4a9edea65c..1bf524392d7 100644
--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Bambora {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
index f7453495077..fb9c0799124 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
@@ -163,6 +163,8 @@ impl ConnectorCommon for Bamboraapac {
reason: response_data.declined_message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
index 5996ba05834..525b0456cec 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
@@ -346,6 +346,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -501,6 +503,8 @@ impl<F>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -663,6 +667,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -944,6 +950,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
index 36d12fe3fc5..c1cc1b644a7 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
@@ -276,6 +276,8 @@ impl ConnectorCommon for Bankofamerica {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
transformers::BankOfAmericaErrorResponse::AuthenticationError(response) => {
@@ -286,6 +288,8 @@ impl ConnectorCommon for Bankofamerica {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -434,6 +438,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -556,6 +562,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -746,6 +754,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -867,6 +877,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Ba
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index 9804f6c4e6c..4b40e36a7a6 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -1445,6 +1445,8 @@ fn map_error_response<F, T>(
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
});
match transaction_status {
@@ -1486,10 +1488,10 @@ fn get_payment_response(
enums::AttemptStatus,
u16,
),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let mandate_reference =
info_response
@@ -1549,7 +1551,8 @@ impl<F>
info_response.status.clone(),
item.data.request.is_auto_capture()?,
));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
let connector_response = match item.data.payment_method {
common_enums::PaymentMethod::Card => info_response
.processor_information
@@ -1648,7 +1651,8 @@ impl<F>
match item.response {
BankOfAmericaPaymentsResponse::ClientReferenceInformation(info_response) => {
let status = map_boa_attempt_status((info_response.status.clone(), true));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
Ok(Self {
status,
response,
@@ -1684,7 +1688,8 @@ impl<F>
match item.response {
BankOfAmericaPaymentsResponse::ClientReferenceInformation(info_response) => {
let status = map_boa_attempt_status((info_response.status.clone(), false));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
Ok(Self {
status,
response,
@@ -2244,6 +2249,8 @@ fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -2521,6 +2528,8 @@ fn convert_to_error_response_from_error_info(
status_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
index b5ddef00358..34bf83a7bd5 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Billwerk {
reason: Some(response.error),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
index 9fe00bac046..e6499306d0f 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
@@ -279,6 +279,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BillwerkPaymentsResponse, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.handle.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
index 4de2f422b94..992196c61d3 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Bitpay {
reason: response.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
index 29b0611c979..23720360294 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
@@ -168,6 +168,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
bluesnap::BluesnapErrors::Auth(error_res) => ErrorResponse {
@@ -177,6 +179,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(error_res.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
bluesnap::BluesnapErrors::General(error_response) => {
let (error_res, attempt_status) = if res.status_code == 403
@@ -199,6 +203,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(error_res),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
};
diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs
index 68195979874..330e7b5ab45 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku.rs
@@ -163,6 +163,8 @@ impl ConnectorCommon for Boku {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(_) => get_xml_deserialized(res, event_builder),
@@ -705,6 +707,8 @@ fn get_xml_deserialized(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree.rs b/crates/hyperswitch_connectors/src/connectors/braintree.rs
index e965e964293..67c54759152 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree.rs
@@ -169,6 +169,8 @@ impl ConnectorCommon for Braintree {
reason: Some(response.api_error_response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => {
@@ -182,6 +184,8 @@ impl ConnectorCommon for Braintree {
reason: Some(response.errors),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
index 2a5fabb7788..dfde2e0a26d 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
@@ -447,7 +447,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeAuthResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeAuthResponse::AuthResponse(auth_response) => {
@@ -461,6 +462,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -513,7 +516,7 @@ impl<F>
fn build_error_response<T>(
response: &[ErrorDetails],
http_code: u16,
-) -> Result<T, hyperswitch_domain_models::router_data::ErrorResponse> {
+) -> Result<T, Box<hyperswitch_domain_models::router_data::ErrorResponse>> {
let error_messages = response
.iter()
.map(|error| error.message.to_string())
@@ -542,15 +545,19 @@ fn get_error_response<T>(
error_msg: Option<String>,
error_reason: Option<String>,
http_code: u16,
-) -> Result<T, hyperswitch_domain_models::router_data::ErrorResponse> {
- Err(hyperswitch_domain_models::router_data::ErrorResponse {
- code: error_code.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
- message: error_msg.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
- reason: error_reason,
- status_code: http_code,
- attempt_status: None,
- connector_transaction_id: None,
- })
+) -> Result<T, Box<hyperswitch_domain_models::router_data::ErrorResponse>> {
+ Err(Box::new(
+ hyperswitch_domain_models::router_data::ErrorResponse {
+ code: error_code.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
+ message: error_msg.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
+ reason: error_reason,
+ status_code: http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
+ },
+ ))
}
#[derive(Debug, Clone, Deserialize, Serialize, strum::Display)]
@@ -624,7 +631,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreePaymentsResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors.clone(), item.http_code),
+ response: build_error_response(&error_response.errors.clone(), item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreePaymentsResponse::PaymentsResponse(payment_response) => {
@@ -638,6 +646,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -708,7 +718,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCompleteChargeResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors.clone(), item.http_code),
+ response: build_error_response(&error_response.errors.clone(), item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCompleteChargeResponse::PaymentsResponse(payment_response) => {
@@ -722,6 +733,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -773,7 +786,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCompleteAuthResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCompleteAuthResponse::AuthResponse(auth_response) => {
@@ -787,6 +801,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -962,7 +978,7 @@ impl TryFrom<RefundsResponseRouterData<Execute, BraintreeRefundResponse>>
Ok(Self {
response: match item.response {
BraintreeRefundResponse::ErrorResponse(error_response) => {
- build_error_response(&error_response.errors, item.http_code)
+ build_error_response(&error_response.errors, item.http_code).map_err(|err| *err)
}
BraintreeRefundResponse::SuccessResponse(refund_data) => {
let refund_data = refund_data.data.refund_transaction.refund;
@@ -975,6 +991,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, BraintreeRefundResponse>>
attempt_status: None,
connector_transaction_id: Some(refund_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -1079,7 +1097,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, BraintreeRSyncResponse>>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeRSyncResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeRSyncResponse::RSyncResponse(rsync_response) => {
@@ -1241,6 +1260,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeTokenResponse, T, PaymentsResp
response: match item.response {
BraintreeTokenResponse::ErrorResponse(error_response) => {
build_error_response(error_response.errors.as_ref(), item.http_code)
+ .map_err(|err| *err)
}
BraintreeTokenResponse::TokenResponse(token_response) => {
@@ -1332,6 +1352,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<BraintreeCaptureResponse>>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1352,7 +1374,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<BraintreeCaptureResponse>>
})
}
BraintreeCaptureResponse::ErrorResponse(error_data) => Ok(Self {
- response: build_error_response(&error_data.errors, item.http_code),
+ response: build_error_response(&error_data.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
}
@@ -1417,6 +1440,7 @@ impl<F>
response: match item.response {
BraintreeRevokeMandateResponse::ErrorResponse(error_response) => {
build_error_response(error_response.errors.as_ref(), item.http_code)
+ .map_err(|err| *err)
}
BraintreeRevokeMandateResponse::RevokeMandateResponse(..) => {
Ok(MandateRevokeResponseData {
@@ -1515,7 +1539,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeCancelResponse, T, PaymentsRes
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCancelResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCancelResponse::CancelResponse(void_response) => {
@@ -1529,6 +1554,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeCancelResponse, T, PaymentsRes
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1611,7 +1638,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreePSyncResponse, T, PaymentsResp
) -> Result<Self, Self::Error> {
match item.response {
BraintreePSyncResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreePSyncResponse::SuccessResponse(psync_response) => {
@@ -1631,6 +1659,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreePSyncResponse, T, PaymentsResp
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index a2a8cf9df65..edd6e54e0ce 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -146,6 +146,8 @@ impl ConnectorCommon for Cashtocode {
reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
index 209092c6b6f..684099deb05 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
@@ -253,6 +253,8 @@ impl<F>
reason: Some(error_data.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
CashtocodePaymentsResponse::CashtoCodeData(response_data) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 73eeabe4356..bde9a165b21 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Chargebee {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout.rs b/crates/hyperswitch_connectors/src/connectors/checkout.rs
index 61977098476..4d151c12159 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout.rs
@@ -179,6 +179,8 @@ impl ConnectorCommon for Checkout {
.or(response.error_type),
attempt_status: None,
connector_transaction_id: response.request_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
index 4630f00b1d5..d364e327504 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
@@ -705,6 +705,8 @@ impl TryFrom<PaymentsResponseRouterData<PaymentsResponse>> for PaymentsAuthorize
reason: item.response.response_summary,
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -757,6 +759,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<PaymentsResponse>> for PaymentsSyncR
reason: item.response.response_summary,
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
index cfdac514847..9e998abebbc 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Coinbase {
reason: response.error.code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/coingate.rs b/crates/hyperswitch_connectors/src/connectors/coingate.rs
index 81bb9116950..e426dcb2384 100644
--- a/crates/hyperswitch_connectors/src/connectors/coingate.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coingate.rs
@@ -142,6 +142,8 @@ impl ConnectorCommon for Coingate {
reason: Some(response.reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
index 2650d8f1e91..4c24018fcbc 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
@@ -193,6 +193,8 @@ impl ConnectorCommon for Cryptopay {
reason: response.error.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
index 98d3dd76cdd..67a67c8878d 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
@@ -175,6 +175,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(payment_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let redirection_data = item
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index 812d0391dec..8b5e748906f 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -239,6 +239,8 @@ impl ConnectorCommon for Cybersource {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => {
@@ -251,6 +253,8 @@ impl ConnectorCommon for Cybersource {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => {
@@ -275,6 +279,8 @@ impl ConnectorCommon for Cybersource {
reason: Some(error_response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -506,6 +512,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -586,6 +594,8 @@ impl ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevoke
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -823,6 +833,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1058,6 +1070,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1172,6 +1186,8 @@ impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Cyber
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1294,6 +1310,8 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1415,6 +1433,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Cy
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index ea5d9b25f84..2a0ebdc9f79 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -2679,10 +2679,10 @@ fn get_error_response_if_failure(
fn get_payment_response(
(info_response, status, http_code): (&CybersourcePaymentsResponse, enums::AttemptStatus, u16),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let incremental_authorization_allowed =
Some(status == enums::AttemptStatus::Authorized);
@@ -2747,7 +2747,8 @@ impl
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -2845,6 +2846,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
status: enums::AttemptStatus::AuthenticationFailed,
..item.data
@@ -3255,6 +3258,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -3292,7 +3297,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -3348,7 +3354,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
true,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -3383,7 +3390,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
false,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -4131,6 +4139,8 @@ pub fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans.rs b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
index f06d7be8693..0f82ae28d8f 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Datatrans {
reason: Some(response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let response: datatrans::DatatransErrorResponse = res
@@ -168,6 +170,8 @@ impl ConnectorCommon for Datatrans {
reason: Some(response.error.message.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
index 9297f783d3e..8299b0387ae 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
@@ -560,6 +560,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransResponse::TransactionResponse(response) => {
Ok(PaymentsResponseData::TransactionResponse {
@@ -629,6 +631,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransResponse::TransactionResponse(response) => {
Ok(PaymentsResponseData::TransactionResponse {
@@ -704,6 +708,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, DatatransRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -733,6 +739,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, DatatransSyncResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransSyncResponse::Response(response) => Ok(RefundsResponseData {
connector_refund_id: response.transaction_id.to_string(),
@@ -762,6 +770,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -785,6 +795,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let mandate_reference = sync_response
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
index b481c3e808d..0972eb63b9e 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
@@ -174,6 +174,8 @@ impl ConnectorCommon for Deutschebank {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -304,6 +306,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
deutschebank::DeutschebankError::AccessTokenErrorResponse(response) => {
Ok(ErrorResponse {
@@ -313,6 +317,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
index bf8a7fc9528..bee5d8662e1 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
@@ -444,7 +444,8 @@ impl
reason: Some("METHOD_REQUIRED Flow is not currently supported for deutschebank 3ds payments".to_owned()),
status_code: item.http_code,
attempt_status: None,
- connector_transaction_id: None,
+ connector_transaction_id: None,issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -514,6 +515,8 @@ fn get_error_response(error_code: String, error_reason: String, status_code: u16
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
index a58a086f5e7..55294d6a588 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
@@ -161,6 +161,8 @@ impl ConnectorCommon for Digitalvirgo {
reason: response.description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
index 60813a4ea08..965575bbe17 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
@@ -152,6 +152,8 @@ impl ConnectorCommon for Dlocal {
reason: response.param,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
index a11c608d69f..861ff22e60f 100644
--- a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
@@ -214,6 +214,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::AttemptStatus::Failure {
@@ -224,6 +226,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(response.ssl_txn_id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -428,6 +432,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::AttemptStatus::Failure {
@@ -438,6 +444,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -478,6 +486,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::RefundStatus::Failure {
@@ -488,6 +498,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
index 50eebb99518..14374a8e18a 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
@@ -178,6 +178,8 @@ impl ConnectorCommon for Fiserv {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
})
.unwrap_or(ErrorResponse {
@@ -187,6 +189,8 @@ impl ConnectorCommon for Fiserv {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}))
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
index b124949c078..d129ed69554 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
@@ -236,6 +236,8 @@ impl ConnectorCommon for Fiservemea {
},
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
None => Ok(ErrorResponse {
@@ -248,6 +250,8 @@ impl ConnectorCommon for Fiservemea {
reason: response.response_type,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
index 7e9bb8c120c..4069d6af8f9 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
@@ -235,6 +235,8 @@ impl ConnectorCommon for Fiuu {
reason: Some(response.error_desc.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 8b1296a0159..181574b54bb 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -828,6 +828,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -898,6 +900,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(data.txn_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -944,6 +948,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: recurring_response.tran_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1077,6 +1083,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, FiuuRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1101,6 +1109,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, FiuuRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(refund_data.refund_id.to_string()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -1240,6 +1250,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
reason: response.error_desc,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(txn_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1305,6 +1317,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
reason: response.error_desc.clone(),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(txn_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1474,6 +1488,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<PaymentCaptureResponse>>
),
attempt_status: None,
connector_transaction_id: Some(item.response.tran_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1587,6 +1603,8 @@ impl TryFrom<PaymentsCancelResponseRouterData<FiuuPaymentCancelResponse>>
),
attempt_status: None,
connector_transaction_id: Some(item.response.tran_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1682,6 +1700,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, FiuuRefundSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs
index 1068922faa7..2356fae53c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/forte.rs
+++ b/crates/hyperswitch_connectors/src/connectors/forte.rs
@@ -165,6 +165,8 @@ impl ConnectorCommon for Forte {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs
index 557dfbeaca3..0f0ee9e32c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Getnet {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay.rs b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
index 6d233bcfc33..641e9fd5f3d 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
@@ -148,6 +148,8 @@ impl ConnectorCommon for Globalpay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -376,6 +378,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
index 27ff359a7ad..57cf5d0f287 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
@@ -268,7 +268,7 @@ fn get_payment_response(
status: common_enums::AttemptStatus,
response: GlobalpayPaymentsResponse,
redirection_data: Option<RedirectForm>,
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let mandate_reference = response.payment_method.as_ref().and_then(|pm| {
pm.card
.as_ref()
@@ -281,13 +281,13 @@ fn get_payment_response(
})
});
match status {
- common_enums::AttemptStatus::Failure => Err(ErrorResponse {
+ common_enums::AttemptStatus::Failure => Err(Box::new(ErrorResponse {
message: response
.payment_method
.and_then(|pm| pm.message)
.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
..Default::default()
- }),
+ })),
_ => Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(response.id),
redirection_data: Box::new(redirection_data),
@@ -327,7 +327,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, GlobalpayPaymentsResponse, T, PaymentsR
let redirection_data = redirect_url.map(|url| RedirectForm::from((url, Method::Get)));
Ok(Self {
status,
- response: get_payment_response(status, item.response, redirection_data),
+ response: get_payment_response(status, item.response, redirection_data)
+ .map_err(|err| *err),
..item.data
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rs
index f11b7b5977f..cca5e99bccd 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Globepay {
reason: Some(response.return_msg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
index a3c027cb5a2..89686f199ad 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
@@ -325,6 +325,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
index a953e01dce0..a36ffdd9e34 100644
--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
@@ -158,6 +158,8 @@ impl ConnectorCommon for Gocardless {
reason: Some(error_reason.join("; ")),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rs
index 79b950063c3..65927bb0f35 100644
--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs
+++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs
@@ -181,6 +181,8 @@ impl ConnectorCommon for Helcim {
reason: Some(error_string),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hipay.rs b/crates/hyperswitch_connectors/src/connectors/hipay.rs
index 1575e361a5b..be1a829efb3 100644
--- a/crates/hyperswitch_connectors/src/connectors/hipay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hipay.rs
@@ -244,6 +244,8 @@ impl ConnectorCommon for Hipay {
reason: response.description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
index cefa332bc8f..b121b0698cd 100644
--- a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
@@ -582,6 +582,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<HipaySyncResponse>> for PaymentsSync
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
status: enums::AttemptStatus::Failure,
@@ -606,6 +608,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<HipaySyncResponse>> for PaymentsSync
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
index f9ab2f3159f..b5ea844fb2e 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
@@ -155,6 +155,8 @@ impl ConnectorCommon for Iatapay {
reason: Some(CONNECTOR_UNAUTHORIZED_ERROR.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
} else {
let response: iatapay::IatapayErrorResponse = res
@@ -171,6 +173,8 @@ impl ConnectorCommon for Iatapay {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
};
Ok(response_error_message)
@@ -288,6 +292,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
index e41057fb8e6..0c5c9fc6786 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
@@ -343,6 +343,8 @@ fn get_iatpay_response(
status_code,
attempt_status: Some(status),
connector_transaction_id: response.iata_payment_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -527,6 +529,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRout
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.iata_refund_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -563,6 +567,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.iata_refund_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs
index 41ae798ade3..e0bd27d47b1 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs
@@ -151,6 +151,8 @@ impl ConnectorCommon for Inespay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
index 3922929892e..508e91438ef 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
@@ -142,6 +142,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPaymentsResponse, T, PaymentsRes
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
};
@@ -267,6 +269,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPSyncResponse, T, PaymentsRespon
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -359,6 +363,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, InespayRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -403,6 +409,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, InespayRSyncResponse>> for Refunds
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank.rs b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
index 34956ace644..e31f86b0385 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
@@ -176,6 +176,8 @@ impl ConnectorCommon for Itaubank {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -296,6 +298,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.detail.or(response.user_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
index 9d6037877f2..68529f725a8 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
@@ -167,6 +167,8 @@ impl ConnectorCommon for Jpmorgan {
reason: Some(response_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
index cbe7881c536..6dd867421a9 100644
--- a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
+++ b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
@@ -187,6 +187,8 @@ impl ConnectorCommon for Juspaythreedsserver {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index 86ad19d7dc2..50a830fdba2 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -126,6 +126,8 @@ impl ConnectorCommon for Klarna {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity.rs b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
index 3b597597e38..eaaa94b4290 100644
--- a/crates/hyperswitch_connectors/src/connectors/mifinity.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Mifinity {
reason: Some(CONNECTOR_UNAUTHORIZED_ERROR.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let response: Result<
@@ -189,6 +191,8 @@ impl ConnectorCommon for Mifinity {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rs
index 325c031c33f..b043dbdd8cc 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Mollie {
reason: response.field,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs
index c8f542c1bad..3562a2e838e 100644
--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs
+++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs
@@ -174,6 +174,8 @@ impl ConnectorCommon for Moneris {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -298,6 +300,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.error_description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 3e632e048a2..e11ac59e75f 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -1045,6 +1045,8 @@ pub fn populate_error_reason(
status_code: http_code,
attempt_status,
connector_transaction_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
// REFUND :
@@ -1150,6 +1152,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, MultisafepayRefundResponse>>
status_code: item.http_code,
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
index f93eef65724..69a8543286d 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
@@ -162,6 +162,8 @@ impl ConnectorCommon for Nexinets {
reason: Some(connector_reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
index 8a9c804cbf2..264bca6b5a9 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
@@ -203,6 +203,8 @@ impl ConnectorCommon for Nexixpay {
reason: concatenated_descriptions,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
index a6a5b0357e1..075b955be49 100644
--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
@@ -285,6 +285,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(None, None, Some(nomupay_inner_error), _, _) => {
match (
@@ -298,6 +300,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(_, Some(validation_errors)) => Ok(ErrorResponse {
status_code: res.status_code,
@@ -314,6 +318,8 @@ impl ConnectorCommon for Nomupay {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(None, None) => Ok(ErrorResponse {
status_code: res.status_code,
@@ -322,6 +328,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
@@ -335,6 +343,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
_ => Ok(ErrorResponse {
status_code: res.status_code,
@@ -343,6 +353,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs
index c4f2eef275d..3f3de600063 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon.rs
@@ -178,6 +178,8 @@ impl ConnectorCommon for Noon {
reason: Some(noon_error_response.message),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_message) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
index b2128b990c1..81dc0186356 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
@@ -596,6 +596,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, NoonPaymentsResponse, T, PaymentsRespon
status_code: item.http_code,
attempt_status: Some(status),
connector_transaction_id: Some(order.id.to_string()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
_ => {
let connector_response_reference_id =
@@ -826,6 +828,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRout
reason: Some(response.message.clone()),
attempt_status: None,
connector_transaction_id: Some(response.result.transaction.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -892,6 +896,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundSyncResponse>> for RefundsRo
reason: Some(response.message.clone()),
attempt_status: None,
connector_transaction_id: Some(noon_transaction.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index 0a47c8ccfba..a6f2e2fc643 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Novalnet {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 44f84bf475d..607acb37fb0 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -589,6 +589,8 @@ pub fn get_error_response(result: ResultData, status_code: u16) -> ErrorResponse
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 0bfd3af7e99..cbc4a244d8c 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1543,17 +1543,14 @@ fn build_error_response<T>(
http_code: u16,
) -> Option<Result<T, ErrorResponse>> {
match response.status {
- NuveiPaymentStatus::Error => Some(get_error_response(
- response.err_code,
- &response.reason,
- http_code,
- )),
+ NuveiPaymentStatus::Error => Some(
+ get_error_response(response.err_code, &response.reason, http_code).map_err(|err| *err),
+ ),
_ => {
- let err = Some(get_error_response(
- response.gw_error_code,
- &response.gw_error_reason,
- http_code,
- ));
+ let err = Some(
+ get_error_response(response.gw_error_code, &response.gw_error_reason, http_code)
+ .map_err(|err| *err),
+ );
match response.transaction_status {
Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
_ => match response
@@ -1709,7 +1706,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, NuveiPaymentsResponse>>
item.response
.transaction_id
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
- ),
+ )
+ .map_err(|err| *err),
..item.data
})
}
@@ -1729,7 +1727,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, NuveiPaymentsResponse>>
item.response
.transaction_id
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
- ),
+ )
+ .map_err(|err| *err),
..item.data
})
}
@@ -1783,7 +1782,7 @@ fn get_refund_response(
response: NuveiPaymentsResponse,
http_code: u16,
txn_id: String,
-) -> Result<RefundsResponseData, ErrorResponse> {
+) -> Result<RefundsResponseData, Box<ErrorResponse>> {
let refund_status = response
.transaction_status
.clone()
@@ -1809,8 +1808,8 @@ fn get_error_response<T>(
error_code: Option<i64>,
error_msg: &Option<String>,
http_code: u16,
-) -> Result<T, ErrorResponse> {
- Err(ErrorResponse {
+) -> Result<T, Box<ErrorResponse>> {
+ Err(Box::new(ErrorResponse {
code: error_code
.map(|c| c.to_string())
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
@@ -1821,7 +1820,9 @@ fn get_error_response<T>(
status_code: http_code,
attempt_status: None,
connector_transaction_id: None,
- })
+ issuer_error_code: None,
+ issuer_error_message: None,
+ }))
}
#[derive(Debug, Default, Serialize, Deserialize)]
diff --git a/crates/hyperswitch_connectors/src/connectors/opayo.rs b/crates/hyperswitch_connectors/src/connectors/opayo.rs
index b2aadda37f7..eef0da72a2c 100644
--- a/crates/hyperswitch_connectors/src/connectors/opayo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opayo.rs
@@ -139,6 +139,8 @@ impl ConnectorCommon for Opayo {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/opennode.rs b/crates/hyperswitch_connectors/src/connectors/opennode.rs
index fefd2f77768..56e30ac3426 100644
--- a/crates/hyperswitch_connectors/src/connectors/opennode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opennode.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Opennode {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rs
index 395fc73808c..0c8577a29d4 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs
@@ -156,6 +156,8 @@ impl ConnectorCommon for Paybox {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
index ef4e308d968..7da6b6e95ea 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
@@ -715,6 +715,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxCaptureResponse, T, PaymentsRespo
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -773,6 +775,8 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -802,6 +806,8 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -845,6 +851,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxSyncResponse, T, PaymentsResponse
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -933,6 +941,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, PayboxSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -964,6 +974,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, TransactionResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1033,6 +1045,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
index 5621b9d1230..b6266d30d21 100644
--- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for Payeezy {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rs
index 9c1a94ad3c0..80dd60c172b 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for Payme {
)),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
index 8dd83d1ebd7..180d22b2a75 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
@@ -232,6 +232,8 @@ fn get_pay_sale_error_response(
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(pay_sale_response.payme_sale_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -314,6 +316,8 @@ fn get_sale_query_error_response(
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(sale_query_response.sale_payme_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -1033,6 +1037,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, PaymeRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: payme_response.payme_transaction_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -1104,6 +1110,8 @@ impl TryFrom<PaymentsCancelResponseRouterData<PaymeVoidResponse>> for PaymentsCa
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: payme_response.payme_transaction_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
// Since we are not receiving payme_sale_id, we are not populating the transaction response
@@ -1158,6 +1166,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaymeQueryTransactionResponse, T, Refun
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(pay_sale_response.payme_transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs
index 1859deeaad1..76283fad3a2 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs
@@ -178,6 +178,8 @@ impl Paypal {
reason: error_reason.or(Some(response.message)),
attempt_status: None,
connector_transaction_id: response.debug_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -350,6 +352,8 @@ impl ConnectorCommon for Paypal {
reason,
attempt_status: None,
connector_transaction_id: response.debug_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -488,6 +492,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1235,6 +1241,8 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
.unwrap_or(paypal::AuthenticationStatus::Null),
)),
status_code: res.status_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs
index 6d6ce2ff83a..2f15b1541a5 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs
@@ -143,6 +143,8 @@ impl ConnectorCommon for Paystack {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
index 2ced7d44d54..4117f689cb6 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
@@ -144,6 +144,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsRe
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
)
}
@@ -251,6 +253,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaystackPSyncResponse, T, PaymentsRespo
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -348,6 +352,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, PaystackRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -388,6 +394,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, PaystackRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs
index cd8c99b6151..6d09c85d917 100644
--- a/crates/hyperswitch_connectors/src/connectors/payu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payu.rs
@@ -139,6 +139,8 @@ impl ConnectorCommon for Payu {
reason: response.status.code_literal,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -339,6 +341,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
index 6e593c53e16..54d8ffadf34 100644
--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
@@ -134,6 +134,8 @@ impl ConnectorCommon for Placetopay {
reason: Some(response.status.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz.rs b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
index 6d88ac368a0..52db1eb49d2 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
@@ -147,6 +147,8 @@ impl ConnectorCommon for Powertranz {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
index 03eaa27281c..04df8ee5e54 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
@@ -459,6 +459,8 @@ fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Opti
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
})
} else if !ISO_SUCCESS_CODES.contains(&item.iso_response_code.as_str()) {
@@ -470,6 +472,8 @@ fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Opti
reason: Some(item.response_message.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
index 245eaf73e75..2518f08c69b 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
@@ -141,6 +141,8 @@ impl ConnectorCommon for Prophetpay {
reason: Some(response.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
index cb93caded2c..28f0e4981be 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
@@ -425,6 +425,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -473,6 +475,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpaySyncResponse, T, PaymentsResp
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -521,6 +525,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpayVoidResponse, T, PaymentsResp
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -629,6 +635,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ProphetpayRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -669,6 +677,8 @@ impl<T> TryFrom<RefundsResponseRouterData<T, ProphetpayRefundSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
index d5473b260f9..b777aff4d9d 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
@@ -140,6 +140,8 @@ impl ConnectorCommon for Rapyd {
reason: response_data.status.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
index 7d4517e00bd..236d9e55b5a 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
@@ -451,6 +451,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsRespo
reason: data.failure_message.to_owned(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
_ => {
@@ -495,6 +497,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsRespo
reason: item.response.status.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
};
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
index 435ff983c8b..fc7cdeb69ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
@@ -160,6 +160,8 @@ impl ConnectorCommon for Razorpay {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
razorpay::ErrorResponse::RazorpayStringError(error_string) => {
@@ -170,6 +172,8 @@ impl ConnectorCommon for Razorpay {
reason: Some(error_string.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
index af9e67f8dbe..214102e42f3 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
@@ -817,6 +817,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RazorpayPaymentsResponse, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -1273,6 +1275,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.refund.unique_request_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index c16810a6ab7..99714dd55f4 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Recurly {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs
index 501182dec07..97f4b4c4b4b 100644
--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Redsys {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs
index 0bf8c4094b1..b85c2472e58 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs
@@ -140,6 +140,8 @@ impl ConnectorCommon for Shift4 {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs
index 9615d4afdd7..6ac3420219d 100644
--- a/crates/hyperswitch_connectors/src/connectors/square.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square.rs
@@ -158,6 +158,8 @@ impl ConnectorCommon for Square {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rs
index 27be4d309dc..57b8ce1a282 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Stax {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index e05fb8b8e33..f3d63ed9ea4 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -141,6 +141,8 @@ impl ConnectorCommon for Stripebilling {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
index 30b92d9ceb8..4420384e87f 100644
--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs
+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Taxjar {
reason: Some(response.detail),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs
index b26c0e67fec..3e2e2fec33c 100644
--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs
+++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Thunes {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
index b3f2c1f9c3e..fed5c109460 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
@@ -177,6 +177,8 @@ impl ConnectorCommon for Trustpay {
.or(response_data.payment_description),
attempt_status: None,
connector_transaction_id: response_data.instance_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -333,6 +335,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.result_info.additional_info,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
index e8da94fae34..0b94b816196 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
@@ -732,6 +732,8 @@ fn handle_cards_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.instance_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -797,6 +799,8 @@ fn handle_bank_redirects_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
let payment_response_data = PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::NoResponseId,
@@ -849,6 +853,8 @@ fn handle_bank_redirects_sync_response(
.payment_request_id
.clone(),
),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -903,6 +909,8 @@ pub fn handle_webhook_response(
status_code,
attempt_status: None,
connector_transaction_id: payment_information.references.payment_request_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1011,6 +1019,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, TrustpayAuthUpdateResponse, T, AccessTo
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1482,6 +1492,8 @@ fn handle_cards_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1515,6 +1527,8 @@ fn handle_webhooks_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: response.references.payment_request_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1543,6 +1557,8 @@ fn handle_bank_redirects_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1579,6 +1595,8 @@ fn handle_bank_redirects_refund_sync_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1602,6 +1620,8 @@ fn handle_bank_redirects_refund_sync_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
//unreachable case as we are sending error as Some()
let refund_response_data = RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
index c2c99c88439..a0e014fd159 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
@@ -238,6 +238,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
index ac634d58aea..61e29203979 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for UnifiedAuthenticationService {
reason: Some(response.error),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rs
index cec1194f281..ae3699bcc20 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt.rs
@@ -171,6 +171,8 @@ impl ConnectorCommon for Volt {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -275,6 +277,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
index 3841b7e33b4..33d174d5db8 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
@@ -354,6 +354,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(payment_response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -395,6 +397,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(webhook_response.payment.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
index 8566ec70341..e58b9d4439a 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
@@ -222,6 +222,8 @@ impl ConnectorCommon for Wellsfargo {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::WellsfargoErrorResponse::AuthenticationError(response)) => {
@@ -234,6 +236,8 @@ impl ConnectorCommon for Wellsfargo {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::WellsfargoErrorResponse::NotAvailableError(response)) => {
@@ -258,6 +262,8 @@ impl ConnectorCommon for Wellsfargo {
reason: Some(error_response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -482,6 +488,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -562,6 +570,8 @@ impl ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevoke
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -696,6 +706,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -890,6 +902,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1011,6 +1025,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for We
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
index 10c381fa857..b346d396866 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
@@ -1708,10 +1708,10 @@ fn get_error_response_if_failure(
fn get_payment_response(
(info_response, status, http_code): (&WellsfargoPaymentsResponse, enums::AttemptStatus, u16),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let incremental_authorization_allowed =
Some(status == enums::AttemptStatus::Authorized);
@@ -1776,7 +1776,8 @@ impl
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -1832,7 +1833,8 @@ impl<F>
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
true,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -1862,7 +1864,8 @@ impl<F>
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
false,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -2376,6 +2379,8 @@ pub fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
pub fn get_error_reason(
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index 41b2207b175..b261343c5b1 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -156,6 +156,8 @@ impl ConnectorCommon for Worldpay {
reason: response.validation_errors.map(|e| e.to_string()),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -483,6 +485,8 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
reason: response.validation_errors.map(|e| e.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index 65c884601de..61621b3cc93 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -786,6 +786,8 @@ impl<F, T>
status_code: router_data.http_code,
attempt_status: Some(status),
connector_transaction_id: optional_correlation_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(_, Some((code, message))) => Err(ErrorResponse {
code,
@@ -794,6 +796,8 @@ impl<F, T>
status_code: router_data.http_code,
attempt_status: Some(status),
connector_transaction_id: optional_correlation_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index f1872e31ae7..cd65b25fda4 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Xendit {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
index 47936d43065..30b023e6dc4 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
@@ -330,6 +330,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let charges = match item.data.request.split_payments.as_ref() {
@@ -439,6 +441,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -572,6 +576,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<XenditResponse>> for PaymentsSyncRou
attempt_status: None,
connector_transaction_id: Some(payment_response.id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs
index 70703b31643..71ca8c7758d 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen.rs
@@ -146,6 +146,8 @@ impl ConnectorCommon for Zen {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 305c8518c8e..bec1f6be0a4 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -939,6 +939,8 @@ fn get_zen_response(
status_code,
attempt_status: Some(status),
connector_transaction_id: Some(response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1085,6 +1087,8 @@ fn get_zen_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rs
index d7c0152b7a6..7ed2a660822 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs
@@ -123,6 +123,8 @@ impl ConnectorCommon for Zsl {
reason: Some(error_reason),
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
index 8a39901e5de..66bd3eda1d1 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
@@ -349,6 +349,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ZslPaymentsResponse, T, PaymentsRespons
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -365,6 +367,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ZslPaymentsResponse, T, PaymentsRespons
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -443,6 +447,8 @@ impl<F> TryFrom<ResponseRouterData<F, ZslWebhookResponse, PaymentsSyncData, Paym
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index b082962e400..97c27539c67 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -336,6 +336,8 @@ pub(crate) fn handle_json_response_deserialization_failure(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
index fd8e144f4f2..733c6a73c93 100644
--- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
+++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
@@ -702,6 +702,8 @@ impl From<ApiErrorResponse> for router_data::ErrorResponse {
},
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 70926056957..2dc4eec15f1 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -846,6 +846,8 @@ pub struct PaymentAttempt {
pub capture_before: Option<PrimitiveDateTime>,
pub card_discovery: Option<common_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -1239,6 +1241,8 @@ pub enum PaymentAttemptUpdate {
connector_transaction_id: Option<String>,
payment_method_data: Option<serde_json::Value>,
authentication_type: Option<storage_enums::AuthenticationType>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
CaptureUpdate {
amount_to_capture: Option<MinorUnit>,
@@ -1542,6 +1546,8 @@ impl PaymentAttemptUpdate {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
} => DieselPaymentAttemptUpdate::ErrorUpdate {
connector,
status,
@@ -1555,6 +1561,8 @@ impl PaymentAttemptUpdate {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
},
Self::CaptureUpdate {
multiple_capture_count,
@@ -1824,6 +1832,8 @@ impl behaviour::Conversion for PaymentAttempt {
processor_transaction_data,
card_discovery: self.card_discovery,
charges: self.charges,
+ issuer_error_code: self.issuer_error_code,
+ issuer_error_message: self.issuer_error_message,
// Below fields are deprecated. Please add any new fields above this line.
connector_transaction_data: None,
})
@@ -1912,6 +1922,8 @@ impl behaviour::Conversion for PaymentAttempt {
capture_before: storage_model.capture_before,
card_discovery: storage_model.card_discovery,
charges: storage_model.charges,
+ issuer_error_code: storage_model.issuer_error_code,
+ issuer_error_message: storage_model.issuer_error_message,
})
}
.await
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 7f1278414ea..6618d2fbc80 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -399,6 +399,8 @@ pub struct ErrorResponse {
pub status_code: u16,
pub attempt_status: Option<common_enums::enums::AttemptStatus>,
pub connector_transaction_id: Option<String>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
impl Default for ErrorResponse {
@@ -410,6 +412,8 @@ impl Default for ErrorResponse {
status_code: http::StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -423,6 +427,8 @@ impl ErrorResponse {
status_code: http::StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -601,6 +607,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
@@ -798,6 +806,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
@@ -1013,6 +1023,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(common_enums::AttemptStatus::Failure);
@@ -1256,6 +1268,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index b70d326feb6..78fdba32c9b 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -198,6 +198,8 @@ pub trait ConnectorIntegration<T, Req, Resp>:
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
@@ -286,6 +288,8 @@ pub trait ConnectorCommon {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
index bc18f5c6639..e0974f5d04d 100644
--- a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
+++ b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
@@ -158,6 +158,8 @@ pub trait ConnectorIntegrationV2<Flow, ResourceCommonData, Req, Resp>:
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/router/src/connector/adyenplatform.rs b/crates/router/src/connector/adyenplatform.rs
index f95e9cd4d64..5ff89721cb4 100644
--- a/crates/router/src/connector/adyenplatform.rs
+++ b/crates/router/src/connector/adyenplatform.rs
@@ -99,6 +99,8 @@ impl ConnectorCommon for Adyenplatform {
reason: response.detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rs
index 226067cef96..f2058c17f6c 100644
--- a/crates/router/src/connector/dummyconnector.rs
+++ b/crates/router/src/connector/dummyconnector.rs
@@ -125,6 +125,8 @@ impl<const T: u8> ConnectorCommon for DummyConnector<T> {
reason: response.error.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/ebanx.rs b/crates/router/src/connector/ebanx.rs
index 01db54c1f67..b38297ed5c7 100644
--- a/crates/router/src/connector/ebanx.rs
+++ b/crates/router/src/connector/ebanx.rs
@@ -124,6 +124,8 @@ impl ConnectorCommon for Ebanx {
reason: response.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/gpayments.rs b/crates/router/src/connector/gpayments.rs
index 1febbfa7885..2d3b1c37d58 100644
--- a/crates/router/src/connector/gpayments.rs
+++ b/crates/router/src/connector/gpayments.rs
@@ -123,6 +123,8 @@ impl ConnectorCommon for Gpayments {
reason: response.error_detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/netcetera.rs b/crates/router/src/connector/netcetera.rs
index 459ac93e068..f1fc94bd482 100644
--- a/crates/router/src/connector/netcetera.rs
+++ b/crates/router/src/connector/netcetera.rs
@@ -111,6 +111,8 @@ impl ConnectorCommon for Netcetera {
reason: response.error_details.error_detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/netcetera/transformers.rs b/crates/router/src/connector/netcetera/transformers.rs
index 886dbc18ad4..1169f29563e 100644
--- a/crates/router/src/connector/netcetera/transformers.rs
+++ b/crates/router/src/connector/netcetera/transformers.rs
@@ -110,6 +110,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
};
@@ -179,6 +181,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rs
index 73aaec55e57..d0cc0f156d7 100644
--- a/crates/router/src/connector/nmi.rs
+++ b/crates/router/src/connector/nmi.rs
@@ -103,6 +103,8 @@ impl ConnectorCommon for Nmi {
code: response.response_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index d6f1cb1962f..da2649cc444 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -224,6 +224,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
enums::AttemptStatus::Failure,
),
@@ -401,6 +403,8 @@ impl ForeignFrom<(NmiCompleteResponse, u16)> for types::ErrorResponse {
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -905,6 +909,8 @@ impl ForeignFrom<(StandardResponse, u16)> for types::ErrorResponse {
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/router/src/connector/payone.rs b/crates/router/src/connector/payone.rs
index 58b179e5799..2e7656f08cf 100644
--- a/crates/router/src/connector/payone.rs
+++ b/crates/router/src/connector/payone.rs
@@ -210,6 +210,8 @@ impl ConnectorCommon for Payone {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
None => Ok(ErrorResponse {
status_code: res.status_code,
@@ -218,6 +220,8 @@ impl ConnectorCommon for Payone {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/router/src/connector/plaid.rs b/crates/router/src/connector/plaid.rs
index f24d7bd8d6d..b5428fba4d3 100644
--- a/crates/router/src/connector/plaid.rs
+++ b/crates/router/src/connector/plaid.rs
@@ -133,6 +133,8 @@ impl ConnectorCommon for Plaid {
reason: response.display_message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/plaid/transformers.rs b/crates/router/src/connector/plaid/transformers.rs
index 4e4fb1863ee..ebab8c185af 100644
--- a/crates/router/src/connector/plaid/transformers.rs
+++ b/crates/router/src/connector/plaid/transformers.rs
@@ -302,6 +302,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
@@ -388,6 +390,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, PlaidSyncResponse, T, types::Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
diff --git a/crates/router/src/connector/riskified.rs b/crates/router/src/connector/riskified.rs
index 1268e041603..a9585e5d3fd 100644
--- a/crates/router/src/connector/riskified.rs
+++ b/crates/router/src/connector/riskified.rs
@@ -147,6 +147,8 @@ impl ConnectorCommon for Riskified {
message: response.error.message.clone(),
reason: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/signifyd.rs b/crates/router/src/connector/signifyd.rs
index 21452819c39..857dce8c2e3 100644
--- a/crates/router/src/connector/signifyd.rs
+++ b/crates/router/src/connector/signifyd.rs
@@ -108,6 +108,8 @@ impl ConnectorCommon for Signifyd {
reason: Some(response.errors.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index a971bd96741..3971ecc7db8 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -129,6 +129,8 @@ impl ConnectorCommon for Stripe {
reason: response.error.message,
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -331,6 +333,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -463,6 +467,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -591,6 +597,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -744,6 +752,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -914,6 +924,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1164,6 +1176,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1291,6 +1305,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1451,6 +1467,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1620,6 +1638,8 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1754,6 +1774,8 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1908,6 +1930,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -2021,6 +2045,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -2152,6 +2178,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 41fb23e7e9e..39d43bd2e06 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -3158,6 +3158,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::RefundsResponseData {
@@ -3193,6 +3195,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::RefundsResponseData {
@@ -3549,6 +3553,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, ChargesResponse, T, types::Payme
status_code: item.http_code,
attempt_status: Some(status),
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
@@ -4169,6 +4175,8 @@ impl ForeignTryFrom<(&Option<ErrorDetails>, u16, String)> for types::PaymentsRes
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/threedsecureio.rs b/crates/router/src/connector/threedsecureio.rs
index aec8f780451..09d232c7471 100644
--- a/crates/router/src/connector/threedsecureio.rs
+++ b/crates/router/src/connector/threedsecureio.rs
@@ -122,6 +122,8 @@ impl ConnectorCommon for Threedsecureio {
reason: response.error_description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(err) => {
diff --git a/crates/router/src/connector/threedsecureio/transformers.rs b/crates/router/src/connector/threedsecureio/transformers.rs
index dc1a90f36e7..faf72a2951b 100644
--- a/crates/router/src/connector/threedsecureio/transformers.rs
+++ b/crates/router/src/connector/threedsecureio/transformers.rs
@@ -124,6 +124,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
};
@@ -205,6 +207,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
ThreedsecureioErrorResponseWrapper::ErrorString(error) => {
@@ -215,6 +219,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
},
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 8a186e0291a..5009eaf4daa 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2621,6 +2621,8 @@ impl
status_code: http_code,
attempt_status,
connector_transaction_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/router/src/connector/wellsfargopayout.rs b/crates/router/src/connector/wellsfargopayout.rs
index 33111ee7be0..5caf3c689b2 100644
--- a/crates/router/src/connector/wellsfargopayout.rs
+++ b/crates/router/src/connector/wellsfargopayout.rs
@@ -132,6 +132,8 @@ impl ConnectorCommon for Wellsfargopayout {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rs
index e4493f5016f..a1d75f18b2a 100644
--- a/crates/router/src/connector/wise.rs
+++ b/crates/router/src/connector/wise.rs
@@ -113,6 +113,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::ErrorResponse {
@@ -122,6 +124,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -132,6 +136,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
@@ -338,6 +344,8 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pa
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs
index 7d56c2ccb91..22f1b593f13 100644
--- a/crates/router/src/core/payments/access_token.rs
+++ b/crates/router/src/core/payments/access_token.rs
@@ -233,6 +233,8 @@ pub async fn refresh_connector_auth(
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
Ok(Err(error_response))
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index bcf0d624ff9..409fccf5e63 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1436,6 +1436,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
connector_transaction_id: err.connector_transaction_id,
payment_method_data: additional_payment_method_data,
authentication_type: auth_update,
+ issuer_error_code: err.issuer_error_code,
+ issuer_error_message: err.issuer_error_message,
}),
)
}
@@ -1473,6 +1475,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
connector_transaction_id,
payment_method_data: None,
authentication_type: auth_update,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
)
}
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 5fdf14dbf5a..24a3ac2ec86 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -537,6 +537,8 @@ where
connector_transaction_id: error_response.connector_transaction_id.clone(),
payment_method_data: additional_payment_method_data,
authentication_type: auth_update,
+ issuer_error_code: error_response.issuer_error_code.clone(),
+ issuer_error_message: error_response.issuer_error_message.clone(),
};
#[cfg(feature = "v1")]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index a34c137dbda..7f5f7858a3a 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2569,6 +2569,8 @@ where
capture_before: payment_attempt.capture_before,
extended_authorization_applied: payment_attempt.extended_authorization_applied,
card_discovery: payment_attempt.card_discovery,
+ issuer_error_code: payment_attempt.issuer_error_code,
+ issuer_error_message: payment_attempt.issuer_error_message,
};
services::ApplicationResponse::JsonWithHeaders((payments_response, headers))
@@ -2827,7 +2829,9 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
order_tax_amount: None,
connector_mandate_id:None,
shipping_cost: None,
- card_discovery: pa.card_discovery
+ card_discovery: pa.card_discovery,
+ issuer_error_code: pa.issuer_error_code,
+ issuer_error_message: pa.issuer_error_message,
}
}
}
diff --git a/crates/router/src/core/payouts/access_token.rs b/crates/router/src/core/payouts/access_token.rs
index e5e9b47e4ff..52c31e8fa94 100644
--- a/crates/router/src/core/payouts/access_token.rs
+++ b/crates/router/src/core/payouts/access_token.rs
@@ -172,6 +172,8 @@ pub async fn refresh_connector_auth(
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
Ok(Err(error_response))
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index b850420dfd7..7d663a48a1a 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -238,6 +238,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
errors::ConnectorError::NotSupported { message, connector } => {
@@ -252,6 +254,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
_ => None,
@@ -335,6 +339,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: Some(unified_code),
unified_message: Some(unified_message),
+ issuer_error_code: err.issuer_error_code,
+ issuer_error_message: err.issuer_error_message,
}
}
Ok(response) => {
@@ -366,6 +372,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
Ok(()) => {
@@ -680,6 +688,8 @@ pub async fn sync_refund_with_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: error_message.issuer_error_code,
+ issuer_error_message: error_message.issuer_error_message,
}
}
Ok(response) => match router_data_res.integrity_check.clone() {
@@ -710,6 +720,8 @@ pub async fn sync_refund_with_gateway(
processor_refund_data,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
Ok(()) => {
@@ -1265,6 +1277,8 @@ impl ForeignFrom<storage::Refund> for api::RefundResponse {
split_refunds: refund.split_refunds,
unified_code: refund.unified_code,
unified_message: refund.unified_message,
+ issuer_error_code: refund.issuer_error_code,
+ issuer_error_message: refund.issuer_error_message,
}
}
}
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index 07bdfa3f77d..1f54eeb5fdc 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -439,6 +439,8 @@ mod storage {
unified_message: None,
processor_refund_data: new.processor_refund_data.clone(),
processor_transaction_data: new.processor_transaction_data.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
// Below fields are deprecated. Please add any new fields above this line.
connector_refund_data: None,
connector_transaction_data: None,
@@ -939,6 +941,8 @@ impl RefundInterface for MockDb {
unified_message: None,
processor_refund_data: new.processor_refund_data.clone(),
processor_transaction_data: new.processor_transaction_data.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
// Below fields are deprecated. Please add any new fields above this line.
connector_refund_data: None,
connector_transaction_data: None,
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index df33e803ab8..e8af5b3b773 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -170,6 +170,8 @@ where
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -359,6 +361,8 @@ where
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
router_data.response = Err(error_response);
router_data.connector_http_status_code = Some(504);
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index f9ef4880924..59ee4e4fb38 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -699,6 +699,8 @@ pub fn handle_json_response_deserialization_failure(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index 64c4853d14b..dac001bac9d 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -154,6 +154,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
connector_transaction_id: None,
payment_method_data: None,
authentication_type: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
payment_data.payment_attempt = db
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 94dcba750af..0e57540e0ea 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -454,6 +454,8 @@ async fn payments_create_core() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
@@ -721,6 +723,8 @@ async fn payments_create_core_adyen_no_redirect() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
vec![],
));
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 66cd41dbc74..19281b45019 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -215,6 +215,8 @@ async fn payments_create_core() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let expected_response =
@@ -491,6 +493,8 @@ async fn payments_create_core_adyen_no_redirect() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
vec![],
));
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 1e4efb2b350..2a637a77e23 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -229,6 +229,8 @@ impl PaymentAttemptInterface for MockDb {
capture_before: payment_attempt.capture_before,
card_discovery: payment_attempt.card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 076b120c2d0..aaa709e7fa7 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -647,6 +647,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
capture_before: payment_attempt.capture_before,
card_discovery: payment_attempt.card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let field = format!("pa_{}", created_attempt.attempt_id);
@@ -1648,6 +1650,8 @@ impl DataModelExt for PaymentAttempt {
processor_transaction_data,
card_discovery: self.card_discovery,
charges: self.charges,
+ issuer_error_code: self.issuer_error_code,
+ issuer_error_message: self.issuer_error_message,
// Below fields are deprecated. Please add any new fields above this line.
connector_transaction_data: None,
}
@@ -1731,6 +1735,8 @@ impl DataModelExt for PaymentAttempt {
capture_before: storage_model.capture_before,
card_discovery: storage_model.card_discovery,
charges: storage_model.charges,
+ issuer_error_code: storage_model.issuer_error_code,
+ issuer_error_message: storage_model.issuer_error_message,
}
}
}
diff --git a/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql
new file mode 100644
index 00000000000..06abb6aefbd
--- /dev/null
+++ b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql
@@ -0,0 +1,7 @@
+ALTER TABLE payment_attempt
+DROP COLUMN IF EXISTS issuer_error_code,
+DROP COLUMN IF EXISTS issuer_error_message;
+
+ALTER TABLE refund
+DROP COLUMN IF EXISTS issuer_error_code,
+DROP COLUMN IF EXISTS issuer_error_message;
\ No newline at end of file
diff --git a/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql
new file mode 100644
index 00000000000..80c1bc3742e
--- /dev/null
+++ b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql
@@ -0,0 +1,7 @@
+ALTER TABLE payment_attempt
+ADD COLUMN IF NOT EXISTS issuer_error_code VARCHAR(64) DEFAULT NULL,
+ADD COLUMN IF NOT EXISTS issuer_error_message TEXT DEFAULT NULL;
+
+ALTER TABLE refund
+ADD COLUMN IF NOT EXISTS issuer_error_code VARCHAR(64) DEFAULT NULL,
+ADD COLUMN IF NOT EXISTS issuer_error_message TEXT DEFAULT NULL;
\ No newline at end of file
diff --git a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
index b0a3f007eee..cbb2b264d45 100644
--- a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
+++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
@@ -89,7 +89,9 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id,
DROP COLUMN authentication_data,
DROP COLUMN payment_method_billing_address_id,
DROP COLUMN connector_mandate_detail,
- DROP COLUMN charge_id;
+ DROP COLUMN charge_id,
+ DROP COLUMN issuer_error_code,
+ DROP COLUMN issuer_error_message;
ALTER TABLE payment_methods
@@ -113,7 +115,9 @@ DROP TYPE IF EXISTS "PaymentMethodIssuerCode";
-- Run below queries only when V1 is deprecated
ALTER TABLE refund DROP COLUMN connector_refund_data,
- DROP COLUMN connector_transaction_data;
+ DROP COLUMN connector_transaction_data,
+ DROP COLUMN issuer_error_code,
+ DROP COLUMN issuer_error_message;
-- Run below queries only when V1 is deprecated
ALTER TABLE captures DROP COLUMN connector_capture_data;
|
2025-03-16T14:34:27Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR introduces -
- Core functionality to read and store raw acquirer responses for `payment` and `refund` operations.
- Read raw acquirer response from connector integration
- Store in `PaymentAttempt` and `Refund` tables
- Updates Adyen connector integration to read raw acquirer response.
- Exposes these fields in `/payments` and `/refunds` API response.
Described in #7467
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Helps HS consumer look at issuer specific error responses - these can be enabled on demand from connector's end.
## How did you test it?
Not possible to test raw acquirer codes in connector sandbox env. Can only be enabled and tested in production.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
c39ecda79a9b1df1ccb4e469111e0dfb92a3d82c
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7405
|
Bug: [FEATURE] display DuitNow QR code in expected color
### Feature Description
DuitNow is a realtime payment method offered in Malaysia. This works using a QR code which is scanned for completing the payment transactions.
Displaying the QR code has guidelines mentioned in - https://docs.developer.paynet.my/branding/duitnow/DuitNow%20Brand.pdf
Currently, HyperSwitch displays a basic QR code (in black), without following any guidelines. This needs to be rendered correctly on the payment links.
- Rendering the QR code in required color (#ED2E67) requires modifying the QR code's image data sent by the connector
- Other UI refactors will be made in SDK
### Possible Implementation
Confirm API response sends back `qr_code_information` as next_action. This field to contain below items
- Modified QR data in specified color
- QR image border color
- QR image display text
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 59ea6e97fbb..12da310ac61 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4406,6 +4406,8 @@ pub enum NextActionData {
#[schema(value_type = String)]
/// The url for Qr code given by the connector
qr_code_url: Option<Url>,
+ display_text: Option<String>,
+ border_color: Option<String>,
},
/// Contains url to fetch Qr code data
FetchQrCodeInformation {
@@ -4493,6 +4495,12 @@ pub enum QrCodeInformation {
qr_code_url: Url,
display_to_timestamp: Option<i64>,
},
+ QrColorDataUrl {
+ color_image_data_url: Url,
+ display_to_timestamp: Option<i64>,
+ display_text: Option<String>,
+ border_color: Option<String>,
+ },
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Eq, PartialEq, ToSchema)]
diff --git a/crates/common_utils/src/errors.rs b/crates/common_utils/src/errors.rs
index e62606b4585..9f653616738 100644
--- a/crates/common_utils/src/errors.rs
+++ b/crates/common_utils/src/errors.rs
@@ -103,6 +103,9 @@ pub enum QrCodeError {
/// Failed to encode data into Qr code
#[error("Failed to create Qr code")]
FailedToCreateQrCode,
+ /// Failed to parse hex color
+ #[error("Invalid hex color code supplied")]
+ InvalidHexColor,
}
/// Api Models construction error
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 2f8a979ba99..5c38a55dc0f 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -41,6 +41,7 @@ const GOOGLEPAY_API_VERSION_MINOR: u8 = 0;
const GOOGLEPAY_API_VERSION: u8 = 2;
use crate::{
+ constants,
types::{
PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData,
PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData,
@@ -1725,16 +1726,21 @@ impl From<RefundStatus> for enums::RefundStatus {
pub fn get_qr_metadata(
response: &DuitNowQrCodeResponse,
) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> {
- let image_data = QrImage::new_from_data(response.txn_data.request_data.qr_data.peek().clone())
- .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+ let image_data = QrImage::new_colored_from_data(
+ response.txn_data.request_data.qr_data.peek().clone(),
+ constants::DUIT_NOW_BRAND_COLOR,
+ )
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let image_data_url = Url::parse(image_data.data.clone().as_str()).ok();
let display_to_timestamp = None;
- if let Some(image_data_url) = image_data_url {
- let qr_code_info = payments::QrCodeInformation::QrDataUrl {
- image_data_url,
+ if let Some(color_image_data_url) = image_data_url {
+ let qr_code_info = payments::QrCodeInformation::QrColorDataUrl {
+ color_image_data_url,
display_to_timestamp,
+ display_text: Some(constants::DUIT_NOW_BRAND_TEXT.to_string()),
+ border_color: Some(constants::DUIT_NOW_BRAND_COLOR.to_string()),
};
Some(qr_code_info.encode_to_value())
diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs
index bf2f4c25843..51767bf327c 100644
--- a/crates/hyperswitch_connectors/src/constants.rs
+++ b/crates/hyperswitch_connectors/src/constants.rs
@@ -43,3 +43,7 @@ pub const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the co
pub const REFUND_VOIDED: &str = "Refund request has been voided.";
pub const LOW_BALANCE_ERROR_MESSAGE: &str = "Insufficient balance in the payment method";
+
+pub const DUIT_NOW_BRAND_COLOR: &str = "#ED2E67";
+
+pub const DUIT_NOW_BRAND_TEXT: &str = "MALAYSIA NATIONAL QR";
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 05657216d9d..e2b7c688aa5 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -51,7 +51,7 @@ use hyperswitch_domain_models::{
types::OrderDetailsWithAmount,
};
use hyperswitch_interfaces::{api, consts, errors, types::Response};
-use image::Luma;
+use image::{DynamicImage, ImageBuffer, ImageFormat, Luma, Rgba};
use masking::{ExposeInterface, PeekInterface, Secret};
use once_cell::sync::Lazy;
use regex::Regex;
@@ -4991,12 +4991,12 @@ impl QrImage {
.change_context(common_utils::errors::QrCodeError::FailedToCreateQrCode)?;
let qrcode_image_buffer = qr_code.render::<Luma<u8>>().build();
- let qrcode_dynamic_image = image::DynamicImage::ImageLuma8(qrcode_image_buffer);
+ let qrcode_dynamic_image = DynamicImage::ImageLuma8(qrcode_image_buffer);
let mut image_bytes = std::io::BufWriter::new(std::io::Cursor::new(Vec::new()));
// Encodes qrcode_dynamic_image and write it to image_bytes
- let _ = qrcode_dynamic_image.write_to(&mut image_bytes, image::ImageFormat::Png);
+ let _ = qrcode_dynamic_image.write_to(&mut image_bytes, ImageFormat::Png);
let image_data_source = format!(
"{},{}",
@@ -5007,6 +5007,58 @@ impl QrImage {
data: image_data_source,
})
}
+
+ pub fn new_colored_from_data(
+ data: String,
+ hex_color: &str,
+ ) -> Result<Self, error_stack::Report<common_utils::errors::QrCodeError>> {
+ let qr_code = qrcode::QrCode::new(data.as_bytes())
+ .change_context(common_utils::errors::QrCodeError::FailedToCreateQrCode)?;
+
+ let qrcode_image_buffer = qr_code.render::<Luma<u8>>().build();
+ let (width, height) = qrcode_image_buffer.dimensions();
+ let mut colored_image = ImageBuffer::new(width, height);
+ let rgb = Self::parse_hex_color(hex_color)?;
+
+ for (x, y, pixel) in qrcode_image_buffer.enumerate_pixels() {
+ let luminance = pixel.0[0];
+ let color = if luminance == 0 {
+ Rgba([rgb.0, rgb.1, rgb.2, 255])
+ } else {
+ Rgba([255, 255, 255, 255])
+ };
+ colored_image.put_pixel(x, y, color);
+ }
+
+ let qrcode_dynamic_image = DynamicImage::ImageRgba8(colored_image);
+ let mut image_bytes = std::io::Cursor::new(Vec::new());
+ qrcode_dynamic_image
+ .write_to(&mut image_bytes, ImageFormat::Png)
+ .change_context(common_utils::errors::QrCodeError::FailedToCreateQrCode)?;
+
+ let image_data_source = format!(
+ "{},{}",
+ QR_IMAGE_DATA_SOURCE_STRING,
+ BASE64_ENGINE.encode(image_bytes.get_ref())
+ );
+
+ Ok(Self {
+ data: image_data_source,
+ })
+ }
+
+ pub fn parse_hex_color(hex: &str) -> Result<(u8, u8, u8), common_utils::errors::QrCodeError> {
+ let hex = hex.trim_start_matches('#');
+ if hex.len() == 6 {
+ let r = u8::from_str_radix(&hex[0..2], 16).ok();
+ let g = u8::from_str_radix(&hex[2..4], 16).ok();
+ let b = u8::from_str_radix(&hex[4..6], 16).ok();
+ if let (Some(r), Some(g), Some(b)) = (r, g, b) {
+ return Ok((r, g, b));
+ }
+ }
+ Err(common_utils::errors::QrCodeError::InvalidHexColor)
+ }
}
#[cfg(test)]
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 545c058ce1c..70051bdd504 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -824,6 +824,8 @@ pub enum StripeNextAction {
image_data_url: Option<url::Url>,
display_to_timestamp: Option<i64>,
qr_code_url: Option<url::Url>,
+ border_color: Option<String>,
+ display_text: Option<String>,
},
FetchQrCodeInformation {
qr_code_fetch_url: url::Url,
@@ -869,10 +871,14 @@ pub(crate) fn into_stripe_next_action(
image_data_url,
display_to_timestamp,
qr_code_url,
+ border_color,
+ display_text,
} => StripeNextAction::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
+ border_color,
+ display_text,
},
payments::NextActionData::FetchQrCodeInformation { qr_code_fetch_url } => {
StripeNextAction::FetchQrCodeInformation { qr_code_fetch_url }
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 03cf9742f70..0b3c6cdd596 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -377,6 +377,8 @@ pub enum StripeNextAction {
image_data_url: Option<url::Url>,
display_to_timestamp: Option<i64>,
qr_code_url: Option<url::Url>,
+ border_color: Option<String>,
+ display_text: Option<String>,
},
FetchQrCodeInformation {
qr_code_fetch_url: url::Url,
@@ -422,10 +424,14 @@ pub(crate) fn into_stripe_next_action(
image_data_url,
display_to_timestamp,
qr_code_url,
+ display_text,
+ border_color,
} => StripeNextAction::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
+ display_text,
+ border_color,
},
payments::NextActionData::FetchQrCodeInformation { qr_code_fetch_url } => {
StripeNextAction::FetchQrCodeInformation { qr_code_fetch_url }
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index ad56394c5f8..12483aac8e2 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2960,6 +2960,8 @@ impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::paymen
image_data_url: Some(image_data_url),
qr_code_url: Some(qr_code_url),
display_to_timestamp,
+ border_color: None,
+ display_text: None,
},
api_models::payments::QrCodeInformation::QrDataUrl {
image_data_url,
@@ -2968,6 +2970,8 @@ impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::paymen
image_data_url: Some(image_data_url),
display_to_timestamp,
qr_code_url: None,
+ border_color: None,
+ display_text: None,
},
api_models::payments::QrCodeInformation::QrCodeImageUrl {
qr_code_url,
@@ -2976,6 +2980,20 @@ impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::paymen
qr_code_url: Some(qr_code_url),
image_data_url: None,
display_to_timestamp,
+ border_color: None,
+ display_text: None,
+ },
+ api_models::payments::QrCodeInformation::QrColorDataUrl {
+ color_image_data_url,
+ display_to_timestamp,
+ border_color,
+ display_text,
+ } => Self::QrCodeInformation {
+ qr_code_url: None,
+ image_data_url: Some(color_image_data_url),
+ display_to_timestamp,
+ border_color,
+ display_text,
},
}
}
|
2025-03-04T06:02:20Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR adds functionality to
- Create QR image data URI for a given hex color
- Send back the border color and display text message along with the QR data in `NextActionData` - which is consumed by SDK to take next action
Described in #7405
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
DuitNow is a realtime payment system which works by scanning QR codes. Displaying these QR codes has certain guidelines mentioned here - https://docs.developer.paynet.my/branding/duitnow/DuitNow%20Brand.pdf
This PR sends required data in the confirm API response which is consumed by SDK.
## How did you test it?
Tested locally by creating payment links and proceeding with DuitNow payment method.
<details>
<summary>Create a payment link (ensure DuitNow is enabled)</summary>
cURL
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_mdkyMYu7o5AvOHSe81Y5MYanl7eTn9rFTRg7DdMvIsJm88Iq5QtXrSihb94pVXmW' \
--data-raw '{"customer_id":"cus_AuvaBi0Ga8Wqx0AyKrYd","profile_id":"pro_7ez6O5T557WOZlcVlidL","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"amount":100,"currency":"MYR","payment_link":true,"capture_method":"automatic","billing":{"address":{"line1":"1467","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"MY","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"}},"email":"john.doe@example.co.in","session_expiry":100000,"return_url":"https://example.com","payment_link_config":{"theme":"#003264","display_sdk_only":true,"hide_card_nickname_field":true,"payment_button_colour":"#FFA445","custom_message_for_card_terms":"Pour vérifier votre compte, un montant de 0,00 € sera débité lorsque vous aurez cliqué sur le bouton « Confirmer »","payment_button_text":"Confirmer","payment_button_text_colour":"#003264","skip_status_screen":true,"background_colour":"#F9F9F9"}}'
Response
{"payment_id":"pay_o8k60sUsjHfrG7a4gExy","merchant_id":"merchant_1741062746","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":null,"client_secret":"pay_o8k60sUsjHfrG7a4gExy_secret_OVVV51kpUYJUdtXFJz1l","created":"2025-03-04T06:11:28.748Z","currency":"MYR","customer_id":"cus_AuvaBi0Ga8Wqx0AyKrYd","customer":{"id":"cus_AuvaBi0Ga8Wqx0AyKrYd","name":"John Nether","email":"john.doe@example.co.in","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"MY","line1":"1467","line2":null,"line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"order_details":null,"email":"john.doe@example.co.in","name":"John Nether","phone":"6168205362","return_url":"https://example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_AuvaBi0Ga8Wqx0AyKrYd","created_at":1741068688,"expires":1741072288,"secret":"epk_2abaa6e62d0d4b43af67b73aa52160c9"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1741062746/pay_o8k60sUsjHfrG7a4gExy?locale=en","secure_link":null,"payment_link_id":"plink_PLK7sgcmehAkqs93KUAq"},"profile_id":"pro_7ez6O5T557WOZlcVlidL","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-03-05T09:58:08.746Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-03-04T06:11:28.763Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null}
</details>
<details>
<summary>Select and proceed with DuitNow</summary>
<img width="498" alt="Screenshot 2025-03-04 at 11 41 48 AM" src="https://github.com/user-attachments/assets/80b2efcf-db64-49e1-ab9e-ac97ab10be6b" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
9bcffa6436e6b9207b1711768737a13783a2e907
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7392
|
Bug: [BUG] GooglePay for Ayden Fixed
GooglePay for Ayden Fixed
|
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 8aba3573f68..93a43f25b8a 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -568,6 +568,7 @@ pub enum AdyenPaymentMethod<'a> {
Eps(Box<BankRedirectionWithIssuer<'a>>),
#[serde(rename = "gcash")]
Gcash(Box<GcashData>),
+ #[serde(rename = "googlepay")]
Gpay(Box<AdyenGPay>),
#[serde(rename = "gopay_wallet")]
GoPay(Box<GoPayData>),
|
2025-02-27T12:28:31Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
GooglePay fixed in Ayden
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<img width="1063" alt="Screenshot 2025-02-27 at 6 39 19 PM" src="https://github.com/user-attachments/assets/eead90cb-da62-4e5d-9ade-f8f0f2f2de19" />
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Coa5dQU6Vo2ezZrfgvAlgmDed2NjJmuW1hTcmI5uMevC27Tkp4F16r5Om4HEb9UU' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"amount_to_capture": 6540,
"confirm": true,
"profile_id": null,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
"setup_future_usage": "on_session",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"customer_id": "customer123",
"phone_country_code": "+1",
"routing": {
"type": "single",
"data": "stripe"
},
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay": {
"type": "CARD",
"description": "Amex •••• 0002",
"info": {
"assurance_details": {
"account_verified": true,
"card_holder_authenticated": false
},
"card_details": "0002",
"card_network": "AMEX"
},
"tokenization_data": {
"token": "{\"signature\":\"MEYCIQC7ferzG3SQgMMoJ18frh9oLAdQigN4jTAeAlx26IoCawIhAIL/6we459IuANws+AeNbeU5+eBnscy7FBjaANj9lJmd\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"VFe6XC/1MKP2O9ETH6Uv/NUe0MtyHjAe0uqDsZ3b1jtUw/crQ+LIAEhgFt0+B2r6pqJdg56yYzZ4nuuEiIVMvgDtMr6Lz8bHRDv620RSFT+lfZOHFAX0JtKAzUSbfzR50tnMFAlBEPBfOKCGVKboA0g2dfQhfhyYFX5pqgEM8rg0/YHl5FPpfSH1ZaZQxM/PXwF/ju84zB9doOVyYyT6/jUtnoW6FmGChVZPSuV3o++y9Q+lOEGTjOEQTsLrWtqiRit3atkiLguzo57xrK6TE9hK6+3XXv8o/7gbBQPaxlXYWSbjRK4mHkOmkC0LTSiPVvJkKlY0SHMjKz85jwcttWs3LgPSHkKkFv+VM4vQiXIjAbmX1KMfgbLcEVNfAWL+/j/IwSif66DVakkO277KcsVhpQC2y/p/1VMTDtg45guT2kMVJsqQORumwJPvYumVgpwIFmlg5uDKo7j0ioyeagp67lBdhZbsyvyJsyzFbSCyGoXaFCJbYqNQIVl8ioFuCIe50ePc79Mkxony\\\",\\\"ephemeralPublicKey\\\":\\\"BBWzyB4tX5yqOEDaryLLlX9h91M2298ChS0lYgHLbXwN/eEh0V8w2PX/psg12dY2do2ksP2NA3be/e+9NhvTlU0\\\\u003d\\\",\\\"tag\\\":\\\"123ZOhok0+5uiBUYaO3i5U/h73+YsXPbwK8IhinHVl8\\\\u003d\\\"}\"}",
"type": "PAYMENT_GATEWAY"
}
}
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 6540,
"account_name": "transaction_processing"
}
],
"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": "128.0.0.1"
},
"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"
}
},
"connector_metadata": {
"noon": {
"order_category": "pay"
}
},
"payment_link": false,
"payment_link_config": {
"theme": "",
"logo": "",
"seller_name": "",
"sdk_layout": "",
"display_sdk_only": false,
"enabled_saved_payment_method": false
},
"payment_type": "normal",
"request_incremental_authorization": false,
"merchant_order_reference_id": "test_ord",
"session_expiry": 900
}'
```
Response
```
{
"payment_id": "pay_BHtu7Av3hbxF6YGyNg6y",
"merchant_id": "merchant_1740661643",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "adyen",
"client_secret": "pay_BHtu7Av3hbxF6YGyNg6y_secret_Ta6ChMs3WiuxCppvsKm8",
"created": "2025-02-27T13:07:38.606Z",
"currency": "USD",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"google_pay": {
"last4": "0002",
"card_network": "AMEX",
"type": "CARD"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "google_pay",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "customer123",
"created_at": 1740661658,
"expires": 1740665258,
"secret": "epk_fa7ee7a7801840348e3e6f6e6f20adf3"
},
"manual_retry_allowed": false,
"connector_transaction_id": "LMSBT86ZTGGNFL75",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": "pay_BHtu7Av3hbxF6YGyNg6y_1",
"payment_link": null,
"profile_id": "pro_5CrLzkPfIhQSZT0e92na",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_kc9GbBR2tswsauYa0J2O",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-27T13:22:38.605Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-27T13:07:40.697Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
5965d0f8acf486909951e427b578aae8d630de13
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7403
|
Bug: [ENHANCEMENT] Payment link enhancements
Payment link flows to be updated, below is a list of enhancements -
**UI**
- Check the existing UI on Windows based browsers, and ensure it's rendered as expected
**Flows**
- In case `skip_status_screen` is true, re-opening the payment link on a terminal status should redirect to end URL (current behavior is to display the status screen)
- In case a payment link was opened in any state other than `requires_payment_method`, handle the state correctly
- for `requires_customer_action`, payment link should resume the journey where the user abandoned it
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cd8b8458364..4ca9f57efb3 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -12587,6 +12587,14 @@
"type": "string",
"description": "The url for Qr code given by the connector"
},
+ "display_text": {
+ "type": "string",
+ "nullable": true
+ },
+ "border_color": {
+ "type": "string",
+ "nullable": true
+ },
"type": {
"type": "string",
"enum": [
@@ -13983,6 +13991,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
+ },
+ "sdk_ui_rules": {
+ "type": "object",
+ "description": "SDK configuration rules",
+ "additionalProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "nullable": true
+ },
+ "payment_link_ui_rules": {
+ "type": "object",
+ "description": "Payment link configuration rules",
+ "additionalProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "nullable": true
}
}
},
@@ -14098,6 +14128,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
+ },
+ "sdk_ui_rules": {
+ "type": "object",
+ "description": "SDK configuration rules",
+ "additionalProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "nullable": true
+ },
+ "payment_link_ui_rules": {
+ "type": "object",
+ "description": "Payment link configuration rules",
+ "additionalProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "nullable": true
}
}
},
@@ -15301,13 +15353,29 @@
"description": "The return url to which the user should be redirected to",
"nullable": true
},
- "associated_payment": {
+ "next_action": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentsResponse"
+ "$ref": "#/components/schemas/NextActionData"
}
],
"nullable": true
+ },
+ "authentication_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AuthenticationDetails"
+ }
+ ],
+ "nullable": true
+ },
+ "associated_payment_methods": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/id_type.GlobalPaymentMethodId"
+ },
+ "description": "The payment method that was created using this payment method session",
+ "nullable": true
}
}
},
@@ -15542,60 +15610,6 @@
},
"additionalProperties": false
},
- "PaymentMethodsSessionResponse": {
- "type": "object",
- "required": [
- "id",
- "customer_id",
- "expires_at",
- "client_secret"
- ],
- "properties": {
- "id": {
- "type": "string",
- "example": "12345_pms_01926c58bc6e77c09e809964e72af8c8"
- },
- "customer_id": {
- "type": "string",
- "description": "The customer id for which the payment methods session is to be created",
- "example": "12345_cus_01926c58bc6e77c09e809964e72af8c8"
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "psp_tokenization": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PspTokenization"
- }
- ],
- "nullable": true
- },
- "network_tokenization": {
- "allOf": [
- {
- "$ref": "#/components/schemas/NetworkTokenization"
- }
- ],
- "nullable": true
- },
- "expires_at": {
- "type": "string",
- "format": "date-time",
- "description": "The iso timestamp when the session will expire\nTrying to retrieve the session or any operations on the session after this time will result in an error",
- "example": "2023-01-18T11:04:09.922Z"
- },
- "client_secret": {
- "type": "string",
- "description": "Client Secret"
- }
- }
- },
"PaymentMethodsSessionUpdateRequest": {
"type": "object",
"properties": {
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 5d31ea70994..d5a4d89910b 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2810,6 +2810,10 @@ pub struct PaymentLinkConfigRequest {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
+ /// SDK configuration rules
+ pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
+ /// Payment link configuration rules
+ pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)]
@@ -2891,6 +2895,10 @@ pub struct PaymentLinkConfig {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
+ /// SDK configuration rules
+ pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
+ /// Payment link configuration rules
+ pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 12da310ac61..813408da0ea 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -7831,6 +7831,8 @@ pub struct PaymentLinkDetails {
pub payment_button_colour: Option<String>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
+ pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
+ pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}
#[derive(Debug, serde::Serialize, Clone)]
@@ -7846,6 +7848,8 @@ pub struct SecurePaymentLinkDetails {
pub payment_button_colour: Option<String>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
+ pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
+ pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 744193bf51e..44f32c6eb4b 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -644,6 +644,8 @@ pub struct PaymentLinkConfigRequest {
pub skip_status_screen: Option<bool>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
+ pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
+ pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq)]
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index a2b3c406a2a..8845a92ba6a 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -187,6 +187,12 @@ pub struct PaymentLinkConfigRequestForPayments {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
+ /// SDK configuration rules
+ pub sdk_ui_rules:
+ Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>,
+ /// Payment link configuration rules
+ pub payment_link_ui_rules:
+ Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>,
}
common_utils::impl_to_sql_from_sql_json!(PaymentLinkConfigRequestForPayments);
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index c97753a6dc0..2d2a4413afc 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -412,6 +412,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen: item.skip_status_screen,
background_colour: item.background_colour,
payment_button_text_colour: item.payment_button_text_colour,
+ sdk_ui_rules: item.sdk_ui_rules,
+ payment_link_ui_rules: item.payment_link_ui_rules,
}
}
fn convert_back(self) -> api_models::admin::PaymentLinkConfigRequest {
@@ -433,6 +435,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen,
background_colour,
payment_button_text_colour,
+ sdk_ui_rules,
+ payment_link_ui_rules,
} = self;
api_models::admin::PaymentLinkConfigRequest {
theme,
@@ -458,6 +462,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen,
background_colour,
payment_button_text_colour,
+ sdk_ui_rules,
+ payment_link_ui_rules,
}
}
}
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index e62d9946416..292f582df9a 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -135,6 +135,8 @@ pub async fn form_payment_link_data(
skip_status_screen: None,
background_colour: None,
payment_button_text_colour: None,
+ sdk_ui_rules: None,
+ payment_link_ui_rules: None,
}
};
@@ -286,6 +288,8 @@ pub async fn form_payment_link_data(
skip_status_screen: payment_link_config.skip_status_screen,
background_colour: payment_link_config.background_colour.clone(),
payment_button_text_colour: payment_link_config.payment_button_text_colour.clone(),
+ sdk_ui_rules: payment_link_config.sdk_ui_rules.clone(),
+ payment_link_ui_rules: payment_link_config.payment_link_ui_rules.clone(),
};
Ok((
@@ -342,6 +346,8 @@ pub async fn initiate_secure_payment_link_flow(
skip_status_screen: payment_link_config.skip_status_screen,
background_colour: payment_link_config.background_colour,
payment_button_text_colour: payment_link_config.payment_button_text_colour,
+ sdk_ui_rules: payment_link_config.sdk_ui_rules,
+ payment_link_ui_rules: payment_link_config.payment_link_ui_rules,
};
let js_script = format!(
"window.__PAYMENT_DETAILS = {}",
@@ -653,6 +659,8 @@ pub fn get_payment_link_config_based_on_priority(
skip_status_screen,
background_colour,
payment_button_text_colour,
+ sdk_ui_rules,
+ payment_link_ui_rules,
) = get_payment_link_config_value!(
payment_create_link_config,
business_theme_configs,
@@ -664,7 +672,9 @@ pub fn get_payment_link_config_based_on_priority(
(payment_button_colour),
(skip_status_screen),
(background_colour),
- (payment_button_text_colour)
+ (payment_button_text_colour),
+ (sdk_ui_rules),
+ (payment_link_ui_rules),
);
let payment_link_config =
@@ -690,6 +700,8 @@ pub fn get_payment_link_config_based_on_priority(
payment_button_colour,
background_colour,
payment_button_text_colour,
+ sdk_ui_rules,
+ payment_link_ui_rules,
};
Ok((payment_link_config, domain_name))
@@ -798,6 +810,8 @@ pub async fn get_payment_link_status(
skip_status_screen: None,
background_colour: None,
payment_button_text_colour: None,
+ sdk_ui_rules: None,
+ payment_link_ui_rules: None,
}
};
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
index 811ae799d0f..5b8267c57a9 100644
--- 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
@@ -231,8 +231,8 @@ function boot() {
link.type = "image/x-icon";
document.head.appendChild(link);
}
- // Render UI
+ // Render UI
if (paymentDetails.display_sdk_only) {
renderSDKHeader(paymentDetails);
renderBranding(paymentDetails);
@@ -247,7 +247,6 @@ function boot() {
renderSDKHeader(paymentDetails);
}
-
// Deal w loaders
show("#sdk-spinner");
hide("#page-spinner");
@@ -256,6 +255,12 @@ function boot() {
// Add event listeners
initializeEventListeners(paymentDetails);
+ // Update payment link styles
+ var paymentLinkUiRules = paymentDetails.payment_link_ui_rules;
+ if (paymentLinkUiRules !== null && typeof paymentLinkUiRules === "object" && Object.getPrototypeOf(paymentLinkUiRules) === Object.prototype) {
+ updatePaymentLinkUi(paymentLinkUiRules);
+ }
+
// Initialize SDK
// @ts-ignore
if (window.Hyper) {
@@ -461,7 +466,7 @@ function handleSubmit(e) {
window.top.location.href = url.toString();
} else {
redirectToStatus();
- }
+ }
})
.catch(function (error) {
console.error("Error confirming payment_intent", error);
@@ -801,7 +806,7 @@ function renderBranding(paymentDetails) {
* - Renders background image in the payment details section
* @param {PaymentDetails} paymentDetails
*/
-function renderBackgroundImage(paymentDetails) {
+function renderBackgroundImage(paymentDetails) {
var backgroundImage = paymentDetails.background_image;
if (typeof backgroundImage === "object" && backgroundImage !== null) {
var paymentDetailsNode = document.getElementById("hyper-checkout-details");
@@ -1104,3 +1109,24 @@ function renderSDKHeader(paymentDetails) {
sdkHeaderNode.append(sdkHeaderItemNode);
}
}
+
+/**
+ * Trigger - post UI render
+ * Use - add CSS rules for the payment link
+ * @param {Object} paymentLinkUiRules
+ */
+function updatePaymentLinkUi(paymentLinkUiRules) {
+ Object.keys(paymentLinkUiRules).forEach(function (selector) {
+ try {
+ var node = document.querySelector(selector);
+ if (node instanceof HTMLElement) {
+ var styles = paymentLinkUiRules[selector];
+ Object.keys(styles).forEach(function (property) {
+ node.style[property] = styles[property];
+ });
+ }
+ } catch (error) {
+ console.error("Failed to apply styles to selector", selector, error);
+ }
+ })
+}
\ No newline at end of file
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link_initiator.js b/crates/router/src/core/payment_link/payment_link_initiate/payment_link_initiator.js
index 6abe5f7d5b2..ca6a944baaa 100644
--- a/crates/router/src/core/payment_link/payment_link_initiate/payment_link_initiator.js
+++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link_initiator.js
@@ -10,7 +10,8 @@
function initializeSDK() {
// @ts-ignore
var paymentDetails = window.__PAYMENT_DETAILS;
- var client_secret = paymentDetails.client_secret;
+ var clientSecret = paymentDetails.client_secret;
+ var sdkUiRules = paymentDetails.sdk_ui_rules;
var appearance = {
variables: {
colorPrimary: paymentDetails.theme || "rgb(0, 109, 249)",
@@ -24,6 +25,9 @@ function initializeSDK() {
colorBackground: "rgb(255, 255, 255)",
},
};
+ if (sdkUiRules !== null && typeof sdkUiRules === "object" && Object.getPrototypeOf(sdkUiRules) === Object.prototype) {
+ appearance.rules = sdkUiRules;
+ }
// @ts-ignore
hyper = window.Hyper(pub_key, {
isPreloadEnabled: false,
@@ -37,12 +41,12 @@ function initializeSDK() {
// @ts-ignore
widgets = hyper.widgets({
appearance: appearance,
- clientSecret: client_secret,
+ clientSecret: clientSecret,
locale: paymentDetails.locale,
});
var type =
paymentDetails.sdk_layout === "spaced_accordion" ||
- paymentDetails.sdk_layout === "accordion"
+ paymentDetails.sdk_layout === "accordion"
? "accordion"
: paymentDetails.sdk_layout;
var hideCardNicknameField = paymentDetails.hide_card_nickname_field;
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
index a8a00e4de9d..9b5a144d29a 100644
--- a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
+++ b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
@@ -31,7 +31,8 @@ if (!isFramed) {
function initializeSDK() {
// @ts-ignore
var paymentDetails = window.__PAYMENT_DETAILS;
- var client_secret = paymentDetails.client_secret;
+ var clientSecret = paymentDetails.client_secret;
+ var sdkUiRules = paymentDetails.sdk_ui_rules;
var appearance = {
variables: {
colorPrimary: paymentDetails.theme || "rgb(0, 109, 249)",
@@ -45,6 +46,9 @@ if (!isFramed) {
colorBackground: "rgb(255, 255, 255)",
},
};
+ if (sdkUiRules !== null && typeof sdkUiRules === "object" && Object.getPrototypeOf(sdkUiRules) === Object.prototype) {
+ appearance.rules = sdkUiRules;
+ }
// @ts-ignore
hyper = window.Hyper(pub_key, {
isPreloadEnabled: false,
@@ -58,12 +62,12 @@ if (!isFramed) {
// @ts-ignore
widgets = hyper.widgets({
appearance: appearance,
- clientSecret: client_secret,
+ clientSecret: clientSecret,
locale: paymentDetails.locale,
});
var type =
paymentDetails.sdk_layout === "spaced_accordion" ||
- paymentDetails.sdk_layout === "accordion"
+ paymentDetails.sdk_layout === "accordion"
? "accordion"
: paymentDetails.sdk_layout;
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 12483aac8e2..eb0f246fdcb 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -4431,6 +4431,8 @@ impl ForeignFrom<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen: config.skip_status_screen,
background_colour: config.background_colour,
payment_button_text_colour: config.payment_button_text_colour,
+ sdk_ui_rules: config.sdk_ui_rules,
+ payment_link_ui_rules: config.payment_link_ui_rules,
}
}
}
@@ -4499,6 +4501,8 @@ impl ForeignFrom<diesel_models::PaymentLinkConfigRequestForPayments>
skip_status_screen: config.skip_status_screen,
background_colour: config.background_colour,
payment_button_text_colour: config.payment_button_text_colour,
+ sdk_ui_rules: config.sdk_ui_rules,
+ payment_link_ui_rules: config.payment_link_ui_rules,
}
}
}
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 9557aabbe81..a112be46188 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -456,7 +456,7 @@ pub async fn connector_retrieve(
let id = path.into_inner();
let payload = web::Json(admin::MerchantConnectorId { id: id.clone() }).into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -477,7 +477,7 @@ pub async fn connector_retrieve(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -491,7 +491,7 @@ pub async fn connector_list(
let flow = Flow::MerchantConnectorsList;
let profile_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -507,7 +507,7 @@ pub async fn connector_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs
index 92b5d667daa..64b46eb2f55 100644
--- a/crates/router/src/routes/ephemeral_key.rs
+++ b/crates/router/src/routes/ephemeral_key.rs
@@ -64,7 +64,7 @@ pub async fn client_secret_create(
) -> HttpResponse {
let flow = Flow::EphemeralKeyCreate;
let payload = json_payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -80,7 +80,7 @@ pub async fn client_secret_create(
},
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -93,7 +93,7 @@ pub async fn client_secret_delete(
) -> HttpResponse {
let flow = Flow::EphemeralKeyDelete;
let payload = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -101,6 +101,6 @@ pub async fn client_secret_delete(
|state, _: auth::AuthenticationData, req, _| helpers::delete_client_secret(state, req),
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index d89f3c65cbe..31e7638b3ef 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -53,7 +53,7 @@ pub async fn retrieve_apple_pay_verified_domains(
let merchant_id = ¶ms.merchant_id;
let mca_id = ¶ms.merchant_connector_account_id;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -73,6 +73,6 @@ pub async fn retrieve_apple_pay_verified_domains(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 514ddbbbb50..2b563f5644b 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -2164,6 +2164,8 @@ impl ForeignFrom<api_models::admin::PaymentLinkConfigRequest>
payment_button_colour: item.payment_button_colour,
background_colour: item.background_colour,
payment_button_text_colour: item.payment_button_text_colour,
+ sdk_ui_rules: item.sdk_ui_rules,
+ payment_link_ui_rules: item.payment_link_ui_rules,
}
}
}
@@ -2192,6 +2194,8 @@ impl ForeignFrom<diesel_models::business_profile::PaymentLinkConfigRequest>
payment_button_colour: item.payment_button_colour,
background_colour: item.background_colour,
payment_button_text_colour: item.payment_button_text_colour,
+ sdk_ui_rules: item.sdk_ui_rules,
+ payment_link_ui_rules: item.payment_link_ui_rules,
}
}
}
|
2025-03-04T13:52:10Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR exposes customizations for payment links. Below configs are added -
- SDK UI rules - https://docs.hyperswitch.io/explore-hyperswitch/merchant-controls/integration-guide/web/customization#id-4.-rules
- Payment Link UI rules - similar to SDK UI rules, but for payment link template*
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Gives granular control to the payment link consumer for designing their UI.
## How did you test it?
Tested locally.
<details>
<summary>1. Add a payment link style ID</summary>
cURL
curl --location --request POST 'http://localhost:8080/account/merchant_1741095653/business_profile/pro_dgzCAaE0KhqCTj6cY5a7' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{"payment_link_config":{"allowed_domains":["*"],"business_specific_configs":{"style1":{"enabled_saved_payment_method":true,"theme":"#E71D36","logo":"https://hyperswitch.io/favicon.ico","sdk_ui_rules":{".Label":{"fontWeight":"700 !important","fontSize":"13px !important","color":"#003264 !important","opacity":"1 !important"}},"payment_link_ui_rules":{"#submit":{"color":"#003264","fontWeight":"700","fontSize":"18px","padding":"25px 0","borderRadius":"20px","backgroundColor":"#ffc439"},"#hyper-checkout-sdk":{"backgroundColor":"#003264"}}}}}}'
Response
{"merchant_id":"merchant_1741095653","profile_id":"pro_dgzCAaE0KhqCTj6cY5a7","profile_name":"IN_default","return_url":"https://google.com/success","enable_payment_response_hash":true,"payment_response_hash_key":"fVkaUtGhpJbDbwJ6bkDO1MX6yRgCNlJPSyaaMkOfe8izhPgWUGS8mdP8p95t5gqp","redirect_to_merchant_with_http_post":false,"webhook_details":{"webhook_version":"1.0.1","webhook_username":"random","webhook_password":"pass","webhook_url":"https://webhook.site/c5368f5d-882b-4d3a-b5be-f372294b6146","payment_created_enabled":true,"payment_succeeded_enabled":true,"payment_failed_enabled":true},"metadata":null,"routing_algorithm":null,"intent_fulfillment_time":900,"frm_routing_algorithm":null,"payout_routing_algorithm":null,"applepay_verified_domains":null,"session_expiry":900,"payment_link_config":{"domain_name":null,"theme":"#1A1A1A","logo":"https://hyperswitch.io/favicon.ico","seller_name":null,"sdk_layout":null,"display_sdk_only":null,"enabled_saved_payment_method":true,"hide_card_nickname_field":null,"show_card_form_by_default":null,"transaction_details":null,"background_image":null,"details_layout":null,"payment_button_text":"Proceed to Payment!","custom_message_for_card_terms":"Hello","payment_button_colour":null,"skip_status_screen":null,"payment_button_text_colour":null,"background_colour":null,"sdk_ui_rules":{".Label":{"fontWeight":"700 !important","fontSize":"13px !important","opacity":"1 !important","backgroundColor":"red !important","color":"#003264 !important"}},"payment_link_ui_rules":null,"business_specific_configs":{"style2":{"theme":"#1A1A1A","logo":"https://hyperswitch.io/favicon.ico","seller_name":null,"sdk_layout":null,"display_sdk_only":null,"enabled_saved_payment_method":true,"hide_card_nickname_field":null,"show_card_form_by_default":null,"transaction_details":null,"background_image":null,"details_layout":null,"payment_button_text":null,"custom_message_for_card_terms":null,"payment_button_colour":null,"skip_status_screen":null,"payment_button_text_colour":null,"background_colour":null,"sdk_ui_rules":null,"payment_link_ui_rules":null},"style1":{"theme":"#E71D36","logo":"https://hyperswitch.io/favicon.ico","seller_name":null,"sdk_layout":null,"display_sdk_only":null,"enabled_saved_payment_method":true,"hide_card_nickname_field":null,"show_card_form_by_default":null,"transaction_details":null,"background_image":null,"details_layout":null,"payment_button_text":null,"custom_message_for_card_terms":null,"payment_button_colour":null,"skip_status_screen":null,"payment_button_text_colour":null,"background_colour":null,"sdk_ui_rules":{".Label":{"color":"#003264 !important","opacity":"1 !important","fontWeight":"700 !important","fontSize":"13px !important"}},"payment_link_ui_rules":{"#submit":{"color":"#003264","fontSize":"18px","backgroundColor":"#ffc439","borderRadius":"20px","padding":"25px 0","fontWeight":"700"},"#hyper-checkout-sdk":{"backgroundColor":"#003264"}}}},"allowed_domains":["*"],"branding_visibility":null},"authentication_connector_details":null,"use_billing_as_payment_method_billing":true,"extended_card_info_config":null,"collect_shipping_details_from_wallet_connector":false,"collect_billing_details_from_wallet_connector":false,"always_collect_shipping_details_from_wallet_connector":false,"always_collect_billing_details_from_wallet_connector":false,"is_connector_agnostic_mit_enabled":true,"payout_link_config":null,"outgoing_webhook_custom_http_headers":null,"tax_connector_id":null,"is_tax_connector_enabled":false,"is_network_tokenization_enabled":true,"is_auto_retries_enabled":false,"max_auto_retries_enabled":null,"always_request_extended_authorization":null,"is_click_to_pay_enabled":true,"authentication_product_ids":null,"card_testing_guard_config":{"card_ip_blocking_status":"disabled","card_ip_blocking_threshold":3,"guest_user_card_blocking_status":"disabled","guest_user_card_blocking_threshold":10,"customer_id_blocking_status":"disabled","customer_id_blocking_threshold":5,"card_testing_guard_expiry":3600},"is_clear_pan_retries_enabled":false}
</details>
<details>
<summary>2. Create a payment link</summary>
cURL
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_R70SBQ7gQzMiqsCrbSGMBTEtsKbNkgc8sXo5yHgpEA0mvT8BktGLXrn9zPOxLwpf' \
--data '{"customer_id":"cus_jJuzSZ5cVZ5mgBGGUNYs","profile_id":"pro_dgzCAaE0KhqCTj6cY5a7","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"amount":100,"currency":"EUR","payment_link":true,"setup_future_usage":"off_session","capture_method":"automatic","session_expiry":100000,"return_url":"https://example.com","payment_link_config_id":"style1"}'
Response
{"payment_id":"pay_1QLObAU2blLbNSfehTJN","merchant_id":"merchant_1741095653","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":null,"client_secret":"pay_1QLObAU2blLbNSfehTJN_secret_oRqjfv36rG6plNEBHvvQ","created":"2025-03-04T22:10:37.490Z","currency":"EUR","customer_id":"cus_jJuzSZ5cVZ5mgBGGUNYs","customer":{"id":"cus_jJuzSZ5cVZ5mgBGGUNYs","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":"John Nether","phone":"6168205362","return_url":"https://example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_jJuzSZ5cVZ5mgBGGUNYs","created_at":1741126237,"expires":1741129837,"secret":"epk_5255cf68bc6947db9fcf59f285eeb37b"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1741095653/pay_1QLObAU2blLbNSfehTJN?locale=en","secure_link":"http://localhost:8080/payment_link/s/merchant_1741095653/pay_1QLObAU2blLbNSfehTJN?locale=en","payment_link_id":"plink_Uve1VxVAdO7XJAkBQzMg"},"profile_id":"pro_dgzCAaE0KhqCTj6cY5a7","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-03-06T01:57:17.488Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-03-04T22:10:37.496Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null}
<img width="646" alt="Screenshot 2025-03-05 at 3 41 38 AM" src="https://github.com/user-attachments/assets/5ceef6f4-e935-463d-904c-6855de2bd4a3" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
### Note
**\* - EDIT 1**
|
759474cd4866aa7a6fba055594b9a96de26681a4
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7391
|
Bug: docs:correction of content in the api-ref
|
2025-02-27T07:12:48Z
|
Corrected the tip content.
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [X] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Corrected the content of the tip.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
closes #7391
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
d945da635dfc84a2135aef456292fa54d9d5982e
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7363
|
Bug: chore: resolve v2 warnings in diesel_models
Resolve v2 warnings in diesel_models.
|
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 769a185c13c..be7f1b7ebeb 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -11,7 +11,7 @@ use crate::enums as storage_enums;
#[cfg(feature = "v1")]
use crate::schema::merchant_connector_account;
#[cfg(feature = "v2")]
-use crate::{enums, schema_v2::merchant_connector_account, types};
+use crate::schema_v2::merchant_connector_account;
#[cfg(feature = "v1")]
#[derive(
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 63f039c32f9..0ec57d9a911 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -966,7 +966,7 @@ impl PaymentAttemptUpdateInternal {
#[cfg(feature = "v2")]
impl PaymentAttemptUpdate {
- pub fn apply_changeset(self, source: PaymentAttempt) -> PaymentAttempt {
+ pub fn apply_changeset(self, _source: PaymentAttempt) -> PaymentAttempt {
todo!()
// let PaymentAttemptUpdateInternal {
// net_amount,
@@ -1188,7 +1188,7 @@ impl PaymentAttemptUpdate {
#[cfg(feature = "v2")]
impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
- fn from(payment_attempt_update: PaymentAttemptUpdate) -> Self {
+ fn from(_payment_attempt_update: PaymentAttemptUpdate) -> Self {
todo!()
// match payment_attempt_update {
// PaymentAttemptUpdate::Update {
diff --git a/crates/diesel_models/src/query/merchant_account.rs b/crates/diesel_models/src/query/merchant_account.rs
index ab51953b6ef..0b641217d4d 100644
--- a/crates/diesel_models/src/query/merchant_account.rs
+++ b/crates/diesel_models/src/query/merchant_account.rs
@@ -1,5 +1,8 @@
+#[cfg(feature = "v1")]
use common_types::consts::API_VERSION;
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
+#[cfg(feature = "v1")]
+use diesel::BoolExpressionMethods;
+use diesel::{associations::HasTable, ExpressionMethods, Table};
use super::generics;
#[cfg(feature = "v1")]
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index 2543ab41461..1226f44221a 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -1,9 +1,11 @@
+#[cfg(feature = "v1")]
use std::collections::HashSet;
use async_bb8_diesel::AsyncRunQueryDsl;
+#[cfg(feature = "v1")]
+use diesel::Table;
use diesel::{
- associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods,
- QueryDsl, Table,
+ associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl,
};
use error_stack::{report, ResultExt};
@@ -12,14 +14,14 @@ use super::generics;
use crate::schema::payment_attempt::dsl;
#[cfg(feature = "v2")]
use crate::schema_v2::payment_attempt::dsl;
+#[cfg(feature = "v1")]
+use crate::{enums::IntentStatus, payment_attempt::PaymentAttemptUpdate, PaymentIntent};
use crate::{
- enums::{self, IntentStatus},
+ enums::{self},
errors::DatabaseError,
- payment_attempt::{
- PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate, PaymentAttemptUpdateInternal,
- },
+ payment_attempt::{PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdateInternal},
query::generics::db_metrics,
- PaymentIntent, PgPooledConn, StorageResult,
+ PgPooledConn, StorageResult,
};
impl PaymentAttemptNew {
diff --git a/crates/diesel_models/src/query/payment_method.rs b/crates/diesel_models/src/query/payment_method.rs
index 62f6f37ba52..efb9198a28f 100644
--- a/crates/diesel_models/src/query/payment_method.rs
+++ b/crates/diesel_models/src/query/payment_method.rs
@@ -1,7 +1,11 @@
use async_bb8_diesel::AsyncRunQueryDsl;
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+use diesel::Table;
use diesel::{
- associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods,
- QueryDsl, Table,
+ associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl,
};
use error_stack::ResultExt;
diff --git a/crates/diesel_models/src/query/user/sample_data.rs b/crates/diesel_models/src/query/user/sample_data.rs
index 8ef4b1e9303..40cd264c052 100644
--- a/crates/diesel_models/src/query/user/sample_data.rs
+++ b/crates/diesel_models/src/query/user/sample_data.rs
@@ -14,9 +14,11 @@ use crate::schema_v2::{
refund::dsl as refund_dsl,
};
use crate::{
- errors, schema::dispute::dsl as dispute_dsl, user, Dispute, DisputeNew, PaymentAttempt,
- PaymentIntent, PaymentIntentNew, PgPooledConn, Refund, RefundNew, StorageResult,
+ errors, schema::dispute::dsl as dispute_dsl, Dispute, DisputeNew, PaymentAttempt,
+ PaymentIntent, PgPooledConn, Refund, RefundNew, StorageResult,
};
+#[cfg(feature = "v1")]
+use crate::{user, PaymentIntentNew};
#[cfg(feature = "v1")]
pub async fn insert_payment_intents(
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 9212d416cb7..26c1834eb6d 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -1,20 +1,23 @@
+#[cfg(feature = "v1")]
use common_enums::{
AttemptStatus, AuthenticationType, CaptureMethod, Currency, PaymentExperience, PaymentMethod,
PaymentMethodType,
};
+#[cfg(feature = "v1")]
use common_types::primitive_wrappers::{
ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,
};
+#[cfg(feature = "v1")]
use common_utils::types::{ConnectorTransactionId, MinorUnit};
+#[cfg(feature = "v1")]
use serde::{Deserialize, Serialize};
+#[cfg(feature = "v1")]
use time::PrimitiveDateTime;
#[cfg(feature = "v1")]
-use crate::schema::payment_attempt;
-#[cfg(feature = "v2")]
-use crate::schema_v2::payment_attempt;
use crate::{
enums::{MandateDataType, MandateDetails},
+ schema::payment_attempt,
ConnectorMandateReferenceId, PaymentAttemptNew,
};
|
2025-02-24T10:36:27Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR resolves the v2 warnings generated in diesel_models.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
eabef328c665cfbaf953a5eb15bd15484c62dcf7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7379
|
Bug: [REFACTOR] Multiple SDK queries fixed
Multiple SDK queries fixed:
Modified field_type text to some unique enum
Corrected multiple required fields
Voucher payments error billing.phone.number is required fixed
Cashapp and Swish payment_experience fixed.
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 6ae46a5ede0..c2a1261508a 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -232,6 +232,7 @@ pub enum FieldType {
UserShippingAddressPincode,
UserShippingAddressState,
UserShippingAddressCountry { options: Vec<String> },
+ UserSocialSecurityNumber,
UserBlikCode,
UserBank,
UserBankAccountNumber,
diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs
index ed3319816d5..63c7d99ee17 100644
--- a/crates/connector_configs/src/transformer.rs
+++ b/crates/connector_configs/src/transformer.rs
@@ -66,6 +66,9 @@ impl DashboardRequestPayload {
(_, PaymentMethodType::DirectCarrierBilling) => {
Some(api_models::enums::PaymentExperience::CollectOtp)
}
+ (_, PaymentMethodType::Cashapp) | (_, PaymentMethodType::Swish) => {
+ Some(api_models::enums::PaymentExperience::DisplayQrCode)
+ }
_ => Some(api_models::enums::PaymentExperience::RedirectToUrl),
},
}
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index b63c4eea2a1..6c3ba6982b3 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -189,6 +189,7 @@ merchant_secret="Source verification key"
payment_method_type = "momo"
[[adyen.wallet]]
payment_method_type = "swish"
+ payment_experience = "display_qr_code"
[[adyen.wallet]]
payment_method_type = "touch_n_go"
[[adyen.voucher]]
@@ -3297,6 +3298,7 @@ merchant_secret="Source verification key"
payment_method_type = "ali_pay"
[[stripe.wallet]]
payment_method_type = "cashapp"
+ payment_experience = "display_qr_code"
is_verifiable = true
[stripe.connector_auth.HeaderKey]
api_key="Secret Key"
diff --git a/crates/hyperswitch_domain_models/src/address.rs b/crates/hyperswitch_domain_models/src/address.rs
index c9beb359c43..f8e38ae8a35 100644
--- a/crates/hyperswitch_domain_models/src/address.rs
+++ b/crates/hyperswitch_domain_models/src/address.rs
@@ -23,10 +23,18 @@ impl Address {
.email
.clone()
.or(other.and_then(|other| other.email.clone())),
- phone: self
- .phone
- .clone()
- .or(other.and_then(|other| other.phone.clone())),
+ phone: {
+ self.phone
+ .clone()
+ .and_then(|phone_details| {
+ if phone_details.number.is_some() {
+ Some(phone_details)
+ } else {
+ None
+ }
+ })
+ .or_else(|| other.and_then(|other| other.phone.clone()))
+ },
}
}
}
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 3849054045c..89058884c9d 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -3566,9 +3566,9 @@ impl Default for settings::RequiredFields {
}
),
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
- required_field: "billing.phone.number".to_string(),
+ required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
@@ -7072,9 +7072,9 @@ impl Default for settings::RequiredFields {
}
),
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
- required_field: "billing.phone.number".to_string(),
+ required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
@@ -9850,9 +9850,9 @@ impl Default for settings::RequiredFields {
common: HashMap::new(),
non_mandate: HashMap::from([
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
- required_field: "billing.phone.number".to_string(),
+ required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
@@ -11195,7 +11195,7 @@ impl Default for settings::RequiredFields {
}
),
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
@@ -11425,9 +11425,9 @@ impl Default for settings::RequiredFields {
}
),
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
- required_field: "billing.phone.number".to_string(),
+ required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
@@ -11547,9 +11547,9 @@ impl Default for settings::RequiredFields {
}
),
(
- "payment_method_data.billing.phone.number".to_string(),
+ "billing.phone.number".to_string(),
RequiredFieldInfo {
- required_field: "billing.phone.number".to_string(),
+ required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
@@ -11675,7 +11675,7 @@ impl Default for settings::RequiredFields {
RequiredFieldInfo {
required_field: "payment_method_data.voucher.boleto.social_security_number".to_string(),
display_name: "social_security_number".to_string(),
- field_type: enums::FieldType::Text,
+ field_type: enums::FieldType::UserSocialSecurityNumber,
value: None,
}
),
@@ -13299,7 +13299,7 @@ impl Default for settings::RequiredFields {
(
"payment_method_data.gift_card.number".to_string(),
RequiredFieldInfo {
- required_field: "payment_method_data.gift_card.number".to_string(),
+ required_field: "payment_method_data.gift_card.givex.number".to_string(),
display_name: "gift_card_number".to_string(),
field_type: enums::FieldType::UserCardNumber,
value: None,
@@ -13308,7 +13308,7 @@ impl Default for settings::RequiredFields {
(
"payment_method_data.gift_card.cvc".to_string(),
RequiredFieldInfo {
- required_field: "payment_method_data.gift_card.cvc".to_string(),
+ required_field: "payment_method_data.gift_card.givex.cvc".to_string(),
display_name: "gift_card_cvc".to_string(),
field_type: enums::FieldType::UserCardCvc,
value: None,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index d072463020a..05fd1c4d5e0 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4557,8 +4557,10 @@ where
(router_data, should_continue_payment)
}
}
- Some(domain::PaymentMethodData::GiftCard(_)) => {
- if connector.connector_name == router_types::Connector::Adyen {
+ Some(domain::PaymentMethodData::GiftCard(gift_card_data)) => {
+ if connector.connector_name == router_types::Connector::Adyen
+ && matches!(gift_card_data.deref(), domain::GiftCardData::Givex(..))
+ {
router_data = router_data.preprocessing_steps(state, connector).await?;
let is_error_in_response = router_data.response.is_err();
|
2025-02-26T07:27:49Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Multiple SDK queries fixed:
1. Modified field_type text to some unique enum
2. Corrected multiple required fields
3. Voucher payments error billing.phone.number is required fixed
4. Cashapp and Swish payment_experience fixed.
5. Preprocessing to be done only for Givex in gift_cards
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Voucher payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_7u1WfwhlOfuf9PlZpwf54Ejwwi7d6cEBn51jXQiQXBzoQEY4C0CMB8ddkJ6ES0GZ' \
--data-raw '{
"amount": 1000,
"currency": "JPY",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 1000,
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "voucher",
"payment_method_type": "seven_eleven",
"payment_method_data": {
"voucher": {
"seven_eleven": {}
},
"billing": {
"address": {
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": ""
},
"email": "someone@kk.com"
}
}
}'
```
Response
```
{
"payment_id": "pay_uoGRFxEqHLGs9mJHh4gs",
"merchant_id": "merchant_1740480565",
"status": "requires_customer_action",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 1000,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_uoGRFxEqHLGs9mJHh4gs_secret_iWcNQpBKiRXtrJE3Ywei",
"created": "2025-02-25T16:02:51.611Z",
"currency": "JPY",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": null,
"phone": null,
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "voucher",
"payment_method_data": {
"voucher": {
"seven_eleven": {
"first_name": null,
"last_name": null,
"email": null,
"phone_number": null
}
},
"billing": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"line3": null,
"zip": null,
"state": null,
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": ""
},
"email": "someone@kk.com"
}
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_uoGRFxEqHLGs9mJHh4gs/merchant_1740480565/pay_uoGRFxEqHLGs9mJHh4gs_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "seven_eleven",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "XZ6J6GDVKX2R3M75",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "XZ6J6GDVKX2R3M75",
"payment_link": null,
"profile_id": "pro_XQL7oWxF1wAf4kznf1Ti",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_uzopYnVyxTBm7bzDBhJI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-25T16:17:51.611Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-25T16:02:56.270Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Other refactoring is related to SDK and Dashboard WASM, so no need to test.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
a5f898f915a79c52fa2033f8f3f7ee043b83e5e4
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7354
|
Bug: chore: resolve v2 warnings in api_models
Resolve all v2 warnings in api_models crate.
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index ae66147b104..ffbbdeb351e 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -14,7 +14,6 @@ use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
use masking::ExposeInterface;
use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
-use url;
use utoipa::ToSchema;
use super::payments::AddressDetails;
diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index a6b2c53d282..76d1201c2e7 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -5,34 +5,28 @@ use super::{
PaymentStartRedirectionRequest, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
PaymentsIntentResponse, PaymentsRequest,
};
-#[cfg(all(
- any(feature = "v2", feature = "v1"),
- not(feature = "payment_methods_v2")
-))]
-use crate::payment_methods::CustomerPaymentMethodsListResponse;
#[cfg(feature = "v1")]
-use crate::payments::{PaymentListFilterConstraints, PaymentListResponseV2};
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-use crate::{events, payment_methods::CustomerPaymentMethodsListResponse};
+use crate::payments::{
+ ExtendedCardInfoResponse, PaymentIdType, PaymentListFilterConstraints, PaymentListResponseV2,
+ PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
+ PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
+ PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
+ PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
+ PaymentsManualUpdateRequest, PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
+ PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsRetrieveRequest,
+ PaymentsStartRequest, PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse,
+};
use crate::{
payment_methods::{
self, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse,
PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest,
- PaymentMethodCollectLinkResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest,
- PaymentMethodListResponse, PaymentMethodMigrateResponse, PaymentMethodResponse,
- PaymentMethodUpdate,
+ PaymentMethodCollectLinkResponse, PaymentMethodListRequest, PaymentMethodListResponse,
+ PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodUpdate,
},
payments::{
- self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints, PaymentListFilters,
- PaymentListFiltersV2, PaymentListResponse, PaymentsAggregateResponse,
- PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
- PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
- PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
- PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
- PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
- PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
- PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
- PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse, RedirectionResponse,
+ self, PaymentListConstraints, PaymentListFilters, PaymentListFiltersV2,
+ PaymentListResponse, PaymentsAggregateResponse, PaymentsSessionResponse,
+ RedirectionResponse,
},
};
@@ -272,7 +266,7 @@ impl ApiEventMetric for payment_methods::DefaultPaymentMethod {
}
#[cfg(feature = "v2")]
-impl ApiEventMetric for PaymentMethodDeleteResponse {
+impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethod {
payment_method_id: self.id.clone(),
@@ -283,7 +277,7 @@ impl ApiEventMetric for PaymentMethodDeleteResponse {
}
#[cfg(feature = "v1")]
-impl ApiEventMetric for PaymentMethodDeleteResponse {
+impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethod {
payment_method_id: self.payment_method_id.clone(),
@@ -293,7 +287,7 @@ impl ApiEventMetric for PaymentMethodDeleteResponse {
}
}
-impl ApiEventMetric for CustomerPaymentMethodsListResponse {}
+impl ApiEventMetric for payment_methods::CustomerPaymentMethodsListResponse {}
impl ApiEventMetric for PaymentMethodListRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/api_models/src/events/refund.rs b/crates/api_models/src/events/refund.rs
index 888918d836e..14e1984a760 100644
--- a/crates/api_models/src/events/refund.rs
+++ b/crates/api_models/src/events/refund.rs
@@ -1,13 +1,12 @@
use common_utils::events::{ApiEventMetric, ApiEventsType};
+use crate::refunds::{
+ self, RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
+ RefundListResponse,
+};
#[cfg(feature = "v1")]
-use crate::refunds::RefundRequest;
-#[cfg(feature = "v2")]
-use crate::refunds::RefundsCreateRequest;
use crate::refunds::{
- RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
- RefundListResponse, RefundManualUpdateRequest, RefundResponse, RefundUpdateRequest,
- RefundsRetrieveRequest,
+ RefundManualUpdateRequest, RefundRequest, RefundUpdateRequest, RefundsRetrieveRequest,
};
#[cfg(feature = "v1")]
@@ -24,14 +23,14 @@ impl ApiEventMetric for RefundRequest {
}
#[cfg(feature = "v2")]
-impl ApiEventMetric for RefundsCreateRequest {
+impl ApiEventMetric for refunds::RefundsCreateRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
None
}
}
#[cfg(feature = "v1")]
-impl ApiEventMetric for RefundResponse {
+impl ApiEventMetric for refunds::RefundResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: Some(self.payment_id.clone()),
@@ -41,7 +40,7 @@ impl ApiEventMetric for RefundResponse {
}
#[cfg(feature = "v2")]
-impl ApiEventMetric for RefundResponse {
+impl ApiEventMetric for refunds::RefundResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: self.payment_id.clone(),
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 4313d224019..0f53776e644 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -3,18 +3,16 @@ use std::collections::{HashMap, HashSet};
use std::str::FromStr;
use cards::CardNumber;
+#[cfg(feature = "v1")]
+use common_utils::crypto::OptionalEncryptableName;
use common_utils::{
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
- crypto::OptionalEncryptableName,
errors,
ext_traits::OptionExt,
id_type, link_utils, pii,
types::{MinorUnit, Percentage, Surcharge},
};
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use masking::PeekInterface;
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-use masking::{ExposeInterface, PeekInterface};
use serde::de;
use utoipa::{schema, ToSchema};
@@ -2430,6 +2428,10 @@ pub enum MigrationStatus {
Failed,
}
+#[cfg(all(
+ any(feature = "v2", feature = "v1"),
+ not(feature = "payment_methods_v2")
+))]
type PaymentMethodMigrationResponseType = (
Result<PaymentMethodMigrateResponse, String>,
PaymentMethodRecord,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 011fd7e4431..29b0c050b67 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1,6 +1,7 @@
+#[cfg(feature = "v1")]
+use std::fmt;
use std::{
collections::{HashMap, HashSet},
- fmt,
num::NonZeroI64,
};
pub mod additional_info;
@@ -9,6 +10,7 @@ use cards::CardNumber;
#[cfg(feature = "v2")]
use common_enums::enums::PaymentConnectorTransmission;
use common_enums::ProductType;
+#[cfg(feature = "v1")]
use common_types::primitive_wrappers::{
ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,
};
@@ -25,24 +27,25 @@ use common_utils::{
use error_stack::ResultExt;
use masking::{PeekInterface, Secret, WithType};
use router_derive::Setter;
-use serde::{de, ser::Serializer, Deserialize, Deserializer, Serialize};
+#[cfg(feature = "v1")]
+use serde::{de, Deserializer};
+use serde::{ser::Serializer, Deserialize, Serialize};
use strum::Display;
use time::{Date, PrimitiveDateTime};
use url::Url;
use utoipa::ToSchema;
-#[cfg(feature = "v1")]
-use crate::ephemeral_key::EphemeralKeyCreateResponse;
#[cfg(feature = "v2")]
-use crate::mandates::ProcessorPaymentToken;
+use crate::mandates;
#[cfg(feature = "v2")]
use crate::payment_methods;
use crate::{
admin::{self, MerchantConnectorInfo},
- disputes, enums as api_enums,
+ enums as api_enums,
mandates::RecurringDetails,
- refunds, ValidateFieldAndGet,
};
+#[cfg(feature = "v1")]
+use crate::{disputes, ephemeral_key::EphemeralKeyCreateResponse, refunds, ValidateFieldAndGet};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PaymentOp {
@@ -5304,7 +5307,7 @@ pub struct ProxyPaymentsRequest {
pub amount: AmountDetails,
- pub recurring_details: ProcessorPaymentToken,
+ pub recurring_details: mandates::ProcessorPaymentToken,
pub shipping: Option<Address>,
@@ -7779,6 +7782,7 @@ mod payment_id_type {
deserializer.deserialize_any(PaymentIdVisitor)
}
+ #[allow(dead_code)]
pub(crate) fn deserialize_option<'a, D>(
deserializer: D,
) -> Result<Option<PaymentIdType>, D::Error>
@@ -8576,8 +8580,8 @@ impl PaymentRevenueRecoveryMetadata {
) {
self.payment_connector_transmission = Some(payment_connector_transmission);
}
- pub fn get_payment_token_for_api_request(&self) -> ProcessorPaymentToken {
- ProcessorPaymentToken {
+ pub fn get_payment_token_for_api_request(&self) -> mandates::ProcessorPaymentToken {
+ mandates::ProcessorPaymentToken {
processor_payment_token: self
.billing_connector_payment_details
.payment_processor_token
|
2025-02-24T07:15:31Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR resolves the v2 warnings generated in api_models.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
50cbe20ee1da0392f4f590bade9f866435356b87
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7388
|
Bug: feat(users): Add V2 User APIs to Support Modularity for Merchant Accounts
Add v2 routes for supporting dashboard functions:
- create new v2 merchant account
- list v2 merchant accounts for user in org
- switch to a v2 merchant account
Also:
- add merchant account permission for recon
|
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index aab8f518abe..5e0564b4187 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -19,8 +19,9 @@ use crate::user::{
SendVerifyEmailRequest, SignUpRequest, SignUpWithMerchantIdRequest, SsoSignInRequest,
SwitchMerchantRequest, SwitchOrganizationRequest, SwitchProfileRequest, TokenResponse,
TwoFactorAuthStatusResponse, TwoFactorStatus, UpdateUserAccountDetailsRequest,
- UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantCreate,
- UserOrgMerchantCreateRequest, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
+ UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantAccountResponse,
+ UserMerchantCreate, UserOrgMerchantCreateRequest, VerifyEmailRequest,
+ VerifyRecoveryCodeRequest, VerifyTotpRequest,
};
common_utils::impl_api_event_type!(
@@ -39,6 +40,7 @@ common_utils::impl_api_event_type!(
CreateInternalUserRequest,
CreateTenantUserRequest,
UserOrgMerchantCreateRequest,
+ UserMerchantAccountResponse,
UserMerchantCreate,
AuthorizeResponse,
ConnectAccountRequest,
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index ea979bfe735..aa39877f0c7 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -133,6 +133,7 @@ pub struct UserOrgMerchantCreateRequest {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UserMerchantCreate {
pub company_name: String,
+ pub product_type: Option<common_enums::MerchantProductType>,
}
#[derive(serde::Serialize, Debug, Clone)]
@@ -151,6 +152,7 @@ pub struct GetUserDetailsResponse {
pub profile_id: id_type::ProfileId,
pub entity_type: EntityType,
pub theme_id: Option<String>,
+ pub version: common_enums::ApiVersion,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
@@ -382,9 +384,11 @@ pub struct ListOrgsForUserResponse {
}
#[derive(Debug, serde::Serialize)]
-pub struct ListMerchantsForUserInOrgResponse {
+pub struct UserMerchantAccountResponse {
pub merchant_id: id_type::MerchantId,
pub merchant_name: OptionalEncryptableName,
+ pub product_type: Option<common_enums::MerchantProductType>,
+ pub version: common_enums::ApiVersion,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/common_enums/src/enums/accounts.rs b/crates/common_enums/src/enums/accounts.rs
index 9a5247512e4..d9c83312d6b 100644
--- a/crates/common_enums/src/enums/accounts.rs
+++ b/crates/common_enums/src/enums/accounts.rs
@@ -17,9 +17,8 @@ use utoipa::ToSchema;
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum MerchantProductType {
- Orchestration,
#[default]
- Legacy,
+ Orchestration,
Vault,
Recon,
Recovery,
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index b6b7571d32f..fef000a3954 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -140,6 +140,7 @@ pub struct MerchantAccountSetter {
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: diesel_models::enums::ReconStatus,
pub is_platform_account: bool,
+ pub version: common_enums::ApiVersion,
pub product_type: Option<common_enums::MerchantProductType>,
}
@@ -158,6 +159,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
organization_id,
recon_status,
is_platform_account,
+ version,
product_type,
} = item;
Self {
@@ -172,6 +174,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
organization_id,
recon_status,
is_platform_account,
+ version,
product_type,
}
}
@@ -191,6 +194,7 @@ pub struct MerchantAccount {
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: diesel_models::enums::ReconStatus,
pub is_platform_account: bool,
+ pub version: common_enums::ApiVersion,
pub product_type: Option<common_enums::MerchantProductType>,
}
@@ -631,6 +635,7 @@ impl super::behaviour::Conversion for MerchantAccount {
organization_id: item.organization_id,
recon_status: item.recon_status,
is_platform_account: item.is_platform_account,
+ version: item.version,
product_type: item.product_type,
})
}
diff --git a/crates/router/src/consts/user.rs b/crates/router/src/consts/user.rs
index d4eb12e39bf..3601f229827 100644
--- a/crates/router/src/consts/user.rs
+++ b/crates/router/src/consts/user.rs
@@ -1,3 +1,4 @@
+use common_enums;
use common_utils::consts::MAX_ALLOWED_MERCHANT_NAME_LENGTH;
pub const MAX_NAME_LENGTH: usize = 70;
@@ -45,3 +46,7 @@ pub const EMAIL_SUBJECT_RESET_PASSWORD: &str = "Get back to Hyperswitch - Reset
pub const EMAIL_SUBJECT_NEW_PROD_INTENT: &str = "New Prod Intent";
pub const EMAIL_SUBJECT_WELCOME_TO_COMMUNITY: &str =
"Thank you for signing up on Hyperswitch Dashboard!";
+
+pub const DEFAULT_PROFILE_NAME: &str = "default";
+pub const DEFAULT_PRODUCT_TYPE: common_enums::MerchantProductType =
+ common_enums::MerchantProductType::Orchestration;
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index dca58f11329..106c904ef7b 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -673,6 +673,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
organization_id: organization.get_organization_id(),
recon_status: diesel_models::enums::ReconStatus::NotRequested,
is_platform_account: false,
+ version: hyperswitch_domain_models::consts::API_VERSION,
product_type: self.product_type,
}),
)
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 4f19f040bdb..f0a6df94453 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -128,13 +128,62 @@ pub async fn get_user_details(
.await
.change_context(UserErrors::InternalServerError)?;
+ let key_manager_state = &(&state).into();
+
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &user_from_token.merchant_id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await;
+
+ let version = if let Ok(merchant_key_store) = merchant_key_store {
+ let merchant_account = state
+ .store
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &user_from_token.merchant_id,
+ &merchant_key_store,
+ )
+ .await;
+
+ if let Ok(merchant_account) = merchant_account {
+ merchant_account.version
+ } else if merchant_account
+ .as_ref()
+ .map_err(|e| e.current_context().is_db_not_found())
+ .err()
+ .unwrap_or(false)
+ {
+ common_enums::ApiVersion::V2
+ } else {
+ Err(merchant_account
+ .err()
+ .map(|e| e.change_context(UserErrors::InternalServerError))
+ .unwrap_or(UserErrors::InternalServerError.into()))?
+ }
+ } else if merchant_key_store
+ .as_ref()
+ .map_err(|e| e.current_context().is_db_not_found())
+ .err()
+ .unwrap_or(false)
+ {
+ common_enums::ApiVersion::V2
+ } else {
+ Err(merchant_key_store
+ .err()
+ .map(|e| e.change_context(UserErrors::InternalServerError))
+ .unwrap_or(UserErrors::InternalServerError.into()))?
+ };
+
let theme = theme_utils::get_most_specific_theme_using_token_and_min_entity(
&state,
&user_from_token,
EntityType::Profile,
)
.await?;
-
Ok(ApplicationResponse::Json(
user_api::GetUserDetailsResponse {
merchant_id: user_from_token.merchant_id,
@@ -149,6 +198,7 @@ pub async fn get_user_details(
profile_id: user_from_token.profile_id,
entity_type: role_info.get_entity_type(),
theme_id: theme.map(|theme| theme.theme_id),
+ version,
},
))
}
@@ -1466,9 +1516,9 @@ pub async fn create_org_merchant_for_user(
.insert_organization(db_organization)
.await
.change_context(UserErrors::InternalServerError)?;
-
+ let default_product_type = consts::user::DEFAULT_PRODUCT_TYPE;
let merchant_account_create_request =
- utils::user::create_merchant_account_request_for_org(req, org)?;
+ utils::user::create_merchant_account_request_for_org(req, org, default_product_type)?;
admin::create_merchant_account(state.clone(), merchant_account_create_request)
.await
@@ -1482,15 +1532,22 @@ pub async fn create_merchant_account(
state: SessionState,
user_from_token: auth::UserFromToken,
req: user_api::UserMerchantCreate,
-) -> UserResponse<()> {
+) -> UserResponse<user_api::UserMerchantAccountResponse> {
let user_from_db = user_from_token.get_user_from_db(&state).await?;
let new_merchant = domain::NewUserMerchant::try_from((user_from_db, req, user_from_token))?;
- new_merchant
+ let domain_merchant_account = new_merchant
.create_new_merchant_and_insert_in_db(state.to_owned())
.await?;
- Ok(ApplicationResponse::StatusOk)
+ Ok(ApplicationResponse::Json(
+ user_api::UserMerchantAccountResponse {
+ merchant_id: domain_merchant_account.get_id().to_owned(),
+ merchant_name: domain_merchant_account.merchant_name,
+ product_type: domain_merchant_account.product_type,
+ version: domain_merchant_account.version,
+ },
+ ))
}
pub async fn list_user_roles_details(
@@ -2858,7 +2915,7 @@ pub async fn list_orgs_for_user(
pub async fn list_merchants_for_user_in_org(
state: SessionState,
user_from_token: auth::UserFromToken,
-) -> UserResponse<Vec<user_api::ListMerchantsForUserInOrgResponse>> {
+) -> UserResponse<Vec<user_api::UserMerchantAccountResponse>> {
let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
&state,
&user_from_token.role_id,
@@ -2917,19 +2974,18 @@ pub async fn list_merchants_for_user_in_org(
}
};
- if merchant_accounts.is_empty() {
- Err(UserErrors::InternalServerError).attach_printable("No merchant found for a user")?;
- }
+ // TODO: Add a check to see if merchant accounts are empty, and handle accordingly, when a single route will be used instead
+ // of having two separate routes.
Ok(ApplicationResponse::Json(
merchant_accounts
.into_iter()
- .map(
- |merchant_account| user_api::ListMerchantsForUserInOrgResponse {
- merchant_name: merchant_account.merchant_name.clone(),
- merchant_id: merchant_account.get_id().to_owned(),
- },
- )
+ .map(|merchant_account| user_api::UserMerchantAccountResponse {
+ merchant_name: merchant_account.merchant_name.clone(),
+ merchant_id: merchant_account.get_id().to_owned(),
+ product_type: merchant_account.product_type.clone(),
+ version: merchant_account.version,
+ })
.collect::<Vec<_>>(),
))
}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 349fb91efc3..fc5e2b94d1c 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -183,6 +183,7 @@ pub fn mk_app(
server_app = server_app
.service(routes::Organization::server(state.clone()))
.service(routes::MerchantAccount::server(state.clone()))
+ .service(routes::User::server(state.clone()))
.service(routes::ApiKeys::server(state.clone()))
.service(routes::Routing::server(state.clone()));
@@ -195,7 +196,6 @@ pub fn mk_app(
.service(routes::Gsm::server(state.clone()))
.service(routes::ApplePayCertificatesMigration::server(state.clone()))
.service(routes::PaymentLink::server(state.clone()))
- .service(routes::User::server(state.clone()))
.service(routes::ConnectorOnboarding::server(state.clone()))
.service(routes::Verify::server(state.clone()))
.service(routes::Analytics::server(state.clone()))
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 7bb42134aa7..6d687fea2d5 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2091,6 +2091,43 @@ impl Verify {
pub struct User;
+#[cfg(all(feature = "olap", feature = "v2"))]
+impl User {
+ pub fn server(state: AppState) -> Scope {
+ let mut route = web::scope("/v2/user").app_data(web::Data::new(state));
+
+ route = route.service(
+ web::resource("/create_merchant")
+ .route(web::post().to(user::user_merchant_account_create)),
+ );
+ route = route.service(
+ web::scope("/list")
+ .service(
+ web::resource("/merchant")
+ .route(web::get().to(user::list_merchants_for_user_in_org)),
+ )
+ .service(
+ web::resource("/profile")
+ .route(web::get().to(user::list_profiles_for_user_in_org_and_merchant)),
+ ),
+ );
+
+ route = route.service(
+ web::scope("/switch")
+ .service(
+ web::resource("/merchant")
+ .route(web::post().to(user::switch_merchant_for_user_in_org)),
+ )
+ .service(
+ web::resource("/profile")
+ .route(web::post().to(user::switch_profile_for_user_in_org_and_merchant)),
+ ),
+ );
+
+ route
+ }
+}
+
#[cfg(all(feature = "olap", feature = "v1"))]
impl User {
pub fn server(state: AppState) -> Scope {
diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rs
index 0cdb68ec8d7..6333de5f19b 100644
--- a/crates/router/src/services/authorization/permission_groups.rs
+++ b/crates/router/src/services/authorization/permission_groups.rs
@@ -180,7 +180,7 @@ pub static USERS: [Resource; 2] = [Resource::User, Resource::Account];
pub static ACCOUNT: [Resource; 3] = [Resource::Account, Resource::ApiKey, Resource::WebhookEvent];
-pub static RECON_OPS: [Resource; 7] = [
+pub static RECON_OPS: [Resource; 8] = [
Resource::ReconToken,
Resource::ReconFiles,
Resource::ReconUpload,
@@ -188,10 +188,12 @@ pub static RECON_OPS: [Resource; 7] = [
Resource::ReconConfig,
Resource::ReconAndSettlementAnalytics,
Resource::ReconReports,
+ Resource::Account,
];
-pub static RECON_REPORTS: [Resource; 3] = [
+pub static RECON_REPORTS: [Resource; 4] = [
Resource::ReconToken,
Resource::ReconAndSettlementAnalytics,
Resource::ReconReports,
+ Resource::Account,
];
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index a51ccfdc710..4854d1b4786 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -19,6 +19,7 @@ use diesel_models::{
user_role::{UserRole, UserRoleNew},
};
use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::api::ApplicationResponse;
use masking::{ExposeInterface, PeekInterface, Secret};
use once_cell::sync::Lazy;
use rand::distributions::{Alphanumeric, DistString};
@@ -37,7 +38,7 @@ use crate::{
db::GlobalStorageInterface,
routes::SessionState,
services::{self, authentication::UserFromToken},
- types::transformers::ForeignFrom,
+ types::{domain, transformers::ForeignFrom},
utils::user::password,
};
@@ -390,6 +391,7 @@ pub struct NewUserMerchant {
merchant_id: id_type::MerchantId,
company_name: Option<UserCompanyName>,
new_organization: NewUserOrganization,
+ product_type: Option<common_enums::MerchantProductType>,
}
impl TryFrom<UserCompanyName> for MerchantName {
@@ -414,6 +416,10 @@ impl NewUserMerchant {
self.new_organization.clone()
}
+ pub fn get_product_type(&self) -> Option<common_enums::MerchantProductType> {
+ self.product_type.clone()
+ }
+
pub async fn check_if_already_exists_in_db(&self, state: SessionState) -> UserResult<()> {
if state
.store
@@ -450,7 +456,7 @@ impl NewUserMerchant {
organization_id: self.new_organization.get_organization_id(),
metadata: None,
merchant_details: None,
- product_type: None,
+ product_type: self.get_product_type(),
})
}
@@ -477,28 +483,115 @@ impl NewUserMerchant {
enable_payment_response_hash: None,
redirect_to_merchant_with_http_post: None,
pm_collect_link_config: None,
- product_type: None,
+ product_type: self.get_product_type(),
})
}
+ #[cfg(feature = "v1")]
pub async fn create_new_merchant_and_insert_in_db(
&self,
state: SessionState,
- ) -> UserResult<()> {
+ ) -> UserResult<domain::MerchantAccount> {
self.check_if_already_exists_in_db(state.clone()).await?;
let merchant_account_create_request = self
.create_merchant_account_request()
.attach_printable("unable to construct merchant account create request")?;
- Box::pin(admin::create_merchant_account(
- state.clone(),
- merchant_account_create_request,
+ let ApplicationResponse::Json(merchant_account_response) = Box::pin(
+ admin::create_merchant_account(state.clone(), merchant_account_create_request),
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Error while creating a merchant")?
+ else {
+ return Err(UserErrors::InternalServerError.into());
+ };
+
+ let key_manager_state = &(&state).into();
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &merchant_account_response.merchant_id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve merchant key store by merchant_id")?;
+
+ let merchant_account = state
+ .store
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &merchant_account_response.merchant_id,
+ &merchant_key_store,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve merchant account by merchant_id")?;
+ Ok(merchant_account)
+ }
+
+ #[cfg(feature = "v2")]
+ pub async fn create_new_merchant_and_insert_in_db(
+ &self,
+ state: SessionState,
+ ) -> UserResult<domain::MerchantAccount> {
+ self.check_if_already_exists_in_db(state.clone()).await?;
+
+ let merchant_account_create_request = self
+ .create_merchant_account_request()
+ .attach_printable("unable to construct merchant account create request")?;
+
+ let ApplicationResponse::Json(merchant_account_response) = Box::pin(
+ admin::create_merchant_account(state.clone(), merchant_account_create_request),
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Error while creating a merchant")?
+ else {
+ return Err(UserErrors::InternalServerError.into());
+ };
+
+ let profile_create_request = admin_api::ProfileCreate {
+ profile_name: consts::user::DEFAULT_PROFILE_NAME.to_string(),
+ ..Default::default()
+ };
+
+ let key_manager_state = &(&state).into();
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &merchant_account_response.id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve merchant key store by merchant_id")?;
+
+ let merchant_account = state
+ .store
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &merchant_account_response.id,
+ &merchant_key_store,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve merchant account by merchant_id")?;
+
+ Box::pin(admin::create_profile(
+ state,
+ profile_create_request,
+ merchant_account.clone(),
+ merchant_key_store,
))
.await
.change_context(UserErrors::InternalServerError)
- .attach_printable("Error while creating a merchant")?;
- Ok(())
+ .attach_printable("Error while creating a profile")?;
+ Ok(merchant_account)
}
}
@@ -507,13 +600,13 @@ impl TryFrom<user_api::SignUpRequest> for NewUserMerchant {
fn try_from(value: user_api::SignUpRequest) -> UserResult<Self> {
let merchant_id = id_type::MerchantId::new_from_unix_timestamp();
-
let new_organization = NewUserOrganization::from(value);
-
+ let product_type = Some(consts::user::DEFAULT_PRODUCT_TYPE);
Ok(Self {
company_name: None,
merchant_id,
new_organization,
+ product_type,
})
}
}
@@ -524,11 +617,12 @@ impl TryFrom<user_api::ConnectAccountRequest> for NewUserMerchant {
fn try_from(value: user_api::ConnectAccountRequest) -> UserResult<Self> {
let merchant_id = id_type::MerchantId::new_from_unix_timestamp();
let new_organization = NewUserOrganization::from(value);
-
+ let product_type = Some(consts::user::DEFAULT_PRODUCT_TYPE);
Ok(Self {
company_name: None,
merchant_id,
new_organization,
+ product_type,
})
}
}
@@ -539,11 +633,13 @@ impl TryFrom<user_api::SignUpWithMerchantIdRequest> for NewUserMerchant {
let company_name = Some(UserCompanyName::new(value.company_name.clone())?);
let merchant_id = MerchantId::new(value.company_name.clone())?;
let new_organization = NewUserOrganization::try_from(value)?;
+ let product_type = Some(consts::user::DEFAULT_PRODUCT_TYPE);
Ok(Self {
company_name,
merchant_id: id_type::MerchantId::try_from(merchant_id)?,
new_organization,
+ product_type,
})
}
}
@@ -563,6 +659,7 @@ impl TryFrom<(user_api::CreateInternalUserRequest, id_type::OrganizationId)> for
company_name: None,
merchant_id,
new_organization,
+ product_type: None,
})
}
}
@@ -576,6 +673,7 @@ impl TryFrom<InviteeUserRequestWithInvitedUserToken> for NewUserMerchant {
company_name: None,
merchant_id,
new_organization,
+ product_type: None,
})
}
}
@@ -588,6 +686,7 @@ impl From<(user_api::CreateTenantUserRequest, MerchantAccountIdentifier)> for Ne
company_name: None,
merchant_id,
new_organization,
+ product_type: None,
}
}
}
@@ -607,6 +706,7 @@ impl TryFrom<UserMerchantCreateRequestWithToken> for NewUserMerchant {
Ok(Self {
merchant_id,
company_name: Some(UserCompanyName::new(value.1.company_name.clone())?),
+ product_type: value.1.product_type.clone(),
new_organization: NewUserOrganization::from(value),
})
}
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index b386185eeca..89612fc1892 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -286,6 +286,7 @@ pub fn is_sso_auth_type(auth_type: UserAuthType) -> bool {
pub fn create_merchant_account_request_for_org(
req: user_api::UserOrgMerchantCreateRequest,
org: organization::Organization,
+ product_type: common_enums::MerchantProductType,
) -> UserResult<api_models::admin::MerchantAccountCreate> {
let merchant_id = if matches!(env::which(), env::Env::Production) {
id_type::MerchantId::try_from(domain::MerchantId::new(req.merchant_name.clone().expose())?)?
@@ -315,7 +316,7 @@ pub fn create_merchant_account_request_for_org(
enable_payment_response_hash: None,
redirect_to_merchant_with_http_post: None,
pm_collect_link_config: None,
- product_type: None,
+ product_type: Some(product_type),
})
}
|
2025-02-27T06:26:07Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
As part of the modularity effort, we are introducing user support to enable dashboard interactions with v2 merchant accounts. This allows users to create, list, and switch between merchant accounts within their organization. This also allows users to list profiles and switch profiles when using v2 merchant accounts.
## Key Changes
### 1. User Support for v2 Merchant Accounts
Introduced APIs to facilitate user interactions with v2 merchant accounts:
- **Create Merchant Account API (v1 & v2)**: Allows users to create a merchant account.
- **List Merchant Accounts API**: Retrieves all v2 merchant accounts associated with a user in an organization.
- **Switch Merchant Account API**: Enables users to switch to a different v2 merchant account.
### 2. Modified Response Structure
- The response for **Create Merchant Account (v1 & v2)** now returns an object instead of just `StatusOk (200)`. The response object includes:
- `merchant_id`
- `merchant_name`
- `product_type`
- `version`
- The **List Merchant Accounts API** now returns a vector of these objects instead of a raw list.
### 3. Request Structure Update
- The **Create Merchant Account API** request now includes an optional `product_type` field.
- This field is currently optional but will be made mandatory once both the frontend and backend are stabilized.
### 4. Recon
- Added **Merchant Account** permission for Recon related activities.
### 5. User Support for v2 Profiles
Introduced APIs to facilitate user interactions with v2 profiles:
- **List Profiles API**: Retrieves all v2 profiles associated with a user in a merchant.
- **Switch Profile API**: Enables users to switch to a different v2 profile in the merchant.
### 6. Modified get_user_details API:
- Modified **get_user_details API** response type to return the version as well, enabling FE to have more context while trying to fetch the merchant account details.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
With the modularization of the payments solution, managing multiple merchant accounts becomes essential. This update ensures a seamless user experience for handling v1 and v2 merchant accounts and profiles within an organization.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
The flow looks like this:
- Sign Up / Sign In through V1 merchant account --> Create Merchant Account (V1 or V2) --> List Merchant Accounts (V1 and V2)--> Switch Merchant Account (V1 and V2)
### Testing V2 Flow:
Sign In to a V1 merchant account
#### Create v2 Merchant Account:
```bash
curl --location 'http://localhost:8000/v2/user/create_merchant' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF92S09zQU9odGc2S3hpSldlR3Y2YiIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE3NTk2MjUsIm9yZ19pZCI6Im9yZ19kUENaYU51bmNaRDY5aVZXb0hKcyIsInByb2ZpbGVfaWQiOiJwcm9fQjV4UWZxUWE4dkNCaXpoc2FnTmkiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.MMJ68FinbhA4dShNvbrOsofU_nTaw1MjGnUrEkmkeOk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF92S09zQU9odGc2S3hpSldlR3Y2YiIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE3NTk2MjUsIm9yZ19pZCI6Im9yZ19kUENaYU51bmNaRDY5aVZXb0hKcyIsInByb2ZpbGVfaWQiOiJwcm9fQjV4UWZxUWE4dkNCaXpoc2FnTmkiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.MMJ68FinbhA4dShNvbrOsofU_nTaw1MjGnUrEkmkeOk' \
--data '{
"company_name": "TestingMerchantAccountCreateV2",
"product_type": "vault"
} '
```
Sample Output:
```json
{
"merchant_id": "testingmerchantaccountcreatev2_Ku5OxNIapqaot1P8rlQr",
"merchant_name": "TestingMerchantAccountCreateV2",
"product_type": "vault",
"version": "v2"
}
```
#### List V2 Merchant Accounts for User in Org:
```bash
curl --location 'http://localhost:8000/v2/user/list/merchant' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF92S09zQU9odGc2S3hpSldlR3Y2YiIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE3NTk2MjUsIm9yZ19pZCI6Im9yZ19kUENaYU51bmNaRDY5aVZXb0hKcyIsInByb2ZpbGVfaWQiOiJwcm9fQjV4UWZxUWE4dkNCaXpoc2FnTmkiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.MMJ68FinbhA4dShNvbrOsofU_nTaw1MjGnUrEkmkeOk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF92S09zQU9odGc2S3hpSldlR3Y2YiIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE3NTk2MjUsIm9yZ19pZCI6Im9yZ19kUENaYU51bmNaRDY5aVZXb0hKcyIsInByb2ZpbGVfaWQiOiJwcm9fQjV4UWZxUWE4dkNCaXpoc2FnTmkiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.MMJ68FinbhA4dShNvbrOsofU_nTaw1MjGnUrEkmkeOk'
```
Sample Output:
```json
[
{
"merchant_id": "merchant_vKOsAOhtg6KxiJWeGv6b",
"merchant_name": "merchant",
"product_type": "orchestration",
"version": "v2"
},
{
"merchant_id": "testingmerchantaccountcreatev2_Ku5OxNIapqaot1P8rlQr",
"merchant_name": "TestingMerchantAccountCreateV2",
"product_type": "vault",
"version": "v2"
}
]
```
#### Switch to V2 merchant Account:
```bash
curl --location 'http://localhost:8000/v2/user/switch/merchant' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF92S09zQU9odGc2S3hpSldlR3Y2YiIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE3NTk2MjUsIm9yZ19pZCI6Im9yZ19kUENaYU51bmNaRDY5aVZXb0hKcyIsInByb2ZpbGVfaWQiOiJwcm9fQjV4UWZxUWE4dkNCaXpoc2FnTmkiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.MMJ68FinbhA4dShNvbrOsofU_nTaw1MjGnUrEkmkeOk' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJ0ZXN0aW5nbWVyY2hhbnRhY2NvdW50Y3JlYXRldjJfS3U1T3hOSWFwcWFvdDFQOHJsUXIiLCJyb2xlX2lkIjoib3JnX2FkbWluIiwiZXhwIjoxNzQxNzU5NzYyLCJvcmdfaWQiOiJvcmdfZFBDWmFOdW5jWkQ2OWlWV29ISnMiLCJwcm9maWxlX2lkIjoicHJvX2huN2RqaVpKckJTMnYxS1hjdWIxIiwidGVuYW50X2lkIjoicHVibGljIn0.kxj8dXx4KBXRl-Ayfy6qVJxZF5hLvwqxouJ2ENubm8Q' \
--data '{
"merchant_id": "testingmerchantaccountcreatev2_Ku5OxNIapqaot1P8rlQr"
}'
```
Sample Output:
```json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWI5ZGZjNWUtZjA2My00YWY3LThkNzUtYmFmOTgzZmU0ODE4IiwibWVyY2hhbnRfaWQiOiJ0ZXN0aW5nbWVyY2hhbnRhY2NvdW50Y3JlYXRldjJfS3U1T3hOSWFwcWFvdDFQOHJsUXIiLCJyb2xlX2lkIjoib3JnX2FkbWluIiwiZXhwIjoxNzQxNzU5NzYyLCJvcmdfaWQiOiJvcmdfZFBDWmFOdW5jWkQ2OWlWV29ISnMiLCJwcm9maWxlX2lkIjoicHJvX2huN2RqaVpKckJTMnYxS1hjdWIxIiwidGVuYW50X2lkIjoicHVibGljIn0.kxj8dXx4KBXRl-Ayfy6qVJxZF5hLvwqxouJ2ENubm8Q",
"token_type": "user_info"
}
```
#### Switch to V2 Profile:
```bash
curl --location 'http://localhost:8000/v2/user/switch/profile' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzhjMjBkNzQtN2FkYy00NmE5LWEzN2UtNGFhOWMzOWE0ZDY4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF9DaGxVcVNSakNyc1pQMTI3VmVUeCIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE4NjIxOTQsIm9yZ19pZCI6Im9yZ19VSWlNWFBvVFRsZVBXOElRU2V3MyIsInByb2ZpbGVfaWQiOiJwcm9fZnhHdTBKZm1mbUVmQVEwUGpiY1ciLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.8QVJGDmL-ybeQ8Rx8On_ACt7_GsFQVkE8-jZtT9fNXg' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzhjMjBkNzQtN2FkYy00NmE5LWEzN2UtNGFhOWMzOWE0ZDY4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF9DaGxVcVNSakNyc1pQMTI3VmVUeCIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE4NjIzODYsIm9yZ19pZCI6Im9yZ19VSWlNWFBvVFRsZVBXOElRU2V3MyIsInByb2ZpbGVfaWQiOiJwcm9fVWpKWUpGektSaGtvUmlZVHU4ckMiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.Yo6_JeAN1fv6GTqFZJWpvsNfm3BhxqPOjP2KRYNMH-A' \
--data '{
"profile_id": "pro_UjJYJFzKRhkoRiYTu8rC"
}'
```
Sample Output:
```json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzhjMjBkNzQtN2FkYy00NmE5LWEzN2UtNGFhOWMzOWE0ZDY4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF9DaGxVcVNSakNyc1pQMTI3VmVUeCIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE4NjIzODYsIm9yZ19pZCI6Im9yZ19VSWlNWFBvVFRsZVBXOElRU2V3MyIsInByb2ZpbGVfaWQiOiJwcm9fVWpKWUpGektSaGtvUmlZVHU4ckMiLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.Yo6_JeAN1fv6GTqFZJWpvsNfm3BhxqPOjP2KRYNMH-A",
"token_type": "user_info"
}
```
#### List V2 Profile for a v2 merchant account:
```bash
curl --location 'http://localhost:8000/v2/user/list/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzhjMjBkNzQtN2FkYy00NmE5LWEzN2UtNGFhOWMzOWE0ZDY4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF9DaGxVcVNSakNyc1pQMTI3VmVUeCIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE4NjIxOTQsIm9yZ19pZCI6Im9yZ19VSWlNWFBvVFRsZVBXOElRU2V3MyIsInByb2ZpbGVfaWQiOiJwcm9fZnhHdTBKZm1mbUVmQVEwUGpiY1ciLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.8QVJGDmL-ybeQ8Rx8On_ACt7_GsFQVkE8-jZtT9fNXg' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzhjMjBkNzQtN2FkYy00NmE5LWEzN2UtNGFhOWMzOWE0ZDY4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF9DaGxVcVNSakNyc1pQMTI3VmVUeCIsInJvbGVfaWQiOiJvcmdfYWRtaW4iLCJleHAiOjE3NDE4NjIxOTQsIm9yZ19pZCI6Im9yZ19VSWlNWFBvVFRsZVBXOElRU2V3MyIsInByb2ZpbGVfaWQiOiJwcm9fZnhHdTBKZm1mbUVmQVEwUGpiY1ciLCJ0ZW5hbnRfaWQiOiJwdWJsaWMifQ.8QVJGDmL-ybeQ8Rx8On_ACt7_GsFQVkE8-jZtT9fNXg'
```
Sample Output:
```json
[
{
"profile_id": "pro_UjJYJFzKRhkoRiYTu8rC",
"profile_name": "TestingV4-Profile"
},
{
"profile_id": "pro_fxGu0JfmfmEfAQ0PjbcW",
"profile_name": "default"
}
]
```
### Testing V1 flow:
Sign in to V1 merchant account
#### Create V1 merchant Account:
```bash
curl --location 'http://localhost:8080/user/create_merchant' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTI2Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTM0OCwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb184QnNld0tIRUlaa3ppdUhKa282YiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lyeIOXMCXVdDaE7ACHxzoFgAZeCY0rjDRFq1rSxu1NE' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTI2Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTM0OCwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb184QnNld0tIRUlaa3ppdUhKa282YiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lyeIOXMCXVdDaE7ACHxzoFgAZeCY0rjDRFq1rSxu1NE' \
--data '{
"company_name": "TestingV1",
"product_type": "recovery"
}'
```
Sample Output:
```json
{
"merchant_id": "merchant_1741588579",
"merchant_name": "TestingV1",
"product_type": "recovery",
"version": "v1"
}
```
#### List V1 Merchant Accounts for User in Org:
```bash
curl --location 'http://localhost:8080/user/list/merchant' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTI2Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTM0OCwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb184QnNld0tIRUlaa3ppdUhKa282YiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lyeIOXMCXVdDaE7ACHxzoFgAZeCY0rjDRFq1rSxu1NE' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTI2Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTM0OCwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb184QnNld0tIRUlaa3ppdUhKa282YiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lyeIOXMCXVdDaE7ACHxzoFgAZeCY0rjDRFq1rSxu1NE'
```
Sample Output:
```json
[
{
"merchant_id": "merchant_1741588526",
"merchant_name": null,
"product_type": "orchestration",
"version": "v1"
},
{
"merchant_id": "merchant_1741588579",
"merchant_name": "TestingV1",
"product_type": "recovery",
"version": "v1"
}
]
```
#### Switch to V1 Merchant Account:
```bash
curl --location 'http://localhost:8080/user/switch/merchant' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTI2Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTM0OCwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb184QnNld0tIRUlaa3ppdUhKa282YiIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lyeIOXMCXVdDaE7ACHxzoFgAZeCY0rjDRFq1rSxu1NE' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTc5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTUwNSwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb19PVnQ0OTIzYmdoS0dVRU13Y1JiOSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.5yi6unFpacer1FO_wcxxQIHRls_mjDjPraIHD6BO0ME' \
--data '{
"merchant_id": "merchant_1741588579"
}'
```
Sample Output:
```json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTk0OTE4YzUtOTM0OS00YjEzLWIzZDItZDc0Mzg0OTk3MWNkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQxNTg4NTc5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTc2MTUwNSwib3JnX2lkIjoib3JnX3NYdWNFTGFKSURtVFU2YVlsbmJZIiwicHJvZmlsZV9pZCI6InByb19PVnQ0OTIzYmdoS0dVRU13Y1JiOSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.5yi6unFpacer1FO_wcxxQIHRls_mjDjPraIHD6BO0ME",
"token_type": "user_info"
}
```
#### get_user_details
```bash
curl --location 'https://integ-api.hyperswitch.io/user' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTlmN2IzZjctMmEwOS00NTllLTllNGItZTRlODcwZDMwMjEwIiwibWVyY2hhbnRfaWQiOiJ0ZXN0Zmxvd3YyX1pMNmV3aFBiZUhIMWU5dmlVc2JoIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTk0MzQ0Miwib3JnX2lkIjoib3JnX3MzUGVzYTQxRk1aNng3VVJOT0RPIiwicHJvZmlsZV9pZCI6InByb19zbjVFTFV0eGpFSnphN0dnYzhmRCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.EbmlEihGnAM_DW08BAyyeDHFZlBWmCm8Q0bRlAPnEfM' \
--header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTlmN2IzZjctMmEwOS00NTllLTllNGItZTRlODcwZDMwMjEwIiwibWVyY2hhbnRfaWQiOiJ0ZXN0Zmxvd3YyX1pMNmV3aFBiZUhIMWU5dmlVc2JoIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0MTk0MzQ0Miwib3JnX2lkIjoib3JnX3MzUGVzYTQxRk1aNng3VVJOT0RPIiwicHJvZmlsZV9pZCI6InByb19zbjVFTFV0eGpFSnphN0dnYzhmRCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.EbmlEihGnAM_DW08BAyyeDHFZlBWmCm8Q0bRlAPnEfM'
```
Sample Output:
```json
{
"merchant_id": "testflowv2_ZL6ewhPbeHH1e9viUsbh",
"name": "sandeep.kumar",
"email": "sandeep.kumar@juspay.in",
"verification_days_left": null,
"role_id": "org_admin",
"org_id": "org_s3Pesa41FMZ6x7URNODO",
"is_two_factor_auth_setup": false,
"recovery_codes_left": null,
"profile_id": "pro_sn5ELUtxjEJza7Ggc8fD",
"entity_type": "organization",
"theme_id": null,
"version": "v2"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
e9496007889350f78af5875566c806f79c397544
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7375
|
Bug: chore: address Rust 1.85.0 clippy lints
Address the clippy lints occurring due to new rust version 1.85.0
See https://github.com/juspay/hyperswitch/issues/3391 for more information.
|
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index 1497c9e3622..02c25d722c1 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -232,8 +232,8 @@ impl super::behaviour::Conversion for Customer {
connector_customer: self.connector_customer,
default_payment_method_id: self.default_payment_method_id,
updated_by: self.updated_by,
- default_billing_address: self.default_billing_address.map(Encryption::from),
- default_shipping_address: self.default_shipping_address.map(Encryption::from),
+ default_billing_address: self.default_billing_address,
+ default_shipping_address: self.default_shipping_address,
version: self.version,
status: self.status,
})
diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
index 6fa9f9450c8..fd8e144f4f2 100644
--- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
+++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
@@ -344,7 +344,7 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
connector,
reason,
status_code,
- } => AER::ConnectorError(ApiError::new("CE", 0, format!("{code}: {message}"), Some(Extra {connector: Some(connector.clone()), reason: reason.to_owned().map(Into::into), ..Default::default()})), StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)),
+ } => AER::ConnectorError(ApiError::new("CE", 0, format!("{code}: {message}"), Some(Extra {connector: Some(connector.clone()), reason: reason.to_owned(), ..Default::default()})), StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)),
Self::PaymentAuthorizationFailed { data } => {
AER::BadRequest(ApiError::new("CE", 1, "Payment failed during authorization with connector. Retry payment", Some(Extra { data: data.clone(), ..Default::default()})))
}
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 545c058ce1c..c24fd506ace 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -283,11 +283,7 @@ impl TryFrom<StripePaymentIntentRequest> for payments::PaymentsRequest {
type Error = error_stack::Report<errors::ApiErrorResponse>;
fn try_from(item: StripePaymentIntentRequest) -> errors::RouterResult<Self> {
let routable_connector: Option<api_enums::RoutableConnectors> =
- item.connector.and_then(|v| {
- v.into_iter()
- .next()
- .map(api_enums::RoutableConnectors::from)
- });
+ item.connector.and_then(|v| v.into_iter().next());
let routing = routable_connector
.map(|connector| {
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 03cf9742f70..896b06ed721 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -179,11 +179,7 @@ impl TryFrom<StripeSetupIntentRequest> for payments::PaymentsRequest {
type Error = error_stack::Report<errors::ApiErrorResponse>;
fn try_from(item: StripeSetupIntentRequest) -> errors::RouterResult<Self> {
let routable_connector: Option<api_enums::RoutableConnectors> =
- item.connector.and_then(|v| {
- v.into_iter()
- .next()
- .map(api_enums::RoutableConnectors::from)
- });
+ item.connector.and_then(|v| v.into_iter().next());
let routing = routable_connector
.map(|connector| {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index bc93b9c53eb..94ace1e2b25 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3731,8 +3731,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
collect_billing_details_from_wallet_connector: self
.collect_billing_details_from_wallet_connector
.or(Some(false)),
- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
- .map(Into::into),
+ outgoing_webhook_custom_http_headers,
tax_connector_id: self.tax_connector_id,
is_tax_connector_enabled: self.is_tax_connector_enabled,
always_collect_billing_details_from_wallet_connector: self
@@ -3879,8 +3878,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
collect_billing_details_from_wallet_connector: self
.collect_billing_details_from_wallet_connector_if_required
.or(Some(false)),
- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
- .map(Into::into),
+ outgoing_webhook_custom_http_headers,
always_collect_billing_details_from_wallet_connector: self
.always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector: self
@@ -4185,8 +4183,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
collect_billing_details_from_wallet_connector: self
.collect_billing_details_from_wallet_connector,
is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,
- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
- .map(Into::into),
+ outgoing_webhook_custom_http_headers,
always_collect_billing_details_from_wallet_connector: self
.always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector: self
@@ -4318,8 +4315,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
collect_billing_details_from_wallet_connector: self
.collect_billing_details_from_wallet_connector_if_required,
is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,
- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
- .map(Into::into),
+ outgoing_webhook_custom_http_headers,
order_fulfillment_time: self
.order_fulfillment_time
.map(|order_fulfillment_time| order_fulfillment_time.into_inner()),
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 353c980c769..6699cf70db0 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -197,10 +197,8 @@ impl CustomerCreateBridge for customers::CustomerRequest {
customer: &'a domain::Customer,
) -> errors::CustomerResponse<customers::CustomerResponse> {
let address = self.get_address();
- let address_details = address.map(api_models::payments::AddressDetails::from);
-
Ok(services::ApplicationResponse::Json(
- customers::CustomerResponse::foreign_from((customer.clone(), address_details)),
+ customers::CustomerResponse::foreign_from((customer.clone(), address)),
))
}
}
@@ -1265,10 +1263,8 @@ impl CustomerUpdateBridge for customers::CustomerUpdateRequest {
customer: &'a domain::Customer,
) -> errors::CustomerResponse<customers::CustomerResponse> {
let address = self.get_address();
- let address_details = address.map(api_models::payments::AddressDetails::from);
-
Ok(services::ApplicationResponse::Json(
- customers::CustomerResponse::foreign_from((customer.clone(), address_details)),
+ customers::CustomerResponse::foreign_from((customer.clone(), address)),
))
}
}
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index ffb864ea072..f2e199d8584 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -905,7 +905,7 @@ pub async fn create_payment_method(
merchant_id,
key_store,
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
)
.await
.attach_printable("Failed to add Payment method to DB")?;
@@ -1191,7 +1191,7 @@ pub async fn payment_method_intent_create(
merchant_id,
key_store,
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
)
.await
.attach_printable("Failed to add Payment method to DB")?;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 1f37cc157e4..548007825e3 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -804,7 +804,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
payment_method_issuer: req.payment_method_issuer.clone(),
scheme: req.card_network.clone().or(card.scheme.clone()),
metadata: payment_method_metadata.map(Secret::new),
- payment_method_data: payment_method_data_encrypted.map(Into::into),
+ payment_method_data: payment_method_data_encrypted,
connector_mandate_details: connector_mandate_details.clone(),
customer_acceptance: None,
client_secret: None,
@@ -823,7 +823,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
created_at: current_time,
last_modified: current_time,
last_used_at: current_time,
- payment_method_billing_address: payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
updated_by: None,
version: domain::consts::API_VERSION,
network_token_requestor_reference_id: None,
@@ -1074,7 +1074,7 @@ pub async fn get_client_secret_or_add_payment_method(
Some(enums::PaymentMethodStatus::AwaitingData),
None,
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
None,
None,
None,
@@ -1167,7 +1167,7 @@ pub async fn get_client_secret_or_add_payment_method_for_migration(
Some(enums::PaymentMethodStatus::AwaitingData),
None,
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
None,
None,
None,
@@ -1687,7 +1687,7 @@ pub async fn add_payment_method(
connector_mandate_details,
req.network_transaction_id.clone(),
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
None,
None,
None,
@@ -1949,7 +1949,7 @@ pub async fn save_migration_payment_method(
connector_mandate_details.clone(),
network_transaction_id.clone(),
merchant_account.storage_scheme,
- payment_method_billing_address.map(Into::into),
+ payment_method_billing_address,
None,
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 fab2a9144c7..f61255de84c 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -283,7 +283,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_intent.metadata = request.metadata.clone().or(payment_intent.metadata);
// The operation merges mandate data from both request and payment_attempt
- let setup_mandate = mandate_data.map(Into::into);
+ let setup_mandate = mandate_data;
let mandate_details_present =
payment_attempt.mandate_details.is_some() || request.mandate_data.is_some();
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 06036c4bc59..5715f498477 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -19,7 +19,7 @@ use diesel_models::{
};
use error_stack::{self, ResultExt};
use hyperswitch_domain_models::{
- mandates::{MandateData, MandateDetails},
+ mandates::MandateDetails,
payments::{
payment_attempt::PaymentAttempt, payment_intent::CustomerData,
FromRequestEncryptablePaymentIntent,
@@ -493,7 +493,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.transpose()?;
// The operation merges mandate data from both request and payment_attempt
- let setup_mandate = mandate_data.map(MandateData::from);
+ let setup_mandate = mandate_data;
let surcharge_details = request.surcharge_details.map(|request_surcharge_details| {
payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt))
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 89a94552bc2..096b7ed0b39 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -421,7 +421,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.transpose()?;
// The operation merges mandate data from both request and payment_attempt
- let setup_mandate = mandate_data.map(Into::into);
+ let setup_mandate = mandate_data;
let mandate_details_present =
payment_attempt.mandate_details.is_some() || request.mandate_data.is_some();
helpers::validate_mandate_data_and_future_usage(
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index b4e4db3d161..deb6dbac03d 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -393,21 +393,20 @@ where
merchant_id,
pm_metadata,
customer_acceptance,
- pm_data_encrypted.map(Into::into),
+ pm_data_encrypted,
key_store,
None,
pm_status,
network_transaction_id,
merchant_account.storage_scheme,
- encrypted_payment_method_billing_address
- .map(Into::into),
+ encrypted_payment_method_billing_address,
resp.card.and_then(|card| {
card.card_network
.map(|card_network| card_network.to_string())
}),
network_token_requestor_ref_id,
network_token_locker_id,
- pm_network_token_data_encrypted.map(Into::into),
+ pm_network_token_data_encrypted,
)
.await
} else {
@@ -512,14 +511,13 @@ where
merchant_id,
resp.metadata.clone().map(|val| val.expose()),
customer_acceptance,
- pm_data_encrypted.map(Into::into),
+ pm_data_encrypted,
key_store,
None,
pm_status,
network_transaction_id,
merchant_account.storage_scheme,
- encrypted_payment_method_billing_address
- .map(Into::into),
+ encrypted_payment_method_billing_address,
resp.card.and_then(|card| {
card.card_network.map(|card_network| {
card_network.to_string()
@@ -527,7 +525,7 @@ where
}),
network_token_requestor_ref_id,
network_token_locker_id,
- pm_network_token_data_encrypted.map(Into::into),
+ pm_network_token_data_encrypted,
)
.await
} else {
@@ -732,20 +730,20 @@ where
merchant_id,
pm_metadata,
customer_acceptance,
- pm_data_encrypted.map(Into::into),
+ pm_data_encrypted,
key_store,
None,
pm_status,
network_transaction_id,
merchant_account.storage_scheme,
- encrypted_payment_method_billing_address.map(Into::into),
+ encrypted_payment_method_billing_address,
resp.card.and_then(|card| {
card.card_network
.map(|card_network| card_network.to_string())
}),
network_token_requestor_ref_id,
network_token_locker_id,
- pm_network_token_data_encrypted.map(Into::into),
+ pm_network_token_data_encrypted,
)
.await?;
};
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 661bd73b506..a3294d5627d 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -4002,7 +4002,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
currency: payment_data.currency,
browser_info,
email: payment_data.email,
- payment_method_data: payment_data.payment_method_data.map(From::from),
+ payment_method_data: payment_data.payment_method_data,
connector_transaction_id: payment_data
.payment_attempt
.get_connector_payment_id()
@@ -4096,7 +4096,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProce
let amount = payment_data.payment_attempt.get_total_amount();
Ok(Self {
- payment_method_data: payment_method_data.map(From::from),
+ payment_method_data,
email: payment_data.email,
currency: Some(payment_data.currency),
amount: Some(amount.get_amount_as_i64()), // need to change this once we move to connector module
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 7eb7925017e..332137b6a18 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -556,7 +556,7 @@ pub async fn save_payout_data_to_locker(
merchant_account.get_id(),
None,
None,
- card_details_encrypted.clone().map(Into::into),
+ card_details_encrypted.clone(),
key_store,
connector_mandate_details,
None,
diff --git a/crates/router/src/services/authorization/roles.rs b/crates/router/src/services/authorization/roles.rs
index c6b6946d15c..995975d12e8 100644
--- a/crates/router/src/services/authorization/roles.rs
+++ b/crates/router/src/services/authorization/roles.rs
@@ -165,7 +165,7 @@ impl From<diesel_models::role::Role> for RoleInfo {
Self {
role_id: role.role_id,
role_name: role.role_name,
- groups: role.groups.into_iter().map(Into::into).collect(),
+ groups: role.groups,
scope: role.scope,
entity_type: role.entity_type,
is_invitable: true,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 2852766cdd3..9764fb6222b 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -409,7 +409,7 @@ pub async fn create_profile_from_merchant_account(
always_collect_shipping_details_from_wallet_connector: request
.always_collect_shipping_details_from_wallet_connector
.or(Some(false)),
- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers.map(Into::into),
+ outgoing_webhook_custom_http_headers,
tax_connector_id: request.tax_connector_id,
is_tax_connector_enabled: request.is_tax_connector_enabled,
dynamic_routing_algorithm: None,
|
2025-02-25T12:54:09Z
|
## Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR addresses the clippy lints occurring due to new rust version 1.85.0
https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
6553e29e478a70e4d2f0124e5a55931377bd8123
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7338
|
Bug: add payment_method_type duplication check for samsung pay
As we do not have a unique identifier to store when we save a wallet, we are unable to prevent payment method duplication. As a result, when a customer uses a saved wallet, we end up saving it again. During the next payment, the customer will see two buttons for the same wallet in the customer PML.
To address this issue, we check if the wallet is already saved. If the particular wallet is already saved, we simply update the 'last used' status for the same wallet, rather than creating a new entry. This payment method duplication check is already implemented for Apple Pay and Google Pay, similar check needs to be added for samsung pay as well
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 54514f6e05a..c286ae04d5f 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1651,6 +1651,12 @@ pub enum PaymentMethodType {
DirectCarrierBilling,
}
+impl PaymentMethodType {
+ pub fn should_check_for_customer_saved_payment_method_type(self) -> bool {
+ matches!(self, Self::ApplePay | Self::GooglePay | Self::SamsungPay)
+ }
+}
+
impl masking::SerializableSecret for PaymentMethodType {}
/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 1803e12f0b2..8020c3d4d5f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -591,10 +591,13 @@ 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)
+ } else if request
+ .payment_method_type
+ .map(|payment_method_type_value| {
+ payment_method_type_value
+ .should_check_for_customer_saved_payment_method_type()
+ })
+ .unwrap_or(false)
{
let payment_request_customer_id = request.get_customer_id();
if let Some(customer_id) =
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index d46977d8c99..b4e4db3d161 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -655,9 +655,11 @@ where
},
None => {
let customer_saved_pm_option = if payment_method_type
- == Some(api_models::enums::PaymentMethodType::ApplePay)
- || payment_method_type
- == Some(api_models::enums::PaymentMethodType::GooglePay)
+ .map(|payment_method_type_value| {
+ payment_method_type_value
+ .should_check_for_customer_saved_payment_method_type()
+ })
+ .unwrap_or(false)
{
match state
.store
|
2025-02-21T09:00:17Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
As we do not have a unique identifier to store when we save a wallet, we are unable to prevent payment method duplication. As a result, when a customer uses a saved wallet, we end up saving it again. During the next payment, the customer will see two buttons for the same wallet in the customer PML.
To address this issue, we check if the wallet is already saved. If the particular wallet is already saved, we simply update the 'last used' status for the same wallet, rather than creating a new entry. This payment method duplication check is already implemented for Apple Pay and Google Pay, and in this PR, I have extended it to include Samsung Pay as well.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a merchant connector account with google pay or samsung pay enabled
-> Enable the below config
```
curl --location 'localhost:8080/configs/' \
--header 'api-key: api-key' \
--header 'Content-Type: application/json' \
--data '{
"key": "skip_saving_wallet_at_connector_merchant_1740130285",
"value": "[\"samsung_pay\",\"google_pay\"]"
}'
```
```
{
"key": "skip_saving_wallet_at_connector_merchant_1740130285",
"value": "[\"samsung_pay\",\"google_pay\"]"
}
```
-> Make a samsung pay payment with `"setup_future_usage": "off_session"`
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
"amount": 2300,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"amount_to_capture": 2300,
"customer_id": "cu_1740120198",
"setup_future_usage": "off_session",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "samsungpay@gmail.com",
"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": "wallet",
"payment_method_type": "samsung_pay",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"user_agent": "amet irure esse"
}
},
"billing": {
"address": {
"line1": "1467",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
}
},
"payment_method_data": {
"wallet": {
"samsung_pay": {
"payment_credential": {
"3_d_s": {
"type": "S",
"version": "100",
"data": "samsung pay token"
},
"payment_card_brand": "VI",
"payment_currency_type": "USD",
"payment_last4_fpan": "1661",
"method": "3DS",
"recurring_payment": false
}
}
}
}
}
'
```
```
{
"payment_id": "pay_2p8lTfi6OM7SZrj6PBnR",
"merchant_id": "merchant_1740130285",
"status": "succeeded",
"amount": 2300,
"net_amount": 2300,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 2300,
"connector": "cybersource",
"client_secret": "pay_2p8lTfi6OM7SZrj6PBnR_secret_gMXnHSdwMhvGnpslHATf",
"created": "2025-02-21T09:33:01.655Z",
"currency": "USD",
"customer_id": "cu_1740120198",
"customer": {
"id": "cu_1740120198",
"name": "Joseph Doe",
"email": "samsungpay@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"samsung_pay": {
"last4": "1661",
"card_network": "Visa",
"type": null
}
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "samsungpay@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "samsung_pay",
"connector_label": "cybersource_US_default_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1740120198",
"created_at": 1740130381,
"expires": 1740133981,
"secret": "epk_6ce927c963fa4105a8ab9228f97416b7"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7401303829696483104805",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_2p8lTfi6OM7SZrj6PBnR_1",
"payment_link": null,
"profile_id": "pro_Gi6ZTv5ZEsUTOmapC9Rq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_1qwQigfi1hdSHlCKLEOw",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-21T09:48:01.655Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-21T09:33:04.066Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
-> List customer payment methods for the above customer. We can see that there is only one payment method that is saved
```
curl --location 'http://localhost:8080/customers/cu_1740120198/payment_methods' \
--header 'Accept: application/json' \
--header 'api-key: api-key'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_NHsoBD91m4hXF1jHayz0",
"payment_method_id": "pm_BuHQFVj1XP70L0hlwzrT",
"customer_id": "cu_1740120198",
"payment_method": "wallet",
"payment_method_type": "samsung_pay",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": false,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": null,
"metadata": null,
"created": "2025-02-21T09:33:04.086Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-02-21T09:33:04.086Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": null
}
```
-> Make a google pay payment for the same customer and make customer pml. The response will contain the google pay at the top indicating it is the recently used payment method type.
```
curl --location 'http://localhost:8080/customers/cu_1740120198/payment_methods' \
--header 'Accept: application/json' \
--header 'api-key: api-key'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_CLtCX0lG2248Tg9x8TCs",
"payment_method_id": "pm_YQISjUrUW9YHJT0Szb7P",
"customer_id": "cu_1740120198",
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": false,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": null,
"metadata": null,
"created": "2025-02-21T09:38:01.648Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-02-21T09:38:01.648Z",
"default_payment_method_set": false,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
}
},
{
"payment_token": "token_1w5WhYajhQbs8ghjTCXP",
"payment_method_id": "pm_BuHQFVj1XP70L0hlwzrT",
"customer_id": "cu_1740120198",
"payment_method": "wallet",
"payment_method_type": "samsung_pay",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": false,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": null,
"metadata": null,
"created": "2025-02-21T09:33:04.086Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-02-21T09:33:04.086Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": null
}
```
-> Now make one more samsung pay payment for the same customer
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
"amount": 2300,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"amount_to_capture": 2300,
"customer_id": "cu_1740120198",
"setup_future_usage": "off_session",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "samsungpay@gmail.com",
"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": "wallet",
"payment_method_type": "samsung_pay",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"user_agent": "amet irure esse"
}
},
"billing": {
"address": {
"line1": "1467",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
}
},
"payment_method_data": {
"wallet": {
"samsung_pay": {
"payment_credential": {
"3_d_s": {
"type": "S",
"version": "100",
"data": "samsung pay token"
},
"payment_card_brand": "VI",
"payment_currency_type": "USD",
"payment_last4_fpan": "1661",
"method": "3DS",
"recurring_payment": false
}
}
}
}
}
'
```
```
{
"payment_id": "pay_4ixWGjRYTrngGcTYhhYO",
"merchant_id": "merchant_1740130285",
"status": "succeeded",
"amount": 2300,
"net_amount": 2300,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 2300,
"connector": "cybersource",
"client_secret": "pay_4ixWGjRYTrngGcTYhhYO_secret_PbeOhfHgCOZNYYYTmzcB",
"created": "2025-02-21T09:40:10.925Z",
"currency": "USD",
"customer_id": "cu_1740120198",
"customer": {
"id": "cu_1740120198",
"name": "Joseph Doe",
"email": "samsungpay@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"samsung_pay": {
"last4": "1661",
"card_network": "Visa",
"type": null
}
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "samsungpay@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "samsung_pay",
"connector_label": "cybersource_US_default_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1740120198",
"created_at": 1740130810,
"expires": 1740134410,
"secret": "epk_86d9427e2e0641ae9d888d0aee1892e9"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7401308119186931304807",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_4ixWGjRYTrngGcTYhhYO_1",
"payment_link": null,
"profile_id": "pro_Gi6ZTv5ZEsUTOmapC9Rq",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_1qwQigfi1hdSHlCKLEOw",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-21T09:55:10.925Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-21T09:40:13.489Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
-> Make customer pml. The response should contain samsung pay at the top indicating it is the recently used payment method type and also there should only be one samsung pay button
```
curl --location 'http://localhost:8080/customers/cu_1740120198/payment_methods' \
--header 'Accept: application/json' \
--header 'api-key: api-key'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_6QkmZgFGtk17Spmc0Krc",
"payment_method_id": "pm_BuHQFVj1XP70L0hlwzrT",
"customer_id": "cu_1740120198",
"payment_method": "wallet",
"payment_method_type": "samsung_pay",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": false,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": null,
"metadata": null,
"created": "2025-02-21T09:33:04.086Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-02-21T09:40:13.492Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
}
},
{
"payment_token": "token_uUhRNFlDlK8pkDXapajC",
"payment_method_id": "pm_YQISjUrUW9YHJT0Szb7P",
"customer_id": "cu_1740120198",
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": false,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": null,
"metadata": null,
"created": "2025-02-21T09:38:01.648Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-02-21T09:38:01.648Z",
"default_payment_method_set": false,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": null,
"line3": null,
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
de865bd13440f965c0d3ffbe44a71925978212dd
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7382
|
Bug: feat(core): create process tracker workflow
create process tracker workflow
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 8f14dc8d860..0c58411dbf7 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -325,7 +325,7 @@ impl PaymentsCreateIntentRequest {
}
// This struct is only used internally, not visible in API Reference
-#[derive(Debug, Clone, serde::Serialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[cfg(feature = "v2")]
pub struct PaymentsGetIntentRequest {
pub id: id_type::GlobalPaymentId,
diff --git a/crates/diesel_models/src/enums.rs b/crates/diesel_models/src/enums.rs
index 1ee1a090ffa..7fda63fb6a5 100644
--- a/crates/diesel_models/src/enums.rs
+++ b/crates/diesel_models/src/enums.rs
@@ -103,6 +103,8 @@ pub enum ProcessTrackerStatus {
ProcessStarted,
// Finished by consumer
Finish,
+ // Review the task
+ Review,
}
// Refund
diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rs
index cd2c429c55e..f998ca5d237 100644
--- a/crates/diesel_models/src/process_tracker.rs
+++ b/crates/diesel_models/src/process_tracker.rs
@@ -210,6 +210,7 @@ pub enum ProcessTrackerRunner {
OutgoingWebhookRetryWorkflow,
AttachPayoutAccountWorkflow,
PaymentMethodStatusUpdateWorkflow,
+ PassiveRecoveryWorkflow,
}
#[cfg(test)]
@@ -265,4 +266,19 @@ pub mod business_status {
/// Business status set for newly created tasks.
pub const PENDING: &str = "Pending";
+
+ /// For the PCR Workflow
+ ///
+ /// This status indicates the completion of a execute task
+ pub const EXECUTE_WORKFLOW_COMPLETE: &str = "COMPLETED_EXECUTE_TASK";
+
+ /// This status indicates that the execute task was completed to trigger the psync task
+ pub const EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC: &str = "COMPLETED_EXECUTE_TASK_TO_TRIGGER_PSYNC";
+
+ /// This status indicates that the execute task was completed to trigger the review task
+ pub const EXECUTE_WORKFLOW_COMPLETE_FOR_REVIEW: &str =
+ "COMPLETED_EXECUTE_TASK_TO_TRIGGER_REVIEW";
+
+ /// This status indicates the completion of a psync task
+ pub const PSYNC_WORKFLOW_COMPLETE: &str = "COMPLETED_PSYNC_TASK";
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index cc1a7054ded..fb08d7a7191 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -318,7 +318,7 @@ pub enum PaymentIntentUpdate {
/// PreUpdate tracker of ConfirmIntent
ConfirmIntent {
status: common_enums::IntentStatus,
- active_attempt_id: id_type::GlobalAttemptId,
+ active_attempt_id: Option<id_type::GlobalAttemptId>,
updated_by: String,
},
/// PostUpdate tracker of ConfirmIntent
@@ -397,7 +397,7 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
updated_by,
} => Self {
status: Some(status),
- active_attempt_id: Some(active_attempt_id),
+ active_attempt_id,
modified_at: common_utils::date_time::now(),
amount: None,
amount_captured: None,
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 63dc9a58632..a997d062bc8 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -252,7 +252,6 @@ pub async fn deep_health_check_func(
#[derive(Debug, Copy, Clone)]
pub struct WorkflowRunner;
-#[cfg(feature = "v1")]
#[async_trait::async_trait]
impl ProcessTrackerWorkflows<routes::SessionState> for WorkflowRunner {
async fn trigger_workflow<'a>(
@@ -322,6 +321,9 @@ impl ProcessTrackerWorkflows<routes::SessionState> for WorkflowRunner {
storage::ProcessTrackerRunner::PaymentMethodStatusUpdateWorkflow => Ok(Box::new(
workflows::payment_method_status_update::PaymentMethodStatusUpdateWorkflow,
)),
+ storage::ProcessTrackerRunner::PassiveRecoveryWorkflow => Ok(Box::new(
+ workflows::passive_churn_recovery_workflow::ExecutePcrWorkflow,
+ )),
}
};
@@ -360,18 +362,6 @@ impl ProcessTrackerWorkflows<routes::SessionState> for WorkflowRunner {
}
}
-#[cfg(feature = "v2")]
-#[async_trait::async_trait]
-impl ProcessTrackerWorkflows<routes::SessionState> for WorkflowRunner {
- async fn trigger_workflow<'a>(
- &'a self,
- _state: &'a routes::SessionState,
- _process: storage::ProcessTracker,
- ) -> CustomResult<(), ProcessTrackerError> {
- todo!()
- }
-}
-
async fn start_scheduler(
state: &routes::AppState,
scheduler_flow: scheduler::SchedulerFlow,
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 365cdaf3a12..fa243d0269a 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -57,4 +57,6 @@ pub mod webhooks;
pub mod unified_authentication_service;
+#[cfg(feature = "v2")]
+pub mod passive_churn_recovery;
pub mod relay;
diff --git a/crates/router/src/core/passive_churn_recovery.rs b/crates/router/src/core/passive_churn_recovery.rs
new file mode 100644
index 00000000000..3c77de98e7e
--- /dev/null
+++ b/crates/router/src/core/passive_churn_recovery.rs
@@ -0,0 +1,207 @@
+pub mod transformers;
+pub mod types;
+use api_models::payments::PaymentsRetrieveRequest;
+use common_utils::{self, id_type, types::keymanager::KeyManagerState};
+use diesel_models::process_tracker::business_status;
+use error_stack::{self, ResultExt};
+use hyperswitch_domain_models::{
+ errors::api_error_response,
+ payments::{PaymentIntent, PaymentStatusData},
+};
+use scheduler::errors;
+
+use crate::{
+ core::{
+ errors::RouterResult,
+ passive_churn_recovery::types as pcr_types,
+ payments::{self, operations::Operation},
+ },
+ db::StorageInterface,
+ logger,
+ routes::{metrics, SessionState},
+ types::{
+ api,
+ storage::{self, passive_churn_recovery as pcr},
+ transformers::ForeignInto,
+ },
+};
+
+pub async fn perform_execute_payment(
+ state: &SessionState,
+ execute_task_process: &storage::ProcessTracker,
+ tracking_data: &pcr::PcrWorkflowTrackingData,
+ pcr_data: &pcr::PcrPaymentData,
+ _key_manager_state: &KeyManagerState,
+ payment_intent: &PaymentIntent,
+) -> Result<(), errors::ProcessTrackerError> {
+ let db = &*state.store;
+ let decision = pcr_types::Decision::get_decision_based_on_params(
+ state,
+ payment_intent.status,
+ false,
+ payment_intent.active_attempt_id.clone(),
+ pcr_data,
+ &tracking_data.global_payment_id,
+ )
+ .await?;
+ // TODO decide if its a global failure or is it requeueable error
+ match decision {
+ pcr_types::Decision::Execute => {
+ let action = pcr_types::Action::execute_payment(
+ db,
+ pcr_data.merchant_account.get_id(),
+ payment_intent,
+ execute_task_process,
+ )
+ .await?;
+ action
+ .execute_payment_task_response_handler(
+ db,
+ &pcr_data.merchant_account,
+ payment_intent,
+ execute_task_process,
+ &pcr_data.profile,
+ )
+ .await?;
+ }
+
+ pcr_types::Decision::Psync(attempt_status, attempt_id) => {
+ // find if a psync task is already present
+ let task = "PSYNC_WORKFLOW";
+ let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
+ let process_tracker_id = format!("{runner}_{task}_{}", attempt_id.get_string_repr());
+ let psync_process = db.find_process_by_id(&process_tracker_id).await?;
+
+ match psync_process {
+ Some(_) => {
+ let pcr_status: pcr_types::PcrAttemptStatus = attempt_status.foreign_into();
+
+ pcr_status
+ .update_pt_status_based_on_attempt_status_for_execute_payment(
+ db,
+ execute_task_process,
+ )
+ .await?;
+ }
+
+ None => {
+ // insert new psync task
+ insert_psync_pcr_task(
+ db,
+ pcr_data.merchant_account.get_id().clone(),
+ payment_intent.get_id().clone(),
+ pcr_data.profile.get_id().clone(),
+ attempt_id.clone(),
+ storage::ProcessTrackerRunner::PassiveRecoveryWorkflow,
+ )
+ .await?;
+
+ // finish the current task
+ db.finish_process_with_business_status(
+ execute_task_process.clone(),
+ business_status::EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC,
+ )
+ .await?;
+ }
+ };
+ }
+ pcr_types::Decision::InvalidDecision => {
+ db.finish_process_with_business_status(
+ execute_task_process.clone(),
+ business_status::EXECUTE_WORKFLOW_COMPLETE,
+ )
+ .await?;
+ logger::warn!("Abnormal State Identified")
+ }
+ }
+
+ Ok(())
+}
+
+async fn insert_psync_pcr_task(
+ db: &dyn StorageInterface,
+ merchant_id: id_type::MerchantId,
+ payment_id: id_type::GlobalPaymentId,
+ profile_id: id_type::ProfileId,
+ payment_attempt_id: id_type::GlobalAttemptId,
+ runner: storage::ProcessTrackerRunner,
+) -> RouterResult<storage::ProcessTracker> {
+ let task = "PSYNC_WORKFLOW";
+ let process_tracker_id = format!("{runner}_{task}_{}", payment_attempt_id.get_string_repr());
+ let schedule_time = common_utils::date_time::now();
+ let psync_workflow_tracking_data = pcr::PcrWorkflowTrackingData {
+ global_payment_id: payment_id,
+ merchant_id,
+ profile_id,
+ payment_attempt_id,
+ };
+ let tag = ["PCR"];
+ let process_tracker_entry = storage::ProcessTrackerNew::new(
+ process_tracker_id,
+ task,
+ runner,
+ tag,
+ psync_workflow_tracking_data,
+ schedule_time,
+ )
+ .change_context(api_error_response::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to construct delete tokenized data process tracker task")?;
+
+ let response = db
+ .insert_process(process_tracker_entry)
+ .await
+ .change_context(api_error_response::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to construct delete tokenized data process tracker task")?;
+ metrics::TASKS_ADDED_COUNT.add(1, router_env::metric_attributes!(("flow", "PsyncPcr")));
+
+ Ok(response)
+}
+
+pub async fn call_psync_api(
+ state: &SessionState,
+ global_payment_id: &id_type::GlobalPaymentId,
+ pcr_data: &pcr::PcrPaymentData,
+) -> RouterResult<PaymentStatusData<api::PSync>> {
+ let operation = payments::operations::PaymentGet;
+ let req = PaymentsRetrieveRequest {
+ force_sync: false,
+ param: None,
+ expand_attempts: true,
+ };
+ // TODO : Use api handler instead of calling get_tracker and payments_operation_core
+ // Get the tracker related information. This includes payment intent and payment attempt
+ let get_tracker_response = operation
+ .to_get_tracker()?
+ .get_trackers(
+ state,
+ global_payment_id,
+ &req,
+ &pcr_data.merchant_account,
+ &pcr_data.profile,
+ &pcr_data.key_store,
+ &hyperswitch_domain_models::payments::HeaderPayload::default(),
+ None,
+ )
+ .await?;
+
+ let (payment_data, _req, _, _, _) = Box::pin(payments::payments_operation_core::<
+ api::PSync,
+ _,
+ _,
+ _,
+ PaymentStatusData<api::PSync>,
+ >(
+ state,
+ state.get_req_state(),
+ pcr_data.merchant_account.clone(),
+ pcr_data.key_store.clone(),
+ &pcr_data.profile,
+ operation,
+ req,
+ get_tracker_response,
+ payments::CallConnectorAction::Trigger,
+ hyperswitch_domain_models::payments::HeaderPayload::default(),
+ ))
+ .await?;
+ Ok(payment_data)
+}
diff --git a/crates/router/src/core/passive_churn_recovery/transformers.rs b/crates/router/src/core/passive_churn_recovery/transformers.rs
new file mode 100644
index 00000000000..ce47714353a
--- /dev/null
+++ b/crates/router/src/core/passive_churn_recovery/transformers.rs
@@ -0,0 +1,39 @@
+use common_enums::AttemptStatus;
+
+use crate::{
+ core::passive_churn_recovery::types::PcrAttemptStatus, types::transformers::ForeignFrom,
+};
+
+impl ForeignFrom<AttemptStatus> for PcrAttemptStatus {
+ fn foreign_from(s: AttemptStatus) -> Self {
+ match s {
+ AttemptStatus::Authorized | AttemptStatus::Charged | AttemptStatus::AutoRefunded => {
+ Self::Succeeded
+ }
+
+ AttemptStatus::Started
+ | AttemptStatus::AuthenticationSuccessful
+ | AttemptStatus::Authorizing
+ | AttemptStatus::CodInitiated
+ | AttemptStatus::VoidInitiated
+ | AttemptStatus::CaptureInitiated
+ | AttemptStatus::Pending => Self::Processing,
+
+ AttemptStatus::AuthenticationFailed
+ | AttemptStatus::AuthorizationFailed
+ | AttemptStatus::VoidFailed
+ | AttemptStatus::RouterDeclined
+ | AttemptStatus::CaptureFailed
+ | AttemptStatus::Failure => Self::Failed,
+
+ AttemptStatus::Voided
+ | AttemptStatus::ConfirmationAwaited
+ | AttemptStatus::PartialCharged
+ | AttemptStatus::PartialChargedAndChargeable
+ | AttemptStatus::PaymentMethodAwaited
+ | AttemptStatus::AuthenticationPending
+ | AttemptStatus::DeviceDataCollectionPending
+ | AttemptStatus::Unresolved => Self::InvalidStatus(s.to_string()),
+ }
+ }
+}
diff --git a/crates/router/src/core/passive_churn_recovery/types.rs b/crates/router/src/core/passive_churn_recovery/types.rs
new file mode 100644
index 00000000000..c47248a882a
--- /dev/null
+++ b/crates/router/src/core/passive_churn_recovery/types.rs
@@ -0,0 +1,259 @@
+use common_enums::{self, AttemptStatus, IntentStatus};
+use common_utils::{self, ext_traits::OptionExt, id_type};
+use diesel_models::{enums, process_tracker::business_status};
+use error_stack::{self, ResultExt};
+use hyperswitch_domain_models::{
+ business_profile, merchant_account,
+ payments::{PaymentConfirmData, PaymentIntent},
+};
+use time::PrimitiveDateTime;
+
+use crate::{
+ core::{
+ errors::{self, RouterResult},
+ passive_churn_recovery::{self as core_pcr},
+ },
+ db::StorageInterface,
+ logger,
+ routes::SessionState,
+ types::{api::payments as api_types, storage, transformers::ForeignInto},
+ workflows::passive_churn_recovery_workflow::get_schedule_time_to_retry_mit_payments,
+};
+
+type RecoveryResult<T> = error_stack::Result<T, errors::RecoveryError>;
+
+/// The status of Passive Churn Payments
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+pub enum PcrAttemptStatus {
+ Succeeded,
+ Failed,
+ Processing,
+ InvalidStatus(String),
+ // Cancelled,
+}
+
+impl PcrAttemptStatus {
+ pub(crate) async fn update_pt_status_based_on_attempt_status_for_execute_payment(
+ &self,
+ db: &dyn StorageInterface,
+ execute_task_process: &storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ match &self {
+ Self::Succeeded | Self::Failed | Self::Processing => {
+ // finish the current execute task
+ db.finish_process_with_business_status(
+ execute_task_process.clone(),
+ business_status::EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC,
+ )
+ .await?;
+ }
+
+ Self::InvalidStatus(action) => {
+ logger::debug!(
+ "Invalid Attempt Status for the Recovery Payment : {}",
+ action
+ );
+ let pt_update = storage::ProcessTrackerUpdate::StatusUpdate {
+ status: enums::ProcessTrackerStatus::Review,
+ business_status: Some(String::from(business_status::EXECUTE_WORKFLOW_COMPLETE)),
+ };
+ // update the process tracker status as Review
+ db.update_process(execute_task_process.clone(), pt_update)
+ .await?;
+ }
+ };
+ Ok(())
+ }
+}
+#[derive(Debug, Clone)]
+pub enum Decision {
+ Execute,
+ Psync(AttemptStatus, id_type::GlobalAttemptId),
+ InvalidDecision,
+}
+
+impl Decision {
+ pub async fn get_decision_based_on_params(
+ state: &SessionState,
+ intent_status: IntentStatus,
+ called_connector: bool,
+ active_attempt_id: Option<id_type::GlobalAttemptId>,
+ pcr_data: &storage::passive_churn_recovery::PcrPaymentData,
+ payment_id: &id_type::GlobalPaymentId,
+ ) -> RecoveryResult<Self> {
+ Ok(match (intent_status, called_connector, active_attempt_id) {
+ (IntentStatus::Failed, false, None) => Self::Execute,
+ (IntentStatus::Processing, true, Some(_)) => {
+ let psync_data = core_pcr::call_psync_api(state, payment_id, pcr_data)
+ .await
+ .change_context(errors::RecoveryError::PaymentCallFailed)
+ .attach_printable("Error while executing the Psync call")?;
+ let payment_attempt = psync_data
+ .payment_attempt
+ .get_required_value("Payment Attempt")
+ .change_context(errors::RecoveryError::ValueNotFound)
+ .attach_printable("Error while executing the Psync call")?;
+ Self::Psync(payment_attempt.status, payment_attempt.get_id().clone())
+ }
+ _ => Self::InvalidDecision,
+ })
+ }
+}
+
+#[derive(Debug, Clone)]
+pub enum Action {
+ SyncPayment(id_type::GlobalAttemptId),
+ RetryPayment(PrimitiveDateTime),
+ TerminalFailure,
+ SuccessfulPayment,
+ ReviewPayment,
+ ManualReviewAction,
+}
+impl Action {
+ pub async fn execute_payment(
+ db: &dyn StorageInterface,
+ merchant_id: &id_type::MerchantId,
+ payment_intent: &PaymentIntent,
+ process: &storage::ProcessTracker,
+ ) -> RecoveryResult<Self> {
+ // call the proxy api
+ let response = call_proxy_api::<api_types::Authorize>(payment_intent);
+ // handle proxy api's response
+ match response {
+ Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() {
+ PcrAttemptStatus::Succeeded => Ok(Self::SuccessfulPayment),
+ PcrAttemptStatus::Failed => {
+ Self::decide_retry_failure_action(db, merchant_id, process.clone()).await
+ }
+
+ PcrAttemptStatus::Processing => {
+ Ok(Self::SyncPayment(payment_data.payment_attempt.id))
+ }
+ PcrAttemptStatus::InvalidStatus(action) => {
+ logger::info!(?action, "Invalid Payment Status For PCR Payment");
+ Ok(Self::ManualReviewAction)
+ }
+ },
+ Err(err) =>
+ // check for an active attempt being constructed or not
+ {
+ logger::error!(execute_payment_res=?err);
+ match payment_intent.active_attempt_id.clone() {
+ Some(attempt_id) => Ok(Self::SyncPayment(attempt_id)),
+ None => Ok(Self::ReviewPayment),
+ }
+ }
+ }
+ }
+
+ pub async fn execute_payment_task_response_handler(
+ &self,
+ db: &dyn StorageInterface,
+ merchant_account: &merchant_account::MerchantAccount,
+ payment_intent: &PaymentIntent,
+ execute_task_process: &storage::ProcessTracker,
+ profile: &business_profile::Profile,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ match self {
+ Self::SyncPayment(attempt_id) => {
+ core_pcr::insert_psync_pcr_task(
+ db,
+ merchant_account.get_id().to_owned(),
+ payment_intent.id.clone(),
+ profile.get_id().to_owned(),
+ attempt_id.clone(),
+ storage::ProcessTrackerRunner::PassiveRecoveryWorkflow,
+ )
+ .await
+ .change_context(errors::RecoveryError::ProcessTrackerFailure)
+ .attach_printable("Failed to create a psync workflow in the process tracker")?;
+
+ db.as_scheduler()
+ .finish_process_with_business_status(
+ execute_task_process.clone(),
+ business_status::EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC,
+ )
+ .await
+ .change_context(errors::RecoveryError::ProcessTrackerFailure)
+ .attach_printable("Failed to update the process tracker")?;
+ Ok(())
+ }
+
+ Self::RetryPayment(schedule_time) => {
+ let mut pt = execute_task_process.clone();
+ // update the schedule time
+ pt.schedule_time = Some(*schedule_time);
+
+ let pt_task_update = diesel_models::ProcessTrackerUpdate::StatusUpdate {
+ status: storage::enums::ProcessTrackerStatus::Pending,
+ business_status: Some(business_status::PENDING.to_owned()),
+ };
+ db.as_scheduler()
+ .update_process(pt.clone(), pt_task_update)
+ .await?;
+ // TODO: update the connector called field and make the active attempt None
+
+ Ok(())
+ }
+ Self::TerminalFailure => {
+ // TODO: Record a failure transaction back to Billing Connector
+ Ok(())
+ }
+ Self::SuccessfulPayment => Ok(()),
+ Self::ReviewPayment => Ok(()),
+ Self::ManualReviewAction => {
+ logger::debug!("Invalid Payment Status For PCR Payment");
+ let pt_update = storage::ProcessTrackerUpdate::StatusUpdate {
+ status: enums::ProcessTrackerStatus::Review,
+ business_status: Some(String::from(business_status::EXECUTE_WORKFLOW_COMPLETE)),
+ };
+ // update the process tracker status as Review
+ db.as_scheduler()
+ .update_process(execute_task_process.clone(), pt_update)
+ .await?;
+ Ok(())
+ }
+ }
+ }
+
+ pub(crate) async fn decide_retry_failure_action(
+ db: &dyn StorageInterface,
+ merchant_id: &id_type::MerchantId,
+ pt: storage::ProcessTracker,
+ ) -> RecoveryResult<Self> {
+ let schedule_time =
+ get_schedule_time_to_retry_mit_payments(db, merchant_id, pt.retry_count + 1).await;
+ match schedule_time {
+ Some(schedule_time) => Ok(Self::RetryPayment(schedule_time)),
+
+ None => Ok(Self::TerminalFailure),
+ }
+ }
+}
+
+// This function would be converted to proxy_payments_core
+fn call_proxy_api<F>(payment_intent: &PaymentIntent) -> RouterResult<PaymentConfirmData<F>>
+where
+ F: Send + Clone + Sync,
+{
+ let payment_address = hyperswitch_domain_models::payment_address::PaymentAddress::new(
+ payment_intent
+ .shipping_address
+ .clone()
+ .map(|address| address.into_inner()),
+ payment_intent
+ .billing_address
+ .clone()
+ .map(|address| address.into_inner()),
+ None,
+ Some(true),
+ );
+ let response = PaymentConfirmData {
+ flow: std::marker::PhantomData,
+ payment_intent: payment_intent.clone(),
+ payment_attempt: todo!(),
+ payment_method_data: None,
+ payment_address,
+ };
+ Ok(response)
+}
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 0f42948e3f0..40b1918323c 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -210,8 +210,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
)
.await?;
- let payment_attempt = db
- .insert_payment_attempt(
+ let payment_attempt: hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt =
+ db.insert_payment_attempt(
key_manager_state,
key_store,
payment_attempt_domain_model,
@@ -416,7 +416,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::ConfirmIntent {
status: intent_status,
updated_by: storage_scheme.to_string(),
- active_attempt_id: payment_data.payment_attempt.id.clone(),
+ active_attempt_id: Some(payment_data.payment_attempt.id.clone()),
};
let authentication_type = payment_data.payment_attempt.authentication_type;
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 96a0d580056..bd033ff4c2a 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -28,6 +28,8 @@ pub mod mandate;
pub mod merchant_account;
pub mod merchant_connector_account;
pub mod merchant_key_store;
+#[cfg(feature = "v2")]
+pub mod passive_churn_recovery;
pub mod payment_attempt;
pub mod payment_link;
pub mod payment_method;
diff --git a/crates/router/src/types/storage/passive_churn_recovery.rs b/crates/router/src/types/storage/passive_churn_recovery.rs
new file mode 100644
index 00000000000..3cf3316a398
--- /dev/null
+++ b/crates/router/src/types/storage/passive_churn_recovery.rs
@@ -0,0 +1,18 @@
+use std::fmt::Debug;
+
+use common_utils::id_type;
+use hyperswitch_domain_models::{business_profile, merchant_account, merchant_key_store};
+#[derive(serde::Serialize, serde::Deserialize, Debug)]
+pub struct PcrWorkflowTrackingData {
+ pub merchant_id: id_type::MerchantId,
+ pub profile_id: id_type::ProfileId,
+ pub global_payment_id: id_type::GlobalPaymentId,
+ pub payment_attempt_id: id_type::GlobalAttemptId,
+}
+
+#[derive(Debug, Clone)]
+pub struct PcrPaymentData {
+ pub merchant_account: merchant_account::MerchantAccount,
+ pub profile: business_profile::Profile,
+ pub key_store: merchant_key_store::MerchantKeyStore,
+}
diff --git a/crates/router/src/workflows.rs b/crates/router/src/workflows.rs
index e86d49faf6c..4961932e067 100644
--- a/crates/router/src/workflows.rs
+++ b/crates/router/src/workflows.rs
@@ -2,12 +2,12 @@
pub mod api_key_expiry;
#[cfg(feature = "payouts")]
pub mod attach_payout_account_workflow;
-#[cfg(feature = "v1")]
pub mod outgoing_webhook_retry;
-#[cfg(feature = "v1")]
pub mod payment_method_status_update;
pub mod payment_sync;
-#[cfg(feature = "v1")]
+
pub mod refund_router;
-#[cfg(feature = "v1")]
+
pub mod tokenized_data;
+
+pub mod passive_churn_recovery_workflow;
diff --git a/crates/router/src/workflows/outgoing_webhook_retry.rs b/crates/router/src/workflows/outgoing_webhook_retry.rs
index c7df4aeff0c..9be893c7ac8 100644
--- a/crates/router/src/workflows/outgoing_webhook_retry.rs
+++ b/crates/router/src/workflows/outgoing_webhook_retry.rs
@@ -36,6 +36,7 @@ pub struct OutgoingWebhookRetryWorkflow;
#[async_trait::async_trait]
impl ProcessTrackerWorkflow<SessionState> for OutgoingWebhookRetryWorkflow {
+ #[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn execute_workflow<'a>(
&'a self,
@@ -226,6 +227,14 @@ impl ProcessTrackerWorkflow<SessionState> for OutgoingWebhookRetryWorkflow {
Ok(())
}
+ #[cfg(feature = "v2")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ todo!()
+ }
#[instrument(skip_all)]
async fn error_handler<'a>(
@@ -266,6 +275,7 @@ impl ProcessTrackerWorkflow<SessionState> for OutgoingWebhookRetryWorkflow {
/// seconds between them by default.
/// - `custom_merchant_mapping.merchant_id1`: Merchant-specific retry configuration for merchant
/// with merchant ID `merchant_id1`.
+#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub(crate) async fn get_webhook_delivery_retry_schedule_time(
db: &dyn StorageInterface,
@@ -311,6 +321,7 @@ pub(crate) async fn get_webhook_delivery_retry_schedule_time(
}
/// Schedule the webhook delivery task for retry
+#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub(crate) async fn retry_webhook_delivery_task(
db: &dyn StorageInterface,
@@ -334,6 +345,7 @@ pub(crate) async fn retry_webhook_delivery_task(
}
}
+#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn get_outgoing_webhook_content_and_event_type(
state: SessionState,
diff --git a/crates/router/src/workflows/passive_churn_recovery_workflow.rs b/crates/router/src/workflows/passive_churn_recovery_workflow.rs
new file mode 100644
index 00000000000..d67f91f1169
--- /dev/null
+++ b/crates/router/src/workflows/passive_churn_recovery_workflow.rs
@@ -0,0 +1,175 @@
+#[cfg(feature = "v2")]
+use api_models::payments::PaymentsGetIntentRequest;
+#[cfg(feature = "v2")]
+use common_utils::ext_traits::{StringExt, ValueExt};
+#[cfg(feature = "v2")]
+use error_stack::ResultExt;
+#[cfg(feature = "v2")]
+use hyperswitch_domain_models::payments::PaymentIntentData;
+#[cfg(feature = "v2")]
+use router_env::logger;
+use scheduler::{consumer::workflows::ProcessTrackerWorkflow, errors};
+#[cfg(feature = "v2")]
+use scheduler::{types::process_data, utils as scheduler_utils};
+
+#[cfg(feature = "v2")]
+use crate::{
+ core::{
+ passive_churn_recovery::{self as pcr},
+ payments,
+ },
+ db::StorageInterface,
+ errors::StorageError,
+ types::{
+ api::{self as api_types},
+ storage::passive_churn_recovery as pcr_storage_types,
+ },
+};
+use crate::{routes::SessionState, types::storage};
+pub struct ExecutePcrWorkflow;
+
+#[async_trait::async_trait]
+impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
+ #[cfg(feature = "v1")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ Ok(())
+ }
+ #[cfg(feature = "v2")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ state: &'a SessionState,
+ process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ let tracking_data = process
+ .tracking_data
+ .clone()
+ .parse_value::<pcr_storage_types::PcrWorkflowTrackingData>(
+ "PCRWorkflowTrackingData",
+ )?;
+ let request = PaymentsGetIntentRequest {
+ id: tracking_data.global_payment_id.clone(),
+ };
+ let key_manager_state = &state.into();
+ let pcr_data = extract_data_and_perform_action(state, &tracking_data).await?;
+ let (payment_data, _, _) = payments::payments_intent_operation_core::<
+ api_types::PaymentGetIntent,
+ _,
+ _,
+ PaymentIntentData<api_types::PaymentGetIntent>,
+ >(
+ state,
+ state.get_req_state(),
+ pcr_data.merchant_account.clone(),
+ pcr_data.profile.clone(),
+ pcr_data.key_store.clone(),
+ payments::operations::PaymentGetIntent,
+ request,
+ tracking_data.global_payment_id.clone(),
+ hyperswitch_domain_models::payments::HeaderPayload::default(),
+ None,
+ )
+ .await?;
+
+ match process.name.as_deref() {
+ Some("EXECUTE_WORKFLOW") => {
+ pcr::perform_execute_payment(
+ state,
+ &process,
+ &tracking_data,
+ &pcr_data,
+ key_manager_state,
+ &payment_data.payment_intent,
+ )
+ .await
+ }
+ Some("PSYNC_WORKFLOW") => todo!(),
+
+ Some("REVIEW_WORKFLOW") => todo!(),
+ _ => Err(errors::ProcessTrackerError::JobNotFound),
+ }
+ }
+}
+#[cfg(feature = "v2")]
+pub(crate) async fn extract_data_and_perform_action(
+ state: &SessionState,
+ tracking_data: &pcr_storage_types::PcrWorkflowTrackingData,
+) -> Result<pcr_storage_types::PcrPaymentData, errors::ProcessTrackerError> {
+ let db = &state.store;
+
+ let key_manager_state = &state.into();
+ let key_store = db
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &tracking_data.merchant_id,
+ &db.get_master_key().to_vec().into(),
+ )
+ .await?;
+
+ let merchant_account = db
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &tracking_data.merchant_id,
+ &key_store,
+ )
+ .await?;
+
+ let profile = db
+ .find_business_profile_by_profile_id(
+ key_manager_state,
+ &key_store,
+ &tracking_data.profile_id,
+ )
+ .await?;
+
+ let pcr_payment_data = pcr_storage_types::PcrPaymentData {
+ merchant_account,
+ profile,
+ key_store,
+ };
+ Ok(pcr_payment_data)
+}
+
+#[cfg(feature = "v2")]
+pub(crate) async fn get_schedule_time_to_retry_mit_payments(
+ db: &dyn StorageInterface,
+ merchant_id: &common_utils::id_type::MerchantId,
+ retry_count: i32,
+) -> Option<time::PrimitiveDateTime> {
+ let key = "pt_mapping_pcr_retries";
+ let result = db
+ .find_config_by_key(key)
+ .await
+ .map(|value| value.config)
+ .and_then(|config| {
+ config
+ .parse_struct("RevenueRecoveryPaymentProcessTrackerMapping")
+ .change_context(StorageError::DeserializationFailed)
+ });
+
+ let mapping = result.map_or_else(
+ |error| {
+ if error.current_context().is_db_not_found() {
+ logger::debug!("Revenue Recovery retry config `{key}` not found, ignoring");
+ } else {
+ logger::error!(
+ ?error,
+ "Failed to read Revenue Recovery retry config `{key}`"
+ );
+ }
+ process_data::RevenueRecoveryPaymentProcessTrackerMapping::default()
+ },
+ |mapping| {
+ logger::debug!(?mapping, "Using custom pcr payments retry config");
+ mapping
+ },
+ );
+
+ let time_delta =
+ scheduler_utils::get_pcr_payments_retry_schedule_time(mapping, merchant_id, retry_count);
+
+ scheduler_utils::get_time_from_delta(time_delta)
+}
diff --git a/crates/router/src/workflows/payment_method_status_update.rs b/crates/router/src/workflows/payment_method_status_update.rs
index 124417e3355..dba3bace252 100644
--- a/crates/router/src/workflows/payment_method_status_update.rs
+++ b/crates/router/src/workflows/payment_method_status_update.rs
@@ -111,6 +111,14 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentMethodStatusUpdateWorkflow
Ok(())
}
+ #[cfg(feature = "v2")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ todo!()
+ }
async fn error_handler<'a>(
&'a self,
_state: &'a SessionState,
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index fb83922935e..64c4853d14b 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -31,8 +31,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
#[cfg(feature = "v2")]
async fn execute_workflow<'a>(
&'a self,
- state: &'a SessionState,
- process: storage::ProcessTracker,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
) -> Result<(), sch_errors::ProcessTrackerError> {
todo!()
}
diff --git a/crates/router/src/workflows/refund_router.rs b/crates/router/src/workflows/refund_router.rs
index 515e34c0689..82e7d8a45de 100644
--- a/crates/router/src/workflows/refund_router.rs
+++ b/crates/router/src/workflows/refund_router.rs
@@ -1,13 +1,14 @@
use scheduler::consumer::workflows::ProcessTrackerWorkflow;
-use crate::{
- core::refunds as refund_flow, errors, logger::error, routes::SessionState, types::storage,
-};
+#[cfg(feature = "v1")]
+use crate::core::refunds as refund_flow;
+use crate::{errors, logger::error, routes::SessionState, types::storage};
pub struct RefundWorkflowRouter;
#[async_trait::async_trait]
impl ProcessTrackerWorkflow<SessionState> for RefundWorkflowRouter {
+ #[cfg(feature = "v1")]
async fn execute_workflow<'a>(
&'a self,
state: &'a SessionState,
@@ -15,6 +16,14 @@ impl ProcessTrackerWorkflow<SessionState> for RefundWorkflowRouter {
) -> Result<(), errors::ProcessTrackerError> {
Ok(Box::pin(refund_flow::start_refund_workflow(state, &process)).await?)
}
+ #[cfg(feature = "v2")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ todo!()
+ }
async fn error_handler<'a>(
&'a self,
diff --git a/crates/router/src/workflows/tokenized_data.rs b/crates/router/src/workflows/tokenized_data.rs
index bc1842205ae..2f2474df66c 100644
--- a/crates/router/src/workflows/tokenized_data.rs
+++ b/crates/router/src/workflows/tokenized_data.rs
@@ -1,13 +1,14 @@
use scheduler::consumer::workflows::ProcessTrackerWorkflow;
-use crate::{
- core::payment_methods::vault, errors, logger::error, routes::SessionState, types::storage,
-};
+#[cfg(feature = "v1")]
+use crate::core::payment_methods::vault;
+use crate::{errors, logger::error, routes::SessionState, types::storage};
pub struct DeleteTokenizeDataWorkflow;
#[async_trait::async_trait]
impl ProcessTrackerWorkflow<SessionState> for DeleteTokenizeDataWorkflow {
+ #[cfg(feature = "v1")]
async fn execute_workflow<'a>(
&'a self,
state: &'a SessionState,
@@ -16,6 +17,15 @@ impl ProcessTrackerWorkflow<SessionState> for DeleteTokenizeDataWorkflow {
Ok(vault::start_tokenize_data_workflow(state, &process).await?)
}
+ #[cfg(feature = "v2")]
+ async fn execute_workflow<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _process: storage::ProcessTracker,
+ ) -> Result<(), errors::ProcessTrackerError> {
+ todo!()
+ }
+
async fn error_handler<'a>(
&'a self,
_state: &'a SessionState,
diff --git a/crates/scheduler/src/consumer/types/process_data.rs b/crates/scheduler/src/consumer/types/process_data.rs
index f68ad4795df..26d0fdf7022 100644
--- a/crates/scheduler/src/consumer/types/process_data.rs
+++ b/crates/scheduler/src/consumer/types/process_data.rs
@@ -82,3 +82,39 @@ impl Default for OutgoingWebhookRetryProcessTrackerMapping {
}
}
}
+
+/// Configuration for outgoing webhook retries.
+#[derive(Debug, Serialize, Deserialize)]
+pub struct RevenueRecoveryPaymentProcessTrackerMapping {
+ /// Default (fallback) retry configuration used when no merchant-specific retry configuration
+ /// exists.
+ pub default_mapping: RetryMapping,
+
+ /// Merchant-specific retry configuration.
+ pub custom_merchant_mapping: HashMap<common_utils::id_type::MerchantId, RetryMapping>,
+}
+
+impl Default for RevenueRecoveryPaymentProcessTrackerMapping {
+ fn default() -> Self {
+ Self {
+ default_mapping: RetryMapping {
+ // 1st attempt happens after 1 minute of it being
+ start_after: 60,
+
+ frequencies: vec![
+ // 2nd and 3rd attempts happen at intervals of 3 hours each
+ (60 * 60 * 3, 2),
+ // 4th, 5th, 6th attempts happen at intervals of 6 hours each
+ (60 * 60 * 6, 3),
+ // 7th, 8th, 9th attempts happen at intervals of 9 hour each
+ (60 * 60 * 9, 3),
+ // 10th, 11th and 12th attempts happen at intervals of 12 hours each
+ (60 * 60 * 12, 3),
+ // 13th, 14th and 15th attempts happen at intervals of 18 hours each
+ (60 * 60 * 18, 3),
+ ],
+ },
+ custom_merchant_mapping: HashMap::new(),
+ }
+ }
+}
diff --git a/crates/scheduler/src/errors.rs b/crates/scheduler/src/errors.rs
index 1fb7599aed0..254c4979524 100644
--- a/crates/scheduler/src/errors.rs
+++ b/crates/scheduler/src/errors.rs
@@ -4,7 +4,7 @@ use external_services::email::EmailError;
use hyperswitch_domain_models::errors::api_error_response::ApiErrorResponse;
pub use redis_interface::errors::RedisError;
pub use storage_impl::errors::ApplicationError;
-use storage_impl::errors::StorageError;
+use storage_impl::errors::{RecoveryError, StorageError};
use crate::env::logger::{self, error};
@@ -46,6 +46,8 @@ pub enum ProcessTrackerError {
EApiErrorResponse,
#[error("Received Error ClientError")]
EClientError,
+ #[error("Received RecoveryError: {0:?}")]
+ ERecoveryError(error_stack::Report<RecoveryError>),
#[error("Received Error StorageError: {0:?}")]
EStorageError(error_stack::Report<StorageError>),
#[error("Received Error RedisError: {0:?}")]
@@ -131,3 +133,8 @@ error_to_process_tracker_error!(
error_stack::Report<EmailError>,
ProcessTrackerError::EEmailError(error_stack::Report<EmailError>)
);
+
+error_to_process_tracker_error!(
+ error_stack::Report<RecoveryError>,
+ ProcessTrackerError::ERecoveryError(error_stack::Report<RecoveryError>)
+);
diff --git a/crates/scheduler/src/utils.rs b/crates/scheduler/src/utils.rs
index 0dbea173eae..3d7f637de90 100644
--- a/crates/scheduler/src/utils.rs
+++ b/crates/scheduler/src/utils.rs
@@ -350,6 +350,25 @@ pub fn get_outgoing_webhook_retry_schedule_time(
}
}
+pub fn get_pcr_payments_retry_schedule_time(
+ mapping: process_data::RevenueRecoveryPaymentProcessTrackerMapping,
+ merchant_id: &common_utils::id_type::MerchantId,
+ retry_count: i32,
+) -> Option<i32> {
+ let mapping = match mapping.custom_merchant_mapping.get(merchant_id) {
+ Some(map) => map.clone(),
+ None => mapping.default_mapping,
+ };
+ // TODO: check if the current scheduled time is not more than the configured timerange
+
+ // For first try, get the `start_after` time
+ if retry_count == 0 {
+ Some(mapping.start_after)
+ } else {
+ get_delay(retry_count, &mapping.frequencies)
+ }
+}
+
/// Get the delay based on the retry count
pub fn get_delay<'a>(
retry_count: i32,
diff --git a/crates/storage_impl/src/errors.rs b/crates/storage_impl/src/errors.rs
index d75911d593c..657e9b000a5 100644
--- a/crates/storage_impl/src/errors.rs
+++ b/crates/storage_impl/src/errors.rs
@@ -299,3 +299,15 @@ pub enum HealthCheckGRPCServiceError {
#[error("Failed to establish connection with gRPC service")]
FailedToCallService,
}
+
+#[derive(thiserror::Error, Debug, Clone)]
+pub enum RecoveryError {
+ #[error("Failed to make a recovery payment")]
+ PaymentCallFailed,
+ #[error("Encountered a Process Tracker Task Failure")]
+ ProcessTrackerFailure,
+ #[error("The encountered task is invalid")]
+ InvalidTask,
+ #[error("The Intended data was not found")]
+ ValueNotFound,
+}
|
2025-01-28T06:07:28Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
- This PR ,creates a process_tracker execute workflow , to trigger a MIT Payment retry
- The first retry attempt , would create a Execute task entry in the PT which would do a api call to the pg to do the MIT payment,
- Its based on the intent status and the called connector param and active_attemt_id, we take a decision, If Decision:
- **Execute** (i.e, the payment_intent status is in processing and there is no active attempt present)
> **Action**: The payment is done , and based on the attempt status get the actions
>If its a **sync Action** , then the payment status is processing -> create another task to perform psync **;** Finish the current task
> If the payment_status is a **success** -> Send back a successful webhook **;** Finish the current task
> If the payment is a **terminal_failure** -> Send back a failure webhook **;** Finish The Current Task
> If the payment is a **retryable payment** the action would be **Retry** -> update the current task process to pending and increment the retry count by 1
> If its an unintended attempt status move it to Manual Review **;** Mark the current task’s pt status as ‘Review’
> If there was an error check if ,
=> If the payment intent doesn’t have an **active_attempt_id** , a new pt task `REVIEW_TASK` is introduced **;** Finish the current task
=> If there is a **active_attempt_id** then, create another task to perform psync **;** Finish the current task
- **Psync** (i.e., the payment_intent status is in processing but the connector has been called and there is an active attempt)
> If an existing process_tracker entry for the `PSYNC TASK`exists, then
=> **Action**: match attempt status and update the process tracker status based on that.
=> Finish the current task
> If there isn’t any `PSYNC_TASK` in process tracker,
=> **Action**: Create a new psync_task in process tracker
=> Finish the current task
- **ReviewTaskForFailedPayment**(To check if the failure is a terminal failure or a retryable one in which the db update for connector_called field and active_attempt_id did not happen successfully) | **ReviewTaskForSuccessfulPayment** (to prevent from double charge)
> Create a `Review_Task` , which is would to handle the abnormal states of a payment (it would re evaluate the decision taken on payment_intent’s params) ; finish the current task
> `This is implemented in the following` [PR](https://github.com/juspay/hyperswitch/pull/7178)
- InvalidTask
> If there is an ambiguous state then log it and finish the current task
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
> This is a v2 PR, cannot be tested , until this [PR](https://github.com/juspay/hyperswitch/pull/7215) gets merged
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
d945da635dfc84a2135aef456292fa54d9d5982e
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7328
|
Bug: [BUG] [DATATRANS] Add new payment status
### Bug Description
For connector Datatrans new payment status need to be added: ChallengeOngoing and ChallengeRequired
### Expected Behavior
ChallengeOngoing and ChallengeRequired status should be handled
### Actual Behavior
ChallengeOngoing and ChallengeRequired not being handled
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
For connector Datatrans new payment status need to be added: ChallengeOngoing and ChallengeRequired
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
index 68daa3743bf..9297f783d3e 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
@@ -129,7 +129,7 @@ pub struct SyncResponse {
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct SyncCardDetails {
- pub alias: String,
+ pub alias: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
@@ -787,9 +787,12 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
connector_transaction_id: None,
})
} else {
- let mandate_reference =
- sync_response.card.as_ref().map(|card| MandateReference {
- connector_mandate_id: Some(card.alias.clone()),
+ let mandate_reference = sync_response
+ .card
+ .as_ref()
+ .and_then(|card| card.alias.as_ref())
+ .map(|alias| MandateReference {
+ connector_mandate_id: Some(alias.clone()),
payment_method_id: None,
mandate_metadata: None,
connector_mandate_request_reference_id: None,
|
2025-02-20T15:27:59Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
For connector Datatrans add new payment status: ChallengeOngoing and ChallengeRequired
Fix Deseralization Issue on Force Sync Flow
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch/issues/7328
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Payments Create:
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_pzCQPy1Bguc8j2kV8DQeqQJHIqJQJCjF5kLyDVep1qhmsjAPfl6GUbb10RId0cr8' \
--data-raw '{
"amount": 1000,
"currency": "GBP",
"amount_to_capture": 1000,
"confirm": true,
"capture_method": "manual",
"authentication_type": "no_three_ds",
"payment_method": "card",
"payment_method_type": "credit",
"email": "guest@example.com",
"payment_method_data": {
"card": {
"card_number": "5404000000000001",
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
},
"billing": {
"email": "guest@example.com"
}
}
}'
```
Response:
```
{
"payment_id": "pay_o5DC6PfvFD102tR0jAkC",
"merchant_id": "merchant_1740052235",
"status": "requires_capture",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 1000,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_o5DC6PfvFD102tR0jAkC_secret_aIwxbFdYcRA5QEzSwRH0",
"created": "2025-02-20T12:54:31.835Z",
"currency": "GBP",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": "guest@example.com",
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": {
"address": null,
"phone": null,
"email": "guest@example.com"
}
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "250220135432771618",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_u7haQkBn6S4w6TXz8EJH",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_2NXjPxtjXhySNn9Ui8bD",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-20T13:09:31.834Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-20T12:54:33.029Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual"
}
```
Payments Intent:
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_pzCQPy1Bguc8j2kV8DQeqQJHIqJQJCjF5kLyDVep1qhmsjAPfl6GUbb10RId0cr8' \
--data '{
"amount": 0,
"currency": "GBP",
"confirm": false,
"setup_future_usage": "off_session",
"customer_id": "tester1799"
}'
```
Response:
```
{
"payment_id": "pay_mLh13MuvuHd60YDrzoRJ",
"merchant_id": "merchant_1740052235",
"status": "requires_payment_method",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_mLh13MuvuHd60YDrzoRJ_secret_vG7S4ysL0mc0jQunux4v",
"created": "2025-02-20T12:55:01.990Z",
"currency": "GBP",
"customer_id": "tester1799",
"customer": {
"id": "tester1799",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": null,
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": null,
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "tester1799",
"created_at": 1740056101,
"expires": 1740059701,
"secret": "epk_5f5f55938a5e4d4aa926cf0ebdfaac0a"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_u7haQkBn6S4w6TXz8EJH",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-20T13:10:01.990Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-20T12:55:02.018Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
Payments Confirm(Creating Mandate):
Request:
```
curl --location 'http://localhost:8080/payments/pay_FW8L70XM5ECVgz0V0M4U/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_pzCQPy1Bguc8j2kV8DQeqQJHIqJQJCjF5kLyDVep1qhmsjAPfl6GUbb10RId0cr8' \
--data-raw '{
"payment_method": "card",
"payment_method_type": "credit",
"customer_acceptance": {
"acceptance_type": "offline"
},
"capture_method": "automatic",
"authentication_type": "no_three_ds",
"payment_method_data": {
"card": {
"card_number": "5404000000000001",
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
},
"billing": {
"email": "guest2@example.com"
}
}
}'
```
Response:
```
{
"payment_id": "pay_mLh13MuvuHd60YDrzoRJ",
"merchant_id": "merchant_1740052235",
"status": "requires_customer_action",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_mLh13MuvuHd60YDrzoRJ_secret_vG7S4ysL0mc0jQunux4v",
"created": "2025-02-20T12:55:01.990Z",
"currency": "GBP",
"customer_id": "tester1799",
"customer": {
"id": "tester1799",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": {
"address": null,
"phone": null,
"email": "guest2@example.com"
}
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_mLh13MuvuHd60YDrzoRJ/merchant_1740052235/pay_mLh13MuvuHd60YDrzoRJ_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "250220135517601774",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_u7haQkBn6S4w6TXz8EJH",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_2NXjPxtjXhySNn9Ui8bD",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-20T13:10:01.990Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": null,
"time_zone": null,
"ip_address": "::1",
"os_version": null,
"user_agent": null,
"color_depth": null,
"device_model": null,
"java_enabled": null,
"screen_width": null,
"accept_header": null,
"screen_height": null,
"accept_language": "en",
"java_script_enabled": null
},
"payment_method_id": "pm_wnpldY3cjI1hNd9eCdvV",
"payment_method_status": "inactive",
"updated": "2025-02-20T12:55:17.804Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual"
}
```
Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_GSXcUmpO1O7kDsua577iUQXDZWOCT4dIMglCcbXzVpPrvujyDkm59ourkW6oOXbS' \
--data-raw '{
"amount": 1000,
"currency": "GBP",
"amount_to_capture": 1000,
"confirm": true,
"capture_method": "manual",
"customer_id":"blajsh",
"authentication_type": "no_three_ds",
"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",
"email": "guest@example.com",
"payment_method_data": {
"card": {
"card_number": "5404000000000001",
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
},
"billing":{
"email":"guest@example.com"
}
}
}'
```
Response
```
{
"payment_id": "pay_guOgcn7GmWiPeGXkZucP",
"merchant_id": "postman_merchant_GHAction_ab9fae91-aff0-4a08-baae-194e61092bf6",
"status": "requires_capture",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 1000,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_guOgcn7GmWiPeGXkZucP_secret_PUdAYdnPcNUscVt1NYqt",
"created": "2025-02-20T15:12:52.832Z",
"currency": "GBP",
"customer_id": "blajsh",
"customer": {
"id": "blajsh",
"name": null,
"email": "guest@example.com",
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": "DEBIT",
"card_network": "Visa",
"card_issuer": "MASTERCARD INTERNATIONAL",
"card_issuing_country": "UNITEDSTATES",
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": {
"address": null,
"phone": null,
"email": "guest@example.com"
}
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "blajsh",
"created_at": 1740064372,
"expires": 1740067972,
"secret": "epk_dd3a6c0d4ead4f78bdec9a0b2b9ec12e"
},
"manual_retry_allowed": false,
"connector_transaction_id": "250220161253992987",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_HKMwd5SucLDtv5qWMf47",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EZEmKXkvmX9nowH9gsty",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-20T15:27:52.832Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-20T15:12:54.206Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual"
}
```
Force Sync (Request)
```
curl --location 'http://localhost:8080/payments/pay_guOgcn7GmWiPeGXkZucP?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_GSXcUmpO1O7kDsua577iUQXDZWOCT4dIMglCcbXzVpPrvujyDkm59ourkW6oOXbS' \
--data ''
```
Force Sync Response
```
{
"payment_id": "pay_guOgcn7GmWiPeGXkZucP",
"merchant_id": "postman_merchant_GHAction_ab9fae91-aff0-4a08-baae-194e61092bf6",
"status": "requires_capture",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 1000,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_guOgcn7GmWiPeGXkZucP_secret_PUdAYdnPcNUscVt1NYqt",
"created": "2025-02-20T15:12:52.832Z",
"currency": "GBP",
"customer_id": "blajsh",
"customer": {
"id": "blajsh",
"name": null,
"email": "guest@example.com",
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": "DEBIT",
"card_network": "Visa",
"card_issuer": "MASTERCARD INTERNATIONAL",
"card_issuing_country": "UNITEDSTATES",
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": {
"address": null,
"phone": null,
"email": "guest@example.com"
}
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "250220161253992987",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_HKMwd5SucLDtv5qWMf47",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EZEmKXkvmX9nowH9gsty",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-20T15:27:52.832Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_T4qWIKfShRUpJp0J6n3o",
"payment_method_status": "active",
"updated": "2025-02-20T15:14:43.581Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual"
}
```
Note: Non-3DS transaction will redirect if we pass off_session https://docs.datatrans.ch/docs/tokenization
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
de865bd13440f965c0d3ffbe44a71925978212dd
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7362
|
Bug: chore: resolve v2 warnings in common_utils
Resolve all v2 warnings in common_utils crate.
|
diff --git a/crates/common_utils/src/id_type/global_id.rs b/crates/common_utils/src/id_type/global_id.rs
index 1e376dfe4de..bb296d7ef1a 100644
--- a/crates/common_utils/src/id_type/global_id.rs
+++ b/crates/common_utils/src/id_type/global_id.rs
@@ -134,7 +134,7 @@ impl GlobalId {
) -> Result<Self, GlobalIdError> {
let length_id = LengthId::from(input_string)?;
let input_string = &length_id.0 .0;
- let (cell_id, remaining) = input_string
+ let (cell_id, _remaining) = input_string
.split_once("_")
.ok_or(GlobalIdError::InvalidIdFormat)?;
diff --git a/crates/common_utils/src/id_type/global_id/customer.rs b/crates/common_utils/src/id_type/global_id/customer.rs
index e0de91d8aed..014d56c9aad 100644
--- a/crates/common_utils/src/id_type/global_id/customer.rs
+++ b/crates/common_utils/src/id_type/global_id/customer.rs
@@ -1,6 +1,4 @@
-use error_stack::ResultExt;
-
-use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
+use crate::errors;
crate::global_id_type!(
GlobalCustomerId,
@@ -29,7 +27,7 @@ impl GlobalCustomerId {
}
impl TryFrom<GlobalCustomerId> for crate::id_type::CustomerId {
- type Error = error_stack::Report<crate::errors::ValidationError>;
+ type Error = error_stack::Report<errors::ValidationError>;
fn try_from(value: GlobalCustomerId) -> Result<Self, Self::Error> {
Self::try_from(std::borrow::Cow::from(value.get_string_repr().to_owned()))
diff --git a/crates/common_utils/src/id_type/global_id/payment.rs b/crates/common_utils/src/id_type/global_id/payment.rs
index e43e33c619a..94ffbed57af 100644
--- a/crates/common_utils/src/id_type/global_id/payment.rs
+++ b/crates/common_utils/src/id_type/global_id/payment.rs
@@ -1,7 +1,7 @@
use common_enums::enums;
use error_stack::ResultExt;
-use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
+use crate::errors;
crate::global_id_type!(
GlobalPaymentId,
@@ -42,7 +42,6 @@ impl GlobalPaymentId {
impl TryFrom<std::borrow::Cow<'static, str>> for GlobalPaymentId {
type Error = error_stack::Report<errors::ValidationError>;
fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> {
- use error_stack::ResultExt;
let merchant_ref_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "payment_id",
@@ -86,7 +85,6 @@ impl GlobalAttemptId {
impl TryFrom<std::borrow::Cow<'static, str>> for GlobalAttemptId {
type Error = error_stack::Report<errors::ValidationError>;
fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> {
- use error_stack::ResultExt;
let global_attempt_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "payment_id",
diff --git a/crates/common_utils/src/id_type/global_id/refunds.rs b/crates/common_utils/src/id_type/global_id/refunds.rs
index 0aac9bf5808..eb8dad6b3aa 100644
--- a/crates/common_utils/src/id_type/global_id/refunds.rs
+++ b/crates/common_utils/src/id_type/global_id/refunds.rs
@@ -1,6 +1,6 @@
use error_stack::ResultExt;
-use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
+use crate::errors;
/// A global id that can be used to identify a refund
#[derive(
@@ -36,7 +36,6 @@ impl GlobalRefundId {
impl TryFrom<std::borrow::Cow<'static, str>> for GlobalRefundId {
type Error = error_stack::Report<errors::ValidationError>;
fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> {
- use error_stack::ResultExt;
let merchant_ref_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "refund_id",
|
2025-02-24T09:50:06Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR resolves the v2 warnings generated in common_utils.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested sanity of common_utils on both v1 and v2
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
eabef328c665cfbaf953a5eb15bd15484c62dcf7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7323
|
Bug: docs: API-ref revamp for better user experience
API-ref revamp for better user experience
|
2025-02-20T09:28:47Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [X] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
We have changes the Intro page of the API-ref to make it more informative and navigable.
Also, The API sidebar is now re-organised basis of different use-cases to improve the dev experience.
Added an introduction page to payments API explaining all the scenarios an user can explore payment API.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #7323
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<img width="1140" alt="Screenshot 2025-02-20 at 5 55 09 PM" src="https://github.com/user-attachments/assets/9e979280-e081-48a0-b60e-33135d2461ec" />
<img width="1153" alt="Screenshot 2025-02-20 at 5 56 20 PM" src="https://github.com/user-attachments/assets/52f6adb1-3d5d-4ba7-99c9-3fdbadb2d4d4" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
74bbf4bf271d45e61e594857707250c95a86f43f
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7316
|
Bug: Integrate EFT into Hyperswitch SDK
## Description
EFT is a bank redirect payment method. This issue involves adding EFT as a payment method in the Hyperswitch SDK.
## Implementation Steps
- **`PaymentDetails.res`**
Define EFT as a payment method by specifying its type, icon, and display name.
- **`PaymentMethodsRecord.res`**
Add EFT to `paymentMethodsFields`.
- **`PaymentModeType.res`**
- Add EFT as a `payment` type.
- Map the `"eft"` string to EFT in `paymentMode`.
- Include EFT in `defaultOrder` to display payment options in a specific sequence. T in `paymentMode` and add EFT in `defaultOrder` to display payment options to users in a specific sequence.
- **`PaymentBody.res`**
Generate a JSON structure for the "EFT" payment method using a provider name. Provider name can be taken from the SDK but for now we can provide Provider name in the code itself as `ozow`.
- **`PaymentUtils.res`**
Add EFT as a bank payment method type.
## How to test:
1. Set up the Hyperswitch Backend locally using this [documentation](https://github.com/juspay/hyperswitch/blob/main/docs/try_local_system.md).
2. Use the cURL commands provided in this [PR](https://github.com/juspay/hyperswitch/pull/7286) in Postman to:
- Set up a merchant account
- Generate Hyperswitch API keys
- Create a Paystack connector
3. Setup Hyperswitch SDK locally using this [documentation](https://github.com/juspay/hyperswitch-web/blob/main/README.md#%EF%B8%8F-try-it-in-local)
4. Run the application on `localhost`, initiate a payment, and manually test EFT by clicking the **Pay Now** button.
**Note:** Run the `npm run re:build` command before raising the PR
|
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index 80330a97429..75f2f02c027 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -1,7 +1,6 @@
mod transformers;
use std::fmt::Debug;
-use common_utils::errors::ReportSwitchExt;
use error_stack::{ResultExt, IntoReport};
use crate::{
diff --git a/connector-template/transformers.rs b/connector-template/transformers.rs
index 985c68a99c0..7e3caf100e1 100644
--- a/connector-template/transformers.rs
+++ b/connector-template/transformers.rs
@@ -30,7 +30,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for {{project-name | downcase
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(),
+ complete: item.request.is_auto_capture()?,
};
Ok(Self {
amount: item.request.amount,
|
2023-04-18T16:43:29Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
## Description
<!-- Describe your changes in detail -->
When `add_connector.sh` is called to generate new connector files `mod.rs` had an unused declaration, removed it. At the time of development, if needed, one can import it directly instead of pre-bloating the stuff.
`Transformers.rs` straight away failed and threw an error addressing `mismatched types` as it is expecting `bool` while were providing `Result<bool, Error>`.
### Additional Changes
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
connector-template/mod.rs
connector-template/transformers.rs
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless its an obvious bug or documentation fix
that will have little conversation).
-->
With the changes made, unexpected errors and warnings at the time of generation of connector code is avoided and addressed.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
|
9c9c52f9af74ebc7e835a5750dd05967b39a0ade
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7318
|
Bug: [V2]: Return connector specific customer reference ID in `CustomerResponse`
Required for tokenization flows in some connectors
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index d93208fb665..67725d8c644 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8833,6 +8833,11 @@
"maxLength": 64,
"minLength": 1
},
+ "connector_customer_ids": {
+ "type": "object",
+ "description": "Connector specific customer reference ids",
+ "nullable": true
+ },
"name": {
"type": "string",
"description": "The customer's name",
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index 2b84c50bba9..f89558e6267 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -17,7 +17,7 @@ olap = []
openapi = ["common_enums/openapi", "olap", "recon", "dummy_connector", "olap"]
recon = []
v1 = ["common_utils/v1"]
-v2 = ["common_utils/v2", "customer_v2"]
+v2 = ["common_types/v2", "common_utils/v2", "customer_v2"]
customer_v2 = ["common_utils/customer_v2"]
payment_methods_v2 = ["common_utils/payment_methods_v2"]
dynamic_routing = []
diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs
index d78564ae53a..eb61cae6e47 100644
--- a/crates/api_models/src/customers.rs
+++ b/crates/api_models/src/customers.rs
@@ -182,6 +182,9 @@ pub struct CustomerResponse {
/// The identifier for the customer object
#[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_reference_id: Option<id_type::CustomerId>,
+ /// Connector specific customer reference ids
+ #[schema(value_type = Option<Object>, example = json!({"mca_hwySG2NtpzX0qr7toOy8": "cus_Rnm2pDKGyQi506"}))]
+ pub connector_customer_ids: Option<common_types::customers::ConnectorCustomerMap>,
/// The customer's name
#[schema(max_length = 255, value_type = Option<String>, example = "Jon Test")]
pub name: crypto::OptionalEncryptableName,
diff --git a/crates/common_types/src/customers.rs b/crates/common_types/src/customers.rs
new file mode 100644
index 00000000000..1d53630cade
--- /dev/null
+++ b/crates/common_types/src/customers.rs
@@ -0,0 +1,30 @@
+//! Customer related types
+
+/// HashMap containing MerchantConnectorAccountId and corresponding customer id
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
+#[diesel(sql_type = diesel::sql_types::Jsonb)]
+#[serde(transparent)]
+pub struct ConnectorCustomerMap(
+ std::collections::HashMap<common_utils::id_type::MerchantConnectorAccountId, String>,
+);
+
+#[cfg(feature = "v2")]
+common_utils::impl_to_sql_from_sql_json!(ConnectorCustomerMap);
+
+#[cfg(feature = "v2")]
+impl std::ops::Deref for ConnectorCustomerMap {
+ type Target =
+ std::collections::HashMap<common_utils::id_type::MerchantConnectorAccountId, String>;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+#[cfg(feature = "v2")]
+impl std::ops::DerefMut for ConnectorCustomerMap {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs
index 6139ddff16a..8c4ee162a76 100644
--- a/crates/common_types/src/lib.rs
+++ b/crates/common_types/src/lib.rs
@@ -2,6 +2,7 @@
#![warn(missing_docs, missing_debug_implementations)]
+pub mod customers;
pub mod domain;
pub mod payment_methods;
pub mod payments;
diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs
index b0d4535ddb7..24fe34c15d9 100644
--- a/crates/diesel_models/src/customers.rs
+++ b/crates/diesel_models/src/customers.rs
@@ -76,7 +76,7 @@ pub struct CustomerNew {
pub description: Option<Description>,
pub created_at: PrimitiveDateTime,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_customer: Option<ConnectorCustomerMap>,
+ pub connector_customer: Option<common_types::customers::ConnectorCustomerMap>,
pub modified_at: PrimitiveDateTime,
pub default_payment_method_id: Option<common_utils::id_type::GlobalPaymentMethodId>,
pub updated_by: Option<String>,
@@ -158,7 +158,7 @@ pub struct Customer {
pub description: Option<Description>,
pub created_at: PrimitiveDateTime,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_customer: Option<ConnectorCustomerMap>,
+ pub connector_customer: Option<common_types::customers::ConnectorCustomerMap>,
pub modified_at: PrimitiveDateTime,
pub default_payment_method_id: Option<common_utils::id_type::GlobalPaymentMethodId>,
pub updated_by: Option<String>,
@@ -236,7 +236,7 @@ pub struct CustomerUpdateInternal {
pub phone_country_code: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
pub modified_at: PrimitiveDateTime,
- pub connector_customer: Option<ConnectorCustomerMap>,
+ pub connector_customer: Option<common_types::customers::ConnectorCustomerMap>,
pub default_payment_method_id: Option<Option<common_utils::id_type::GlobalPaymentMethodId>>,
pub updated_by: Option<String>,
pub default_billing_address: Option<Encryption>,
@@ -283,31 +283,3 @@ impl CustomerUpdateInternal {
}
}
}
-
-#[cfg(all(feature = "v2", feature = "customer_v2"))]
-#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
-#[diesel(sql_type = diesel::sql_types::Jsonb)]
-#[serde(transparent)]
-pub struct ConnectorCustomerMap(
- std::collections::HashMap<common_utils::id_type::MerchantConnectorAccountId, String>,
-);
-
-#[cfg(all(feature = "v2", feature = "customer_v2"))]
-common_utils::impl_to_sql_from_sql_json!(ConnectorCustomerMap);
-
-#[cfg(all(feature = "v2", feature = "customer_v2"))]
-impl std::ops::Deref for ConnectorCustomerMap {
- type Target =
- std::collections::HashMap<common_utils::id_type::MerchantConnectorAccountId, String>;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
-
-#[cfg(all(feature = "v2", feature = "customer_v2"))]
-impl std::ops::DerefMut for ConnectorCustomerMap {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.0
- }
-}
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index 02c25d722c1..384bc5ab427 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -56,7 +56,7 @@ pub struct Customer {
pub description: Option<Description>,
pub created_at: PrimitiveDateTime,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_customer: Option<diesel_models::ConnectorCustomerMap>,
+ pub connector_customer: Option<common_types::customers::ConnectorCustomerMap>,
pub modified_at: PrimitiveDateTime,
pub default_payment_method_id: Option<id_type::GlobalPaymentMethodId>,
pub updated_by: Option<String>,
@@ -334,7 +334,7 @@ pub struct CustomerGeneralUpdate {
pub description: Option<Description>,
pub phone_country_code: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_customer: Box<Option<diesel_models::ConnectorCustomerMap>>,
+ pub connector_customer: Box<Option<common_types::customers::ConnectorCustomerMap>>,
pub default_billing_address: Option<Encryption>,
pub default_shipping_address: Option<Encryption>,
pub default_payment_method_id: Option<Option<id_type::GlobalPaymentMethodId>>,
@@ -346,7 +346,7 @@ pub struct CustomerGeneralUpdate {
pub enum CustomerUpdate {
Update(Box<CustomerGeneralUpdate>),
ConnectorCustomer {
- connector_customer: Option<diesel_models::ConnectorCustomerMap>,
+ connector_customer: Option<common_types::customers::ConnectorCustomerMap>,
},
UpdateDefaultPaymentMethod {
default_payment_method_id: Option<Option<id_type::GlobalPaymentMethodId>>,
diff --git a/crates/router/src/types/api/customers.rs b/crates/router/src/types/api/customers.rs
index 5b37fb2add6..63ebfe49930 100644
--- a/crates/router/src/types/api/customers.rs
+++ b/crates/router/src/types/api/customers.rs
@@ -50,6 +50,7 @@ impl ForeignFrom<customer::Customer> for CustomerResponse {
customers::CustomerResponse {
id: cust.id,
merchant_reference_id: cust.merchant_reference_id,
+ connector_customer_ids: cust.connector_customer,
name: cust.name,
email: cust.email,
phone: cust.phone,
|
2025-02-19T12:31:39Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add a field `connector_customer` to `CustomerResponse` that contains a map between `MerchantConnectorAccountId` and connector customer id
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
From #7246:
> with respect to the multi-use tokens that were created with Stripe (support added in #7106), the payment methods were created on Stripe's end, but were not associated with a customer, due to which they could not be used to make transactions again, we used to receive such an error:
```text
The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.
```
> To address this, we have to create a customer on Stripe's end first, and then pass Stripe's customer ID when saving the payment method with Stripe.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Request:
```
curl --location 'http://localhost:8080/v2/customers/12345_cus_01951dbc16d57d03ac193a7e297d4899' \
--header 'x-profile-id: pro_Vb32qOaqvkJClXH7aNWK' \
--header 'Authorization: api-key=dev_f4mNrhkUeCtLcsqUaG1fpzHpqTCnPdJMBSPNZAP2nWwwr7FRYtbj1RUdWBPKBKZ0' \
--header 'api-key: dev_f4mNrhkUeCtLcsqUaG1fpzHpqTCnPdJMBSPNZAP2nWwwr7FRYtbj1RUdWBPKBKZ0'
```
- Response:
```json
{
"id": "12345_cus_01951dbc16d57d03ac193a7e297d4899",
"merchant_reference_id": "customer_1739960621",
"connector_customer": {
"mca_hwySG2NtpzX0qr7toOy8": "cus_Rnm2pDKGyQi506"
},
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"default_billing_address": null,
"default_shipping_address": null,
"created_at": "2025-02-19T10:23:40.758Z",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"default_payment_method_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ba3ad87e06d63910d78fdb217db47064b4d926be
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7346
|
Bug: FEAT[CONNECTOR]: Add feature_matrix support for coinbase, iatapay, nexixpay and square connectors
add feature matrix endpoint to 4 more connectors:
- coinbase
- nexixpay
- iatapay
- square
and also update the pm filters list for these 4 connectors
scripts:
```check.sh
#!/bin/bash
# The lengthy string fetched from another script that i lost it somewhere
a="AED,AFN,ALL,AMD,ANG,AOA,API,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BOV,BRL,BSD,BTC,BTN,BWP,BYR,BZD,CAD,CDF,CDN,CFA,CFP,CHE,CHF,CHW,CLF,CLP,CNY,COP,COU,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,END,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,ISO,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LTL,LVL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRO,MUR,MVR,MWK,MXN,MXV,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PDX,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,USN,USS,UYI,UYU,UZS,VEF,VND,VUV,WIR,WST,XAF,XAG,XAU,XBA,XBB,XBC,XBD,XCD,XDR,XOF,XPD,XPF,XPT,XTS,XUS,XXX,YER,ZAR,ZMK,ZMW"
# taken from /crates/common_enums/src/enums.rs
declare -a currency_enum=(
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
)
# Convert string 'a' to array
IFS=',' read -ra string_array <<< "$a"
echo "Values in string 'a' that are not in Currency enum:"
for value in "${string_array[@]}"; do
found=false
for enum_value in "${currency_enum[@]}"; do
if [ "$value" = "$enum_value" ]; then
found=true
break
fi
done
if [ "$found" = false ]; then
echo "$value"
fi
done
```
```checkv2.sh
#!/bin/bash
# The lengthy string a
a="AED,AFN,ALL,AMD,ANG,AOA,API,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BOV,BRL,BSD,BTC,BTN,BWP,BYR,BZD,CAD,CDF,CDN,CFA,CFP,CHE,CHF,CHW,CLF,CLP,CNY,COP,COU,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,END,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,ISO,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LTL,LVL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRO,MUR,MVR,MWK,MXN,MXV,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PDX,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,USN,USS,UYI,UYU,UZS,VEF,VND,VUV,WIR,WST,XAF,XAG,XAU,XBA,XBB,XBC,XBD,XCD,XDR,XOF,XPD,XPF,XPT,XTS,XUS,XXX,YER,ZAR,ZMK,ZMW"
# String b with values to remove
b="
Values in string 'a' that are not in Currency enum:
API
BOV
BTC
BYR
CDN
CFA
CFP
CHE
CHW
CLF
COU
CUC
END
ISO
LTL
LVL
MRO
MXV
PDX
STD
USN
USS
UYI
VEF
WIR
XAG
XAU
XBA
XBB
XBC
XBD
XDR
XPD
XPT
XTS
XUS
XXX
ZMK
"
# Function to remove values from b in string a
remove_values() {
local input_string="$1"
local remove_values="$2"
# Convert input string to array
IFS=',' read -ra input_array <<< "$input_string"
# Convert remove values to array
readarray -t remove_array <<< "$remove_values"
# Create new array for filtered values
declare -a filtered_array
# Check each value from input
for value in "${input_array[@]}"; do
skip=false
# Compare with values to remove
for remove_value in "${remove_array[@]}"; do
# Remove any trailing whitespace or newline from remove_value
remove_value=$(echo "$remove_value" | tr -d '[:space:]')
if [ "$value" = "$remove_value" ]; then
skip=true
break
fi
done
# If value should not be skipped, add it to filtered array
if [ "$skip" = false ]; then
filtered_array+=("$value")
fi
done
# Join array elements with commas
local result=$(IFS=,; echo "${filtered_array[*]}")
echo "$result"
}
# Call the function and store result
result=$(remove_values "$a" "$b")
echo "Original string length: $(echo $a | tr -cd ',' | wc -c)"
echo "New string length: $(echo $result | tr -cd ',' | wc -c)"
echo "Removed $(( $(echo $a | tr -cd ',' | wc -c) - $(echo $result | tr -cd ',' | wc -c) )) values"
echo -e "\nNew string:"
echo "$result"
```
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 3457d330c9a..410b8dbe037 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -579,8 +579,25 @@ debit = { currency = "USD" }
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" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 079134e6d03..2cc2d86ade1 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -346,8 +346,25 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 79ed26906ef..a291cff5c6f 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -308,7 +308,6 @@ debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }
-
[pm_filters.cybersource]
credit = { currency = "USD,GBP,EUR,PLN" }
debit = { currency = "USD,GBP,EUR,PLN" }
@@ -318,8 +317,25 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index a92deafb20a..13a3f12228b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -319,8 +319,25 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
@@ -357,7 +374,6 @@ mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR
[pm_filters.prophetpay]
card_redirect.currency = "USD"
-
[pm_filters.stax]
ach = { country = "US", currency = "USD" }
diff --git a/config/development.toml b/config/development.toml
index 13ed82c81f6..871352452ef 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -532,8 +532,25 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 0031c37f022..109a3d42a1f 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -484,8 +484,25 @@ samsung_pay = { currency = "USD,GBP,EUR" }
paze = { currency = "USD" }
[pm_filters.nexixpay]
-credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
-debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
[pm_filters.novalnet]
credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
index f58437ff079..a567d5b5c82 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
@@ -22,7 +22,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
RefundsRouterData,
@@ -39,6 +42,7 @@ use hyperswitch_interfaces::{
types::{PaymentsAuthorizeType, PaymentsSyncType, Response},
webhooks,
};
+use lazy_static::lazy_static;
use masking::Mask;
use transformers as coinbase;
@@ -135,24 +139,7 @@ impl ConnectorCommon for Coinbase {
}
}
-impl ConnectorValidation for Coinbase {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_supported_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Coinbase {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Coinbase
@@ -445,4 +432,50 @@ impl webhooks::IncomingWebhook for Coinbase {
}
}
-impl ConnectorSpecifications for Coinbase {}
+lazy_static! {
+ static ref COINBASE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name:
+ "Coinbase is a place for people and businesses to buy, sell, and manage crypto.",
+ description:
+ "Square is the largest business technology platform serving all kinds of businesses.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+ static ref COINBASE_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let mut coinbase_supported_payment_methods = SupportedPaymentMethods::new();
+
+ coinbase_supported_payment_methods.add(
+ enums::PaymentMethod::Crypto,
+ enums::PaymentMethodType::CryptoCurrency,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::NotSupported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ coinbase_supported_payment_methods
+ };
+ static ref COINBASE_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> =
+ vec![enums::EventClass::Payments, enums::EventClass::Refunds,];
+}
+
+impl ConnectorSpecifications for Coinbase {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*COINBASE_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*COINBASE_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*COINBASE_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
index 9db00b61101..f9ab2f3159f 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
@@ -1,6 +1,6 @@
pub mod transformers;
-use api_models::webhooks::IncomingWebhookEvent;
+use api_models::{enums, webhooks::IncomingWebhookEvent};
use base64::Engine;
use common_utils::{
consts::BASE64_ENGINE,
@@ -23,7 +23,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
RefundSyncRouterData, RefundsRouterData,
@@ -41,6 +44,7 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
};
+use lazy_static::lazy_static;
use masking::{Mask, PeekInterface};
use transformers::{self as iatapay, IatapayPaymentsResponse};
@@ -744,4 +748,126 @@ impl IncomingWebhook for Iatapay {
}
}
-impl ConnectorSpecifications for Iatapay {}
+lazy_static! {
+ static ref IATAPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Iatapay",
+ description:
+ "IATA Pay is a payment method for travellers to pay for air tickets purchased online by directly debiting their bank account.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+
+ static ref IATAPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic
+ ];
+
+ let mut iatapay_supported_payment_methods = SupportedPaymentMethods::new();
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::Upi,
+ enums::PaymentMethodType::UpiCollect,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::Upi,
+ enums::PaymentMethodType::UpiIntent,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::Ideal,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::LocalBankRedirect,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::RealTimePayment,
+ enums::PaymentMethodType::DuitNow,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::RealTimePayment,
+ enums::PaymentMethodType::Fps,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::RealTimePayment,
+ enums::PaymentMethodType::PromptPay,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods.add(
+ enums::PaymentMethod::RealTimePayment,
+ enums::PaymentMethodType::VietQr,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None
+ }
+ );
+
+ iatapay_supported_payment_methods
+ };
+
+ static ref IATAPAY_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> =
+ vec![enums::EventClass::Payments, enums::EventClass::Refunds,];
+}
+
+impl ConnectorSpecifications for Iatapay {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*IATAPAY_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*IATAPAY_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*IATAPAY_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
index 9ec2ac73903..8a9c804cbf2 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
@@ -25,7 +25,10 @@ use hyperswitch_domain_models::{
PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,
PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData,
@@ -43,6 +46,7 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
+use lazy_static::lazy_static;
use masking::{ExposeInterface, Mask};
use serde_json::Value;
use transformers as nexixpay;
@@ -204,22 +208,6 @@ impl ConnectorCommon for Nexixpay {
}
impl ConnectorValidation for Nexixpay {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
fn validate_mandate_payment(
&self,
pm_type: Option<enums::PaymentMethodType>,
@@ -999,4 +987,83 @@ impl webhooks::IncomingWebhook for Nexixpay {
}
}
-impl ConnectorSpecifications for Nexixpay {}
+lazy_static! {
+ static ref NEXIXPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Nexixpay",
+ description: "Nexixpay is an Italian bank that specialises in payment systems such as Nexi Payments (formerly known as CartaSi).",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+
+ static ref NEXIXPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::JCB,
+ ];
+
+ let mut nexixpay_supported_payment_methods = SupportedPaymentMethods::new();
+
+ nexixpay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::Supported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ )
+ }
+ );
+ nexixpay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::Supported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods,
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network,
+ }
+ }),
+ )
+ }
+ );
+
+ nexixpay_supported_payment_methods
+ };
+
+ static ref NEXIXPAY_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+}
+
+impl ConnectorSpecifications for Nexixpay {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*NEXIXPAY_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*NEXIXPAY_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*NEXIXPAY_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs
index e07d85800ff..9615d4afdd7 100644
--- a/crates/hyperswitch_connectors/src/connectors/square.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square.rs
@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{
PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
PaymentsSyncData, RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsAuthorizeSessionTokenRouterData,
PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
@@ -44,6 +47,7 @@ use hyperswitch_interfaces::{
types::{self, PaymentsAuthorizeType, Response},
webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
};
+use lazy_static::lazy_static;
use masking::{Mask, Maskable, PeekInterface};
use transformers::{
self as square, SquareAuthType, SquarePaymentsRequest, SquareRefundRequest, SquareTokenRequest,
@@ -52,7 +56,7 @@ use transformers::{
use crate::{
constants::headers,
types::ResponseRouterData,
- utils::{self, get_header_key_value, RefundsRequestData},
+ utils::{get_header_key_value, RefundsRequestData},
};
#[derive(Debug, Clone)]
@@ -158,24 +162,7 @@ impl ConnectorCommon for Square {
}
}
-impl ConnectorValidation for Square {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Square {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Square {
//TODO: implement sessions flow
@@ -927,4 +914,85 @@ impl IncomingWebhook for Square {
}
}
-impl ConnectorSpecifications for Square {}
+lazy_static! {
+ static ref SQUARE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Square",
+ description:
+ "Square is the largest business technology platform serving all kinds of businesses.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+ static ref SQUARE_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::Interac,
+ common_enums::CardNetwork::JCB,
+ ];
+
+ let mut square_supported_payment_methods = SupportedPaymentMethods::new();
+
+ square_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+ square_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods,
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network,
+ }
+ }),
+ ),
+ },
+ );
+
+ square_supported_payment_methods
+ };
+ static ref SQUARE_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> =
+ vec![enums::EventClass::Payments, enums::EventClass::Refunds,];
+}
+
+impl ConnectorSpecifications for Square {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*SQUARE_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*SQUARE_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*SQUARE_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 6766d7cb7e6..d0804039b39 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -108,8 +108,8 @@ elavon.base_url = "https://api.demo.convergepay.com/VirtualMerchantDemo/"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
-fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
-fiuu.third_base_url="https://api.merchant.razer.com/"
+fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"
+fiuu.third_base_url = "https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
@@ -121,7 +121,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
-jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
+jpmorgan.secondary_base_url = "https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
@@ -140,7 +140,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
-paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
+paybox.secondary_base_url = "https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -183,8 +183,7 @@ zsl.base_url = "https://api.sitoffalb.net/"
apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }
[connectors.supported]
-wallets = ["klarna",
- "mifinity", "braintree", "applepay"]
+wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
@@ -272,22 +271,43 @@ cards = [
]
[pm_filters.volt]
-open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"}
+open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }
[pm_filters.razorpay]
-upi_collect = {country = "IN", currency = "INR"}
+upi_collect = { country = "IN", currency = "INR" }
[pm_filters.adyen]
boleto = { country = "BR", currency = "BRL" }
-sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"}
+sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" }
paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" }
-klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD"}
+klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD" }
ideal = { country = "NL", currency = "EUR" }
[pm_filters.bambora]
credit = { country = "US,CA", currency = "USD" }
debit = { country = "US,CA", currency = "USD" }
+[pm_filters.nexixpay]
+credit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+debit = { country = "PL,CZ,RO,SE,CH,HU,US,GB,DK,UA,MK,BG,HR,BA,IS,RS,GI", currency = "PLN,CZK,RON,SEK,CHF,HUF,USD,GBP,DKK,UAH,MKD,BGN,HRK,BAM,ISK,RSD,GIP" }
+
+[pm_filters.square]
+credit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+debit = { country = "AU,CA,FR,IE,JP,ES,GB,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,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,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,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
+
+[pm_filters.iatapay]
+upi_collect = { country = "IN", currency = "INR" }
+upi_intent = { country = "IN", currency = "INR" }
+ideal = { country = "NL", currency = "EUR" }
+local_bank_redirect = { country = "AT,BE,EE,FI,FR,DE,IE,IT,LV,LT,LU,NL,PT,ES,GB,IN,HK,SG,TH,BR,MX,GH,VN,MY,PH,JO,AU,CO", currency = "EUR,GBP,INR,HKD,SGD,THB,BRL,MXN,GHS,VND,MYR,PHP,JOD,AUD,COP" }
+duit_now = { country = "MY", currency = "MYR" }
+fps = { country = "GB", currency = "GBP" }
+prompt_pay = { country = "TH", currency = "THB" }
+viet_qr = { country = "VN", currency = "VND" }
+
+[pm_filters.coinbase]
+crypto_currency = { country = "ZA,US,BR,CA,TR,SG,VN,GB,DE,FR,ES,PT,IT,NL,AU" }
+
[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
@@ -304,10 +324,10 @@ red_pagos = { country = "UY", currency = "UYU" }
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
-mollie = {long_lived_token = false, payment_method = "card"}
+mollie = { long_lived_token = false, payment_method = "card" }
braintree = { long_lived_token = false, payment_method = "card" }
-gocardless = {long_lived_token = true, payment_method = "bank_debit"}
-billwerk = {long_lived_token = false, payment_method = "card"}
+gocardless = { long_lived_token = true, payment_method = "bank_debit" }
+billwerk = { long_lived_token = false, payment_method = "card" }
[connector_customer]
connector_list = "gocardless,stax,stripe"
@@ -337,17 +357,17 @@ discord_invite_url = "https://discord.gg/wJZ7DVW8mm"
payout_eligibility = true
[mandates.supported_payment_methods]
-bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
-bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
-bank_debit.bacs = { connector_list = "stripe,gocardless" }
-bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
+bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
+bank_debit.bacs = { connector_list = "stripe,gocardless" }
+bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+pay_later.klarna.connector_list = "adyen"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
-wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
+wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
wallet.go_pay.connector_list = "adyen"
@@ -356,13 +376,13 @@ wallet.dana.connector_list = "adyen"
wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
-bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,globalpay"
-bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
-bank_redirect.bancontact_card.connector_list="adyen,stripe"
-bank_redirect.trustly.connector_list="adyen"
-bank_redirect.open_banking_uk.connector_list="adyen"
-bank_redirect.eps.connector_list="globalpay,nexinets"
+bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
+bank_redirect.bancontact_card.connector_list = "adyen,stripe"
+bank_redirect.trustly.connector_list = "adyen"
+bank_redirect.open_banking_uk.connector_list = "adyen"
+bank_redirect.eps.connector_list = "globalpay,nexinets"
[cors]
@@ -372,8 +392,8 @@ allowed_methods = "GET,POST,PUT,DELETE"
wildcard_origin = false
[mandates.update_mandate_supported]
-card.credit ={connector_list ="cybersource"}
-card.debit = {connector_list ="cybersource"}
+card.credit = { connector_list = "cybersource" }
+card.debit = { connector_list = "cybersource" }
[network_transaction_id_supported_connectors]
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"
@@ -409,14 +429,14 @@ enabled = false
global_tenant = { tenant_id = "global", schema = "public", redis_key_prefix = "" }
[multitenancy.tenants.public]
-base_url = "http://localhost:8080"
-schema = "public"
-accounts_schema = "public"
+base_url = "http://localhost:8080"
+schema = "public"
+accounts_schema = "public"
redis_key_prefix = ""
clickhouse_database = "default"
[multitenancy.tenants.public.user]
-control_center_url = "http://localhost:9000"
+control_center_url = "http://localhost:9000"
[email]
sender_email = "example@example.com"
|
2025-02-21T09:22:40Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
this pr introduces feature_matrix api to 4 more connectors and in addition to that, pm filters also have been updated.
have written many scripts to verify the pm_filters and are attached in the issue
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
With this PR, we'll be increasing the `feature_matrix` coverage for connectors by implementing `ConnectorSpecifications` just so that it will be the single source of truth for getting information about the payment methods and payment method types that the connector supports.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
tested by making a request to the feature matrix endpoint:
request:
```curl
curl --location 'http://Localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json'
```
response:
```json
{
"connector_count": 7,
"connectors": [
{
"name": "BAMBORA",
"display_name": "Bambora",
"description": "Bambora is a leading online payment provider in Canada and United States.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"Discover",
"JCB",
"DinersClub"
],
"supported_countries": [
"US",
"CA"
],
"supported_currencies": [
"USD"
]
}
],
"supported_webhook_flows": []
},
{
"name": "COINBASE",
"display_name": "Coinbase is a place for people and businesses to buy, sell, and manage crypto.",
"description": "Square is the largest business technology platform serving all kinds of businesses.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "crypto",
"payment_method_type": "crypto_currency",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"supported_countries": [
"VN",
"US",
"DE",
"BR",
"SG",
"FR",
"ZA",
"ES",
"GB",
"CA",
"IT",
"TR",
"NL",
"PT",
"AU"
],
"supported_currencies": null
}
],
"supported_webhook_flows": [
"payments",
"refunds"
]
},
{
"name": "DEUTSCHEBANK",
"display_name": "Deutsche Bank",
"description": "Deutsche Bank is a German multinational investment bank and financial services company ",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "bank_debit",
"payment_method_type": "sepa",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"supported_countries": null,
"supported_currencies": null
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"no_three_ds": "not_supported",
"supported_card_networks": [
"Visa",
"Mastercard"
],
"supported_countries": null,
"supported_currencies": null
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"no_three_ds": "not_supported",
"supported_card_networks": [
"Visa",
"Mastercard"
],
"supported_countries": null,
"supported_currencies": null
}
],
"supported_webhook_flows": []
},
{
"name": "IATAPAY",
"display_name": "Iatapay",
"description": "IATA Pay is a payment method for travellers to pay for air tickets purchased online by directly debiting their bank account.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "bank_redirect",
"payment_method_type": "local_bank_redirect",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"GB",
"SG",
"LV",
"ES",
"TH",
"AU",
"LT",
"IE",
"MX",
"PT",
"GH",
"FI",
"DE",
"VN",
"FR",
"PH",
"IN",
"JO",
"MY",
"EE",
"HK",
"IT",
"NL",
"CO",
"BE",
"BR",
"LU",
"AT"
],
"supported_currencies": [
"GBP",
"INR",
"AUD",
"SGD",
"EUR",
"MXN",
"VND",
"PHP",
"BRL",
"MYR",
"THB",
"HKD",
"COP",
"JOD",
"GHS"
]
},
{
"payment_method": "bank_redirect",
"payment_method_type": "ideal",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"NL"
],
"supported_currencies": [
"EUR"
]
},
{
"payment_method": "real_time_payment",
"payment_method_type": "fps",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"GB"
],
"supported_currencies": [
"GBP"
]
},
{
"payment_method": "real_time_payment",
"payment_method_type": "viet_qr",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"VN"
],
"supported_currencies": [
"VND"
]
},
{
"payment_method": "real_time_payment",
"payment_method_type": "duit_now",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"MY"
],
"supported_currencies": [
"MYR"
]
},
{
"payment_method": "real_time_payment",
"payment_method_type": "prompt_pay",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"TH"
],
"supported_currencies": [
"THB"
]
},
{
"payment_method": "upi",
"payment_method_type": "upi_intent",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"IN"
],
"supported_currencies": [
"INR"
]
},
{
"payment_method": "upi",
"payment_method_type": "upi_collect",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"IN"
],
"supported_currencies": [
"INR"
]
}
],
"supported_webhook_flows": [
"payments",
"refunds"
]
},
{
"name": "NEXIXPAY",
"display_name": "Nexixpay",
"description": "Nexixpay is an Italian bank that specialises in payment systems such as Nexi Payments (formerly known as CartaSi).",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"JCB"
],
"supported_countries": [
"BA",
"HR",
"GB",
"DK",
"PL",
"US",
"GI",
"HU",
"MK",
"CZ",
"CH",
"RS",
"SE",
"BG",
"RO",
"UA",
"IS"
],
"supported_currencies": [
"BGN",
"CHF",
"HUF",
"HRK",
"CZK",
"RSD",
"UAH",
"SEK",
"GIP",
"RON",
"ISK",
"USD",
"PLN",
"GBP",
"MKD",
"DKK",
"BAM"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"JCB"
],
"supported_countries": [
"RO",
"PL",
"CH",
"UA",
"MK",
"BA",
"CZ",
"HU",
"SE",
"US",
"HR",
"RS",
"DK",
"GB",
"IS",
"BG",
"GI"
],
"supported_currencies": [
"MKD",
"CHF",
"HUF",
"BGN",
"CZK",
"ISK",
"RSD",
"GIP",
"SEK",
"BAM",
"GBP",
"USD",
"HRK",
"RON",
"PLN",
"DKK",
"UAH"
]
}
],
"supported_webhook_flows": []
},
{
"name": "SQUARE",
"display_name": "Square",
"description": "Square is the largest business technology platform serving all kinds of businesses.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"Discover",
"UnionPay",
"Interac",
"JCB"
],
"supported_countries": [
"GB",
"ES",
"US",
"AU",
"CA",
"FR",
"JP",
"IE"
],
"supported_currencies": [
"MWK",
"GIP",
"MOP",
"AWG",
"KMF",
"NGN",
"TMT",
"LKR",
"CRC",
"HNL",
"MXN",
"QAR",
"BMD",
"SYP",
"NOK",
"AMD",
"GYD",
"UZS",
"XCD",
"SLE",
"BZD",
"GBP",
"EUR",
"SZL",
"TTD",
"KYD",
"MNT",
"KPW",
"WST",
"RON",
"HKD",
"GHS",
"MUR",
"USD",
"HRK",
"INR",
"PYG",
"UGX",
"LAK",
"OMR",
"SSP",
"HUF",
"FJD",
"GTQ",
"BBD",
"MMK",
"SRD",
"MKD",
"CZK",
"AUD",
"TJS",
"ZAR",
"RSD",
"GEL",
"LRD",
"AOA",
"GNF",
"ISK",
"NAD",
"BGN",
"IRR",
"BND",
"THB",
"KRW",
"BHD",
"TOP",
"PHP",
"MYR",
"UYU",
"BSD",
"DOP",
"SBD",
"SVC",
"MVR",
"EGP",
"TRY",
"SDG",
"KHR",
"MAD",
"MGA",
"SLL",
"CDF",
"NZD",
"TND",
"TZS",
"VUV",
"BAM",
"ANG",
"NPR",
"XOF",
"BWP",
"XPF",
"MDL",
"BTN",
"DZD",
"ETB",
"LYD",
"IDR",
"IQD",
"BIF",
"CHF",
"JPY",
"SAR",
"KGS",
"JOD",
"KWD",
"PKR",
"UAH",
"KES",
"MZN",
"GMD",
"LBP",
"PAB",
"SCR",
"YER",
"JMD",
"ERN",
"CNY",
"XAF",
"BOB",
"BDT",
"ARS",
"PEN",
"RUB",
"AZN",
"KZT",
"CAD",
"SHP",
"CVE",
"NIO",
"DJF",
"HTG",
"AED",
"BRL",
"COP",
"DKK",
"PLN",
"SOS",
"SGD",
"LSL",
"ALL",
"ZMW",
"PGK",
"CLP",
"FKP",
"AFN",
"ILS",
"VND",
"RWF",
"CUP",
"SEK",
"TWD"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"Discover",
"UnionPay",
"Interac",
"JCB"
],
"supported_countries": [
"JP",
"ES",
"IE",
"AU",
"CA",
"GB",
"FR",
"US"
],
"supported_currencies": [
"SRD",
"SCR",
"CLP",
"SLL",
"VUV",
"NIO",
"ANG",
"DOP",
"OMR",
"TZS",
"IQD",
"BIF",
"CDF",
"ILS",
"PAB",
"CNY",
"ETB",
"BDT",
"BGN",
"SHP",
"KHR",
"SVC",
"AUD",
"JOD",
"RSD",
"IDR",
"KGS",
"EGP",
"SSP",
"TND",
"XPF",
"BND",
"ISK",
"GHS",
"KYD",
"GIP",
"MGA",
"TOP",
"TRY",
"USD",
"RWF",
"COP",
"BHD",
"BBD",
"MWK",
"WST",
"BWP",
"XOF",
"AMD",
"MOP",
"QAR",
"AFN",
"NAD",
"PHP",
"ALL",
"XCD",
"AWG",
"CZK",
"HKD",
"GBP",
"GNF",
"GMD",
"NOK",
"ERN",
"RUB",
"PEN",
"SBD",
"AED",
"DJF",
"ZMW",
"DZD",
"UAH",
"AOA",
"NPR",
"HUF",
"PKR",
"LBP",
"DKK",
"HNL",
"KES",
"CHF",
"NGN",
"SEK",
"TWD",
"MAD",
"FJD",
"PYG",
"BOB",
"JPY",
"JMD",
"BTN",
"LRD",
"MNT",
"SLE",
"SOS",
"TTD",
"ZAR",
"KWD",
"UGX",
"BAM",
"RON",
"TJS",
"GYD",
"NZD",
"CAD",
"TMT",
"MMK",
"BRL",
"SGD",
"UYU",
"SZL",
"FKP",
"SAR",
"ARS",
"GEL",
"LAK",
"MZN",
"VND",
"BSD",
"LYD",
"UZS",
"XAF",
"MVR",
"PLN",
"LKR",
"SYP",
"HRK",
"BZD",
"KPW",
"PGK",
"EUR",
"MYR",
"GTQ",
"YER",
"MUR",
"CRC",
"CUP",
"IRR",
"KRW",
"MXN",
"AZN",
"BMD",
"HTG",
"KMF",
"INR",
"KZT",
"LSL",
"MDL",
"SDG",
"THB",
"CVE",
"MKD"
]
}
],
"supported_webhook_flows": [
"payments",
"refunds"
]
},
{
"name": "ZSL",
"display_name": "ZSL",
"description": "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "bank_transfer",
"payment_method_type": "local_bank_transfer",
"mandates": "not_supported",
"refunds": "not_supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"CN"
],
"supported_currencies": [
"CNY"
]
}
],
"supported_webhook_flows": []
}
]
}
```
Iatapay does support refunds. They have mentioned it in general that refunds are supported. And upon testing (intent creation, sync and refund), all working fine.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy --all-features --all-targets -- -D warnings`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
9f334c1ebcf0e8ee15ae2af608fb8f27fab2a6b2
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7315
|
Bug: Implement the PaymentAuthorize, PaymentSync, Refund and RefundSync flows for Paystack
Follow the steps outlined in the `add_connector.md` file.
Implement the PaymentAuthorize, PaymentSync, Refund, RefundSync, and Webhooks flows for Paystack connector.
Connector doc (Paystack): https://paystack.com/docs/payments/payment-channels/
- **Payment Authorize:**
Authorize call to be made via Electronic Fund Transfer (payment method).
Implement `impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Paystack` to make Payment Authorize call.
- **Payment Sync:**
Implement `impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Paystack` in `paystack.rs` to make Payment Sync call.
- **Refund:**
Implement `impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paystack` in `paystack.rs` to make Refund call.
- **RefundSync:**
Implement `impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paystack` in `paystack.rs` to make Refund Sync call.
- **Webhooks:**
There are two types of webhooks Payment, and Refund which to be implemented in `impl webhooks::IncomingWebhook for Paystack` in `paystack.rs` to receive the incoming webhooks sent by the connector.
Modify the `get_headers()` and `get_url()` according to the connector documentation.
Implement the Request and Response types and proper status mapping(Payment and Refund) in the `transformers.rs` file.
Webhooks - Paystack sends a webhook with payment and refund status, we have to catch those and update in the db as well.
Run the following commands before raising the PR -
`cargo clippy`
`cargo +nightly fmt --all`
Ref PR: https://github.com/juspay/hyperswitch/pull/7286
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index b63c4eea2a1..1faac62d6c6 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -2846,6 +2846,14 @@ client_id="Client ID"
api_key="Client Secret"
key1="Client ID"
+[paystack]
+[[paystack.bank_redirect]]
+ payment_method_type = "eft"
+[paystack.connector_auth.HeaderKey]
+api_key="API Key"
+[paystack.connector_webhook_details]
+merchant_secret="API Key"
+
[payu]
[[payu.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index a2e01c524e8..5123c66ea7e 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -2123,6 +2123,14 @@ merchant_secret="Source verification key"
[paypal.metadata.paypal_sdk]
client_id="Client ID"
+[paystack]
+[[paystack.bank_redirect]]
+ payment_method_type = "eft"
+[paystack.connector_auth.HeaderKey]
+api_key="API Key"
+[paystack.connector_webhook_details]
+merchant_secret="API Key"
+
[payu]
[[payu.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 8084bd00b00..a036e6c4fbd 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -3955,6 +3955,14 @@ api_key="Api Key"
[paypal_test.connector_auth.HeaderKey]
api_key="Api Key"
+[paystack]
+[[paystack.bank_redirect]]
+ payment_method_type = "eft"
+[paystack.connector_auth.HeaderKey]
+api_key="API Key"
+[paystack.connector_webhook_details]
+merchant_secret="API Key"
+
[stripe_test]
[[stripe_test.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs
index a88b60cc210..6d6ce2ff83a 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs
@@ -1,12 +1,13 @@
pub mod transformers;
use common_utils::{
+ crypto,
errors::CustomResult,
- ext_traits::BytesExt,
+ ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
@@ -43,13 +44,13 @@ use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Clone)]
pub struct Paystack {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
}
impl Paystack {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &MinorUnitForConnector,
}
}
}
@@ -117,7 +118,7 @@ impl ConnectorCommon for Paystack {
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
+ format!("Bearer {}", auth.api_key.expose()).into_masked(),
)])
}
@@ -133,12 +134,13 @@ impl ConnectorCommon for Paystack {
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+ let error_message = paystack::get_error_message(response.clone());
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code,
- message: response.message,
- reason: response.reason,
+ message: error_message,
+ reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
})
@@ -176,9 +178,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!("{}/charge", self.base_url(connectors)))
}
fn get_request_body(
@@ -262,10 +264,20 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
fn get_url(
&self,
- _req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let connector_payment_id = req
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+ Ok(format!(
+ "{}{}{}",
+ self.base_url(connectors),
+ "/transaction/verify/",
+ connector_payment_id,
+ ))
}
fn build_request(
@@ -289,7 +301,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: paystack::PaystackPaymentsResponse = res
+ let response: paystack::PaystackPSyncResponse = res
.response
.parse_struct("paystack PaymentsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -406,9 +418,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paystac
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/refund", self.base_url(connectors)))
}
fn get_request_body(
@@ -452,7 +464,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paystac
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
- let response: paystack::RefundResponse = res
+ let response: paystack::PaystackRefundsResponse = res
.response
.parse_struct("paystack RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -489,10 +501,20 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paystack
fn get_url(
&self,
- _req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let connector_refund_id = req
+ .request
+ .connector_refund_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorRefundID)?;
+ Ok(format!(
+ "{}{}{}",
+ self.base_url(connectors),
+ "/refund/",
+ connector_refund_id,
+ ))
}
fn build_request(
@@ -519,7 +541,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paystack
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: paystack::RefundResponse = res
+ let response: paystack::PaystackRefundsResponse = res
.response
.parse_struct("paystack RefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -543,25 +565,87 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paystack
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Paystack {
- fn get_webhook_object_reference_id(
+ fn get_webhook_source_verification_algorithm(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
+ Ok(Box::new(crypto::HmacSha512))
+ }
+
+ fn get_webhook_source_verification_signature(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let signature = utils::get_header_key_value("x-paystack-signature", request.headers)
+ .change_context(errors::ConnectorError::WebhookSignatureNotFound)?;
+
+ hex::decode(signature)
+ .change_context(errors::ConnectorError::WebhookVerificationSecretInvalid)
+ }
+
+ fn get_webhook_source_verification_message(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let message = std::str::from_utf8(request.body)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
+ Ok(message.to_string().into_bytes())
+ }
+
+ fn get_webhook_object_reference_id(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body = request
+ .body
+ .parse_struct::<paystack::PaystackWebhookData>("PaystackWebhookData")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ match webhook_body.data {
+ paystack::PaystackWebhookEventData::Payment(data) => {
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(data.reference),
+ ))
+ }
+ paystack::PaystackWebhookEventData::Refund(data) => {
+ Ok(api_models::webhooks::ObjectReferenceId::RefundId(
+ api_models::webhooks::RefundIdType::ConnectorRefundId(data.id),
+ ))
+ }
+ }
}
fn get_webhook_event_type(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body = request
+ .body
+ .parse_struct::<paystack::PaystackWebhookData>("PaystackWebhookData")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok(api_models::webhooks::IncomingWebhookEvent::from(
+ webhook_body.data,
+ ))
}
fn get_webhook_resource_object(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body = request
+ .body
+ .parse_struct::<paystack::PaystackWebhookData>("PaystackWebhookData")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok(match webhook_body.data {
+ paystack::PaystackWebhookEventData::Payment(payment_webhook_data) => {
+ Box::new(payment_webhook_data)
+ }
+ paystack::PaystackWebhookEventData::Refund(refund_webhook_data) => {
+ Box::new(refund_webhook_data)
+ }
+ })
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
index 8a07997fbdc..2ced7d44d54 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
@@ -1,30 +1,31 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_enums::{enums, Currency};
+use common_utils::{pii::Email, request::Method, types::MinorUnit};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
- router_data::{ConnectorAuthType, RouterData},
+ payment_method_data::{BankRedirectData, PaymentMethodData},
+ router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},
types::{PaymentsAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
+use url::Url;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::PaymentsAuthorizeRequestData,
};
-//TODO: Fill the struct with respective fields
pub struct PaystackRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: MinorUnit,
pub router_data: T,
}
-impl<T> From<(StringMinorUnit, T)> for PaystackRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
+impl<T> From<(MinorUnit, T)> for PaystackRouterData<T> {
+ fn from((amount, item): (MinorUnit, T)) -> Self {
//Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
@@ -33,20 +34,17 @@ impl<T> From<(StringMinorUnit, T)> for PaystackRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, PartialEq)]
-pub struct PaystackPaymentsRequest {
- amount: StringMinorUnit,
- card: PaystackCard,
+pub struct PaystackEftProvider {
+ provider: String,
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct PaystackCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct PaystackPaymentsRequest {
+ amount: MinorUnit,
+ currency: Currency,
+ email: Email,
+ eft: PaystackEftProvider,
}
impl TryFrom<&PaystackRouterData<&PaymentsAuthorizeRouterData>> for PaystackPaymentsRequest {
@@ -55,17 +53,14 @@ impl TryFrom<&PaystackRouterData<&PaymentsAuthorizeRouterData>> for PaystackPaym
item: &PaystackRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = PaystackCard {
- 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()?,
- };
+ PaymentMethodData::BankRedirect(BankRedirectData::Eft { provider }) => {
+ let email = item.router_data.request.get_email()?;
+ let eft = PaystackEftProvider { provider };
Ok(Self {
- amount: item.amount.clone(),
- card,
+ amount: item.amount,
+ currency: item.router_data.request.currency,
+ email,
+ eft,
})
}
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
@@ -73,8 +68,6 @@ impl TryFrom<&PaystackRouterData<&PaymentsAuthorizeRouterData>> for PaystackPaym
}
}
-//TODO: Fill the struct with respective fields
-// Auth Struct
pub struct PaystackAuthType {
pub(super) api_key: Secret<String>,
}
@@ -90,139 +83,383 @@ impl TryFrom<&ConnectorAuthType> for PaystackAuthType {
}
}
}
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackEftRedirect {
+ reference: String,
+ status: String,
+ url: String,
+}
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackPaymentsResponseData {
+ status: bool,
+ message: String,
+ data: PaystackEftRedirect,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(untagged)]
+pub enum PaystackPaymentsResponse {
+ PaystackPaymentsData(PaystackPaymentsResponseData),
+ PaystackPaymentsError(PaystackErrorResponse),
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let (status, response) = match item.response {
+ PaystackPaymentsResponse::PaystackPaymentsData(resp) => {
+ let redirection_url = Url::parse(resp.data.url.as_str())
+ .change_context(errors::ConnectorError::ParsingFailed)?;
+ let redirection_data = RedirectForm::from((redirection_url, Method::Get));
+ (
+ common_enums::AttemptStatus::AuthenticationPending,
+ Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ resp.data.reference.clone(),
+ ),
+ redirection_data: Box::new(Some(redirection_data)),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ )
+ }
+ PaystackPaymentsResponse::PaystackPaymentsError(err) => {
+ let err_msg = get_error_message(err.clone());
+ (
+ common_enums::AttemptStatus::Failure,
+ Err(ErrorResponse {
+ code: err.code,
+ message: err_msg.clone(),
+ reason: Some(err_msg.clone()),
+ attempt_status: None,
+ connector_transaction_id: None,
+ status_code: item.http_code,
+ }),
+ )
+ }
+ };
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
-pub enum PaystackPaymentStatus {
- Succeeded,
+pub enum PaystackPSyncStatus {
+ Abandoned,
Failed,
- #[default]
+ Ongoing,
+ Pending,
Processing,
+ Queued,
+ Reversed,
+ Success,
}
-impl From<PaystackPaymentStatus> for common_enums::AttemptStatus {
- fn from(item: PaystackPaymentStatus) -> Self {
+impl From<PaystackPSyncStatus> for common_enums::AttemptStatus {
+ fn from(item: PaystackPSyncStatus) -> Self {
match item {
- PaystackPaymentStatus::Succeeded => Self::Charged,
- PaystackPaymentStatus::Failed => Self::Failure,
- PaystackPaymentStatus::Processing => Self::Authorizing,
+ PaystackPSyncStatus::Success => Self::Charged,
+ PaystackPSyncStatus::Abandoned => Self::AuthenticationPending,
+ PaystackPSyncStatus::Ongoing
+ | PaystackPSyncStatus::Pending
+ | PaystackPSyncStatus::Processing
+ | PaystackPSyncStatus::Queued => Self::Pending,
+ PaystackPSyncStatus::Failed => Self::Failure,
+ PaystackPSyncStatus::Reversed => Self::Voided,
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct PaystackPaymentsResponse {
- status: PaystackPaymentStatus,
- id: String,
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackPSyncData {
+ status: PaystackPSyncStatus,
+ reference: String,
}
-impl<F, T> TryFrom<ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>>
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackPSyncResponseData {
+ status: bool,
+ message: String,
+ data: PaystackPSyncData,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(untagged)]
+pub enum PaystackPSyncResponse {
+ PaystackPSyncData(PaystackPSyncResponseData),
+ PaystackPSyncWebhook(PaystackPaymentWebhookData),
+ PaystackPSyncError(PaystackErrorResponse),
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, PaystackPSyncResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>,
+ item: ResponseRouterData<F, PaystackPSyncResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charges: None,
+ match item.response {
+ PaystackPSyncResponse::PaystackPSyncData(resp) => Ok(Self {
+ status: common_enums::AttemptStatus::from(resp.data.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(resp.data.reference.clone()),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
}),
- ..item.data
- })
+ PaystackPSyncResponse::PaystackPSyncWebhook(resp) => Ok(Self {
+ status: common_enums::AttemptStatus::from(resp.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(resp.reference.clone()),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ }),
+ PaystackPSyncResponse::PaystackPSyncError(err) => {
+ let err_msg = get_error_message(err.clone());
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: err.code,
+ message: err_msg.clone(),
+ reason: Some(err_msg.clone()),
+ attempt_status: None,
+ connector_transaction_id: None,
+ status_code: item.http_code,
+ }),
+ ..item.data
+ })
+ }
+ }
}
}
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct PaystackRefundRequest {
- pub amount: StringMinorUnit,
+ pub transaction: String,
+ pub amount: MinorUnit,
}
impl<F> TryFrom<&PaystackRouterData<&RefundsRouterData<F>>> for PaystackRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PaystackRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
Ok(Self {
+ transaction: item.router_data.request.connector_transaction_id.clone(),
amount: item.amount.to_owned(),
})
}
}
-// Type definition for Refund Response
-
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
+#[derive(Debug, Serialize, Default, Deserialize, Clone, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum PaystackRefundStatus {
+ Processed,
Failed,
#[default]
Processing,
+ Pending,
}
-impl From<RefundStatus> for enums::RefundStatus {
- fn from(item: RefundStatus) -> Self {
+impl From<PaystackRefundStatus> for enums::RefundStatus {
+ fn from(item: PaystackRefundStatus) -> Self {
match item {
- RefundStatus::Succeeded => Self::Success,
- RefundStatus::Failed => Self::Failure,
- RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
+ PaystackRefundStatus::Processed => Self::Success,
+ PaystackRefundStatus::Failed => Self::Failure,
+ PaystackRefundStatus::Processing | PaystackRefundStatus::Pending => Self::Pending,
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
- id: String,
- status: RefundStatus,
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackRefundsData {
+ status: PaystackRefundStatus,
+ id: i64,
+}
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackRefundsResponseData {
+ status: bool,
+ message: String,
+ data: PaystackRefundsData,
}
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(untagged)]
+pub enum PaystackRefundsResponse {
+ PaystackRefundsData(PaystackRefundsResponseData),
+ PaystackRSyncWebhook(PaystackRefundWebhookData),
+ PaystackRefundsError(PaystackErrorResponse),
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, PaystackRefundsResponse>>
+ for RefundsRouterData<Execute>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<Execute, RefundResponse>,
+ item: RefundsResponseRouterData<Execute, PaystackRefundsResponse>,
) -> 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),
+ match item.response {
+ PaystackRefundsResponse::PaystackRefundsData(resp) => Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: resp.data.id.to_string(),
+ refund_status: enums::RefundStatus::from(resp.data.status),
+ }),
+ ..item.data
}),
- ..item.data
- })
+ PaystackRefundsResponse::PaystackRSyncWebhook(resp) => Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: resp.id,
+ refund_status: enums::RefundStatus::from(resp.status),
+ }),
+ ..item.data
+ }),
+ PaystackRefundsResponse::PaystackRefundsError(err) => {
+ let err_msg = get_error_message(err.clone());
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: err.code,
+ message: err_msg.clone(),
+ reason: Some(err_msg.clone()),
+ attempt_status: None,
+ connector_transaction_id: None,
+ status_code: item.http_code,
+ }),
+ ..item.data
+ })
+ }
+ }
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+impl TryFrom<RefundsResponseRouterData<RSync, PaystackRefundsResponse>>
+ for RefundsRouterData<RSync>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<RSync, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, PaystackRefundsResponse>,
) -> 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),
+ match item.response {
+ PaystackRefundsResponse::PaystackRefundsData(resp) => Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: resp.data.id.to_string(),
+ refund_status: enums::RefundStatus::from(resp.data.status),
+ }),
+ ..item.data
}),
- ..item.data
- })
+ PaystackRefundsResponse::PaystackRSyncWebhook(resp) => Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: resp.id,
+ refund_status: enums::RefundStatus::from(resp.status),
+ }),
+ ..item.data
+ }),
+ PaystackRefundsResponse::PaystackRefundsError(err) => {
+ let err_msg = get_error_message(err.clone());
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: err.code,
+ message: err_msg.clone(),
+ reason: Some(err_msg.clone()),
+ attempt_status: None,
+ connector_transaction_id: None,
+ status_code: item.http_code,
+ }),
+ ..item.data
+ })
+ }
+ }
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct PaystackErrorResponse {
- pub status_code: u16,
- pub code: String,
+ pub status: bool,
pub message: String,
- pub reason: Option<String>,
+ pub data: Option<serde_json::Value>,
+ pub meta: serde_json::Value,
+ pub code: String,
+}
+
+pub fn get_error_message(response: PaystackErrorResponse) -> String {
+ if let Some(serde_json::Value::Object(err_map)) = response.data {
+ err_map.get("message").map(|msg| msg.clone().to_string())
+ } else {
+ None
+ }
+ .unwrap_or(response.message)
+}
+
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct PaystackPaymentWebhookData {
+ pub status: PaystackPSyncStatus,
+ pub reference: String,
+}
+
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct PaystackRefundWebhookData {
+ pub status: PaystackRefundStatus,
+ pub id: String,
+ pub transaction_reference: String,
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
+#[serde(untagged)]
+pub enum PaystackWebhookEventData {
+ Payment(PaystackPaymentWebhookData),
+ Refund(PaystackRefundWebhookData),
+}
+
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct PaystackWebhookData {
+ pub event: String,
+ pub data: PaystackWebhookEventData,
+}
+
+impl From<PaystackWebhookEventData> for api_models::webhooks::IncomingWebhookEvent {
+ fn from(item: PaystackWebhookEventData) -> Self {
+ match item {
+ PaystackWebhookEventData::Payment(payment_data) => match payment_data.status {
+ PaystackPSyncStatus::Success => Self::PaymentIntentSuccess,
+ PaystackPSyncStatus::Failed => Self::PaymentIntentFailure,
+ PaystackPSyncStatus::Abandoned
+ | PaystackPSyncStatus::Ongoing
+ | PaystackPSyncStatus::Pending
+ | PaystackPSyncStatus::Processing
+ | PaystackPSyncStatus::Queued => Self::PaymentIntentProcessing,
+ PaystackPSyncStatus::Reversed => Self::EventNotSupported,
+ },
+ PaystackWebhookEventData::Refund(refund_data) => match refund_data.status {
+ PaystackRefundStatus::Processed => Self::RefundSuccess,
+ PaystackRefundStatus::Failed => Self::RefundFailure,
+ PaystackRefundStatus::Processing | PaystackRefundStatus::Pending => {
+ Self::EventNotSupported
+ }
+ },
+ }
+ }
}
|
2025-03-06T08:07:22Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Paystack EFT flow (Payments, PSync, Refunds, RSync, Webhooks).
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Merchant Account Create:
```
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
"merchant_id": "merchant_1739960795",
"locker_id": "m0010",
"merchant_name": "NewAge Retailer",
"merchant_details": {
"primary_contact_person": "John Test",
"primary_email": "JohnTest@test.com",
"primary_phone": "sunt laborum",
"secondary_contact_person": "John Test2",
"secondary_email": "JohnTest2@test.com",
"secondary_phone": "cillum do dolor id",
"website": "https://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://google.com/success",
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"sub_merchants_enabled": false,
"metadata": {
"city": "NY",
"unit": "245"
},
"primary_business_details": [
{
"country": "US",
"business": "food"
}
]
}'
```
2. API Key Create:
```
curl --location 'http://localhost:8080/api_keys/merchant_1739898797' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"name": "API Key 1",
"description": null,
"expiration": "2025-09-23T01:02:03.000Z"
}'
```
3. Paystack Connector Create:
```
curl --location 'http://localhost:8080/account/merchant_1739898797/connectors?=' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "payment_processor",
"connector_name": "paystack",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "abc"
},
"test_mode": false,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "bank_redirect",
"payment_method_types": [
{
"payment_method_type": "eft",
"payment_experience": "redirect_to_url",
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 0,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": false
}
]
}
],
"connector_webhook_details": {
"merchant_secret": "abc",
"additional_secret": null
}
}'
```
4. Payments Create:
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ykM0z3Y0k65EtZIce9BsbJXPtoq7KzcAWsLZUS3SIT13cdYEOQQ4mMkb4UMB5Oyd' \
--data-raw '{
"amount": 6540,
"currency": "ZAR",
"confirm": true,
"amount_to_capture": 6540,
"customer_id": "StripbmnxeCustomer",
"email": "abc@gmail.com",
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "bank_redirect",
"payment_method_type": "eft",
"payment_method_data": {
"bank_redirect": {
"eft": {
"provider": "ozow"
}
}
}
}'
```
Response:
```
{
"payment_id": "pay_kQrdGr1rVMmwEKYXorLM",
"merchant_id": "merchant_1739898797",
"status": "requires_customer_action",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 6540,
"amount_received": null,
"connector": "paystack",
"client_secret": "pay_kQrdGr1rVMmwEKYXorLM_secret_U7lStVK9TuKNY4l0mxmc",
"created": "2025-02-19T10:32:31.775Z",
"currency": "ZAR",
"customer_id": "StripbmnxeCustomer",
"customer": {
"id": "StripbmnxeCustomer",
"name": null,
"email": "abc@gmail.com",
"phone": null,
"phone_country_code": null
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": null,
"payment_method": "bank_redirect",
"payment_method_data": {
"bank_redirect": {
"type": "BankRedirectResponse",
"bank_name": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "abc@gmail.com",
"name": null,
"phone": null,
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_kQrdGr1rVMmwEKYXorLM/merchant_1739898797/pay_kQrdGr1rVMmwEKYXorLM_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "eft",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripbmnxeCustomer",
"created_at": 1739961151,
"expires": 1739964751,
"secret": "epk_09592792e8504aa3a943feff38c3e3e2"
},
"manual_retry_allowed": null,
"connector_transaction_id": "sug0jyf5kbbbpe5",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_z5wMP3CJUUrMDF5CBGl9",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_Ux3UO8AL0iD9BlzLSE83",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-19T10:47:31.774Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-19T10:32:32.739Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
5. Payments Retrieve
Request:
```
curl --location 'http://localhost:8080/payments/pay_kWVz157PfvGL9GyAiTnI?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_ykM0z3Y0k65EtZIce9BsbJXPtoq7KzcAWsLZUS3SIT13cdYEOQQ4mMkb4UMB5Oyd' \
--data ''
```
Response: Same as payments response>
6. Refunds Create
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ykM0z3Y0k65EtZIce9BsbJXPtoq7KzcAWsLZUS3SIT13cdYEOQQ4mMkb4UMB5Oyd' \
--data '{
"payment_id": "pay_6Ww3WmcWCT8ni7O5K5gV",
"amount": 1000,
"reason": "Customer returned product",
"refund_type": "instant",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
Response:
```
{
"refund_id": "ref_XSsCj6O6bujAZypJAFJk",
"payment_id": "pay_6Ww3WmcWCT8ni7O5K5gV",
"amount": 1000,
"currency": "ZAR",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-19T10:31:32.658Z",
"updated_at": "2025-02-19T10:31:34.094Z",
"connector": "paystack",
"profile_id": "pro_z5wMP3CJUUrMDF5CBGl9",
"merchant_connector_id": "mca_Ux3UO8AL0iD9BlzLSE83",
"split_refunds": null
}
```
7. Refunds Retrieve
Request:
```
curl --location 'http://localhost:8080/refunds/ref_XSsCj6O6bujAZypJAFJk' \
--header 'Accept: application/json' \
--header 'api-key: dev_ZgTXlFsnanc0o4AW2Ag32dJQsA1rAvU1prQVsIE0JbUjPv7g65ZU5pO7MyiPLL5J'
```
Response: Same as Refunds response.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
13a274909962872f1d663d082af33fc44205d419
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7306
|
Bug: [CYPRESS] Fiuu Connector Configuration and Payment Processing Issues
The FIUU Connector is not functioning as expected.
### Expected Behavior:
- The Fiuu Connector should be configurable without errors.
- Test Cases should pass successfully through the Fiuu Payment Connector.
### Actual Behavior:
- Errors occur during the configuration process.
- Test Cases do not go through as expected.
|
2025-02-18T12:33:02Z
|
## Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
The FIUU Connector was not functioning as expected.
## Key Changes
- Added fiuu connector configs for `PaymentConfirmWithShippingCost`, `ZeroAuthMandate`, and `SaveCardConfirmAutoCaptureOffSessionWithoutBilling`.
- Added `billing.email` in some places in the configs where it was a required parameter.
- Mapped `error_message: "The currency not allow for the RecordType"` wherever necessary.
- Mandate Payments using PMID responds with the `connector_transaction_id: null` if the payment fails. So, changed the command accordingly.
- Fiuu does not support Connector Diagnostic, so updated the exclusion list to include Fiuu connector.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Initial Condition
<img width="710" alt="image" src="https://github.com/user-attachments/assets/976bb14e-c200-4d34-a61d-a8ab46115824" />
Current Condition
<img width="710" alt="image" src="https://github.com/user-attachments/assets/3f01b9c3-3de1-468a-b022-2733d1c03c0b" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
c0c08d05ef04d914e07d49f163e43bdddf5c885b
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7321
|
Bug: add support to collect customer address details form Samsung Pay based on business profile config and connector required fields
add support to collect customer address details form Samsung Pay based on business profile config and connector required fields
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index c91810a9902..5616da620bd 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -19766,7 +19766,9 @@
"merchant",
"amount",
"protocol",
- "allowed_brands"
+ "allowed_brands",
+ "billing_address_required",
+ "shipping_address_required"
],
"properties": {
"version": {
@@ -19796,6 +19798,14 @@
"type": "string"
},
"description": "List of supported card brands"
+ },
+ "billing_address_required": {
+ "type": "boolean",
+ "description": "Is billing address required to be collected from wallet"
+ },
+ "shipping_address_required": {
+ "type": "boolean",
+ "description": "Is shipping address required to be collected from wallet"
}
}
},
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 7b1ba943ee7..b107c2d6b96 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -6570,6 +6570,10 @@ pub struct SamsungPaySessionTokenResponse {
pub protocol: SamsungPayProtocolType,
/// List of supported card brands
pub allowed_brands: Vec<String>,
+ /// Is billing address required to be collected from wallet
+ pub billing_address_required: bool,
+ /// Is shipping address required to be collected from wallet
+ pub shipping_address_required: bool,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index f6e5d1e7f05..662453c4a3e 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -610,8 +610,11 @@ fn create_paze_session_token(
}
fn create_samsung_pay_session_token(
+ state: &routes::SessionState,
router_data: &types::PaymentsSessionRouterData,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ connector: &api::ConnectorData,
+ business_profile: &domain::Profile,
) -> RouterResult<types::PaymentsSessionRouterData> {
let samsung_pay_session_token_data = router_data
.connector_wallets_details
@@ -657,6 +660,20 @@ fn create_samsung_pay_session_token(
let formatted_payment_id = router_data.payment_id.replace("_", "-");
+ let billing_address_required = is_billing_address_required_to_be_collected_from_wallet(
+ state,
+ connector,
+ business_profile,
+ enums::PaymentMethodType::SamsungPay,
+ );
+
+ let shipping_address_required = is_shipping_address_required_to_be_collected_form_wallet(
+ state,
+ connector,
+ business_profile,
+ enums::PaymentMethodType::SamsungPay,
+ );
+
Ok(types::PaymentsSessionRouterData {
response: Ok(types::PaymentsResponseData::SessionResponse {
session_token: payment_types::SessionToken::SamsungPay(Box::new(
@@ -677,6 +694,8 @@ fn create_samsung_pay_session_token(
},
protocol: payment_types::SamsungPayProtocolType::Protocol3ds,
allowed_brands: samsung_pay_wallet_details.allowed_brands,
+ billing_address_required,
+ shipping_address_required,
},
)),
}),
@@ -684,6 +703,86 @@ fn create_samsung_pay_session_token(
})
}
+/// Function to determine whether the billing address is required to be collected from the wallet,
+/// based on business profile settings, the payment method type, and the connector's required fields
+/// for the specific payment method.
+///
+/// If `always_collect_billing_details_from_wallet_connector` is enabled, it indicates that the
+/// billing address is always required to be collected from the wallet.
+///
+/// If only `collect_billing_details_from_wallet_connector` is enabled, the billing address will be
+/// collected only if the connector required fields for the specific payment method type contain
+/// the billing fields.
+fn is_billing_address_required_to_be_collected_from_wallet(
+ state: &routes::SessionState,
+ connector: &api::ConnectorData,
+ business_profile: &domain::Profile,
+ payment_method_type: enums::PaymentMethodType,
+) -> bool {
+ let always_collect_billing_details_from_wallet_connector = business_profile
+ .always_collect_billing_details_from_wallet_connector
+ .unwrap_or(false);
+
+ if always_collect_billing_details_from_wallet_connector {
+ always_collect_billing_details_from_wallet_connector
+ } else if business_profile
+ .collect_billing_details_from_wallet_connector
+ .unwrap_or(false)
+ {
+ let billing_variants = enums::FieldType::get_billing_variants();
+
+ is_dynamic_fields_required(
+ &state.conf.required_fields,
+ enums::PaymentMethod::Wallet,
+ payment_method_type,
+ connector.connector_name,
+ billing_variants,
+ )
+ } else {
+ false
+ }
+}
+
+/// Function to determine whether the shipping address is required to be collected from the wallet,
+/// based on business profile settings, the payment method type, and the connector required fields
+/// for the specific payment method type.
+///
+/// If `always_collect_shipping_details_from_wallet_connector` is enabled, it indicates that the
+/// shipping address is always required to be collected from the wallet.
+///
+/// If only `collect_shipping_details_from_wallet_connector` is enabled, the shipping address will be
+/// collected only if the connector required fields for the specific payment method type contain
+/// the shipping fields.
+fn is_shipping_address_required_to_be_collected_form_wallet(
+ state: &routes::SessionState,
+ connector: &api::ConnectorData,
+ business_profile: &domain::Profile,
+ payment_method_type: enums::PaymentMethodType,
+) -> bool {
+ let always_collect_shipping_details_from_wallet_connector = business_profile
+ .always_collect_shipping_details_from_wallet_connector
+ .unwrap_or(false);
+
+ if always_collect_shipping_details_from_wallet_connector {
+ always_collect_shipping_details_from_wallet_connector
+ } else if business_profile
+ .collect_shipping_details_from_wallet_connector
+ .unwrap_or(false)
+ {
+ let shipping_variants = enums::FieldType::get_shipping_variants();
+
+ is_dynamic_fields_required(
+ &state.conf.required_fields,
+ enums::PaymentMethod::Wallet,
+ payment_method_type,
+ connector.connector_name,
+ shipping_variants,
+ )
+ } else {
+ false
+ }
+}
+
fn get_session_request_for_simplified_apple_pay(
apple_pay_merchant_identifier: String,
session_token_data: payment_types::SessionTokenForSimplifiedApplePay,
@@ -865,27 +964,12 @@ fn create_gpay_session_token(
..router_data.clone()
})
} else {
- let always_collect_billing_details_from_wallet_connector = business_profile
- .always_collect_billing_details_from_wallet_connector
- .unwrap_or(false);
-
- let is_billing_details_required = if always_collect_billing_details_from_wallet_connector {
- always_collect_billing_details_from_wallet_connector
- } else if business_profile
- .collect_billing_details_from_wallet_connector
- .unwrap_or(false)
- {
- let billing_variants = enums::FieldType::get_billing_variants();
- is_dynamic_fields_required(
- &state.conf.required_fields,
- enums::PaymentMethod::Wallet,
- enums::PaymentMethodType::GooglePay,
- connector.connector_name,
- billing_variants,
- )
- } else {
- false
- };
+ let is_billing_details_required = is_billing_address_required_to_be_collected_from_wallet(
+ state,
+ connector,
+ business_profile,
+ enums::PaymentMethodType::GooglePay,
+ );
let required_amount_type = StringMajorUnitForConnector;
let google_pay_amount = required_amount_type
@@ -904,29 +988,13 @@ fn create_gpay_session_token(
total_price: google_pay_amount,
};
- let always_collect_shipping_details_from_wallet_connector = business_profile
- .always_collect_shipping_details_from_wallet_connector
- .unwrap_or(false);
-
let required_shipping_contact_fields =
- if always_collect_shipping_details_from_wallet_connector {
- true
- } else if business_profile
- .collect_shipping_details_from_wallet_connector
- .unwrap_or(false)
- {
- let shipping_variants = enums::FieldType::get_shipping_variants();
-
- is_dynamic_fields_required(
- &state.conf.required_fields,
- enums::PaymentMethod::Wallet,
- enums::PaymentMethodType::GooglePay,
- connector.connector_name,
- shipping_variants,
- )
- } else {
- false
- };
+ is_shipping_address_required_to_be_collected_form_wallet(
+ state,
+ connector,
+ business_profile,
+ enums::PaymentMethodType::GooglePay,
+ );
if connector_wallets_details.google_pay.is_some() {
let gpay_data = router_data
@@ -1199,9 +1267,13 @@ impl RouterDataSession for types::PaymentsSessionRouterData {
api::GetToken::GpayMetadata => {
create_gpay_session_token(state, self, connector, business_profile)
}
- api::GetToken::SamsungPayMetadata => {
- create_samsung_pay_session_token(self, header_payload)
- }
+ api::GetToken::SamsungPayMetadata => create_samsung_pay_session_token(
+ state,
+ self,
+ header_payload,
+ connector,
+ business_profile,
+ ),
api::GetToken::ApplePayMetadata => {
create_applepay_session_token(
state,
|
2025-02-19T13:28:35Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pull request includes changes to enhance the handling of billing and shipping address requirements for Samsung Pay and Google Pay session tokens. The most important changes include adding new fields to the `SamsungPaySessionTokenResponse` struct, updating the `create_samsung_pay_session_token` function to include these new fields, and refactoring the code to use helper functions for determining address requirements.
Enhancements to session token handling:
* Added `billing_address_required` and `shipping_address_required` fields to the `SamsungPaySessionTokenResponse` struct.
* Updated the `create_samsung_pay_session_token` function to include the new address requirement fields and refactored the logic to use helper functions for determining if billing and shipping addresses are required.
Refactoring for address requirement determination:
* Introduced the `is_billing_address_required_to_be_collected_from_wallet` and `is_shipping_address_required_to_be_collected_form_wallet` functions to encapsulate the logic for determining address requirements based on business profile settings and connector fields.
* Refactored the `create_gpay_session_token` function to use the new helper functions for determining billing and shipping address requirements.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Collect the customer's address details from Samsung Pay during payment to enhance the customer experience
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a merchant connector account with the samsung pay enabled for it
-> Create a payment with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
"amount": 6100,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"amount_to_capture": 6100,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "something@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"customer_id": "1739970997",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
}
}'
```
```
{
"payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
"merchant_id": "merchant_1739965434",
"status": "requires_payment_method",
"amount": 6100,
"net_amount": 6100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
"created": "2025-02-19T13:16:04.153Z",
"currency": "USD",
"customer_id": "1739970964",
"customer": {
"id": "1739970964",
"name": "Joseph Doe",
"email": "something@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "something@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": null,
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "1739970964",
"created_at": 1739970964,
"expires": 1739974564,
"secret": "epk_40529c632d7946338b7ad09430a613e6"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_2STAgRa16ISVgMLO11F2",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-19T13:31:04.153Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-19T13:16:04.173Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null
}
```
-> Set the below profile configuration
```
curl --location 'http://localhost:8080/account/merchant_1739965434/business_profile/pro_2STAgRa16ISVgMLO11F2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
"collect_billing_details_from_wallet_connector": false,
"collect_shipping_details_from_wallet_connector": false,
"always_collect_shipping_details_from_wallet_connector": true,
"always_collect_billing_details_from_wallet_connector": true,
}'
```
```
{
"merchant_id": "merchant_1739965434",
"profile_id": "pro_2STAgRa16ISVgMLO11F2",
"profile_name": "US_default",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "0txdls9EorK9Gzx1OYRGV0X9xS87pn5sUxfFHFlfq9endVIs7S1iqV5TnCsZUYD7",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": null,
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"metadata": null,
"routing_algorithm": null,
"intent_fulfillment_time": 900,
"frm_routing_algorithm": null,
"payout_routing_algorithm": null,
"applepay_verified_domains": null,
"session_expiry": 900,
"payment_link_config": null,
"authentication_connector_details": null,
"use_billing_as_payment_method_billing": true,
"extended_card_info_config": null,
"collect_shipping_details_from_wallet_connector": false,
"collect_billing_details_from_wallet_connector": false,
"always_collect_shipping_details_from_wallet_connector": true,
"always_collect_billing_details_from_wallet_connector": true,
"is_connector_agnostic_mit_enabled": true,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null,
"tax_connector_id": null,
"is_tax_connector_enabled": false,
"is_network_tokenization_enabled": false,
"is_auto_retries_enabled": false,
"max_auto_retries_enabled": null,
"always_request_extended_authorization": null,
"is_click_to_pay_enabled": false,
"authentication_product_ids": null
}
```
-> For this profile configuration the `shipping_address_required` and `billing_address_required` be true in the session resposne
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: api-key' \
--data '{
"payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
"wallets": [],
"client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL"
}'
```
```
{
"payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
"client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
"session_token": [
{
"wallet_name": "google_pay",
"merchant_info": {
"merchant_name": "Stripe"
},
"shipping_address_required": true,
"email_required": true,
"shipping_address_parameters": {
"phone_number_required": true
},
"allowed_payment_methods": [
{
"type": "CARD",
"parameters": {
"allowed_auth_methods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"allowed_card_networks": [
"AMEX",
"DISCOVER",
"INTERAC",
"JCB",
"MASTERCARD",
"VISA"
],
"billing_address_required": true,
"billing_address_parameters": {
"phone_number_required": true,
"format": "FULL"
}
},
"tokenization_specification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2018-10-31",
"stripe:publishableKey": "pk_test_51Msk2GAGHc77EJXX78h549SX2uaOnEkUYqBfjcoD05PIpAnDkYxMn8nQ4d19im85NQuX4Z6WDyHaUw2fFTPBWsIY00Wa7oNerO"
}
}
}
],
"transaction_info": {
"country_code": "US",
"currency_code": "USD",
"total_price_status": "Final",
"total_price": "61.00"
},
"delayed_session_token": false,
"connector": "cybersource",
"sdk_next_action": {
"next_action": "confirm"
},
"secrets": null
},
{
"wallet_name": "samsung_pay",
"version": "2",
"service_id": "49400558c67f4a97b3925f",
"order_number": "pay-2B9WMNGYhzpVoUHGxvpS",
"merchant": {
"name": "Hyperswitch",
"url": null,
"country_code": "IN"
},
"amount": {
"option": "FORMAT_TOTAL_PRICE_ONLY",
"currency_code": "USD",
"total": "61.00"
},
"protocol": "PROTOCOL3DS",
"allowed_brands": [
"visa",
"masterCard",
"amex",
"discover"
],
"billing_address_required": true,
"shipping_address_required": true
},
{
"wallet_name": "apple_pay",
"session_token_data": {},
"payment_request_data": {
"country_code": "AU",
"currency_code": "USD",
"total": {
"label": "applepay",
"type": "final",
"amount": "61.00"
},
"merchant_capabilities": [
"supports3DS"
],
"supported_networks": [
"visa",
"masterCard",
"amex",
"discover"
],
"merchant_identifier": "merchant.sandbox.hyperswitch",
"required_billing_contact_fields": [
"postalAddress"
],
"required_shipping_contact_fields": [
"postalAddress",
"phone",
"email"
]
},
"connector": "cybersource",
"delayed_session_token": false,
"sdk_next_action": {
"next_action": "confirm"
},
"connector_reference_id": null,
"connector_sdk_public_key": null,
"connector_merchant_id": null
}
]
}
```
-> Set the below profile configuration
```
curl --location 'http://localhost:8080/account/merchant_1739965434/business_profile/pro_2STAgRa16ISVgMLO11F2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
"collect_billing_details_from_wallet_connector": true,
"collect_shipping_details_from_wallet_connector": true,
"always_collect_shipping_details_from_wallet_connector": false,
"always_collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": true
}'
```
```
{
"merchant_id": "merchant_1739965434",
"profile_id": "pro_2STAgRa16ISVgMLO11F2",
"profile_name": "US_default",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "0txdls9EorK9Gzx1OYRGV0X9xS87pn5sUxfFHFlfq9endVIs7S1iqV5TnCsZUYD7",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": null,
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"metadata": null,
"routing_algorithm": null,
"intent_fulfillment_time": 900,
"frm_routing_algorithm": null,
"payout_routing_algorithm": null,
"applepay_verified_domains": null,
"session_expiry": 900,
"payment_link_config": null,
"authentication_connector_details": null,
"use_billing_as_payment_method_billing": true,
"extended_card_info_config": null,
"collect_shipping_details_from_wallet_connector": true,
"collect_billing_details_from_wallet_connector": true,
"always_collect_shipping_details_from_wallet_connector": false,
"always_collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": true,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null,
"tax_connector_id": null,
"is_tax_connector_enabled": false,
"is_network_tokenization_enabled": false,
"is_auto_retries_enabled": false,
"max_auto_retries_enabled": null,
"always_request_extended_authorization": null,
"is_click_to_pay_enabled": false,
"authentication_product_ids": null
}
```
-> As per the above profile configuration the the `billing_address_required` will be `true` as the cybersource requires billing derails to be passed and `shipping_address_required` will be `false` as shipping details are not required by cybserourec.
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: api-key' \
--data '{
"payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
"wallets": [],
"client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL"
}'
```
```
{
"payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
"client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
"session_token": [
{
"wallet_name": "google_pay",
"merchant_info": {
"merchant_name": "Stripe"
},
"shipping_address_required": false,
"email_required": true,
"shipping_address_parameters": {
"phone_number_required": false
},
"allowed_payment_methods": [
{
"type": "CARD",
"parameters": {
"allowed_auth_methods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"allowed_card_networks": [
"AMEX",
"DISCOVER",
"INTERAC",
"JCB",
"MASTERCARD",
"VISA"
],
"billing_address_required": true,
"billing_address_parameters": {
"phone_number_required": true,
"format": "FULL"
}
},
"tokenization_specification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2018-10-31",
"stripe:publishableKey": "pk_test_51Msk2GAGHc77EJXX78h549SX2uaOnEkUYqBfjcoD05PIpAnDkYxMn8nQ4d19im85NQuX4Z6WDyHaUw2fFTPBWsIY00Wa7oNerO"
}
}
}
],
"transaction_info": {
"country_code": "US",
"currency_code": "USD",
"total_price_status": "Final",
"total_price": "61.00"
},
"delayed_session_token": false,
"connector": "cybersource",
"sdk_next_action": {
"next_action": "confirm"
},
"secrets": null
},
{
"wallet_name": "samsung_pay",
"version": "2",
"service_id": "49400558c67f4a97b3925f",
"order_number": "pay-2B9WMNGYhzpVoUHGxvpS",
"merchant": {
"name": "Hyperswitch",
"url": null,
"country_code": "IN"
},
"amount": {
"option": "FORMAT_TOTAL_PRICE_ONLY",
"currency_code": "USD",
"total": "61.00"
},
"protocol": "PROTOCOL3DS",
"allowed_brands": [
"visa",
"masterCard",
"amex",
"discover"
],
"billing_address_required": true,
"shipping_address_required": false
},
{
"wallet_name": "apple_pay",
"session_token_data": {},
"payment_request_data": {
"country_code": "AU",
"currency_code": "USD",
"total": {
"label": "applepay",
"type": "final",
"amount": "61.00"
},
"merchant_capabilities": [
"supports3DS"
],
"supported_networks": [
"visa",
"masterCard",
"amex",
"discover"
],
"merchant_identifier": "merchant.sandbox.hyperswitch",
"required_billing_contact_fields": [
"postalAddress"
],
"required_shipping_contact_fields": [
"phone",
"email"
]
},
"connector": "cybersource",
"delayed_session_token": false,
"sdk_next_action": {
"next_action": "confirm"
},
"connector_reference_id": null,
"connector_sdk_public_key": null,
"connector_merchant_id": null
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
f3ca2009c1902094a72b8bf43e89b406e44ecfd4
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7313
|
Bug: Integrate EFT as a Payment Method in Hyperswitch
Electronic Fund Transfer is a redirection flow, that falls under Bank Redirect in Hyperswitch. We have to add EFT as a payment method.
- Add EFT under `BankRedirectData` enum in `crates/api_models/src/payments.rs` which has a structure:
```
Eft {
/// The preferred eft provider
#[schema(example = "ozow")]
provider: String,
}
```
- Everywhere the enum `BankRedirectData` is used we have to put EFT there.
- In the transformers.rs file of every connector, if the connector supports EFT we have to add implementations there otherwise we'll this as `NotSupported` or `NotImplemented` elsewhere.
Ref PR: https://github.com/juspay/hyperswitch/pull/7304
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index bef1bcdeb55..4f801c2dd0c 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -5578,6 +5578,27 @@
"type": "object"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "eft"
+ ],
+ "properties": {
+ "eft": {
+ "type": "object",
+ "required": [
+ "provider"
+ ],
+ "properties": {
+ "provider": {
+ "type": "string",
+ "description": "The preferred eft provider",
+ "example": "ozow"
+ }
+ }
+ }
+ }
}
]
},
@@ -15433,6 +15454,7 @@
"debit",
"duit_now",
"efecty",
+ "eft",
"eps",
"fps",
"evoucher",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 15d6e68f14e..2d2679f646c 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2639,6 +2639,7 @@ impl GetPaymentMethodType for BankRedirectData {
Self::BancontactCard { .. } => api_enums::PaymentMethodType::BancontactCard,
Self::Bizum {} => api_enums::PaymentMethodType::Bizum,
Self::Blik { .. } => api_enums::PaymentMethodType::Blik,
+ Self::Eft { .. } => api_enums::PaymentMethodType::Eft,
Self::Eps { .. } => api_enums::PaymentMethodType::Eps,
Self::Giropay { .. } => api_enums::PaymentMethodType::Giropay,
Self::Ideal { .. } => api_enums::PaymentMethodType::Ideal,
@@ -3015,6 +3016,11 @@ pub enum BankRedirectData {
issuer: common_enums::BankNames,
},
LocalBankRedirect {},
+ Eft {
+ /// The preferred eft provider
+ #[schema(example = "ozow")]
+ provider: String,
+ },
}
impl GetAddressFromPaymentMethodData for BankRedirectData {
@@ -3130,7 +3136,8 @@ impl GetAddressFromPaymentMethodData for BankRedirectData {
| Self::OnlineBankingPoland { .. }
| Self::OnlineBankingSlovakia { .. }
| Self::OnlineBankingCzechRepublic { .. }
- | Self::Blik { .. } => None,
+ | Self::Blik { .. }
+ | Self::Eft { .. } => None,
}
}
}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 26b56be1f07..208fb7dedb5 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1587,6 +1587,7 @@ pub enum PaymentMethodType {
Debit,
DuitNow,
Efecty,
+ Eft,
Eps,
Fps,
Evoucher,
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index d351f5c927e..6fcc33a97f0 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1821,6 +1821,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Debit => Self::Card,
PaymentMethodType::Fps => Self::RealTimePayment,
PaymentMethodType::DuitNow => Self::RealTimePayment,
+ PaymentMethodType::Eft => Self::BankRedirect,
PaymentMethodType::Eps => Self::BankRedirect,
PaymentMethodType::Evoucher => Self::Reward,
PaymentMethodType::Giropay => Self::BankRedirect,
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index 6fb302641db..58e9f6fca31 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -147,6 +147,7 @@ pub enum BankRedirectType {
Giropay,
Ideal,
Sofort,
+ Eft,
Eps,
BancontactCard,
Blik,
diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs
index 04a029bd109..c5cb54378b0 100644
--- a/crates/euclid/src/frontend/dir/lowering.rs
+++ b/crates/euclid/src/frontend/dir/lowering.rs
@@ -160,6 +160,7 @@ impl From<enums::BankRedirectType> for global_enums::PaymentMethodType {
enums::BankRedirectType::Giropay => Self::Giropay,
enums::BankRedirectType::Ideal => Self::Ideal,
enums::BankRedirectType::Sofort => Self::Sofort,
+ enums::BankRedirectType::Eft => Self::Eft,
enums::BankRedirectType::Eps => Self::Eps,
enums::BankRedirectType::BancontactCard => Self::BancontactCard,
enums::BankRedirectType::Blik => Self::Blik,
diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs
index 1a3bb52e0fa..762f3a857b2 100644
--- a/crates/euclid/src/frontend/dir/transformers.rs
+++ b/crates/euclid/src/frontend/dir/transformers.rs
@@ -196,6 +196,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
global_enums::PaymentMethodType::DirectCarrierBilling => {
Ok(dirval!(MobilePaymentType = DirectCarrierBilling))
}
+ global_enums::PaymentMethodType::Eft => Ok(dirval!(BankRedirectType = Eft)),
}
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
index 9fe45cef21e..3e4ac8d80a8 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
@@ -174,6 +174,17 @@ impl
merchant_transaction_id: None,
customer_email: None,
})),
+ BankRedirectData::Eft { .. } => Self::BankRedirect(Box::new(BankRedirectionPMData {
+ payment_brand: PaymentBrand::Eft,
+ bank_account_country: Some(item.router_data.get_billing_country()?),
+ bank_account_bank_name: None,
+ bank_account_bic: None,
+ bank_account_iban: None,
+ billing_country: None,
+ merchant_customer_id: None,
+ merchant_transaction_id: None,
+ customer_email: None,
+ })),
BankRedirectData::Giropay {
bank_account_bic,
bank_account_iban,
@@ -326,6 +337,7 @@ pub struct WalletPMData {
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum PaymentBrand {
Eps,
+ Eft,
Ideal,
Giropay,
Sofortueberweisung,
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 5c38a55dc0f..8b1296a0159 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -465,6 +465,7 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Giropay { .. }
| BankRedirectData::Ideal { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
index 6450839fac3..e41057fb8e6 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
@@ -164,6 +164,7 @@ impl
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Giropay { .. }
| BankRedirectData::Interac { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index dd0110d9593..86ad19d7dc2 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -581,6 +581,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Debit
| common_enums::PaymentMethodType::DirectCarrierBilling
| common_enums::PaymentMethodType::Efecty
+ | common_enums::PaymentMethodType::Eft
| common_enums::PaymentMethodType::Eps
| common_enums::PaymentMethodType::Evoucher
| common_enums::PaymentMethodType::Giropay
@@ -698,6 +699,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Debit
| common_enums::PaymentMethodType::DirectCarrierBilling
| common_enums::PaymentMethodType::Efecty
+ | common_enums::PaymentMethodType::Eft
| common_enums::PaymentMethodType::Eps
| common_enums::PaymentMethodType::Evoucher
| common_enums::PaymentMethodType::Giropay
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 61732e5c751..3e632e048a2 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -525,6 +525,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum { .. }
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
@@ -590,6 +591,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum { .. }
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
@@ -777,6 +779,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum { .. }
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Giropay { .. }
| BankRedirectData::Interac { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
index 88cea9c8edf..8e4b9995040 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
@@ -593,6 +593,7 @@ fn get_payment_details_and_product(
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Blik { .. }
| BankRedirectData::Bizum { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 3bc06aa6e19..0bfd3af7e99 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -977,6 +977,7 @@ where
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index b2fd0ed0b49..cfa5c28e7ba 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -505,6 +505,7 @@ impl TryFrom<&BankRedirectData> for PaymentMethodType {
BankRedirectData::Sofort { .. } => Ok(Self::Sofort),
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Trustly { .. }
| BankRedirectData::Przelewy24 { .. }
| BankRedirectData::Bizum {}
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
index 52181738579..e8da94fae34 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
@@ -238,6 +238,7 @@ impl TryFrom<&BankRedirectData> for TrustpayPaymentMethod {
BankRedirectData::Blik { .. } => Ok(Self::Blik),
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
index 86816195276..3841b7e33b4 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
@@ -113,6 +113,7 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Giropay { .. }
| BankRedirectData::Ideal { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
index f9d7da5d1ec..d716bfd088f 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
@@ -390,6 +390,7 @@ fn make_bank_redirect_request(
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index abe528eff29..305c8518c8e 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -724,6 +724,7 @@ impl TryFrom<&BankRedirectData> for ZenPaymentsRequest {
| BankRedirectData::BancontactCard { .. }
| BankRedirectData::Blik { .. }
| BankRedirectData::Trustly { .. }
+ | BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Giropay { .. }
| BankRedirectData::Przelewy24 { .. }
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index ac5a7714b54..ce40e373462 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -5199,6 +5199,7 @@ pub enum PaymentMethodDataType {
BancontactCard,
Bizum,
Blik,
+ Eft,
Eps,
Giropay,
Ideal,
@@ -5330,6 +5331,7 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
}
payment_method_data::BankRedirectData::Bizum {} => Self::Bizum,
payment_method_data::BankRedirectData::Blik { .. } => Self::Blik,
+ payment_method_data::BankRedirectData::Eft { .. } => Self::Eft,
payment_method_data::BankRedirectData::Eps { .. } => Self::Eps,
payment_method_data::BankRedirectData::Giropay { .. } => Self::Giropay,
payment_method_data::BankRedirectData::Ideal { .. } => Self::Ideal,
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 78b2144f3ed..9b73fe45f65 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -437,6 +437,9 @@ pub enum BankRedirectData {
issuer: common_enums::BankNames,
},
LocalBankRedirect {},
+ Eft {
+ provider: String,
+ },
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
@@ -1029,6 +1032,7 @@ impl From<api_models::payments::BankRedirectData> for BankRedirectData {
api_models::payments::BankRedirectData::LocalBankRedirect { .. } => {
Self::LocalBankRedirect {}
}
+ api_models::payments::BankRedirectData::Eft { provider } => Self::Eft { provider },
}
}
}
@@ -1613,6 +1617,7 @@ impl GetPaymentMethodType for BankRedirectData {
Self::BancontactCard { .. } => api_enums::PaymentMethodType::BancontactCard,
Self::Bizum {} => api_enums::PaymentMethodType::Bizum,
Self::Blik { .. } => api_enums::PaymentMethodType::Blik,
+ Self::Eft { .. } => api_enums::PaymentMethodType::Eft,
Self::Eps { .. } => api_enums::PaymentMethodType::Eps,
Self::Giropay { .. } => api_enums::PaymentMethodType::Giropay,
Self::Ideal { .. } => api_enums::PaymentMethodType::Ideal,
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index e224078493f..88c32a48187 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -28,6 +28,7 @@ fn get_dir_value_payment_method(
api_enums::PaymentMethodType::Ideal => Ok(dirval!(BankRedirectType = Ideal)),
api_enums::PaymentMethodType::Sofort => Ok(dirval!(BankRedirectType = Sofort)),
api_enums::PaymentMethodType::Eps => Ok(dirval!(BankRedirectType = Eps)),
+ api_enums::PaymentMethodType::Eft => Ok(dirval!(BankRedirectType = Eft)),
api_enums::PaymentMethodType::Klarna => Ok(dirval!(PayLaterType = Klarna)),
api_enums::PaymentMethodType::Affirm => Ok(dirval!(PayLaterType = Affirm)),
api_enums::PaymentMethodType::AfterpayClearpay => {
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index adfe5820866..0479753d8d0 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -136,6 +136,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
api_enums::PaymentMethodType::Giropay => Ok(dirval!(BankRedirectType = Giropay)),
api_enums::PaymentMethodType::Ideal => Ok(dirval!(BankRedirectType = Ideal)),
api_enums::PaymentMethodType::Sofort => Ok(dirval!(BankRedirectType = Sofort)),
+ api_enums::PaymentMethodType::Eft => Ok(dirval!(BankRedirectType = Eft)),
api_enums::PaymentMethodType::Eps => Ok(dirval!(BankRedirectType = Eps)),
api_enums::PaymentMethodType::Klarna => Ok(dirval!(PayLaterType = Klarna)),
api_enums::PaymentMethodType::Affirm => Ok(dirval!(PayLaterType = Affirm)),
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 7067592771f..7cefdda657e 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -222,6 +222,7 @@ impl ConnectorValidation for Adyen {
| PaymentMethodType::Multibanco
| PaymentMethodType::Przelewy24
| PaymentMethodType::Becs
+ | PaymentMethodType::Eft
| PaymentMethodType::ClassicReward
| PaymentMethodType::Pse
| PaymentMethodType::LocalBankTransfer
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 93a43f25b8a..0920887962a 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2404,6 +2404,7 @@ impl
),
domain::BankRedirectData::Trustly { .. } => Ok(AdyenPaymentMethod::Trustly),
domain::BankRedirectData::Giropay { .. }
+ | domain::BankRedirectData::Eft { .. }
| domain::BankRedirectData::Interac { .. }
| domain::BankRedirectData::LocalBankRedirect {}
| domain::BankRedirectData::Przelewy24 { .. }
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 5989706bf5b..80a702512c0 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -762,6 +762,7 @@ fn get_payment_source(
.into())
}
domain::BankRedirectData::Bizum {}
+ | domain::BankRedirectData::Eft { .. }
| domain::BankRedirectData::Interac { .. }
| domain::BankRedirectData::OnlineBankingCzechRepublic { .. }
| domain::BankRedirectData::OnlineBankingFinland { .. }
@@ -1158,6 +1159,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
| enums::PaymentMethodType::DirectCarrierBilling
| enums::PaymentMethodType::DuitNow
| enums::PaymentMethodType::Efecty
+ | enums::PaymentMethodType::Eft
| enums::PaymentMethodType::Eps
| enums::PaymentMethodType::Fps
| enums::PaymentMethodType::Evoucher
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index cdcf7b4c7b2..41fb23e7e9e 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -711,6 +711,7 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::Dana
| enums::PaymentMethodType::DirectCarrierBilling
| enums::PaymentMethodType::Efecty
+ | enums::PaymentMethodType::Eft
| enums::PaymentMethodType::Evoucher
| enums::PaymentMethodType::GoPay
| enums::PaymentMethodType::Gcash
@@ -1032,6 +1033,7 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodType {
}
domain::BankRedirectData::Bizum {}
| domain::BankRedirectData::Interac { .. }
+ | domain::BankRedirectData::Eft { .. }
| domain::BankRedirectData::OnlineBankingCzechRepublic { .. }
| domain::BankRedirectData::OnlineBankingFinland { .. }
| domain::BankRedirectData::OnlineBankingPoland { .. }
@@ -1600,6 +1602,7 @@ impl TryFrom<(&domain::BankRedirectData, Option<StripeBillingAddress>)>
.into())
}
domain::BankRedirectData::Bizum {}
+ | domain::BankRedirectData::Eft { .. }
| domain::BankRedirectData::Interac { .. }
| domain::BankRedirectData::OnlineBankingCzechRepublic { .. }
| domain::BankRedirectData::OnlineBankingFinland { .. }
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 2d7e3cc6d52..8a186e0291a 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2789,6 +2789,7 @@ pub enum PaymentMethodDataType {
BancontactCard,
Bizum,
Blik,
+ Eft,
Eps,
Giropay,
Ideal,
@@ -2920,6 +2921,7 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
}
domain::payments::BankRedirectData::Bizum {} => Self::Bizum,
domain::payments::BankRedirectData::Blik { .. } => Self::Blik,
+ domain::payments::BankRedirectData::Eft { .. } => Self::Eft,
domain::payments::BankRedirectData::Eps { .. } => Self::Eps,
domain::payments::BankRedirectData::Giropay { .. } => Self::Giropay,
domain::payments::BankRedirectData::Ideal { .. } => Self::Ideal,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 05b4d592c23..cdbda13997b 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2997,6 +2997,7 @@ pub fn validate_payment_method_type_against_payment_method(
api_enums::PaymentMethodType::Giropay
| api_enums::PaymentMethodType::Ideal
| api_enums::PaymentMethodType::Sofort
+ | api_enums::PaymentMethodType::Eft
| api_enums::PaymentMethodType::Eps
| api_enums::PaymentMethodType::BancontactCard
| api_enums::PaymentMethodType::Blik
@@ -4828,6 +4829,12 @@ pub async fn get_additional_payment_data(
details: None,
},
)),
+ domain::BankRedirectData::Eft { .. } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
+ bank_name: None,
+ details: None,
+ },
+ )),
domain::BankRedirectData::Ideal { bank_name, .. } => Ok(Some(
api_models::payments::AdditionalPaymentData::BankRedirect {
bank_name: bank_name.to_owned(),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 514ddbbbb50..860d5f5f580 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -491,6 +491,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
api_enums::PaymentMethodType::Giropay
| api_enums::PaymentMethodType::Ideal
| api_enums::PaymentMethodType::Sofort
+ | api_enums::PaymentMethodType::Eft
| api_enums::PaymentMethodType::Eps
| api_enums::PaymentMethodType::BancontactCard
| api_enums::PaymentMethodType::Blik
|
2025-02-18T19:46:27Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Active Issue: https://github.com/juspay/hyperswitch/issues/7313
## Description
<!-- Describe your changes in detail -->
Added EFT as a payment method in Bank Redirect.
Active Issue linked to this PR: https://github.com/juspay/hyperswitch/issues/7313
but still PR convention checks are failing
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
EFT is a new payment payment method and there is no connector to test that. Paystack is the only connector with EFT.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
30f321bc2001264f5197172428ecae79896ad2f5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7299
|
Bug: add Samsung pay mandate support for Cybersource
add Samsung pay mandate support for Cybersource
|
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index b7b57690474..f9b9fb1b414 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1215,6 +1215,8 @@ merchant_secret="Source verification key"
payment_method_type = "google_pay"
[[cybersource.wallet]]
payment_method_type = "paze"
+[[cybersource.wallet]]
+ payment_method_type = "samsung_pay"
[cybersource.connector_auth.SignatureKey]
api_key="Key"
key1="Merchant ID"
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index 5a60f6d705a..812d0391dec 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -312,6 +312,7 @@ impl ConnectorValidation for Cybersource {
PaymentMethodDataType::Card,
PaymentMethodDataType::ApplePay,
PaymentMethodDataType::GooglePay,
+ PaymentMethodDataType::SamsungPay,
]);
utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index b953fa73754..4652080397a 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -251,6 +251,11 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
)),
Some(PaymentSolution::GooglePay),
),
+ WalletData::SamsungPay(samsung_pay_data) => (
+ (get_samsung_pay_payment_information(&samsung_pay_data)
+ .attach_printable("Failed to get samsung pay payment information")?),
+ Some(PaymentSolution::SamsungPay),
+ ),
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
@@ -269,7 +274,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
| WalletData::PaypalRedirect(_)
| WalletData::PaypalSdk(_)
| WalletData::Paze(_)
- | WalletData::SamsungPay(_)
| WalletData::TwintRedirect {}
| WalletData::VippsRedirect {}
| WalletData::TouchNGoRedirect(_)
@@ -1859,25 +1863,8 @@ impl
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
- let samsung_pay_fluid_data_value =
- get_samsung_pay_fluid_data_value(&samsung_pay_data.payment_credential.token_data)?;
-
- let samsung_pay_fluid_data_str = serde_json::to_string(&samsung_pay_fluid_data_value)
- .change_context(errors::ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to serialize samsung pay fluid data")?;
-
- let payment_information =
- PaymentInformation::SamsungPay(Box::new(SamsungPayPaymentInformation {
- fluid_data: FluidData {
- value: Secret::new(consts::BASE64_ENGINE.encode(samsung_pay_fluid_data_str)),
- descriptor: Some(
- consts::BASE64_ENGINE.encode(FLUID_DATA_DESCRIPTOR_FOR_SAMSUNG_PAY),
- ),
- },
- tokenized_card: SamsungPayTokenizedCard {
- transaction_type: TransactionType::SamsungPay,
- },
- }));
+ let payment_information = get_samsung_pay_payment_information(&samsung_pay_data)
+ .attach_printable("Failed to get samsung pay payment information")?;
let processing_information = ProcessingInformation::try_from((
item,
@@ -1903,6 +1890,32 @@ impl
}
}
+fn get_samsung_pay_payment_information(
+ samsung_pay_data: &SamsungPayWalletData,
+) -> Result<PaymentInformation, error_stack::Report<errors::ConnectorError>> {
+ let samsung_pay_fluid_data_value =
+ get_samsung_pay_fluid_data_value(&samsung_pay_data.payment_credential.token_data)?;
+
+ let samsung_pay_fluid_data_str = serde_json::to_string(&samsung_pay_fluid_data_value)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to serialize samsung pay fluid data")?;
+
+ let payment_information =
+ PaymentInformation::SamsungPay(Box::new(SamsungPayPaymentInformation {
+ fluid_data: FluidData {
+ value: Secret::new(consts::BASE64_ENGINE.encode(samsung_pay_fluid_data_str)),
+ descriptor: Some(
+ consts::BASE64_ENGINE.encode(FLUID_DATA_DESCRIPTOR_FOR_SAMSUNG_PAY),
+ ),
+ },
+ tokenized_card: SamsungPayTokenizedCard {
+ transaction_type: TransactionType::SamsungPay,
+ },
+ }));
+
+ Ok(payment_information)
+}
+
fn get_samsung_pay_fluid_data_value(
samsung_pay_token_data: &hyperswitch_domain_models::payment_method_data::SamsungPayTokenData,
) -> Result<SamsungPayFluidDataValue, error_stack::Report<errors::ConnectorError>> {
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 27cc485188b..3849054045c 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -9128,7 +9128,86 @@ impl Default for settings::RequiredFields {
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
- common: HashMap::new(),
+ common: HashMap::from(
+ [
+ (
+ "billing.email".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.first_name".to_string(),
+ display_name: "billing_first_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ 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.state".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.state".to_string(),
+ display_name: "state".to_string(),
+ field_type: enums::FieldType::UserAddressState,
+ 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.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,
+ }
+ ),
+ (
+ "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,
+ }
+ )
+ ]
+ ),
}
),
]),
|
2025-02-18T12:45:16Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pr adds Samsung pay mandate support for Cybersource and enable samsung pay for cybersource on sandbox.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a Cybersource connector with Samsung pay enabled for it
-> Make a samsung pay off_session payment with amount set to zero. Payment will be in failed status with `"error_message": "SERVER_ERROR"`. This is expected, we need to get off_session payments enabled for our cybersource account.
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"customer_id": "cu_1739882499",
"setup_future_usage": "off_session",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "samsungpay@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"phone_country_code": "+65",
"payment_type": "setup_mandate",
"description": "Its my first payment request",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"payment_method": "wallet",
"payment_method_type": "samsung_pay",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"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": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"payment_method_data": {
"wallet": {
"samsung_pay": {
"payment_credential": {
"3_d_s": {
"type": "S",
"version": "100",
"data": "samsung-pay-token"
},
"payment_card_brand": "VI",
"payment_currency_type": "USD",
"payment_last4_fpan": "1661",
"method": "3DS",
"recurring_payment": false
}
}
}
}
}
'
```
```
{
"payment_id": "pay_WXbt7aYJDjO0DvyZRpsf",
"merchant_id": "merchant_1739867293",
"status": "failed",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "cybersource",
"client_secret": "pay_WXbt7aYJDjO0DvyZRpsf_secret_qZUj82yqxmREZX3MBnTR",
"created": "2025-02-18T08:29:27.643Z",
"currency": "USD",
"customer_id": "cu_1739867368",
"customer": {
"id": "cu_1739867368",
"name": "Joseph Doe",
"email": "samsungpay@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"samsung_pay": {
"last4": "1661",
"card_network": "Visa",
"type": null
}
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "samsungpay@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": "SERVER_ERROR",
"error_message": "SERVER_ERROR",
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"payment_experience": null,
"payment_method_type": "samsung_pay",
"connector_label": "cybersource_US_default_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1739867368",
"created_at": 1739867367,
"expires": 1739870967,
"secret": "epk_7c1492ae7ec84198a64f11a089f48508"
},
"manual_retry_allowed": true,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_lUspT7TZ8NWvqh6aWiEy",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_oGt66qf0Ct6bRlh8P9BN",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-18T08:44:27.643Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-18T08:29:28.698Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
d6e13dd0c87537e6696dd6dfc02280f825d116ab
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7314
|
Bug: Generating the Template Code for Paystack using add_connector script
Follow the steps outlined in the [add_connector.md](https://github.com/juspay/hyperswitch/blob/main/add_connector.md) file. Execute the script provided in the markdown file with Connector name(eg: Paystack) and Connector base url. This will add respective code to add the specific connector in `hyperswitch_connector` crate.
- Do the changes according to the document in the files.
Then run the following commands:
- `cargo clippy`
- `cargo +nightly fmt --all`
Afterward, review the code and raise a pull request (PR).
Ref PR: https://github.com/juspay/hyperswitch/pull/7285
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index f81eca420a0..93e95761d09 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7433,6 +7433,7 @@
"payme",
"payone",
"paypal",
+ "paystack",
"payu",
"placetopay",
"powertranz",
@@ -20037,6 +20038,7 @@
"payme",
"payone",
"paypal",
+ "paystack",
"payu",
"placetopay",
"powertranz",
diff --git a/config/config.example.toml b/config/config.example.toml
index 3457d330c9a..0ec70721cb0 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -247,6 +247,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
@@ -330,6 +331,7 @@ cards = [
"mollie",
"moneris",
"paypal",
+ "paystack",
"shift4",
"square",
"stax",
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 079134e6d03..033b19cadea 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -92,6 +92,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 79ed26906ef..5b3360d64b7 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -96,6 +96,7 @@ payeezy.base_url = "https://api.payeezy.com/"
payme.base_url = "https://live.payme.io/"
payone.base_url = "https://payment.payone.com/"
paypal.base_url = "https://api-m.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.payu.com/api/"
placetopay.base_url = "https://checkout.placetopay.com/rest/gateway"
plaid.base_url = "https://production.plaid.com"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index a92deafb20a..6203b9393ee 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -96,6 +96,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
diff --git a/config/development.toml b/config/development.toml
index 13ed82c81f6..ce4f24edaac 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -198,6 +198,7 @@ cards = [
"payme",
"payone",
"paypal",
+ "paystack",
"payu",
"placetopay",
"plaid",
@@ -317,6 +318,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 0031c37f022..6d7c88a9c62 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -179,6 +179,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
@@ -279,6 +280,7 @@ cards = [
"payme",
"payone",
"paypal",
+ "paystack",
"payu",
"placetopay",
"plaid",
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index c52bb6816d7..3e13cb8a820 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -109,6 +109,7 @@ pub enum RoutableConnectors {
Payme,
Payone,
Paypal,
+ Paystack,
Payu,
Placetopay,
Powertranz,
@@ -250,6 +251,7 @@ pub enum Connector {
Payme,
Payone,
Paypal,
+ Paystack,
Payu,
Placetopay,
Powertranz,
@@ -397,6 +399,7 @@ impl Connector {
| Self::Payme
| Self::Payone
| Self::Paypal
+ | Self::Paystack
| Self::Payu
| Self::Placetopay
| Self::Powertranz
@@ -527,6 +530,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Payme => Self::Payme,
RoutableConnectors::Payone => Self::Payone,
RoutableConnectors::Paypal => Self::Paypal,
+ RoutableConnectors::Paystack => Self::Paystack,
RoutableConnectors::Payu => Self::Payu,
RoutableConnectors::Placetopay => Self::Placetopay,
RoutableConnectors::Powertranz => Self::Powertranz,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 2d1d2e4ede8..7134f5c5d34 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -219,6 +219,7 @@ pub struct ConnectorConfig {
pub paypal: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub paypal_payout: Option<ConnectorTomlConfig>,
+ pub paystack: Option<ConnectorTomlConfig>,
pub payu: Option<ConnectorTomlConfig>,
pub placetopay: Option<ConnectorTomlConfig>,
pub plaid: Option<ConnectorTomlConfig>,
@@ -382,6 +383,7 @@ impl ConnectorConfig {
Connector::Payme => Ok(connector_data.payme),
Connector::Payone => Err("Use get_payout_connector_config".to_string()),
Connector::Paypal => Ok(connector_data.paypal),
+ Connector::Paystack => Ok(connector_data.paystack),
Connector::Payu => Ok(connector_data.payu),
Connector::Placetopay => Ok(connector_data.placetopay),
Connector::Plaid => Ok(connector_data.plaid),
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 0b6042ef931..97a2bdb77bb 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -46,6 +46,7 @@ pub mod novalnet;
pub mod nuvei;
pub mod paybox;
pub mod payeezy;
+pub mod paystack;
pub mod payu;
pub mod placetopay;
pub mod powertranz;
@@ -80,10 +81,10 @@ pub use self::{
iatapay::Iatapay, inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan, klarna::Klarna,
mifinity::Mifinity, mollie::Mollie, moneris::Moneris, multisafepay::Multisafepay,
nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay, novalnet::Novalnet, nuvei::Nuvei,
- paybox::Paybox, payeezy::Payeezy, payu::Payu, placetopay::Placetopay, powertranz::Powertranz,
- prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, redsys::Redsys, shift4::Shift4,
- square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys,
- unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
+ paybox::Paybox, payeezy::Payeezy, paystack::Paystack, payu::Payu, placetopay::Placetopay,
+ powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay,
+ redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes,
+ tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen,
zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs
new file mode 100644
index 00000000000..a88b60cc210
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs
@@ -0,0 +1,568 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as paystack;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Paystack {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Paystack {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Paystack {}
+impl api::PaymentSession for Paystack {}
+impl api::ConnectorAccessToken for Paystack {}
+impl api::MandateSetup for Paystack {}
+impl api::PaymentAuthorize for Paystack {}
+impl api::PaymentSync for Paystack {}
+impl api::PaymentCapture for Paystack {}
+impl api::PaymentVoid for Paystack {}
+impl api::Refund for Paystack {}
+impl api::RefundExecute for Paystack {}
+impl api::RefundSync for Paystack {}
+impl api::PaymentToken for Paystack {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Paystack
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Paystack
+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 Paystack {
+ fn id(&self) -> &'static str {
+ "paystack"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.paystack.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = paystack::PaystackAuthType::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: paystack::PaystackErrorResponse = res
+ .response
+ .parse_struct("PaystackErrorResponse")
+ .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 Paystack {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Paystack {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Paystack {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
+ for Paystack
+{
+}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Paystack {
+ 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 = paystack::PaystackRouterData::from((amount, req));
+ let connector_req = paystack::PaystackPaymentsRequest::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: paystack::PaystackPaymentsResponse = res
+ .response
+ .parse_struct("Paystack 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 Paystack {
+ 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: paystack::PaystackPaymentsResponse = res
+ .response
+ .parse_struct("paystack 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 Paystack {
+ 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: paystack::PaystackPaymentsResponse = res
+ .response
+ .parse_struct("Paystack 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 Paystack {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paystack {
+ 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 = paystack::PaystackRouterData::from((refund_amount, req));
+ let connector_req = paystack::PaystackRefundRequest::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: paystack::RefundResponse = res
+ .response
+ .parse_struct("paystack 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 Paystack {
+ 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: paystack::RefundResponse = res
+ .response
+ .parse_struct("paystack 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 Paystack {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl ConnectorSpecifications for Paystack {}
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
new file mode 100644
index 00000000000..8a07997fbdc
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/paystack/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 PaystackRouterData<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 PaystackRouterData<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 PaystackPaymentsRequest {
+ amount: StringMinorUnit,
+ card: PaystackCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct PaystackCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&PaystackRouterData<&PaymentsAuthorizeRouterData>> for PaystackPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &PaystackRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = PaystackCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct PaystackAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for PaystackAuthType {
+ 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 PaystackPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<PaystackPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: PaystackPaymentStatus) -> Self {
+ match item {
+ PaystackPaymentStatus::Succeeded => Self::Charged,
+ PaystackPaymentStatus::Failed => Self::Failure,
+ PaystackPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaystackPaymentsResponse {
+ status: PaystackPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct PaystackRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&PaystackRouterData<&RefundsRouterData<F>>> for PaystackRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaystackRouterData<&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 PaystackErrorResponse {
+ 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 b2df2d15f71..4be5f661134 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -139,6 +139,7 @@ default_imp_for_authorize_session_token!(
connectors::Nexixpay,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -228,6 +229,7 @@ default_imp_for_calculate_tax!(
connectors::Novalnet,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -315,6 +317,7 @@ default_imp_for_session_update!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::UnifiedAuthenticationService,
@@ -401,6 +404,7 @@ default_imp_for_post_session_tokens!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Fiuu,
@@ -475,6 +479,7 @@ default_imp_for_complete_authorize!(
connectors::Novalnet,
connectors::Nexinets,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Rapyd,
@@ -553,6 +558,7 @@ default_imp_for_incremental_authorization!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -642,6 +648,7 @@ default_imp_for_create_customer!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -720,6 +727,7 @@ default_imp_for_connector_redirect_response!(
connectors::Nexixpay,
connectors::Nomupay,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -795,6 +803,7 @@ default_imp_for_pre_processing_steps!(
connectors::Nexinets,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -880,6 +889,7 @@ default_imp_for_post_processing_steps!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -967,6 +977,7 @@ default_imp_for_approve!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1054,6 +1065,7 @@ default_imp_for_reject!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1141,6 +1153,7 @@ default_imp_for_webhook_source_verification!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1229,6 +1242,7 @@ default_imp_for_accept_dispute!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1316,6 +1330,7 @@ default_imp_for_submit_evidence!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1403,6 +1418,7 @@ default_imp_for_defend_dispute!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1499,6 +1515,7 @@ default_imp_for_file_upload!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1582,6 +1599,7 @@ default_imp_for_payouts!(
connectors::Novalnet,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1666,6 +1684,7 @@ default_imp_for_payouts_create!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1755,6 +1774,7 @@ default_imp_for_payouts_retrieve!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1844,6 +1864,7 @@ default_imp_for_payouts_eligibility!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1932,6 +1953,7 @@ default_imp_for_payouts_fulfill!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2021,6 +2043,7 @@ default_imp_for_payouts_cancel!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2110,6 +2133,7 @@ default_imp_for_payouts_quote!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2199,6 +2223,7 @@ default_imp_for_payouts_recipient!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2288,6 +2313,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2377,6 +2403,7 @@ default_imp_for_frm_sale!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2466,6 +2493,7 @@ default_imp_for_frm_checkout!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2555,6 +2583,7 @@ default_imp_for_frm_transaction!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2644,6 +2673,7 @@ default_imp_for_frm_fulfillment!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2733,6 +2763,7 @@ default_imp_for_frm_record_return!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2818,6 +2849,7 @@ default_imp_for_revoking_mandates!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2904,6 +2936,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Nexixpay,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Powertranz,
connectors::Prophetpay,
@@ -2989,6 +3022,7 @@ default_imp_for_uas_post_authentication!(
connectors::Nexixpay,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Powertranz,
connectors::Prophetpay,
@@ -3074,6 +3108,7 @@ default_imp_for_uas_authentication!(
connectors::Nexixpay,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Powertranz,
connectors::Prophetpay,
@@ -3160,6 +3195,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Nexixpay,
connectors::Nuvei,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Powertranz,
connectors::Prophetpay,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index d0ffd3a230c..003c3cc46d1 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -248,6 +248,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -336,6 +337,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -419,6 +421,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -507,6 +510,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -594,6 +598,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -682,6 +687,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -780,6 +786,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -870,6 +877,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -960,6 +968,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1050,6 +1059,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1140,6 +1150,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1230,6 +1241,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1320,6 +1332,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1410,6 +1423,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1500,6 +1514,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1588,6 +1603,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1678,6 +1694,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1768,6 +1785,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1858,6 +1876,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -1948,6 +1967,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2038,6 +2058,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
@@ -2125,6 +2146,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
+ connectors::Paystack,
connectors::Payu,
connectors::Placetopay,
connectors::Powertranz,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index d5656f3a477..4c4801801f0 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -73,6 +73,7 @@ pub struct Connectors {
pub payme: ConnectorParams,
pub payone: ConnectorParams,
pub paypal: ConnectorParams,
+ pub paystack: ConnectorParams,
pub payu: ConnectorParams,
pub placetopay: ConnectorParams,
pub plaid: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 4bf57cb16f0..de9d86fdd79 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -41,11 +41,11 @@ pub use hyperswitch_connectors::connectors::{
klarna::Klarna, mifinity, mifinity::Mifinity, mollie, mollie::Mollie, moneris,
moneris::Moneris, multisafepay, multisafepay::Multisafepay, nexinets, nexinets::Nexinets,
nexixpay, nexixpay::Nexixpay, nomupay, nomupay::Nomupay, novalnet, novalnet::Novalnet, nuvei,
- nuvei::Nuvei, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payu, payu::Payu, placetopay,
- placetopay::Placetopay, powertranz, powertranz::Powertranz, prophetpay, prophetpay::Prophetpay,
- rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, redsys, redsys::Redsys, shift4,
- shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes,
- thunes::Thunes, tsys, tsys::Tsys, unified_authentication_service,
+ nuvei::Nuvei, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, paystack, paystack::Paystack,
+ payu, payu::Payu, placetopay, placetopay::Placetopay, powertranz, powertranz::Powertranz,
+ prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, redsys,
+ redsys::Redsys, shift4, shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar,
+ taxjar::Taxjar, thunes, thunes::Thunes, tsys, tsys::Tsys, unified_authentication_service,
unified_authentication_service::UnifiedAuthenticationService, volt, volt::Volt, wellsfargo,
wellsfargo::Wellsfargo, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit,
xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index bc93b9c53eb..cc753e12895 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1490,6 +1490,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
payone::transformers::PayoneAuthType::try_from(self.auth_type)?;
Ok(())
}
+ api_enums::Connector::Paystack => {
+ paystack::transformers::PaystackAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Payu => {
payu::transformers::PayuAuthType::try_from(self.auth_type)?;
Ok(())
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 1219363b212..997a40c9393 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1030,6 +1030,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Powertranz,
connector::Rapyd,
@@ -1496,6 +1497,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Powertranz,
connector::Rapyd,
@@ -1873,6 +1875,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Placetopay,
connector::Powertranz,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index f55c1f58f60..e9e3ea10cd6 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -452,6 +452,7 @@ default_imp_for_connector_request_id!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Placetopay,
connector::Plaid,
@@ -1413,6 +1414,7 @@ default_imp_for_fraud_check!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Placetopay,
connector::Plaid,
@@ -1948,6 +1950,7 @@ default_imp_for_connector_authentication!(
connector::Payme,
connector::Payone,
connector::Paypal,
+ connector::Paystack,
connector::Payu,
connector::Placetopay,
connector::Plaid,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 43556eb581a..14a5730d4f1 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -543,6 +543,9 @@ impl ConnectorData {
enums::Connector::Paypal => {
Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new())))
}
+ enums::Connector::Paystack => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new())))
+ }
// enums::Connector::Thunes => Ok(ConnectorEnum::Old(Box::new(connector::Thunes))),
enums::Connector::Trustpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new())))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index a05020856b9..957d8279b36 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -282,6 +282,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Payme => Self::Payme,
api_enums::Connector::Payone => Self::Payone,
api_enums::Connector::Paypal => Self::Paypal,
+ api_enums::Connector::Paystack => Self::Paystack,
api_enums::Connector::Payu => Self::Payu,
api_models::enums::Connector::Placetopay => Self::Placetopay,
api_enums::Connector::Plaid => Self::Plaid,
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index f2fdfddfd63..d0eb96efcc8 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -69,6 +69,7 @@ mod payeezy;
mod payme;
mod payone;
mod paypal;
+mod paystack;
mod payu;
mod placetopay;
mod plaid;
diff --git a/crates/router/tests/connectors/paystack.rs b/crates/router/tests/connectors/paystack.rs
new file mode 100644
index 00000000000..2aaac95b208
--- /dev/null
+++ b/crates/router/tests/connectors/paystack.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct PaystackTest;
+impl ConnectorActions for PaystackTest {}
+impl utils::Connector for PaystackTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Paystack;
+ utils::construct_connector_data_old(
+ Box::new(Paystack::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .paystack
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "paystack".to_string()
+ }
+}
+
+static CONNECTOR: PaystackTest = PaystackTest {};
+
+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 4677417104c..6314b7fd322 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -313,4 +313,7 @@ api_key="API Key"
api_key= "API Key"
[moneris]
-api_key= "API Key"
\ No newline at end of file
+api_key= "API Key"
+
+[paystack]
+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 7a5b48f03a6..6036dc2a20f 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -74,6 +74,7 @@ pub struct ConnectorAuthentication {
pub payme: Option<BodyKey>,
pub payone: Option<HeaderKey>,
pub paypal: Option<BodyKey>,
+ pub paystack: Option<HeaderKey>,
pub payu: Option<BodyKey>,
pub placetopay: Option<BodyKey>,
pub plaid: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 6766d7cb7e6..22d2ccf7d98 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -145,6 +145,7 @@ payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paystack.base_url = "https://api.paystack.co"
payu.base_url = "https://secure.snd.payu.com/"
placetopay.base_url = "https://test.placetopay.com/rest/gateway"
plaid.base_url = "https://sandbox.plaid.com"
@@ -245,6 +246,7 @@ cards = [
"payme",
"payone",
"paypal",
+ "paystack",
"payu",
"placetopay",
"plaid",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 021854ab3f1..f2c55f54adc 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
2025-02-17T11:23:37Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Paystack template PR.
Follow the steps outlined in the add_connector.md file. Execute the script provided in the markdown file, then run the following commands:
cargo clippy
cargo +nightly fmt --all
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
5e7e0d829a7deeed6b50af9633f6d2307b51c4bd
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7292
|
Bug: South African EFT Payment Method Integration via Paystack
### Feature Description
This issue tracks the implementation of EFT (Electronic Funds Transfer) as a payment method in Hyperswitch system. The feature involves generating the necessary template code, integrating EFT as a supported payment method, and completing all required payment flows for Paystack connector.
Paystack's Documentation [Link](https://paystack.com/docs/api/)
Add new connector documentation [Link](https://github.com/juspay/hyperswitch/blob/main/add_connector_updated.md)
### Possible Implementation
- [x] #7314
- [x] #7313
- [x] #7315
- [x] #7316
- [x] #7317
|
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index 80330a97429..75f2f02c027 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -1,7 +1,6 @@
mod transformers;
use std::fmt::Debug;
-use common_utils::errors::ReportSwitchExt;
use error_stack::{ResultExt, IntoReport};
use crate::{
diff --git a/connector-template/transformers.rs b/connector-template/transformers.rs
index 985c68a99c0..7e3caf100e1 100644
--- a/connector-template/transformers.rs
+++ b/connector-template/transformers.rs
@@ -30,7 +30,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for {{project-name | downcase
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(),
+ complete: item.request.is_auto_capture()?,
};
Ok(Self {
amount: item.request.amount,
|
2023-04-18T16:43:29Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
## Description
<!-- Describe your changes in detail -->
When `add_connector.sh` is called to generate new connector files `mod.rs` had an unused declaration, removed it. At the time of development, if needed, one can import it directly instead of pre-bloating the stuff.
`Transformers.rs` straight away failed and threw an error addressing `mismatched types` as it is expecting `bool` while were providing `Result<bool, Error>`.
### Additional Changes
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
connector-template/mod.rs
connector-template/transformers.rs
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless its an obvious bug or documentation fix
that will have little conversation).
-->
With the changes made, unexpected errors and warnings at the time of generation of connector code is avoided and addressed.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
|
9c9c52f9af74ebc7e835a5750dd05967b39a0ade
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7294
|
Bug: [MASKING] add peek_mut function in PeekInterface
|
diff --git a/crates/masking/src/abs.rs b/crates/masking/src/abs.rs
index 6501f89c9db..8996db65f23 100644
--- a/crates/masking/src/abs.rs
+++ b/crates/masking/src/abs.rs
@@ -6,6 +6,9 @@ use crate::Secret;
pub trait PeekInterface<S> {
/// Only method providing access to the secret value.
fn peek(&self) -> &S;
+
+ /// Provide a mutable reference to the inner value.
+ fn peek_mut(&mut self) -> &mut S;
}
/// Interface that consumes a option secret and returns the value.
diff --git a/crates/masking/src/bytes.rs b/crates/masking/src/bytes.rs
index e828f8a78e0..07b8c289ad8 100644
--- a/crates/masking/src/bytes.rs
+++ b/crates/masking/src/bytes.rs
@@ -28,6 +28,10 @@ impl PeekInterface<BytesMut> for SecretBytesMut {
fn peek(&self) -> &BytesMut {
&self.0
}
+
+ fn peek_mut(&mut self) -> &mut BytesMut {
+ &mut self.0
+ }
}
impl fmt::Debug for SecretBytesMut {
diff --git a/crates/masking/src/secret.rs b/crates/masking/src/secret.rs
index 7f7c18094a0..ee65b1c015b 100644
--- a/crates/masking/src/secret.rs
+++ b/crates/masking/src/secret.rs
@@ -95,6 +95,10 @@ where
fn peek(&self) -> &SecretValue {
&self.inner_secret
}
+
+ fn peek_mut(&mut self) -> &mut SecretValue {
+ &mut self.inner_secret
+ }
}
impl<SecretValue, MaskingStrategy> From<SecretValue> for Secret<SecretValue, MaskingStrategy>
diff --git a/crates/masking/src/strong_secret.rs b/crates/masking/src/strong_secret.rs
index 300b5463d25..43d2c97dfb3 100644
--- a/crates/masking/src/strong_secret.rs
+++ b/crates/masking/src/strong_secret.rs
@@ -32,6 +32,10 @@ impl<Secret: ZeroizableSecret, MaskingStrategy> PeekInterface<Secret>
fn peek(&self) -> &Secret {
&self.inner_secret
}
+
+ fn peek_mut(&mut self) -> &mut Secret {
+ &mut self.inner_secret
+ }
}
impl<Secret: ZeroizableSecret, MaskingStrategy> From<Secret>
|
2025-02-17T09:29:37Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Enhancement
## Description
<!-- Describe your changes in detail -->
Add `peek_mut` function to PeekInterface to get mutable reference for the inner data.
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
To get the mutable reference for inner data in StrongSecret.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
** THIS CANNOT BE TESTED IN ENVIRONMENTS **
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
|
3607b30c26cc24341bf88f8ce9968e094fb7a60a
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7289
|
Bug: [BUG] Fix contract updation for Contract routing
### Feature Description
We need to update the contract once it is not found in the dynamic routing service.
### Possible Implementation
The updation happening in the post-update tracker does not work when the payment goes through a different connector.
Need to set the contract when fetch fails.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/external_services/src/grpc_client/dynamic_routing.rs b/crates/external_services/src/grpc_client/dynamic_routing.rs
index e34f721b30e..67069b9fe8b 100644
--- a/crates/external_services/src/grpc_client/dynamic_routing.rs
+++ b/crates/external_services/src/grpc_client/dynamic_routing.rs
@@ -32,9 +32,12 @@ pub enum DynamicRoutingError {
#[error("Error from Dynamic Routing Server while perfrming success_rate analysis : {0}")]
SuccessRateBasedRoutingFailure(String),
- /// Error from Dynamic Routing Server while performing contract based routing
+ /// Generic Error from Dynamic Routing Server while performing contract based routing
#[error("Error from Dynamic Routing Server while performing contract based routing: {0}")]
ContractBasedRoutingFailure(String),
+ /// Generic Error from Dynamic Routing Server while performing contract based routing
+ #[error("Contract not found in the dynamic routing service")]
+ ContractNotFound,
/// Error from Dynamic Routing Server while perfrming elimination
#[error("Error from Dynamic Routing Server while perfrming elimination : {0}")]
EliminationRateRoutingFailure(String),
diff --git a/crates/external_services/src/grpc_client/dynamic_routing/contract_routing_client.rs b/crates/external_services/src/grpc_client/dynamic_routing/contract_routing_client.rs
index b210d996bc0..ff16594ca6e 100644
--- a/crates/external_services/src/grpc_client/dynamic_routing/contract_routing_client.rs
+++ b/crates/external_services/src/grpc_client/dynamic_routing/contract_routing_client.rs
@@ -26,6 +26,8 @@ use crate::grpc_client::{self, GrpcHeaders};
pub mod contract_routing {
tonic::include_proto!("contract_routing");
}
+pub use tonic::Code;
+
use super::{Client, DynamicRoutingError, DynamicRoutingResult};
/// The trait ContractBasedDynamicRouting would have the functions required to support the calculation and updation window
#[async_trait::async_trait]
@@ -46,6 +48,7 @@ pub trait ContractBasedDynamicRouting: dyn_clone::DynClone + Send + Sync {
label_info: Vec<LabelInformation>,
params: String,
response: Vec<RoutableConnectorChoiceWithStatus>,
+ incr_count: u64,
headers: GrpcHeaders,
) -> DynamicRoutingResult<UpdateContractResponse>;
/// To invalidates the contract scores against the id
@@ -90,9 +93,10 @@ impl ContractBasedDynamicRouting for ContractScoreCalculatorClient<Client> {
.clone()
.fetch_contract_score(request)
.await
- .change_context(DynamicRoutingError::ContractBasedRoutingFailure(
- "Failed to fetch the contract score".to_string(),
- ))?
+ .map_err(|err| match err.code() {
+ Code::NotFound => DynamicRoutingError::ContractNotFound,
+ _ => DynamicRoutingError::ContractBasedRoutingFailure(err.to_string()),
+ })?
.into_inner();
logger::info!(dynamic_routing_response=?response);
@@ -106,13 +110,18 @@ impl ContractBasedDynamicRouting for ContractScoreCalculatorClient<Client> {
label_info: Vec<LabelInformation>,
params: String,
_response: Vec<RoutableConnectorChoiceWithStatus>,
+ incr_count: u64,
headers: GrpcHeaders,
) -> DynamicRoutingResult<UpdateContractResponse> {
- let labels_information = label_info
+ let mut labels_information = label_info
.into_iter()
.map(ProtoLabelInfo::foreign_from)
.collect::<Vec<_>>();
+ labels_information
+ .iter_mut()
+ .for_each(|info| info.current_count += incr_count);
+
let request = grpc_client::create_grpc_request(
UpdateContractRequest {
id,
@@ -183,10 +192,14 @@ impl ForeignTryFrom<ContractBasedRoutingConfigBody> for CalContractScoreConfig {
impl ForeignFrom<LabelInformation> for ProtoLabelInfo {
fn foreign_from(config: LabelInformation) -> Self {
Self {
- label: config.label,
+ label: format!(
+ "{}:{}",
+ config.label.clone(),
+ config.mca_id.get_string_repr()
+ ),
target_count: config.target_count,
target_time: config.target_time,
- current_count: 1,
+ current_count: u64::default(),
}
}
}
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index d06ffea581f..215f262ea8b 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -400,8 +400,10 @@ pub enum RoutingError {
ContractBasedRoutingConfigError,
#[error("Params not found in contract based routing config")]
ContractBasedRoutingParamsNotFoundError,
- #[error("Unable to calculate contract score from dynamic routing service")]
- ContractScoreCalculationError,
+ #[error("Unable to calculate contract score from dynamic routing service: '{err}'")]
+ ContractScoreCalculationError { err: String },
+ #[error("Unable to update contract score on dynamic routing service")]
+ ContractScoreUpdationError,
#[error("contract routing client from dynamic routing gRPC service not initialized")]
ContractRoutingClientInitializationError,
#[error("Invalid contract based connector label received from dynamic routing service: '{0}'")]
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index cf5cd35fb98..e78861d4327 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -26,8 +26,9 @@ use euclid::{
};
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use external_services::grpc_client::dynamic_routing::{
- contract_routing_client::{CalContractScoreResponse, ContractBasedDynamicRouting},
+ contract_routing_client::ContractBasedDynamicRouting,
success_rate_client::{CalSuccessRateResponse, SuccessBasedDynamicRouting},
+ DynamicRoutingError,
};
use hyperswitch_domain_models::address::Address;
use kgraph_utils::{
@@ -1599,19 +1600,57 @@ pub async fn perform_contract_based_routing(
.change_context(errors::RoutingError::ContractBasedRoutingConfigError)
.attach_printable("unable to fetch contract based dynamic routing configs")?;
- let contract_based_connectors: CalContractScoreResponse = client
+ let contract_based_connectors_result = client
.calculate_contract_score(
profile_id.get_string_repr().into(),
- contract_based_routing_configs,
+ contract_based_routing_configs.clone(),
"".to_string(),
routable_connectors,
state.get_grpc_headers(),
)
.await
- .change_context(errors::RoutingError::ContractScoreCalculationError)
.attach_printable(
"unable to calculate/fetch contract score from dynamic routing service",
- )?;
+ );
+
+ let contract_based_connectors = match contract_based_connectors_result {
+ Ok(resp) => resp,
+ Err(err) => match err.current_context() {
+ DynamicRoutingError::ContractNotFound => {
+ let label_info = contract_based_routing_configs
+ .label_info
+ .ok_or(errors::RoutingError::ContractBasedRoutingConfigError)
+ .attach_printable(
+ "Label information not found in contract routing configs",
+ )?;
+
+ client
+ .update_contracts(
+ profile_id.get_string_repr().into(),
+ label_info,
+ "".to_string(),
+ vec![],
+ u64::default(),
+ state.get_grpc_headers(),
+ )
+ .await
+ .change_context(errors::RoutingError::ContractScoreUpdationError)
+ .attach_printable(
+ "unable to update contract based routing window in dynamic routing service",
+ )?;
+ return Err((errors::RoutingError::ContractScoreCalculationError {
+ err: err.to_string(),
+ })
+ .into());
+ }
+ _ => {
+ return Err((errors::RoutingError::ContractScoreCalculationError {
+ err: err.to_string(),
+ })
+ .into())
+ }
+ },
+ };
let mut connectors = Vec::with_capacity(contract_based_connectors.labels_with_score.len());
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index b8a7ee5dc1c..17edc50a30d 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -1036,11 +1036,7 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing(
);
let request_label_info = routing_types::LabelInformation {
- label: format!(
- "{}:{}",
- final_label_info.label.clone(),
- final_label_info.mca_id.get_string_repr()
- ),
+ label: final_label_info.label.clone(),
target_count: final_label_info.target_count,
target_time: final_label_info.target_time,
mca_id: final_label_info.mca_id.to_owned(),
@@ -1056,6 +1052,7 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing(
vec![request_label_info],
"".to_string(),
vec![],
+ 1,
state.get_grpc_headers(),
)
.await
|
2025-02-14T15:17:21Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Fixed the contract updation when contract is not set in dynamo. If contract is not set, we'll set in the same flow.
This fixes an issue.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Same as https://github.com/juspay/hyperswitch/pull/6761
New error log -

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
0688972814cf03edbff4bf125a59c338a7e49593
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7268
|
Bug: [BUG] NMI cypress failing
### Bug Description
Cypress test for NMi failing due to this `[PR](https://github.com/juspay/hyperswitch/pull/7200)`
### Expected Behavior
Cypress test should run perfectly for NMI
### Actual Behavior
Cypress test for NMi failing due to this `[PR](https://github.com/juspay/hyperswitch/pull/7200)`
### Steps To Reproduce
1. Create a `nmi_creds.json` file by giving NMI creds.
2. Run the cypress test
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution: Mac
2. Rust version (output of `rustc --version`): `rustc 1.83.0`
3. App version (output of `cargo r --features vergen -- --version`): `router 2025.02.11.0-19-g191008e-191008e-2025-02-14T08:17:49.000000000Z`
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
2025-02-14T08:20:34Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Fixes this issue - github.com/juspay/hyperswitch/issues/7268
## Description
<!-- Describe your changes in detail -->
NMI cypress were failing because of this [PR](https://github.com/juspay/hyperswitch/pull/7200). This PR resolves the cypress issue
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Cypress Test
<img width="767" alt="Screenshot 2025-02-14 at 13 45 56" src="https://github.com/user-attachments/assets/58733baf-303d-45a0-8eb9-c9d93cf0335d" />
<img width="795" alt="Screenshot 2025-02-14 at 15 56 41" src="https://github.com/user-attachments/assets/6406627d-a05d-4c1b-bfb1-c7bf6454b4ad" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3916ba6e3d4707b3a1f28439a314e6ea098597f2
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7279
|
Bug: [BUG] Analytics giving 5xx on forex crate returning no data
### Bug Description
Forex return error because there is no data in redis which is present for the currency exchange rate
### Expected Behavior
Forex create should always return data when queried for exchange rates
### Actual Behavior
Analytics API gives 5xx when forex return error because there is no data in redis which is present for the currency exchange rate
### Steps To Reproduce
On first API call for the forex crate, you get error because there is no redis key set for the service to return data.
### Context For The Bug
_No response_
### Environment
All environments
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None
|
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index 0fce7048e69..d6872bcf06c 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -229,3 +229,6 @@ pub(crate) const PROTOCOL: &str = "ECv2";
/// Sender ID for Google Pay Decryption
pub(crate) const SENDER_ID: &[u8] = b"Google";
+
+/// Default value for the number of attempts to retry fetching forex rates
+pub const DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS: u64 = 3;
diff --git a/crates/router/src/core/currency.rs b/crates/router/src/core/currency.rs
index bc63dc878cc..43b63cd6e63 100644
--- a/crates/router/src/core/currency.rs
+++ b/crates/router/src/core/currency.rs
@@ -2,11 +2,13 @@ use analytics::errors::AnalyticsError;
use common_utils::errors::CustomResult;
use currency_conversion::types::ExchangeRates;
use error_stack::ResultExt;
+use router_env::logger;
use crate::{
+ consts::DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS,
core::errors::ApiErrorResponse,
services::ApplicationResponse,
- utils::currency::{self, convert_currency, get_forex_rates},
+ utils::currency::{self, convert_currency, get_forex_rates, ForexError as ForexCacheError},
SessionState,
};
@@ -48,9 +50,45 @@ pub async fn get_forex_exchange_rates(
state: SessionState,
) -> CustomResult<ExchangeRates, AnalyticsError> {
let forex_api = state.conf.forex_api.get_inner();
- let rates = get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds)
- .await
- .change_context(AnalyticsError::ForexFetchFailed)?;
+ let mut attempt = 1;
+
+ logger::info!("Starting forex exchange rates fetch");
+ loop {
+ logger::info!("Attempting to fetch forex rates - Attempt {attempt} of {DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS}");
+
+ match get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds).await {
+ Ok(rates) => {
+ logger::info!("Successfully fetched forex rates");
+ return Ok((*rates.data).clone());
+ }
+ Err(error) => {
+ let is_retryable = matches!(
+ error.current_context(),
+ ForexCacheError::CouldNotAcquireLock
+ | ForexCacheError::EntryNotFound
+ | ForexCacheError::ForexDataUnavailable
+ | ForexCacheError::LocalReadError
+ | ForexCacheError::LocalWriteError
+ | ForexCacheError::RedisConnectionError
+ | ForexCacheError::RedisLockReleaseFailed
+ | ForexCacheError::RedisWriteError
+ | ForexCacheError::WriteLockNotAcquired
+ );
+
+ if !is_retryable {
+ return Err(error.change_context(AnalyticsError::ForexFetchFailed));
+ }
- Ok((*rates.data).clone())
+ if attempt >= DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS {
+ logger::error!("Failed to fetch forex rates after {DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS} attempts");
+ return Err(error.change_context(AnalyticsError::ForexFetchFailed));
+ }
+ logger::warn!(
+ "Forex rates fetch failed with retryable error, retrying in {attempt} seconds"
+ );
+ tokio::time::sleep(std::time::Duration::from_secs(attempt * 2)).await;
+ attempt += 1;
+ }
+ }
+ }
}
|
2025-02-17T09:09:50Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Implementing a retry logic for forex crate call with linear time increment in retry counter
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
`crates/router/src/core/currency.rs`
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
This was required as the Analytics API was returning 5xx when forex was returning error which would eventually resolve on retry
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
As soon as you hit the API of analytics
`curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'authorization: Bearer token \
--data '[
{
"timeRange": {
"startTime": "2024-09-11T18:30:00Z",
"endTime": "2024-09-25T09:22:00Z"
},
"source": "BATCH",
"metrics": [
"payment_processed_amount"
],
"timeSeries": {
"granularity": "G_ONEDAY"
},
"delta": true
}
]'`
There is no change is response but how the evaluation of the request to give out response would change
Added logs for the same are added below

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
10371af561ecc7536bb1db191af90a3cac2ab515
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7283
|
Bug: feat(connector): add template code for recurly
add a template code for recurly connector
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 9e54c7e8c88..453e1161284 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -255,6 +255,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index c8eb14c9853..a6a7a09e16e 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -100,6 +100,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 90ca4ae143d..e8f2c30c696 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -104,6 +104,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://api.juspay.in"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://wh.riskified.com/api/"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 29e60131149..302ff6f3a0c 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -104,6 +104,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/development.toml b/config/development.toml
index 7619f992aab..b81080740fd 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -327,6 +327,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 58cf75fb8d2..83aa883a164 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -187,6 +187,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index cadca5fad02..65fa444175e 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -116,6 +116,7 @@ pub enum RoutableConnectors {
Prophetpay,
Rapyd,
Razorpay,
+ // Recurly,
// Redsys,
Riskified,
Shift4,
@@ -259,6 +260,7 @@ pub enum Connector {
Prophetpay,
Rapyd,
Razorpay,
+ //Recurly,
// Redsys,
Shift4,
Square,
@@ -408,6 +410,7 @@ impl Connector {
| Self::Powertranz
| Self::Prophetpay
| Self::Rapyd
+ // | Self::Recurly
// | Self::Redsys
| Self::Shift4
| Self::Square
@@ -543,6 +546,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Prophetpay => Self::Prophetpay,
RoutableConnectors::Rapyd => Self::Rapyd,
RoutableConnectors::Razorpay => Self::Razorpay,
+ // RoutableConnectors::Recurly => Self::Recurly,
RoutableConnectors::Riskified => Self::Riskified,
RoutableConnectors::Shift4 => Self::Shift4,
RoutableConnectors::Signifyd => Self::Signifyd,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 6fa0d9e103e..495228de0c9 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -59,6 +59,7 @@ pub mod powertranz;
pub mod prophetpay;
pub mod rapyd;
pub mod razorpay;
+pub mod recurly;
pub mod redsys;
pub mod shift4;
pub mod square;
@@ -92,8 +93,8 @@ pub use self::{
noon::Noon, novalnet::Novalnet, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, paybox::Paybox,
payeezy::Payeezy, payme::Payme, paystack::Paystack, payu::Payu, placetopay::Placetopay,
powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay,
- redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, stripebilling::Stripebilling,
- taxjar::Taxjar, thunes::Thunes, trustpay::Trustpay, tsys::Tsys,
+ recurly::Recurly, redsys::Redsys, shift4::Shift4, square::Square, stax::Stax,
+ stripebilling::Stripebilling, taxjar::Taxjar, thunes::Thunes, trustpay::Trustpay, tsys::Tsys,
unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen,
zsl::Zsl,
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
new file mode 100644
index 00000000000..c16810a6ab7
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -0,0 +1,568 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as recurly;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Recurly {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Recurly {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Recurly {}
+impl api::PaymentSession for Recurly {}
+impl api::ConnectorAccessToken for Recurly {}
+impl api::MandateSetup for Recurly {}
+impl api::PaymentAuthorize for Recurly {}
+impl api::PaymentSync for Recurly {}
+impl api::PaymentCapture for Recurly {}
+impl api::PaymentVoid for Recurly {}
+impl api::Refund for Recurly {}
+impl api::RefundExecute for Recurly {}
+impl api::RefundSync for Recurly {}
+impl api::PaymentToken for Recurly {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Recurly
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Recurly
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Recurly {
+ fn id(&self) -> &'static str {
+ "recurly"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ // TODO! Check connector documentation, on which unit they are processing the currency.
+ // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
+ // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.recurly.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = recurly::RecurlyAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: recurly::RecurlyErrorResponse = res
+ .response
+ .parse_struct("RecurlyErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Recurly {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Recurly {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Recurly {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Recurly {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = recurly::RecurlyRouterData::from((amount, req));
+ let connector_req = recurly::RecurlyPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("Recurly PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("recurly PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("Recurly PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Recurly {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = recurly::RecurlyRouterData::from((refund_amount, req));
+ let connector_req = recurly::RecurlyRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: recurly::RefundResponse = res
+ .response
+ .parse_struct("recurly RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: recurly::RefundResponse = res
+ .response
+ .parse_struct("recurly RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Recurly {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl ConnectorSpecifications for Recurly {}
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
new file mode 100644
index 00000000000..bc62985edb3
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
@@ -0,0 +1,228 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ types::{RefundsResponseRouterData, ResponseRouterData},
+ utils::PaymentsAuthorizeRequestData,
+};
+
+//TODO: Fill the struct with respective fields
+pub struct RecurlyRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for RecurlyRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct RecurlyPaymentsRequest {
+ amount: StringMinorUnit,
+ card: RecurlyCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct RecurlyCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&RecurlyRouterData<&PaymentsAuthorizeRouterData>> for RecurlyPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &RecurlyRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = RecurlyCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct RecurlyAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for RecurlyAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum RecurlyPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RecurlyPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: RecurlyPaymentStatus) -> Self {
+ match item {
+ RecurlyPaymentStatus::Succeeded => Self::Charged,
+ RecurlyPaymentStatus::Failed => Self::Failure,
+ RecurlyPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct RecurlyPaymentsResponse {
+ status: RecurlyPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, RecurlyPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, RecurlyPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct RecurlyRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&RecurlyRouterData<&RefundsRouterData<F>>> for RecurlyRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &RecurlyRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct RecurlyErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index f64f624187a..ad9e456c948 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -156,6 +156,7 @@ default_imp_for_authorize_session_token!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -250,6 +251,7 @@ default_imp_for_calculate_tax!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -319,6 +321,7 @@ default_imp_for_session_update!(
connectors::Klarna,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -415,6 +418,7 @@ default_imp_for_post_session_tokens!(
connectors::Klarna,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -520,6 +524,7 @@ default_imp_for_complete_authorize!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Stax,
connectors::Square,
@@ -613,6 +618,7 @@ default_imp_for_incremental_authorization!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -707,6 +713,7 @@ default_imp_for_create_customer!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Square,
@@ -789,6 +796,7 @@ default_imp_for_connector_redirect_response!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -875,6 +883,7 @@ default_imp_for_pre_processing_steps!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Stax,
connectors::Square,
@@ -968,6 +977,7 @@ default_imp_for_post_processing_steps!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1064,6 +1074,7 @@ default_imp_for_approve!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1160,6 +1171,7 @@ default_imp_for_reject!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1256,6 +1268,7 @@ default_imp_for_webhook_source_verification!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1352,6 +1365,7 @@ default_imp_for_accept_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1447,6 +1461,7 @@ default_imp_for_submit_evidence!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1542,6 +1557,7 @@ default_imp_for_defend_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1646,6 +1662,7 @@ default_imp_for_file_upload!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1733,6 +1750,7 @@ default_imp_for_payouts!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Square,
@@ -1829,6 +1847,7 @@ default_imp_for_payouts_create!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1926,6 +1945,7 @@ default_imp_for_payouts_retrieve!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2023,6 +2043,7 @@ default_imp_for_payouts_eligibility!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2119,6 +2140,7 @@ default_imp_for_payouts_fulfill!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2216,6 +2238,7 @@ default_imp_for_payouts_cancel!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2313,6 +2336,7 @@ default_imp_for_payouts_quote!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2410,6 +2434,7 @@ default_imp_for_payouts_recipient!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2507,6 +2532,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2605,6 +2631,7 @@ default_imp_for_frm_sale!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2703,6 +2730,7 @@ default_imp_for_frm_checkout!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2801,6 +2829,7 @@ default_imp_for_frm_transaction!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2899,6 +2928,7 @@ default_imp_for_frm_fulfillment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2997,6 +3027,7 @@ default_imp_for_frm_record_return!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3090,6 +3121,7 @@ default_imp_for_revoking_mandates!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3186,6 +3218,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3280,6 +3313,7 @@ default_imp_for_uas_post_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3374,6 +3408,7 @@ default_imp_for_uas_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3469,6 +3504,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index f333800480b..972a26adf36 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -265,6 +265,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -362,6 +363,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -454,6 +456,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -551,6 +554,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -647,6 +651,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -744,6 +749,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -851,6 +857,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -950,6 +957,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1049,6 +1057,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1148,6 +1157,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1247,6 +1257,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1346,6 +1357,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1445,6 +1457,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1544,6 +1557,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1643,6 +1657,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1740,6 +1755,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1839,6 +1855,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1938,6 +1955,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2037,6 +2055,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2136,6 +2155,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2235,6 +2255,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2331,6 +2352,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 5b46184c363..e3177856925 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -81,6 +81,7 @@ pub struct Connectors {
pub prophetpay: ConnectorParams,
pub rapyd: ConnectorParams,
pub razorpay: ConnectorParamsWithKeys,
+ pub recurly: ConnectorParams,
pub redsys: ConnectorParams,
pub riskified: ConnectorParams,
pub shift4: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 9f99b4c61a3..a89ae69451c 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -38,12 +38,12 @@ pub use hyperswitch_connectors::connectors::{
opennode::Opennode, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payme, payme::Payme,
paystack, paystack::Paystack, payu, payu::Payu, placetopay, placetopay::Placetopay, powertranz,
powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay,
- razorpay::Razorpay, redsys, redsys::Redsys, shift4, shift4::Shift4, square, square::Square,
- stax, stax::Stax, stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, thunes,
- thunes::Thunes, trustpay, trustpay::Trustpay, tsys, tsys::Tsys, unified_authentication_service,
- unified_authentication_service::UnifiedAuthenticationService, volt, volt::Volt, wellsfargo,
- wellsfargo::Wellsfargo, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit,
- xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
+ razorpay::Razorpay, recurly::Recurly, redsys, redsys::Redsys, shift4, shift4::Shift4, square,
+ square::Square, stax, stax::Stax, stripebilling, stripebilling::Stripebilling, taxjar,
+ taxjar::Taxjar, thunes, thunes::Thunes, trustpay, trustpay::Trustpay, tsys, tsys::Tsys,
+ unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService,
+ volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, worldline, worldline::Worldline,
+ worldpay, worldpay::Worldpay, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
};
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index 4f963755b1b..8d38b84a001 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -985,6 +985,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Powertranz,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
@@ -1390,6 +1391,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Powertranz,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
@@ -1729,6 +1731,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 02a4fe2386c..7e5cdfdaa37 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -439,6 +439,7 @@ default_imp_for_connector_request_id!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Shift4,
@@ -1289,6 +1290,7 @@ default_imp_for_fraud_check!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Shift4,
connector::Square,
@@ -1778,6 +1780,7 @@ default_imp_for_connector_authentication!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Shift4,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index a32e0457dfa..c4c2371abf8 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -510,6 +510,7 @@ impl ConnectorData {
enums::Connector::Rapyd => {
Ok(ConnectorEnum::Old(Box::new(connector::Rapyd::new())))
}
+ // enums::Connector::Recurly => Ok(ConnectorEnum::Old(Box::new(connector::Recurly))),
// enums::Connector::Redsys => Ok(ConnectorEnum::Old(Box::new(connector::Redsys))),
enums::Connector::Shift4 => {
Ok(ConnectorEnum::Old(Box::new(connector::Shift4::new())))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 514ddbbbb50..6ab4111f4b7 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -290,6 +290,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Prophetpay => Self::Prophetpay,
api_enums::Connector::Rapyd => Self::Rapyd,
api_enums::Connector::Razorpay => Self::Razorpay,
+ // api_enums::Connector::Recurly => Self::Recurly,
// api_enums::Connector::Redsys => Self::Redsys,
api_enums::Connector::Shift4 => Self::Shift4,
api_enums::Connector::Signifyd => {
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 09718d56181..040b2dd6317 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -78,6 +78,7 @@ mod powertranz;
mod prophetpay;
mod rapyd;
mod razorpay;
+mod recurly;
mod redsys;
mod shift4;
mod square;
diff --git a/crates/router/tests/connectors/recurly.rs b/crates/router/tests/connectors/recurly.rs
new file mode 100644
index 00000000000..a38ed49d415
--- /dev/null
+++ b/crates/router/tests/connectors/recurly.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct RecurlyTest;
+impl ConnectorActions for RecurlyTest {}
+impl utils::Connector for RecurlyTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Recurly;
+ utils::construct_connector_data_old(
+ Box::new(Recurly::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .recurly
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "Recurly".to_string()
+ }
+}
+
+static CONNECTOR: RecurlyTest = RecurlyTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index d30a5008887..0650e5e6a4d 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -320,4 +320,7 @@ api_key= "API Key"
api_key= "API Key"
[paystack]
-api_key = "API Key"
\ No newline at end of file
+api_key = "API Key"
+
+[recurly]
+api_key= "API Key"
\ No newline at end of file
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index bb40cc51eaa..f19d5d22e80 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -82,6 +82,7 @@ pub struct ConnectorAuthentication {
pub prophetpay: Option<HeaderKey>,
pub rapyd: Option<BodyKey>,
pub razorpay: Option<BodyKey>,
+ pub recurly: Option<HeaderKey>,
pub redsys: Option<HeaderKey>,
pub shift4: Option<HeaderKey>,
pub square: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 526899b7fff..6b1afeab21e 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -153,6 +153,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 046042bfa73..022e54a943c 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
2025-02-17T11:09:07Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
connector integration template code for recurly.
Issue: This PR closes the issue #7283
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
No testing required since its a template code
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
8e922d30da367bc0baf3cba64a86c385764fff39
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7265
|
Bug: Add trait based implementation for relay
Refactor the relay flow to add trait based implication for it
|
diff --git a/crates/api_models/src/relay.rs b/crates/api_models/src/relay.rs
index f54e1471632..aded73b4345 100644
--- a/crates/api_models/src/relay.rs
+++ b/crates/api_models/src/relay.rs
@@ -24,11 +24,11 @@ pub struct RelayRequest {
#[serde(rename_all = "snake_case")]
pub enum RelayData {
/// The data that is associated with a refund relay request
- Refund(RelayRefundRequest),
+ Refund(RelayRefundRequestData),
}
#[derive(Debug, ToSchema, Clone, Deserialize, Serialize)]
-pub struct RelayRefundRequest {
+pub struct RelayRefundRequestData {
/// The amount that is being refunded
#[schema(value_type = i64 , example = 6540)]
pub amount: MinorUnit,
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
index 9208bb486f7..1e602c02824 100644
--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
@@ -87,6 +87,10 @@ impl MerchantConnectorAccount {
pub fn get_connector_test_mode(&self) -> Option<bool> {
self.test_mode
}
+
+ pub fn get_connector_name_as_string(&self) -> String {
+ self.connector_name.clone()
+ }
}
#[cfg(feature = "v2")]
@@ -151,6 +155,10 @@ impl MerchantConnectorAccount {
pub fn get_connector_test_mode(&self) -> Option<bool> {
todo!()
}
+
+ pub fn get_connector_name_as_string(&self) -> String {
+ self.connector_name.clone().to_string()
+ }
}
#[cfg(feature = "v2")]
diff --git a/crates/hyperswitch_domain_models/src/relay.rs b/crates/hyperswitch_domain_models/src/relay.rs
index 8af58265c39..d4829c7599e 100644
--- a/crates/hyperswitch_domain_models/src/relay.rs
+++ b/crates/hyperswitch_domain_models/src/relay.rs
@@ -74,6 +74,16 @@ impl From<api_models::relay::RelayData> for RelayData {
}
}
+impl From<api_models::relay::RelayRefundRequestData> for RelayRefundData {
+ fn from(relay: api_models::relay::RelayRefundRequestData) -> Self {
+ Self {
+ amount: relay.amount,
+ currency: relay.currency,
+ reason: relay.reason,
+ }
+ }
+}
+
impl RelayUpdate {
pub fn from(
response: Result<router_response_types::RefundsResponseData, ErrorResponse>,
@@ -92,6 +102,20 @@ impl RelayUpdate {
}
}
+impl From<RelayData> for api_models::relay::RelayData {
+ fn from(relay: RelayData) -> Self {
+ match relay {
+ RelayData::Refund(relay_refund_request) => {
+ Self::Refund(api_models::relay::RelayRefundRequestData {
+ amount: relay_refund_request.amount,
+ currency: relay_refund_request.currency,
+ reason: relay_refund_request.reason,
+ })
+ }
+ }
+ }
+}
+
impl From<Relay> for api_models::relay::RelayResponse {
fn from(value: Relay) -> Self {
let error = value
@@ -106,7 +130,7 @@ impl From<Relay> for api_models::relay::RelayResponse {
let data = value.request_data.map(|relay_data| match relay_data {
RelayData::Refund(relay_refund_request) => {
- api_models::relay::RelayData::Refund(api_models::relay::RelayRefundRequest {
+ api_models::relay::RelayData::Refund(api_models::relay::RelayRefundRequestData {
amount: relay_refund_request.amount,
currency: relay_refund_request.currency,
reason: relay_refund_request.reason,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index eb5edb08fab..06931f693d7 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -537,7 +537,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::relay::RelayResponse,
api_models::enums::RelayType,
api_models::relay::RelayData,
- api_models::relay::RelayRefundRequest,
+ api_models::relay::RelayRefundRequestData,
api_models::enums::RelayStatus,
api_models::relay::RelayError,
api_models::payments::AmountFilter,
diff --git a/crates/router/src/core/relay.rs b/crates/router/src/core/relay.rs
index 9492816452a..474c371b7cc 100644
--- a/crates/router/src/core/relay.rs
+++ b/crates/router/src/core/relay.rs
@@ -1,7 +1,14 @@
-use api_models::relay as relay_models;
+use std::marker::PhantomData;
+
+use api_models::relay as relay_api_models;
+use async_trait::async_trait;
use common_enums::RelayStatus;
-use common_utils::{self, id_type};
+use common_utils::{
+ self, fp_utils,
+ id_type::{self, GenerateId},
+};
use error_stack::ResultExt;
+use hyperswitch_domain_models::relay;
use super::errors::{self, ConnectorErrorExt, RouterResponse, RouterResult, StorageErrorExt};
use crate::{
@@ -17,13 +24,208 @@ use crate::{
pub mod utils;
-pub async fn relay(
+pub trait Validate {
+ type Error: error_stack::Context;
+ fn validate(&self) -> Result<(), Self::Error>;
+}
+
+impl Validate for relay_api_models::RelayRefundRequestData {
+ type Error = errors::ApiErrorResponse;
+ fn validate(&self) -> Result<(), Self::Error> {
+ fp_utils::when(self.amount.get_amount_as_i64() <= 0, || {
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Amount should be greater than 0".to_string(),
+ })
+ })?;
+ Ok(())
+ }
+}
+
+#[async_trait]
+pub trait RelayInterface {
+ type Request: Validate;
+ fn validate_relay_request(req: &Self::Request) -> RouterResult<()> {
+ req.validate()
+ .change_context(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Invalid relay request".to_string(),
+ })
+ }
+
+ fn get_domain_models(
+ relay_request: RelayRequestInner<Self>,
+ merchant_id: &id_type::MerchantId,
+ profile_id: &id_type::ProfileId,
+ ) -> relay::Relay;
+
+ async fn process_relay(
+ state: &SessionState,
+ merchant_account: domain::MerchantAccount,
+ connector_account: domain::MerchantConnectorAccount,
+ relay_record: &relay::Relay,
+ ) -> RouterResult<relay::RelayUpdate>;
+
+ fn generate_response(value: relay::Relay) -> RouterResult<api_models::relay::RelayResponse>;
+}
+
+pub struct RelayRequestInner<T: RelayInterface + ?Sized> {
+ pub connector_resource_id: String,
+ pub connector_id: id_type::MerchantConnectorAccountId,
+ pub relay_type: PhantomData<T>,
+ pub data: T::Request,
+}
+
+impl RelayRequestInner<RelayRefund> {
+ pub fn from_relay_request(relay_request: relay_api_models::RelayRequest) -> RouterResult<Self> {
+ match relay_request.data {
+ Some(relay_api_models::RelayData::Refund(ref_data)) => Ok(Self {
+ connector_resource_id: relay_request.connector_resource_id,
+ connector_id: relay_request.connector_id,
+ relay_type: PhantomData,
+ data: ref_data,
+ }),
+ None => Err(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Relay data is required for relay type refund".to_string(),
+ })?,
+ }
+ }
+}
+
+pub struct RelayRefund;
+
+#[async_trait]
+impl RelayInterface for RelayRefund {
+ type Request = relay_api_models::RelayRefundRequestData;
+
+ fn get_domain_models(
+ relay_request: RelayRequestInner<Self>,
+ merchant_id: &id_type::MerchantId,
+ profile_id: &id_type::ProfileId,
+ ) -> relay::Relay {
+ let relay_id = id_type::RelayId::generate();
+ let relay_refund: relay::RelayRefundData = relay_request.data.into();
+ relay::Relay {
+ id: relay_id.clone(),
+ connector_resource_id: relay_request.connector_resource_id.clone(),
+ connector_id: relay_request.connector_id.clone(),
+ profile_id: profile_id.clone(),
+ merchant_id: merchant_id.clone(),
+ relay_type: common_enums::RelayType::Refund,
+ request_data: Some(relay::RelayData::Refund(relay_refund)),
+ status: RelayStatus::Created,
+ connector_reference_id: None,
+ error_code: None,
+ error_message: None,
+ created_at: common_utils::date_time::now(),
+ modified_at: common_utils::date_time::now(),
+ response_data: None,
+ }
+ }
+
+ async fn process_relay(
+ state: &SessionState,
+ merchant_account: domain::MerchantAccount,
+ connector_account: domain::MerchantConnectorAccount,
+ relay_record: &relay::Relay,
+ ) -> RouterResult<relay::RelayUpdate> {
+ let connector_id = &relay_record.connector_id;
+
+ let merchant_id = merchant_account.get_id();
+
+ let connector_name = &connector_account.get_connector_name_as_string();
+
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ &state.conf.connectors,
+ connector_name,
+ api::GetToken::Connector,
+ Some(connector_id.clone()),
+ )?;
+
+ let connector_integration: services::BoxedRefundConnectorIntegrationInterface<
+ api::Execute,
+ hyperswitch_domain_models::router_request_types::RefundsData,
+ hyperswitch_domain_models::router_response_types::RefundsResponseData,
+ > = connector_data.connector.get_connector_integration();
+
+ let router_data = utils::construct_relay_refund_router_data(
+ state,
+ merchant_id,
+ &connector_account,
+ relay_record,
+ )
+ .await?;
+
+ let router_data_res = services::execute_connector_processing_step(
+ state,
+ connector_integration,
+ &router_data,
+ payments::CallConnectorAction::Trigger,
+ None,
+ )
+ .await
+ .to_refund_failed_response()?;
+
+ let relay_update = relay::RelayUpdate::from(router_data_res.response);
+
+ Ok(relay_update)
+ }
+
+ fn generate_response(value: relay::Relay) -> RouterResult<api_models::relay::RelayResponse> {
+ let error = value
+ .error_code
+ .zip(value.error_message)
+ .map(
+ |(error_code, error_message)| api_models::relay::RelayError {
+ code: error_code,
+ message: error_message,
+ },
+ );
+
+ let data =
+ api_models::relay::RelayData::from(value.request_data.get_required_value("RelayData")?);
+
+ Ok(api_models::relay::RelayResponse {
+ id: value.id,
+ status: value.status,
+ error,
+ connector_resource_id: value.connector_resource_id,
+ connector_id: value.connector_id,
+ profile_id: value.profile_id,
+ relay_type: value.relay_type,
+ data: Some(data),
+ connector_reference_id: value.connector_reference_id,
+ })
+ }
+}
+
+pub async fn relay_flow_decider(
state: SessionState,
merchant_account: domain::MerchantAccount,
profile_id_optional: Option<id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
- req: relay_models::RelayRequest,
-) -> RouterResponse<relay_models::RelayResponse> {
+ request: relay_api_models::RelayRequest,
+) -> RouterResponse<relay_api_models::RelayResponse> {
+ let relay_flow_request = match request.relay_type {
+ common_enums::RelayType::Refund => {
+ RelayRequestInner::<RelayRefund>::from_relay_request(request)?
+ }
+ };
+ relay(
+ state,
+ merchant_account,
+ profile_id_optional,
+ key_store,
+ relay_flow_request,
+ )
+ .await
+}
+
+pub async fn relay<T: RelayInterface>(
+ state: SessionState,
+ merchant_account: domain::MerchantAccount,
+ profile_id_optional: Option<id_type::ProfileId>,
+ key_store: domain::MerchantKeyStore,
+ req: RelayRequestInner<T>,
+) -> RouterResponse<relay_api_models::RelayResponse> {
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
let merchant_id = merchant_account.get_id();
@@ -64,10 +266,9 @@ pub async fn relay(
id: connector_id.get_string_repr().to_string(),
})?;
- validate_relay_refund_request(&req).attach_printable("Invalid relay refund request")?;
+ T::validate_relay_request(&req.data)?;
- let relay_domain =
- hyperswitch_domain_models::relay::Relay::new(&req, merchant_id, profile.get_id());
+ let relay_domain = T::get_domain_models(req, merchant_id, profile.get_id());
let relay_record = db
.insert_relay(key_manager_state, &key_store, relay_domain)
@@ -75,117 +276,31 @@ pub async fn relay(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to insert a relay record in db")?;
- let relay_response = match req.relay_type {
- common_enums::RelayType::Refund => {
- Box::pin(relay_refund(
- &state,
- merchant_account,
- connector_account,
- &relay_record,
- ))
- .await?
- }
- };
+ let relay_response =
+ T::process_relay(&state, merchant_account, connector_account, &relay_record)
+ .await
+ .attach_printable("Failed to process relay")?;
let relay_update_record = db
.update_relay(key_manager_state, &key_store, relay_record, relay_response)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)?;
- let response = relay_models::RelayResponse::from(relay_update_record);
+ let response = T::generate_response(relay_update_record)
+ .attach_printable("Failed to generate relay response")?;
Ok(hyperswitch_domain_models::api::ApplicationResponse::Json(
response,
))
}
-pub async fn relay_refund(
- state: &SessionState,
- merchant_account: domain::MerchantAccount,
- connector_account: domain::MerchantConnectorAccount,
- relay_record: &hyperswitch_domain_models::relay::Relay,
-) -> RouterResult<hyperswitch_domain_models::relay::RelayUpdate> {
- let connector_id = &relay_record.connector_id;
-
- let merchant_id = merchant_account.get_id();
-
- #[cfg(feature = "v1")]
- let connector_name = &connector_account.connector_name;
-
- #[cfg(feature = "v2")]
- let connector_name = &connector_account.connector_name.to_string();
-
- let connector_data = api::ConnectorData::get_connector_by_name(
- &state.conf.connectors,
- connector_name,
- api::GetToken::Connector,
- Some(connector_id.clone()),
- )?;
-
- let connector_integration: services::BoxedRefundConnectorIntegrationInterface<
- api::Execute,
- hyperswitch_domain_models::router_request_types::RefundsData,
- hyperswitch_domain_models::router_response_types::RefundsResponseData,
- > = connector_data.connector.get_connector_integration();
-
- let router_data = utils::construct_relay_refund_router_data(
- state,
- merchant_id,
- &connector_account,
- relay_record,
- )
- .await?;
-
- let router_data_res = services::execute_connector_processing_step(
- state,
- connector_integration,
- &router_data,
- payments::CallConnectorAction::Trigger,
- None,
- )
- .await
- .to_refund_failed_response()?;
-
- let relay_response =
- hyperswitch_domain_models::relay::RelayUpdate::from(router_data_res.response);
-
- Ok(relay_response)
-}
-
-// validate relay request
-pub fn validate_relay_refund_request(
- relay_request: &relay_models::RelayRequest,
-) -> RouterResult<()> {
- match (relay_request.relay_type, &relay_request.data) {
- (common_enums::RelayType::Refund, Some(relay_models::RelayData::Refund(ref_data))) => {
- validate_relay_refund_data(ref_data)
- }
- (common_enums::RelayType::Refund, None) => {
- Err(errors::ApiErrorResponse::PreconditionFailed {
- message: "Relay data is required for refund relay".to_string(),
- })?
- }
- }
-}
-
-pub fn validate_relay_refund_data(
- refund_data: &relay_models::RelayRefundRequest,
-) -> RouterResult<()> {
- if refund_data.amount.get_amount_as_i64() <= 0 {
- Err(errors::ApiErrorResponse::PreconditionFailed {
- message: "Amount should be greater than 0".to_string(),
- })?
- }
- Ok(())
-}
-
pub async fn relay_retrieve(
state: SessionState,
merchant_account: domain::MerchantAccount,
profile_id_optional: Option<id_type::ProfileId>,
key_store: domain::MerchantKeyStore,
- req: relay_models::RelayRetrieveRequest,
-) -> RouterResponse<relay_models::RelayResponse> {
+ req: relay_api_models::RelayRetrieveRequest,
+) -> RouterResponse<relay_api_models::RelayResponse> {
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
let merchant_id = merchant_account.get_id();
@@ -269,17 +384,14 @@ pub async fn relay_retrieve(
}
};
- let response = relay_models::RelayResponse::from(relay_response);
+ let response = relay_api_models::RelayResponse::from(relay_response);
Ok(hyperswitch_domain_models::api::ApplicationResponse::Json(
response,
))
}
-fn should_call_connector_for_relay_refund_status(
- relay: &hyperswitch_domain_models::relay::Relay,
- force_sync: bool,
-) -> bool {
+fn should_call_connector_for_relay_refund_status(relay: &relay::Relay, force_sync: bool) -> bool {
// This allows refund sync at connector level if force_sync is enabled, or
// check if the refund is in terminal state
!matches!(relay.status, RelayStatus::Failure | RelayStatus::Success) && force_sync
@@ -288,9 +400,9 @@ fn should_call_connector_for_relay_refund_status(
pub async fn sync_relay_refund_with_gateway(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
- relay_record: &hyperswitch_domain_models::relay::Relay,
+ relay_record: &relay::Relay,
connector_account: domain::MerchantConnectorAccount,
-) -> RouterResult<hyperswitch_domain_models::relay::RelayUpdate> {
+) -> RouterResult<relay::RelayUpdate> {
let connector_id = &relay_record.connector_id;
let merchant_id = merchant_account.get_id();
@@ -333,8 +445,7 @@ pub async fn sync_relay_refund_with_gateway(
.await
.to_refund_failed_response()?;
- let relay_response =
- hyperswitch_domain_models::relay::RelayUpdate::from(router_data_res.response);
+ let relay_response = relay::RelayUpdate::from(router_data_res.response);
Ok(relay_response)
}
diff --git a/crates/router/src/routes/relay.rs b/crates/router/src/routes/relay.rs
index cfc66253d50..dd079563a20 100644
--- a/crates/router/src/routes/relay.rs
+++ b/crates/router/src/routes/relay.rs
@@ -22,7 +22,7 @@ pub async fn relay(
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
- relay::relay(
+ relay::relay_flow_decider(
state,
auth.merchant_account,
#[cfg(feature = "v1")]
|
2025-02-13T11:05:23Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pr refactors the relay flow to add trait based implementation for it.
Changes made:-
1. `relay_flow_decider` decides the relay flow based on the relay types
2. Introduced `RelayInterface` trait that consists the methods required for different relay types
a. `validate_relay_request` validates the relay requests for different type of relay types. It also provides default
implementation, if a new relay type does not have specific type.
b. `get_domain_models` to convert the relay request form api models to domain models
c. `process_relay` that consists the core functionality for every relay type
d. `generate_response` relay type specific response
3. `Validate` trait provides the generic validation. This trait can be implemented for any type, that requires validation.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
3. `crates/router/src/configs`
4. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Make a relay payment
```
curl --location 'http://localhost:8080/relay' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_Zv50p4TBhOIRJFnynXL7' \
--header 'api-key: <api-key>' \
--data '{
"connector_id": "mca_5dVmrsd0IwgQAsu3uiUo",
"connector_resource_id": "pi_3Qs0CqEOqOywnAIx0QJ1vo67",
"data": {
"refund": {
"amount": 1,
"currency": "USD"
}
},
"type": "refund"
}'
```
```
{
"id": "relay_5nS1Mr5DHgWCkadiEVwY",
"status": "success",
"connector_resource_id": "pi_3Qs0CqEOqOywnAIx0QJ1vo67",
"error": null,
"connector_reference_id": "re_3Qs0CqEOqOywnAIx07ZIvgZ1",
"connector_id": "mca_5dVmrsd0IwgQAsu3uiUo",
"profile_id": "pro_Zv50p4TBhOIRJFnynXL7",
"type": "refund",
"data": {
"refund": {
"amount": 1,
"currency": "USD",
"reason": null
}
}
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
eea4d6ff8d93cee031670e147343861335884229
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7250
|
Bug: [BUG] zero amount mandates for wallets through Novalnet
### Bug Description
Zero amount mandates for wallets through Novalnet throws errors saying some required fields are missing. This is needed to be fixed in the connector integration.
### Expected Behavior
Zero amount mandates for wallets (GPay + PayPal + APay) should return a connector mandate ID which can be used for future MITs.
### Actual Behavior
Zero amount mandates for wallets throw an error saying some required fields are missing.
### Steps To Reproduce
1. Create a payment link (amount: 0, currency: EUR, do not send billing details)
2. Select GooglePay and complete the txn
3. Confirm call returns 400 saying billing.address is missing OR email is missing
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index ba00162281f..44f84bf475d 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -28,7 +28,7 @@ use strum::Display;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, AddressDetailsData, ApplePay, PaymentsAuthorizeRequestData,
+ self, AddressData, AddressDetailsData, ApplePay, PaymentsAuthorizeRequestData,
PaymentsCancelRequestData, PaymentsCaptureRequestData, PaymentsSetupMandateRequestData,
PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
},
@@ -1467,7 +1467,7 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
enums::AuthenticationType::NoThreeDs => None,
};
let test_mode = get_test_mode(item.test_mode);
- let req_address = item.get_billing_address()?.to_owned();
+ let req_address = item.get_optional_billing();
let billing = NovalnetPaymentsRequestBilling {
house_no: item.get_optional_billing_line1(),
@@ -1477,10 +1477,12 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
country_code: item.get_optional_billing_country(),
};
+ let email = item.get_billing_email().or(item.request.get_email())?;
+
let customer = NovalnetPaymentsRequestCustomer {
- first_name: req_address.get_optional_first_name(),
- last_name: req_address.get_optional_last_name(),
- email: item.request.get_email()?.clone(),
+ first_name: req_address.and_then(|addr| addr.get_optional_first_name()),
+ last_name: req_address.and_then(|addr| addr.get_optional_last_name()),
+ email,
mobile: item.get_optional_billing_phone_number(),
billing: Some(billing),
// no_nc is used to indicate if minimal customer data is passed or not
@@ -1504,7 +1506,7 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
card_expiry_month: req_card.card_exp_month.clone(),
card_expiry_year: req_card.card_exp_year.clone(),
card_cvc: req_card.card_cvc.clone(),
- card_holder: req_address.get_full_name()?.clone(),
+ card_holder: item.get_billing_address()?.get_full_name()?,
});
let transaction = NovalnetPaymentsRequestTransaction {
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index aec4d31072d..af8e89eeced 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1935,6 +1935,8 @@ pub trait AddressData {
fn get_optional_full_name(&self) -> Option<Secret<String>>;
fn get_email(&self) -> Result<Email, Error>;
fn get_phone_with_country_code(&self) -> Result<Secret<String>, Error>;
+ fn get_optional_first_name(&self) -> Option<Secret<String>>;
+ fn get_optional_last_name(&self) -> Option<Secret<String>>;
}
impl AddressData for Address {
@@ -1955,6 +1957,18 @@ impl AddressData for Address {
.transpose()?
.ok_or_else(missing_field_err("phone"))
}
+
+ fn get_optional_first_name(&self) -> Option<Secret<String>> {
+ self.address
+ .as_ref()
+ .and_then(|billing_address| billing_address.get_optional_first_name())
+ }
+
+ fn get_optional_last_name(&self) -> Option<Secret<String>> {
+ self.address
+ .as_ref()
+ .and_then(|billing_address| billing_address.get_optional_last_name())
+ }
}
pub trait PaymentsPreProcessingRequestData {
fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error>;
|
2025-02-12T09:46:32Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR updates connector integration for SetupMandate flow for Novalnet.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Helps fix zero amount CIT mandate flow for wallets through Novalnet
## How did you test it?
<details>
<summary>1. Zero amount mandate through GPay (CIT)</summary>
cURL (create a payment link)
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G' \
--data '{"customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","profile_id":"pro_9tMbnzk3iyggEiTQDwZi","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"amount":0,"currency":"EUR","payment_link":true,"setup_future_usage":"off_session","description":"This is my description of why this payment was requested.","capture_method":"automatic","session_expiry":100000,"return_url":"https://example.com","payment_link_config":{"theme":"#0E103D","logo":"https://hyperswitch.io/favicon.ico","seller_name":"Hyperswitch Inc."}}'
Response
{"payment_id":"pay_H4hegvKbutEoaqqWnfi7","merchant_id":"merchant_1739349514","status":"requires_payment_method","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_H4hegvKbutEoaqqWnfi7_secret_0dJICKnhrb8h98fGIpRH","created":"2025-02-12T09:58:12.371Z","currency":"EUR","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","customer":{"id":"cus_zO4rCUYOsXWOdZb4Tb8f","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"description":"This is my description of why this payment was requested.","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":"John Nether","phone":"6168205362","return_url":"https://example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","created_at":1739354292,"expires":1739357892,"secret":"epk_2a0d34b394314b75ae482a0151bf5793"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1739349514/pay_H4hegvKbutEoaqqWnfi7?locale=en","secure_link":null,"payment_link_id":"plink_QXzLep6VzSaTGthJpxSS"},"profile_id":"pro_9tMbnzk3iyggEiTQDwZi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-02-13T13:44:52.369Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-02-12T09:58:12.384Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
- Open payment link and complete GPay txn
- cURL (retrieve payment_method_id)
curl --location --request GET 'http://localhost:8080/payments/pay_H4hegvKbutEoaqqWnfi7?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G'
Response
{"payment_id":"pay_H4hegvKbutEoaqqWnfi7","merchant_id":"merchant_1739349514","status":"succeeded","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":0,"connector":"novalnet","client_secret":"pay_H4hegvKbutEoaqqWnfi7_secret_LieHRikq7Bov1SA7Pm0c","created":"2025-02-12T10:00:12.291Z","currency":"EUR","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","customer":{"id":"cus_zO4rCUYOsXWOdZb4Tb8f","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"google_pay":{"last4":"0002","card_network":"AMEX","type":"CARD"}},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://google.com/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"15146800034507274","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"15146800034507274","payment_link":null,"profile_id":"pro_9tMbnzk3iyggEiTQDwZi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_VSzA7Xp292ZhnZFVAzXk","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-02-12T10:15:12.291Z","fingerprint":null,"browser_info":null,"payment_method_id":"pm_7fdNeTCaPqNvsn5ws3V1","payment_method_status":"active","updated":"2025-02-12T10:00:14.797Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
</details>
<details>
<summary>2. MIT for GPay</summary>
cURL (create GPay MIT)
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G' \
--data-raw '{"amount":100,"currency":"EUR","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","email":"guest@example.com","name":"John Doe","phone":"999999999","profile_id":"pro_9tMbnzk3iyggEiTQDwZi","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"no_three_ds","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_7fdNeTCaPqNvsn5ws3V1"},"statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.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-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true}}'
Response
{"payment_id":"pay_5LvOZ6RQsFmyQqDvaqXh","merchant_id":"merchant_1737699414","status":"succeeded","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":6500,"connector":"worldpay","client_secret":"pay_5LvOZ6RQsFmyQqDvaqXh_secret_njW4m0eWv4WWrYHXyUws","created":"2025-01-24T06:49:49.063Z","currency":"USD","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","customer":{"id":"cus_IoFeOlGhEeD54AbBdvxI","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"0000","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"491761","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John US","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_IoFeOlGhEeD54AbBdvxI","created_at":1737701389,"expires":1737704989,"secret":"epk_37a0d95869a44072afca52b6a53523b0"},"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLWG3iYvLMl12v8Akq6Pt+SKmRV:l4OVG3XzCOZGpobnymfgF9Uk2Www3mSVoKRxeIXIe9pic4l22Rveu3MW0qp:7+4GYJYOg3e9WdLnxDKf8zDOVuNV9Smp3TrKAPuNF+l9HY8h4r+1y1WBHupQz59qPpv59wMMnZCI15w9voaKGUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9IlaVI4eDFRFhVVWboq417XA0B7A7omqvwyPr9UpXP4WEW0OwEozD:UT7vKzbOBIqfC+WwXVvDoxGmrxlJztOw0Zye5zF6oXedJ3PRFO1S38DZNrYIkRNlWpYaVeOJiIYYJegfV4WMVmEHXUV1JsgVeJ7ye7vUhLQaQWH669jc7KxCb6UloO7ZTj7Q+18PY5jSOT91RpDIiNOKkj:oboIAbw=","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"92b96418-ccfc-4a41-b882-c196f2d17d91","payment_link":null,"profile_id":"pro_7kIKHNtq6xvKHlBfazbc","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_c38WWereiWnpVCtrDTmH","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-24T07:04:49.062Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_19peBlu9TYmWO2bASPQL","payment_method_status":"active","updated":"2025-01-24T06:49:51.258Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
</details>
<details>
<summary>3. Zero amount mandate through PayPal (CIT)</summary>
cURL (create a payment link)
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G' \
--data '{"customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","profile_id":"pro_9tMbnzk3iyggEiTQDwZi","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"amount":0,"currency":"EUR","payment_link":true,"setup_future_usage":"off_session","description":"This is my description of why this payment was requested.","capture_method":"automatic","session_expiry":100000,"return_url":"https://example.com","payment_link_config":{"theme":"#0E103D","logo":"https://hyperswitch.io/favicon.ico","seller_name":"Hyperswitch Inc."}}'
Response
{"payment_id":"pay_eSstvDXVT0iKWsdKIkTw","merchant_id":"merchant_1739349514","status":"requires_payment_method","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_eSstvDXVT0iKWsdKIkTw_secret_y5hDfv9Woup0YGv0ZvzZ","created":"2025-02-12T10:02:55.258Z","currency":"EUR","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","customer":{"id":"cus_zO4rCUYOsXWOdZb4Tb8f","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":"This is my description of why this payment was requested.","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","created_at":1739354575,"expires":1739358175,"secret":"epk_4c4915a65d3b450286ce3e9ec0a494d4"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1739349514/pay_eSstvDXVT0iKWsdKIkTw?locale=en","secure_link":null,"payment_link_id":"plink_REQTjbWTbPsP4R8fMdsA"},"profile_id":"pro_9tMbnzk3iyggEiTQDwZi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-02-13T13:49:35.254Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-02-12T10:02:55.271Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
cURL (retrieve payment_method_id)
curl --location --request GET 'http://localhost:8080/payments/pay_eSstvDXVT0iKWsdKIkTw?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G'
Response
{"payment_id":"pay_eSstvDXVT0iKWsdKIkTw","merchant_id":"merchant_1739349514","status":"succeeded","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":0,"connector":"novalnet","client_secret":"pay_eSstvDXVT0iKWsdKIkTw_secret_y5hDfv9Woup0YGv0ZvzZ","created":"2025-02-12T10:02:55.258Z","currency":"EUR","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","customer":{"id":"cus_zO4rCUYOsXWOdZb4Tb8f","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":"This is my description of why this payment was requested.","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://example.com/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":"redirect_to_url","payment_method_type":"paypal","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"15146800034821188","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"15146800034821188","payment_link":{"link":"http://localhost:8080/payment_link/merchant_1739349514/pay_eSstvDXVT0iKWsdKIkTw?locale=en","secure_link":null,"payment_link_id":"plink_REQTjbWTbPsP4R8fMdsA"},"profile_id":"pro_9tMbnzk3iyggEiTQDwZi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_VSzA7Xp292ZhnZFVAzXk","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-02-13T13:49:35.254Z","fingerprint":null,"browser_info":{"os_type":"macOS","language":"en-US","time_zone":-330,"ip_address":"::1","os_version":"10.15.7","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15","color_depth":24,"device_model":"Macintosh","java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"accept_language":"en-US,en;q=0.9","java_script_enabled":true},"payment_method_id":"pm_xOKqXFkPih09U60Md7a9","payment_method_status":"active","updated":"2025-02-12T10:04:11.573Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
</details>
<details>
<summary>4. MIT for PayPal</summary>
cURL (create PayPal MIT)
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Z6hI0pxQyHsH240jY8lyalrGGJGyZBtjWhFrxxCmbvEdc7KywJRANdBXFzZ8XO2G' \
--data-raw '{"amount":100,"currency":"EUR","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","email":"guest@example.com","name":"John Doe","phone":"999999999","profile_id":"pro_9tMbnzk3iyggEiTQDwZi","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"no_three_ds","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_xOKqXFkPih09U60Md7a9"},"statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.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-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true}}'
Response
{"payment_id":"pay_0NCUSdZA36EEALDTtMEf","merchant_id":"merchant_1739349514","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"novalnet","client_secret":"pay_0NCUSdZA36EEALDTtMEf_secret_0en976XGc0HB37cHdfN8","created":"2025-02-12T10:05:39.834Z","currency":"EUR","customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","customer":{"id":"cus_zO4rCUYOsXWOdZb4Tb8f","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"paypal","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_zO4rCUYOsXWOdZb4Tb8f","created_at":1739354739,"expires":1739358339,"secret":"epk_b6fb3fbc14bd44b287d75d7f29406aa9"},"manual_retry_allowed":false,"connector_transaction_id":"15146800034912664","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"15146800034912664","payment_link":null,"profile_id":"pro_9tMbnzk3iyggEiTQDwZi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_VSzA7Xp292ZhnZFVAzXk","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-02-12T10:20:39.834Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_xOKqXFkPih09U60Md7a9","payment_method_status":"active","updated":"2025-02-12T10:05:43.065Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"VVBV24y20uF-D20uND14oV24y-12m14oJ00aZ16qZ20uRZTTZ18s20u18s18s151"}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
fa09db1534884037947c6d488e33a3ce600c2a0c
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7255
|
Bug: [FEATURE] [GETNET] Implement Card Flows
Getnet Card Implementation
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index d93208fb665..53af0100c4f 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7629,6 +7629,7 @@
"fiservemea",
"fiuu",
"forte",
+ "getnet",
"globalpay",
"globepay",
"gocardless",
@@ -9757,6 +9758,12 @@
"user_card_cvc"
]
},
+ {
+ "type": "string",
+ "enum": [
+ "user_card_network"
+ ]
+ },
{
"type": "string",
"enum": [
@@ -20297,6 +20304,7 @@
"fiservemea",
"fiuu",
"forte",
+ "getnet",
"globalpay",
"globepay",
"gocardless",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 6ae46a5ede0..bd328c75a09 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -211,6 +211,7 @@ pub enum FieldType {
UserCardExpiryMonth,
UserCardExpiryYear,
UserCardCvc,
+ UserCardNetwork,
UserFullName,
UserEmailAddress,
UserPhoneNumber,
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index e58d934a56b..afa6d367ffe 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -81,7 +81,7 @@ pub enum RoutableConnectors {
Fiservemea,
Fiuu,
Forte,
- // Getnet,
+ Getnet,
Globalpay,
Globepay,
Gocardless,
@@ -224,7 +224,7 @@ pub enum Connector {
Fiservemea,
Fiuu,
Forte,
- // Getnet,
+ Getnet,
Globalpay,
Globepay,
Gocardless,
@@ -382,7 +382,7 @@ impl Connector {
| Self::Fiservemea
| Self::Fiuu
| Self::Forte
- // | Self::Getnet
+ | Self::Getnet
| Self::Globalpay
| Self::Globepay
| Self::Gocardless
@@ -520,6 +520,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Fiservemea => Self::Fiservemea,
RoutableConnectors::Fiuu => Self::Fiuu,
RoutableConnectors::Forte => Self::Forte,
+ RoutableConnectors::Getnet => Self::Getnet,
RoutableConnectors::Globalpay => Self::Globalpay,
RoutableConnectors::Globepay => Self::Globepay,
RoutableConnectors::Gocardless => Self::Gocardless,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 2ac83b81e03..de5e4111d4f 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -195,7 +195,7 @@ pub struct ConnectorConfig {
pub fiservemea: Option<ConnectorTomlConfig>,
pub fiuu: Option<ConnectorTomlConfig>,
pub forte: Option<ConnectorTomlConfig>,
- // pub getnet: Option<ConnectorTomlConfig>,
+ pub getnet: Option<ConnectorTomlConfig>,
pub globalpay: Option<ConnectorTomlConfig>,
pub globepay: Option<ConnectorTomlConfig>,
pub gocardless: Option<ConnectorTomlConfig>,
@@ -366,7 +366,7 @@ impl ConnectorConfig {
Connector::Fiservemea => Ok(connector_data.fiservemea),
Connector::Fiuu => Ok(connector_data.fiuu),
Connector::Forte => Ok(connector_data.forte),
- // Connector::Getnet => Ok(connector_data.getnet),
+ Connector::Getnet => Ok(connector_data.getnet),
Connector::Globalpay => Ok(connector_data.globalpay),
Connector::Globepay => Ok(connector_data.globepay),
Connector::Gocardless => Ok(connector_data.gocardless),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 2708fe11af5..2ec49c5812f 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1618,6 +1618,30 @@ key2="Location ID"
[forte.connector_webhook_details]
merchant_secret="Source verification key"
+[getnet]
+[[getnet.credit]]
+ payment_method_type = "Mastercard"
+[[getnet.credit]]
+ payment_method_type = "Visa"
+[[getnet.credit]]
+ payment_method_type = "Interac"
+[[getnet.credit]]
+ payment_method_type = "AmericanExpress"
+[[getnet.credit]]
+ payment_method_type = "JCB"
+[[getnet.credit]]
+ payment_method_type = "DinersClub"
+[[getnet.credit]]
+ payment_method_type = "Discover"
+[[getnet.credit]]
+ payment_method_type = "CartesBancaires"
+[[getnet.credit]]
+ payment_method_type = "UnionPay"
+[[getnet.credit]]
+ payment_method_type = "Rupay"
+[[getnet.credit]]
+ payment_method_type = "Maestro"
+
[globalpay]
[[globalpay.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 52535d57b4a..569f7208ae0 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1343,6 +1343,30 @@ key2="Location ID"
merchant_secret="Source verification key"
+[getnet]
+[[getnet.credit]]
+ payment_method_type = "Mastercard"
+[[getnet.credit]]
+ payment_method_type = "Visa"
+[[getnet.credit]]
+ payment_method_type = "Interac"
+[[getnet.credit]]
+ payment_method_type = "AmericanExpress"
+[[getnet.credit]]
+ payment_method_type = "JCB"
+[[getnet.credit]]
+ payment_method_type = "DinersClub"
+[[getnet.credit]]
+ payment_method_type = "Discover"
+[[getnet.credit]]
+ payment_method_type = "CartesBancaires"
+[[getnet.credit]]
+ payment_method_type = "UnionPay"
+[[getnet.credit]]
+ payment_method_type = "Rupay"
+[[getnet.credit]]
+ payment_method_type = "Maestro"
+
[globalpay]
[[globalpay.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index da8f9ba62e5..e83cc9f76f2 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1568,6 +1568,30 @@ key2="Location ID"
[forte.connector_webhook_details]
merchant_secret="Source verification key"
+[getnet]
+[[getnet.credit]]
+ payment_method_type = "Mastercard"
+[[getnet.credit]]
+ payment_method_type = "Visa"
+[[getnet.credit]]
+ payment_method_type = "Interac"
+[[getnet.credit]]
+ payment_method_type = "AmericanExpress"
+[[getnet.credit]]
+ payment_method_type = "JCB"
+[[getnet.credit]]
+ payment_method_type = "DinersClub"
+[[getnet.credit]]
+ payment_method_type = "Discover"
+[[getnet.credit]]
+ payment_method_type = "CartesBancaires"
+[[getnet.credit]]
+ payment_method_type = "UnionPay"
+[[getnet.credit]]
+ payment_method_type = "Rupay"
+[[getnet.credit]]
+ payment_method_type = "Maestro"
+
[globalpay]
[[globalpay.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs
index 557dfbeaca3..263b1ad5b46 100644
--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs
@@ -1,12 +1,16 @@
pub mod transformers;
-
+use api_models::webhooks::IncomingWebhookEvent;
+use base64::{self, Engine};
+use common_enums::enums;
use common_utils::{
+ consts::BASE64_ENGINE,
+ crypto,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
@@ -21,8 +25,8 @@ use hyperswitch_domain_models::{
},
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
@@ -31,25 +35,26 @@ use hyperswitch_interfaces::{
ConnectorValidation,
},
configs::Connectors,
- errors,
+ errors::{self},
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks,
+ webhooks::{self},
};
-use masking::{ExposeInterface, Mask};
+use masking::{Mask, PeekInterface, Secret};
+use ring::hmac;
use transformers as getnet;
use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Clone)]
pub struct Getnet {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Getnet {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &FloatMajorUnitForConnector,
}
}
}
@@ -82,10 +87,16 @@ where
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 header = vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ ),
+ (
+ headers::ACCEPT.to_string(),
+ self.get_accept_type().to_string().into(),
+ ),
+ ];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
@@ -99,9 +110,6 @@ impl ConnectorCommon for Getnet {
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 {
@@ -118,9 +126,12 @@ impl ConnectorCommon for Getnet {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = getnet::GetnetAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let encoded_api_key =
+ 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(),
)])
}
@@ -149,16 +160,60 @@ impl ConnectorCommon for Getnet {
}
impl ConnectorValidation for Getnet {
- //TODO: implement functions when support enabled
-}
+ fn validate_connector_against_payment_request(
+ &self,
+ capture_method: Option<enums::CaptureMethod>,
+ _payment_method: enums::PaymentMethod,
+ _pmt: Option<enums::PaymentMethodType>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let capture_method = capture_method.unwrap_or_default();
+ match capture_method {
+ enums::CaptureMethod::Automatic
+ | enums::CaptureMethod::Manual
+ | enums::CaptureMethod::SequentialAutomatic => Ok(()),
+ enums::CaptureMethod::Scheduled | enums::CaptureMethod::ManualMultiple => Err(
+ utils::construct_not_implemented_error_report(capture_method, self.id()),
+ ),
+ }
+ }
-impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Getnet {
- //TODO: implement sessions flow
+ fn validate_psync_reference_id(
+ &self,
+ data: &PaymentsSyncData,
+ _is_three_ds: bool,
+ _status: enums::AttemptStatus,
+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ if data.encoded_data.is_some()
+ || data
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .is_ok()
+ {
+ return Ok(());
+ }
+
+ Err(errors::ConnectorError::MissingConnectorTransactionID.into())
+ }
}
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Getnet {}
+
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Getnet {}
-impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Getnet {}
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Getnet {
+ // Not Implemented (R)
+ fn build_request(
+ &self,
+ _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Err(
+ errors::ConnectorError::NotImplemented("Setup Mandate flow for Getnet".to_string())
+ .into(),
+ )
+ }
+}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Getnet {
fn get_headers(
@@ -176,9 +231,10 @@ 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())
+ let endpoint = self.base_url(connectors);
+ Ok(format!("{endpoint}/payments/"))
}
fn get_request_body(
@@ -191,10 +247,11 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req.request.minor_amount,
req.request.currency,
)?;
-
let connector_router_data = getnet::GetnetRouterData::from((amount, req));
let connector_req = getnet::GetnetPaymentsRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
+ let res = RequestContent::Json(Box::new(connector_req));
+
+ Ok(res)
}
fn build_request(
@@ -262,10 +319,24 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Get
fn get_url(
&self,
- _req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let auth = getnet::GetnetAuthType::try_from(&req.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let merchant_id = auth.merchant_id.peek();
+
+ let endpoint = self.base_url(connectors);
+ let transaction_id = req
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+
+ Ok(format!(
+ "{}/merchants/{}/payments/{}",
+ endpoint, merchant_id, transaction_id
+ ))
}
fn build_request(
@@ -327,17 +398,26 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
fn get_url(
&self,
_req: &PaymentsCaptureRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let endpoint = self.base_url(connectors);
+ Ok(format!("{endpoint}/payments/"))
}
fn get_request_body(
&self,
- _req: &PaymentsCaptureRouterData,
+ req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount_to_capture,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = getnet::GetnetRouterData::from((amount, req));
+ let connector_req = getnet::GetnetCaptureRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
@@ -366,7 +446,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: getnet::GetnetPaymentsResponse = res
+ let response: getnet::GetnetCaptureResponse = res
.response
.parse_struct("Getnet PaymentsCaptureResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -377,6 +457,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
data: data.clone(),
http_code: res.status_code,
})
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
@@ -388,7 +469,84 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
}
}
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Getnet {}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Getnet {
+ fn get_headers(
+ &self,
+ req: &PaymentsCancelRouterData,
+ 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: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let endpoint = self.base_url(connectors);
+ Ok(format!("{endpoint}/payments/"))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsCancelRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = getnet::GetnetCancelRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+ .set_body(types::PaymentsVoidType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCancelRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: getnet::GetnetCancelResponse = res
+ .response
+ .parse_struct("GetnetPaymentsVoidResponse")
+ .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<Execute, RefundsData, RefundsResponseData> for Getnet {
fn get_headers(
@@ -406,9 +564,10 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Getnet
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let endpoint = self.base_url(connectors);
+ Ok(format!("{endpoint}/payments/"))
}
fn get_request_body(
@@ -489,10 +648,19 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Getnet {
fn get_url(
&self,
- _req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let auth = getnet::GetnetAuthType::try_from(&req.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let merchant_id = auth.merchant_id.peek();
+ let endpoint = self.base_url(connectors);
+ let transaction_id = req.request.connector_transaction_id.clone();
+
+ Ok(format!(
+ "{}/merchants/{}/payments/{}",
+ endpoint, merchant_id, transaction_id
+ ))
}
fn build_request(
@@ -543,25 +711,118 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Getnet {
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Getnet {
- fn get_webhook_object_reference_id(
+ fn get_webhook_source_verification_algorithm(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
+ Ok(Box::new(crypto::HmacSha256))
+ }
+
+ fn get_webhook_source_verification_signature(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let notif_item = getnet::get_webhook_response(request.body)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
+ let response_base64 = ¬if_item.response_base64.peek().clone();
+ BASE64_ENGINE
+ .decode(response_base64)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
+ }
+
+ fn get_webhook_source_verification_message(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let notif = getnet::get_webhook_response(request.body)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
+
+ Ok(notif.response_base64.peek().clone().into_bytes())
+ }
+
+ fn get_webhook_object_reference_id(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = getnet::get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ let transaction_type = ¬if.payment.transaction_type;
+ if getnet::is_refund_event(transaction_type) {
+ Ok(api_models::webhooks::ObjectReferenceId::RefundId(
+ api_models::webhooks::RefundIdType::ConnectorRefundId(
+ notif.payment.transaction_id.to_string(),
+ ),
+ ))
+ } else {
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(
+ notif.payment.transaction_id.to_string(),
+ ),
+ ))
+ }
}
fn get_webhook_event_type(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
- ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
+ let notif = getnet::get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ let incoming_webhook_event = getnet::get_incoming_webhook_event(
+ notif.payment.transaction_type,
+ notif.payment.transaction_state,
+ );
+ Ok(incoming_webhook_event)
}
fn get_webhook_resource_object(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = getnet::get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
+ Ok(Box::new(notif))
+ }
+
+ async fn verify_webhook_source(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ merchant_id: &common_utils::id_type::MerchantId,
+ connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
+ _connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>,
+ connector_name: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ let notif_item = getnet::get_webhook_response(request.body)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
+
+ let connector_webhook_secrets = self
+ .get_webhook_source_verification_merchant_secret(
+ merchant_id,
+ connector_name,
+ connector_webhook_details,
+ )
+ .await?;
+
+ let signature = notif_item.response_signature_base64.peek().clone();
+
+ let message = self.get_webhook_source_verification_message(
+ request,
+ merchant_id,
+ &connector_webhook_secrets,
+ )?;
+
+ let secret = connector_webhook_secrets.secret;
+
+ let key = hmac::Key::new(hmac::HMAC_SHA256, &secret);
+ let result = hmac::sign(&key, &message);
+
+ let computed_signature = BASE64_ENGINE.encode(result.as_ref());
+
+ let normalized_computed_signature = computed_signature.replace("+", " ");
+ Ok(signature == normalized_computed_signature)
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
index a6dd52d83f5..31aef0a4b1e 100644
--- a/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
@@ -1,31 +1,47 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use api_models::webhooks::IncomingWebhookEvent;
+use base64::Engine;
+use cards::CardNumber;
+use common_enums::{enums, AttemptStatus, CaptureMethod, CountryAlpha2};
+use common_utils::{
+ consts::BASE64_ENGINE,
+ errors::CustomResult,
+ pii::{Email, IpAddress},
+ types::FloatMajorUnit,
+};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
- router_request_types::ResponseId,
+ router_request_types::{
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, ResponseId,
+ },
router_response_types::{PaymentsResponseData, RefundsResponseData},
- types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundsRouterData,
+ },
};
use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
- types::{RefundsResponseRouterData, ResponseRouterData},
- utils::PaymentsAuthorizeRequestData,
+ connectors::paybox::transformers::parse_url_encoded_to_struct,
+ types::{PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData},
+ utils::{
+ BrowserInformationData, PaymentsAuthorizeRequestData, PaymentsSyncRequestData,
+ RouterData as _,
+ },
};
-//TODO: Fill the struct with respective fields
pub struct GetnetRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: FloatMajorUnit,
pub router_data: T,
}
-impl<T> From<(StringMinorUnit, T)> for GetnetRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
+impl<T> From<(FloatMajorUnit, T)> for GetnetRouterData<T> {
+ fn from((amount, item): (FloatMajorUnit, T)) -> Self {
Self {
amount,
router_data: item,
@@ -33,39 +49,226 @@ impl<T> From<(StringMinorUnit, T)> for GetnetRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct Amount {
+ pub value: FloatMajorUnit,
+ pub currency: enums::Currency,
+}
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct Address {
+ #[serde(rename = "street1")]
+ pub street1: Option<Secret<String>>,
+ pub city: Option<String>,
+ pub state: Option<Secret<String>>,
+ pub country: Option<CountryAlpha2>,
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct AccountHolder {
+ #[serde(rename = "first-name")]
+ pub first_name: Option<Secret<String>>,
+ #[serde(rename = "last-name")]
+ pub last_name: Option<Secret<String>>,
+ pub email: Option<Email>,
+ pub phone: Option<Secret<String>>,
+ pub address: Option<Address>,
+}
+
#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct Card {
+ #[serde(rename = "account-number")]
+ pub account_number: CardNumber,
+ #[serde(rename = "expiration-month")]
+ pub expiration_month: Secret<String>,
+ #[serde(rename = "expiration-year")]
+ pub expiration_year: Secret<String>,
+ #[serde(rename = "card-security-code")]
+ pub card_security_code: Secret<String>,
+ #[serde(rename = "card-type")]
+ pub card_type: String,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum GetnetPaymentMethods {
+ CreditCard,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct PaymentMethod {
+ pub name: GetnetPaymentMethods,
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct Notification {
+ pub url: Option<String>,
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct PaymentMethodContainer {
+ #[serde(rename = "payment-method")]
+ pub payment_method: Vec<PaymentMethod>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum NotificationFormat {
+ #[serde(rename = "application/json-signed")]
+ JsonSigned,
+ #[serde(rename = "application/json")]
+ Json,
+ #[serde(rename = "application/xml")]
+ Xml,
+ #[serde(rename = "application/html")]
+ Html,
+ #[serde(rename = "application/x-www-form-urlencoded")]
+ Urlencoded,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct NotificationContainer {
+ pub notification: Vec<Notification>,
+ pub format: NotificationFormat,
+}
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+pub struct MerchantAccountId {
+ pub value: Secret<String>,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct PaymentData {
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ pub card: Card,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ pub notifications: Option<NotificationContainer>,
+}
+
+#[derive(Debug, Serialize)]
pub struct GetnetPaymentsRequest {
- amount: StringMinorUnit,
- card: GetnetCard,
+ payment: PaymentData,
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct GetnetCard {
- number: cards::CardNumber,
+ number: CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Secret<String>,
complete: bool,
}
+impl TryFrom<enums::PaymentMethodType> for PaymentMethodContainer {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(payment_method_type: enums::PaymentMethodType) -> Result<Self, Self::Error> {
+ match payment_method_type {
+ enums::PaymentMethodType::Credit => Ok(Self {
+ payment_method: vec![PaymentMethod {
+ name: GetnetPaymentMethods::CreditCard,
+ }],
+ }),
+ _ => Err(errors::ConnectorError::NotSupported {
+ message: "Payment method type not supported".to_string(),
+ connector: "Getnet",
+ }
+ .into()),
+ }
+ }
+}
+
impl TryFrom<&GetnetRouterData<&PaymentsAuthorizeRouterData>> for GetnetPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &GetnetRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = GetnetCard {
- 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()?,
+ PaymentMethodData::Card(ref req_card) => {
+ if item.router_data.is_three_ds() {
+ return Err(errors::ConnectorError::NotSupported {
+ message: "3DS payments".to_string(),
+ connector: "Getnet",
+ }
+ .into());
+ }
+ let request = &item.router_data.request;
+ let auth_type = GetnetAuthType::try_from(&item.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let merchant_account_id = MerchantAccountId {
+ value: auth_type.merchant_id,
};
- Ok(Self {
- amount: item.amount.clone(),
+
+ let requested_amount = Amount {
+ value: item.amount,
+ currency: request.currency,
+ };
+
+ let account_holder = AccountHolder {
+ first_name: item.router_data.get_optional_billing_first_name(),
+ last_name: item.router_data.get_optional_billing_last_name(),
+ email: item.router_data.request.get_optional_email(),
+ phone: item.router_data.get_optional_billing_phone_number(),
+ address: Some(Address {
+ street1: item.router_data.get_optional_billing_line2(),
+ city: item.router_data.get_optional_billing_city(),
+ state: item.router_data.get_optional_billing_state(),
+ country: item.router_data.get_optional_billing_country(),
+ }),
+ };
+
+ let card = Card {
+ account_number: req_card.card_number.clone(),
+ expiration_month: req_card.card_exp_month.clone(),
+ expiration_year: req_card.card_exp_year.clone(),
+ card_security_code: req_card.card_cvc.clone(),
+ card_type: req_card
+ .card_network
+ .as_ref()
+ .map(|network| network.to_string().to_lowercase())
+ .unwrap_or_default(),
+ };
+
+ let pmt = item.router_data.request.get_payment_method_type()?;
+ let payment_method = PaymentMethodContainer::try_from(pmt)?;
+
+ let notifications: NotificationContainer = NotificationContainer {
+ format: NotificationFormat::JsonSigned,
+
+ notification: vec![Notification {
+ url: Some(item.router_data.request.get_webhook_url()?),
+ }],
+ };
+ let transaction_type = if request.is_auto_capture()? {
+ GetnetTransactionType::Purchase
+ } else {
+ GetnetTransactionType::Authorization
+ };
+ let payment_data = PaymentData {
+ merchant_account_id,
+ request_id: item.router_data.payment_id.clone(),
+ transaction_type,
+ requested_amount,
+ account_holder: Some(account_holder),
card,
+ ip_address: Some(request.get_browser_info()?.get_ip_address()?),
+ payment_methods: payment_method,
+ notifications: Some(notifications),
+ };
+
+ Ok(Self {
+ payment: payment_data,
})
}
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
@@ -73,62 +276,382 @@ impl TryFrom<&GetnetRouterData<&PaymentsAuthorizeRouterData>> for GetnetPayments
}
}
-//TODO: Fill the struct with respective fields
-// Auth Struct
pub struct GetnetAuthType {
- pub(super) api_key: Secret<String>,
+ pub username: Secret<String>,
+ pub password: Secret<String>,
+ pub merchant_id: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for GetnetAuthType {
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::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self {
+ username: key1.to_owned(),
+ password: api_key.to_owned(),
+ merchant_id: api_secret.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 GetnetPaymentStatus {
- Succeeded,
+ Success,
Failed,
#[default]
- Processing,
+ InProgress,
}
-impl From<GetnetPaymentStatus> for common_enums::AttemptStatus {
+impl From<GetnetPaymentStatus> for AttemptStatus {
fn from(item: GetnetPaymentStatus) -> Self {
match item {
- GetnetPaymentStatus::Succeeded => Self::Charged,
+ GetnetPaymentStatus::Success => Self::Charged,
GetnetPaymentStatus::Failed => Self::Failure,
- GetnetPaymentStatus::Processing => Self::Authorizing,
+ GetnetPaymentStatus::InProgress => Self::Pending,
+ }
+ }
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct Status {
+ pub code: String,
+ pub description: String,
+ pub severity: String,
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct Statuses {
+ pub status: Vec<Status>,
+}
+
+#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct CardToken {
+ #[serde(rename = "token-id")]
+ pub token_id: Secret<String>,
+ #[serde(rename = "masked-account-number")]
+ pub masked_account_number: Secret<String>,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct PaymentResponseData {
+ pub statuses: Statuses,
+ pub descriptor: Option<String>,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "transaction-id")]
+ pub transaction_id: String,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "transaction-state")]
+ pub transaction_state: GetnetPaymentStatus,
+ #[serde(rename = "completion-time-stamp")]
+ pub completion_time_stamp: Option<i64>,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ #[serde(rename = "card-token")]
+ pub card_token: CardToken,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ #[serde(rename = "api-id")]
+ pub api_id: String,
+ #[serde(rename = "self")]
+ pub self_url: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct PaymentsResponse {
+ payment: PaymentResponseData,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum GetnetPaymentsResponse {
+ PaymentsResponse(Box<PaymentsResponse>),
+ GetnetWebhookNotificationResponse(Box<GetnetWebhookNotificationResponseBody>),
+}
+
+pub fn authorization_attempt_status_from_transaction_state(
+ getnet_status: GetnetPaymentStatus,
+ is_auto_capture: bool,
+) -> AttemptStatus {
+ match getnet_status {
+ GetnetPaymentStatus::Success => {
+ if is_auto_capture {
+ AttemptStatus::Charged
+ } else {
+ AttemptStatus::Authorized
+ }
+ }
+ GetnetPaymentStatus::InProgress => AttemptStatus::Pending,
+ GetnetPaymentStatus::Failed => AttemptStatus::Failure,
+ }
+}
+
+impl<F>
+ TryFrom<
+ ResponseRouterData<F, GetnetPaymentsResponse, PaymentsAuthorizeData, PaymentsResponseData>,
+ > for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<
+ F,
+ GetnetPaymentsResponse,
+ PaymentsAuthorizeData,
+ PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ match item.response {
+ GetnetPaymentsResponse::PaymentsResponse(ref payment_response) => Ok(Self {
+ status: authorization_attempt_status_from_transaction_state(
+ payment_response.payment.transaction_state.clone(),
+ item.data.request.is_auto_capture()?,
+ ),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ payment_response.payment.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ }),
+
+ _ => Err(error_stack::Report::new(
+ errors::ConnectorError::ResponseHandlingFailed,
+ )),
+ }
+ }
+}
+
+pub fn psync_attempt_status_from_transaction_state(
+ getnet_status: GetnetPaymentStatus,
+ is_auto_capture: bool,
+ transaction_type: GetnetTransactionType,
+) -> AttemptStatus {
+ match getnet_status {
+ GetnetPaymentStatus::Success => {
+ if is_auto_capture && transaction_type == GetnetTransactionType::CaptureAuthorization {
+ AttemptStatus::Charged
+ } else {
+ AttemptStatus::Authorized
+ }
+ }
+ GetnetPaymentStatus::InProgress => AttemptStatus::Pending,
+ GetnetPaymentStatus::Failed => AttemptStatus::Failure,
+ }
+}
+
+impl TryFrom<PaymentsSyncResponseRouterData<GetnetPaymentsResponse>> for PaymentsSyncRouterData {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: PaymentsSyncResponseRouterData<GetnetPaymentsResponse>,
+ ) -> Result<Self, Self::Error> {
+ match item.response {
+ GetnetPaymentsResponse::PaymentsResponse(ref payment_response) => Ok(Self {
+ status: authorization_attempt_status_from_transaction_state(
+ payment_response.payment.transaction_state.clone(),
+ item.data.request.is_auto_capture()?,
+ ),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ payment_response.payment.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ }),
+
+ GetnetPaymentsResponse::GetnetWebhookNotificationResponse(ref webhook_response) => {
+ Ok(Self {
+ status: psync_attempt_status_from_transaction_state(
+ webhook_response.payment.transaction_state.clone(),
+ item.data.request.is_auto_capture()?,
+ webhook_response.payment.transaction_type.clone(),
+ ),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ webhook_response.payment.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct GetnetPaymentsResponse {
- status: GetnetPaymentStatus,
- id: String,
+#[derive(Debug, Serialize, PartialEq)]
+pub struct CapturePaymentData {
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "parent-transaction-id")]
+ pub parent_transaction_id: String,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct GetnetCaptureRequest {
+ pub payment: CapturePaymentData,
+}
+impl TryFrom<&GetnetRouterData<&PaymentsCaptureRouterData>> for GetnetCaptureRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &GetnetRouterData<&PaymentsCaptureRouterData>) -> Result<Self, Self::Error> {
+ let request = &item.router_data.request;
+ let auth_type = GetnetAuthType::try_from(&item.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let merchant_account_id = MerchantAccountId {
+ value: auth_type.merchant_id,
+ };
+
+ let requested_amount = Amount {
+ value: item.amount,
+ currency: request.currency,
+ };
+ let req = &item.router_data.request;
+ let webhook_url = &req.webhook_url;
+ let notifications = NotificationContainer {
+ format: NotificationFormat::JsonSigned,
+
+ notification: vec![Notification {
+ url: webhook_url.clone(),
+ }],
+ };
+ let transaction_type = GetnetTransactionType::CaptureAuthorization;
+ let ip_address = req
+ .browser_info
+ .as_ref()
+ .and_then(|info| info.ip_address.as_ref())
+ .map(|ip| Secret::new(ip.to_string()));
+ let request_id = item.router_data.connector_request_reference_id.clone();
+ let parent_transaction_id = item.router_data.request.connector_transaction_id.clone();
+ let capture_payment_data = CapturePaymentData {
+ merchant_account_id,
+ request_id,
+ transaction_type,
+ parent_transaction_id,
+ requested_amount,
+ notifications,
+ ip_address,
+ };
+
+ Ok(Self {
+ payment: capture_payment_data,
+ })
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct CaptureResponseData {
+ pub statuses: Statuses,
+ pub descriptor: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "transaction-id")]
+ pub transaction_id: String,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "transaction-state")]
+ pub transaction_state: GetnetPaymentStatus,
+ #[serde(rename = "completion-time-stamp")]
+ pub completion_time_stamp: Option<i64>,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "parent-transaction-id")]
+ pub parent_transaction_id: String,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ #[serde(rename = "card-token")]
+ pub card_token: CardToken,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ #[serde(rename = "parent-transaction-amount")]
+ pub parent_transaction_amount: Amount,
+ #[serde(rename = "authorization-code")]
+ pub authorization_code: String,
+ #[serde(rename = "api-id")]
+ pub api_id: String,
+ #[serde(rename = "self")]
+ pub self_url: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct GetnetCaptureResponse {
+ payment: CaptureResponseData,
+}
+
+pub fn capture_status_from_transaction_state(getnet_status: GetnetPaymentStatus) -> AttemptStatus {
+ match getnet_status {
+ GetnetPaymentStatus::Success => AttemptStatus::Charged,
+ GetnetPaymentStatus::InProgress => AttemptStatus::Pending,
+ GetnetPaymentStatus::Failed => AttemptStatus::Authorized,
+ }
}
-impl<F, T> TryFrom<ResponseRouterData<F, GetnetPaymentsResponse, T, PaymentsResponseData>>
- for RouterData<F, T, PaymentsResponseData>
+impl<F>
+ TryFrom<ResponseRouterData<F, GetnetCaptureResponse, PaymentsCaptureData, PaymentsResponseData>>
+ for RouterData<F, PaymentsCaptureData, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, GetnetPaymentsResponse, T, PaymentsResponseData>,
+ item: ResponseRouterData<
+ F,
+ GetnetCaptureResponse,
+ PaymentsCaptureData,
+ PaymentsResponseData,
+ >,
) -> Result<Self, Self::Error> {
Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
+ status: capture_status_from_transaction_state(item.response.payment.transaction_state),
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.payment.transaction_id,
+ ),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
@@ -142,50 +665,140 @@ impl<F, T> TryFrom<ResponseRouterData<F, GetnetPaymentsResponse, T, PaymentsResp
}
}
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
+#[derive(Debug, Serialize, PartialEq)]
+pub struct RefundPaymentData {
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "parent-transaction-id")]
+ pub parent_transaction_id: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+}
+#[derive(Debug, Serialize)]
pub struct GetnetRefundRequest {
- pub amount: StringMinorUnit,
+ pub payment: RefundPaymentData,
}
impl<F> TryFrom<&GetnetRouterData<&RefundsRouterData<F>>> for GetnetRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &GetnetRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ let request = &item.router_data.request;
+ let auth_type = GetnetAuthType::try_from(&item.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let url = request.webhook_url.clone();
+
+ let merchant_account_id = MerchantAccountId {
+ value: auth_type.merchant_id,
+ };
+ let notifications = NotificationContainer {
+ format: NotificationFormat::JsonSigned,
+ notification: vec![Notification { url }],
+ };
+ let capture_method = request.capture_method;
+ let transaction_type = match capture_method {
+ Some(CaptureMethod::Automatic) => GetnetTransactionType::RefundPurchase,
+ Some(CaptureMethod::Manual) => GetnetTransactionType::RefundCapture,
+ Some(CaptureMethod::ManualMultiple)
+ | Some(CaptureMethod::Scheduled)
+ | Some(CaptureMethod::SequentialAutomatic)
+ | None => {
+ return Err(errors::ConnectorError::CaptureMethodNotSupported {}.into());
+ }
+ };
+ let ip_address = request
+ .browser_info
+ .as_ref()
+ .and_then(|browser_info| browser_info.ip_address.as_ref())
+ .map(|ip| Secret::new(ip.to_string()));
+ let request_id = item
+ .router_data
+ .refund_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorRefundID)?;
+
+ let parent_transaction_id = item.router_data.request.connector_transaction_id.clone();
+ let refund_payment_data = RefundPaymentData {
+ merchant_account_id,
+ request_id,
+ transaction_type,
+ parent_transaction_id,
+ notifications,
+ ip_address,
+ };
+
Ok(Self {
- amount: item.amount.to_owned(),
+ payment: refund_payment_data,
})
}
}
-// Type definition for Refund Response
-
#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone, PartialEq)]
+#[serde(rename_all = "lowercase")]
pub enum RefundStatus {
- Succeeded,
+ Success,
Failed,
#[default]
- Processing,
+ InProgress,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
- RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Success => Self::Success,
RefundStatus::Failed => Self::Failure,
- RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
+ RefundStatus::InProgress => Self::Pending,
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct RefundResponseData {
+ pub statuses: Statuses,
+ pub descriptor: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "transaction-id")]
+ pub transaction_id: String,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "transaction-state")]
+ pub transaction_state: RefundStatus,
+ #[serde(rename = "completion-time-stamp")]
+ pub completion_time_stamp: Option<i64>,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "parent-transaction-id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_id: Option<String>,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ #[serde(rename = "card-token")]
+ pub card_token: CardToken,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ #[serde(rename = "parent-transaction-amount")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_amount: Option<Amount>,
+ #[serde(rename = "api-id")]
+ pub api_id: String,
+ #[serde(rename = "self")]
+ pub self_url: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
- id: String,
- status: RefundStatus,
+ payment: RefundResponseData,
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
@@ -195,8 +808,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRout
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.response.payment.transaction_id,
+ refund_status: enums::RefundStatus::from(item.response.payment.transaction_state),
}),
..item.data
})
@@ -210,15 +823,181 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.response.payment.transaction_id,
+ refund_status: enums::RefundStatus::from(item.response.payment.transaction_state),
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct CancelPaymentData {
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "parent-transaction-id")]
+ pub parent_transaction_id: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct GetnetCancelRequest {
+ pub payment: CancelPaymentData,
+}
+
+impl TryFrom<&PaymentsCancelRouterData> for GetnetCancelRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaymentsCancelRouterData) -> Result<Self, Self::Error> {
+ let request = &item.request;
+ let auth_type = GetnetAuthType::try_from(&item.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let merchant_account_id = MerchantAccountId {
+ value: auth_type.merchant_id,
+ };
+ let webhook_url = &item.request.webhook_url;
+ let notifications = NotificationContainer {
+ format: NotificationFormat::JsonSigned,
+
+ notification: vec![Notification {
+ url: webhook_url.clone(),
+ }],
+ };
+ let capture_method = &item.request.capture_method;
+ let transaction_type = match capture_method {
+ Some(CaptureMethod::Automatic) => GetnetTransactionType::VoidPurchase,
+ Some(CaptureMethod::Manual) => GetnetTransactionType::VoidAuthorization,
+ Some(CaptureMethod::ManualMultiple)
+ | Some(CaptureMethod::Scheduled)
+ | Some(CaptureMethod::SequentialAutomatic) => {
+ return Err(errors::ConnectorError::CaptureMethodNotSupported {}.into());
+ }
+ None => {
+ return Err(errors::ConnectorError::CaptureMethodNotSupported {}.into());
+ }
+ };
+ let ip_address = request
+ .browser_info
+ .as_ref()
+ .and_then(|browser_info| browser_info.ip_address.as_ref())
+ .map(|ip| Secret::new(ip.to_string()));
+ let request_id = &item.connector_request_reference_id.clone();
+ let parent_transaction_id = item.request.connector_transaction_id.clone();
+ let cancel_payment_data = CancelPaymentData {
+ merchant_account_id,
+ request_id: request_id.to_string(),
+ transaction_type,
+ parent_transaction_id,
+ notifications,
+ ip_address,
+ };
+ Ok(Self {
+ payment: cancel_payment_data,
+ })
+ }
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum GetnetTransactionType {
+ Purchase,
+ #[serde(rename = "capture-authorization")]
+ CaptureAuthorization,
+ #[serde(rename = "refund-purchase")]
+ RefundPurchase,
+ #[serde(rename = "refund-capture")]
+ RefundCapture,
+ #[serde(rename = "void-authorization")]
+ VoidAuthorization,
+ #[serde(rename = "void-purchase")]
+ VoidPurchase,
+ Authorization,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub struct CancelResponseData {
+ pub statuses: Statuses,
+ pub descriptor: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "transaction-id")]
+ pub transaction_id: String,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "transaction-state")]
+ pub transaction_state: GetnetPaymentStatus,
+ #[serde(rename = "completion-time-stamp")]
+ pub completion_time_stamp: Option<i64>,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "parent-transaction-id")]
+ pub parent_transaction_id: String,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ #[serde(rename = "card-token")]
+ pub card_token: CardToken,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ #[serde(rename = "parent-transaction-amount")]
+ pub parent_transaction_amount: Amount,
+ #[serde(rename = "api-id")]
+ pub api_id: String,
+ #[serde(rename = "self")]
+ pub self_url: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct GetnetCancelResponse {
+ payment: CancelResponseData,
+}
+
+pub fn cancel_status_from_transaction_state(getnet_status: GetnetPaymentStatus) -> AttemptStatus {
+ match getnet_status {
+ GetnetPaymentStatus::Success => AttemptStatus::Voided,
+ GetnetPaymentStatus::InProgress => AttemptStatus::Pending,
+ GetnetPaymentStatus::Failed => AttemptStatus::VoidFailed,
+ }
+}
+
+impl<F>
+ TryFrom<ResponseRouterData<F, GetnetCancelResponse, PaymentsCancelData, PaymentsResponseData>>
+ for RouterData<F, PaymentsCancelData, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, GetnetCancelResponse, PaymentsCancelData, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: cancel_status_from_transaction_state(item.response.payment.transaction_state),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.payment.transaction_id,
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
}),
..item.data
})
}
}
-//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct GetnetErrorResponse {
pub status_code: u16,
@@ -226,3 +1005,150 @@ pub struct GetnetErrorResponse {
pub message: String,
pub reason: Option<String>,
}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct GetnetWebhookNotificationResponse {
+ #[serde(rename = "response-signature-base64")]
+ pub response_signature_base64: Secret<String>,
+ #[serde(rename = "response-signature-algorithm")]
+ pub response_signature_algorithm: Secret<String>,
+ #[serde(rename = "response-base64")]
+ pub response_base64: Secret<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize, PartialEq)]
+pub struct WebhookResponseData {
+ pub statuses: Statuses,
+ pub descriptor: String,
+ pub notifications: NotificationContainer,
+ #[serde(rename = "merchant-account-id")]
+ pub merchant_account_id: MerchantAccountId,
+ #[serde(rename = "transaction-id")]
+ pub transaction_id: String,
+ #[serde(rename = "request-id")]
+ pub request_id: String,
+ #[serde(rename = "transaction-type")]
+ pub transaction_type: GetnetTransactionType,
+ #[serde(rename = "transaction-state")]
+ pub transaction_state: GetnetPaymentStatus,
+ #[serde(rename = "completion-time-stamp")]
+ pub completion_time_stamp: u64,
+ #[serde(rename = "requested-amount")]
+ pub requested_amount: Amount,
+ #[serde(rename = "parent-transaction-id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_id: Option<String>,
+ #[serde(rename = "account-holder")]
+ pub account_holder: Option<AccountHolder>,
+ #[serde(rename = "card-token")]
+ pub card_token: CardToken,
+ #[serde(rename = "ip-address")]
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ #[serde(rename = "payment-methods")]
+ pub payment_methods: PaymentMethodContainer,
+ #[serde(rename = "parent-transaction-amount")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_amount: Option<Amount>,
+ #[serde(rename = "authorization-code")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub authorization_code: Option<String>,
+ #[serde(rename = "api-id")]
+ pub api_id: String,
+ #[serde(rename = "provider-account-id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub provider_account_id: Option<String>,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct GetnetWebhookNotificationResponseBody {
+ pub payment: WebhookResponseData,
+}
+
+pub fn is_refund_event(transaction_type: &GetnetTransactionType) -> bool {
+ matches!(
+ transaction_type,
+ GetnetTransactionType::RefundPurchase | GetnetTransactionType::RefundCapture
+ )
+}
+
+pub fn get_webhook_object_from_body(
+ body: &[u8],
+) -> CustomResult<GetnetWebhookNotificationResponseBody, errors::ConnectorError> {
+ let body_bytes = bytes::Bytes::copy_from_slice(body);
+ let parsed_param: GetnetWebhookNotificationResponse =
+ parse_url_encoded_to_struct(body_bytes)
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ let response_base64 = &parsed_param.response_base64.peek();
+ let decoded_response = BASE64_ENGINE
+ .decode(response_base64)
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+ let getnet_webhook_notification_response: GetnetWebhookNotificationResponseBody =
+ match serde_json::from_slice::<GetnetWebhookNotificationResponseBody>(&decoded_response) {
+ Ok(response) => response,
+ Err(_e) => {
+ return Err(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ }
+ };
+
+ Ok(getnet_webhook_notification_response)
+}
+
+pub fn get_webhook_response(
+ body: &[u8],
+) -> CustomResult<GetnetWebhookNotificationResponse, errors::ConnectorError> {
+ let body_bytes = bytes::Bytes::copy_from_slice(body);
+ let parsed_param: GetnetWebhookNotificationResponse =
+ parse_url_encoded_to_struct(body_bytes)
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok(parsed_param)
+}
+
+pub fn get_incoming_webhook_event(
+ transaction_type: GetnetTransactionType,
+ transaction_status: GetnetPaymentStatus,
+) -> IncomingWebhookEvent {
+ match transaction_type {
+ GetnetTransactionType::Purchase => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::PaymentIntentSuccess,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::PaymentIntentFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::PaymentIntentProcessing,
+ },
+
+ GetnetTransactionType::Authorization => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::PaymentIntentAuthorizationSuccess,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::PaymentIntentAuthorizationFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::PaymentIntentProcessing,
+ },
+
+ GetnetTransactionType::CaptureAuthorization => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::PaymentIntentCaptureSuccess,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::PaymentIntentCaptureFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::PaymentIntentCaptureFailure,
+ },
+
+ GetnetTransactionType::RefundPurchase => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::RefundSuccess,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::RefundFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::RefundFailure,
+ },
+
+ GetnetTransactionType::RefundCapture => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::RefundSuccess,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::RefundFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::RefundFailure,
+ },
+
+ GetnetTransactionType::VoidAuthorization => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::PaymentIntentCancelled,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::PaymentIntentCancelFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::PaymentIntentCancelFailure,
+ },
+
+ GetnetTransactionType::VoidPurchase => match transaction_status {
+ GetnetPaymentStatus::Success => IncomingWebhookEvent::PaymentIntentCancelled,
+ GetnetPaymentStatus::Failed => IncomingWebhookEvent::PaymentIntentCancelFailure,
+ GetnetPaymentStatus::InProgress => IncomingWebhookEvent::PaymentIntentCancelFailure,
+ },
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index ce40e373462..93eca2a1bfa 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1836,6 +1836,7 @@ pub trait PaymentsCaptureRequestData {
fn get_optional_language_from_browser_info(&self) -> Option<String>;
fn is_multiple_capture(&self) -> bool;
fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
+ fn get_webhook_url(&self) -> Result<String, Error>;
}
impl PaymentsCaptureRequestData for PaymentsCaptureData {
@@ -1852,6 +1853,11 @@ impl PaymentsCaptureRequestData for PaymentsCaptureData {
.clone()
.and_then(|browser_info| browser_info.language)
}
+ fn get_webhook_url(&self) -> Result<String, Error> {
+ self.webhook_url
+ .clone()
+ .ok_or_else(missing_field_err("webhook_url"))
+ }
}
pub trait PaymentsSyncRequestData {
@@ -1889,6 +1895,7 @@ pub trait PaymentsCancelRequestData {
fn get_currency(&self) -> Result<enums::Currency, Error>;
fn get_cancellation_reason(&self) -> Result<String, Error>;
fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
+ fn get_webhook_url(&self) -> Result<String, Error>;
}
impl PaymentsCancelRequestData for PaymentsCancelData {
@@ -1913,6 +1920,11 @@ impl PaymentsCancelRequestData for PaymentsCancelData {
.clone()
.and_then(|browser_info| browser_info.language)
}
+ fn get_webhook_url(&self) -> Result<String, Error> {
+ self.webhook_url
+ .clone()
+ .ok_or_else(missing_field_err("webhook_url"))
+ }
}
pub trait RefundsRequestData {
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 6c1e11ced4e..ff5534dcebc 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -125,6 +125,7 @@ pub struct PaymentsCaptureData {
pub minor_payment_amount: MinorUnit,
pub minor_amount_to_capture: MinorUnit,
pub integrity_object: Option<CaptureIntegrityObject>,
+ pub webhook_url: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
@@ -467,6 +468,8 @@ pub struct PaymentsCancelData {
// minor amount data for amount framework
pub minor_amount: Option<MinorUnit>,
+ pub webhook_url: Option<String>,
+ pub capture_method: Option<storage_enums::CaptureMethod>,
}
#[derive(Debug, Default, Clone)]
@@ -643,6 +646,7 @@ pub struct RefundsData {
pub refund_status: storage_enums::RefundStatus,
pub merchant_account_id: Option<Secret<String>>,
pub merchant_config_currency: Option<storage_enums::Currency>,
+ pub capture_method: Option<storage_enums::CaptureMethod>,
}
#[derive(Debug, Clone, PartialEq)]
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index b70d326feb6..cf9b2ff9764 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -100,6 +100,11 @@ pub trait ConnectorIntegration<T, Req, Resp>:
mime::APPLICATION_JSON.essence_str()
}
+ /// fn get_content_type
+ fn get_accept_type(&self) -> &'static str {
+ mime::APPLICATION_JSON.essence_str()
+ }
+
/// primarily used when creating signature based on request method of payment flow
fn get_http_method(&self) -> Method {
Method::Post
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 3849054045c..9b912ce00ba 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -5303,6 +5303,62 @@ impl Default for settings::RequiredFields {
common:HashMap::new(),
}
),
+ (
+ enums::Connector::Getnet,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from(
+ [
+ (
+ "payment_method_data.card.card_number".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_number".to_string(),
+ display_name: "card_number".to_string(),
+ field_type: enums::FieldType::UserCardNumber,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_month".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_month".to_string(),
+ display_name: "card_exp_month".to_string(),
+ field_type: enums::FieldType::UserCardExpiryMonth,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_year".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_year".to_string(),
+ display_name: "card_exp_year".to_string(),
+ field_type: enums::FieldType::UserCardExpiryYear,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_cvc".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_cvc".to_string(),
+ display_name: "card_cvc".to_string(),
+ field_type: enums::FieldType::UserCardCvc,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_network".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_network".to_string(),
+ display_name: "card_network".to_string(),
+ field_type: enums::FieldType::UserCardNetwork,
+ value: None,
+ }
+ ),
+ ]
+ ),
+ }
+ ),
(
enums::Connector::Globalpay,
RequiredFieldFinal {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index c5fb803ef97..271da3f4e21 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1381,10 +1381,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
forte::transformers::ForteAuthType::try_from(self.auth_type)?;
Ok(())
}
- // api_enums::Connector::Getnet => {
- // getnet::transformers::GetnetAuthType::try_from(self.auth_type)?;
- // Ok(())
- // }
+ api_enums::Connector::Getnet => {
+ getnet::transformers::GetnetAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Globalpay => {
globalpay::transformers::GlobalpayAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index b5104391ab8..308a3f2ede3 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -627,6 +627,7 @@ impl<F>
minor_amount_to_capture: item.request.minor_amount,
integrity_object: None,
split_payments: item.request.split_payments,
+ webhook_url: item.request.webhook_url,
})
}
}
diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
index 6e8152716d0..54dca9b2e41 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -319,6 +319,7 @@ impl<F>
minor_amount_to_capture: item.request.minor_amount,
integrity_object: None,
split_payments: None,
+ webhook_url: None,
})
}
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 9647a277b0e..36b3586ae67 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -473,6 +473,7 @@ pub async fn construct_payment_router_data_for_capture<'a>(
metadata: payment_data.payment_intent.metadata.expose_option(),
integrity_object: None,
split_payments: None,
+ webhook_url: None,
};
// TODO: evaluate the fields in router data, if they are required or not
@@ -3440,6 +3441,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCaptureD
metadata: payment_data.payment_intent.metadata.expose_option(),
integrity_object: None,
split_payments: None,
+ webhook_url: None,
})
}
}
@@ -3470,6 +3472,21 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCaptureD
field_name: "browser_info",
})?;
let amount = payment_data.payment_attempt.get_total_amount();
+
+ let router_base_url = &additional_data.router_base_url;
+ let attempt = &payment_data.payment_attempt;
+
+ let merchant_connector_account_id = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .ok_or(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ let webhook_url: Option<_> = Some(helpers::create_webhook_url(
+ router_base_url,
+ &attempt.merchant_id,
+ merchant_connector_account_id,
+ ));
Ok(Self {
capture_method: payment_data.get_capture_method(),
amount_to_capture: amount_to_capture.get_amount_as_i64(), // This should be removed once we start moving to connector module
@@ -3496,6 +3513,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCaptureD
metadata: payment_data.payment_intent.metadata,
integrity_object: None,
split_payments: payment_data.payment_intent.split_payments,
+ webhook_url,
})
}
}
@@ -3531,6 +3549,22 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCancelDa
field_name: "browser_info",
})?;
let amount = payment_data.payment_attempt.get_total_amount();
+
+ let router_base_url = &additional_data.router_base_url;
+ let attempt = &payment_data.payment_attempt;
+
+ let merchant_connector_account_id = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .ok_or(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ let webhook_url: Option<_> = Some(helpers::create_webhook_url(
+ router_base_url,
+ &attempt.merchant_id,
+ merchant_connector_account_id,
+ ));
+ let capture_method = payment_data.payment_attempt.capture_method;
Ok(Self {
amount: Some(amount.get_amount_as_i64()), // This should be removed once we start moving to connector module
minor_amount: Some(amount),
@@ -3543,6 +3577,8 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCancelDa
connector_meta: payment_data.payment_attempt.connector_metadata,
browser_info,
metadata: payment_data.payment_intent.metadata,
+ webhook_url,
+ capture_method,
})
}
}
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index 969566c098e..b4d70038c67 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -109,6 +109,7 @@ pub async fn construct_relay_refund_router_data<F>(
refund_status: common_enums::RefundStatus::from(relay_record.status),
merchant_account_id: None,
merchant_config_currency: None,
+ capture_method: None,
},
response: Err(ErrorResponse::default()),
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 537f67871ea..d9467d19ced 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -337,6 +337,7 @@ pub async fn construct_refund_router_data<'a, F>(
})?;
let connector_refund_id = refund.get_optional_connector_refund_id().cloned();
+ let capture_method = payment_attempt.capture_method;
let braintree_metadata = payment_intent
.connector_metadata
@@ -395,6 +396,7 @@ pub async fn construct_refund_router_data<'a, F>(
refund_status: refund.refund_status,
merchant_account_id,
merchant_config_currency,
+ capture_method,
},
response: Ok(types::RefundsResponseData {
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 99d577c657b..ff60cfbb442 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -440,9 +440,9 @@ impl ConnectorData {
enums::Connector::Forte => {
Ok(ConnectorEnum::Old(Box::new(connector::Forte::new())))
}
- // enums::Connector::Getnet => {
- // Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new())))
- // }
+ enums::Connector::Getnet => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new())))
+ }
enums::Connector::Globalpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Globalpay::new())))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 5baf491cb33..da2fc35e823 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -246,7 +246,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Fiservemea => Self::Fiservemea,
api_enums::Connector::Fiuu => Self::Fiuu,
api_enums::Connector::Forte => Self::Forte,
- // api_enums::Connector::Getnet => Self::Getnet,
+ api_enums::Connector::Getnet => Self::Getnet,
api_enums::Connector::Globalpay => Self::Globalpay,
api_enums::Connector::Globepay => Self::Globepay,
api_enums::Connector::Gocardless => Self::Gocardless,
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index ead0173ed56..c8747225513 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -408,6 +408,7 @@ pub trait ConnectorActions: Connector {
refund_status: enums::RefundStatus::Pending,
merchant_account_id: None,
merchant_config_currency: None,
+ capture_method: None,
}),
payment_info,
);
@@ -1075,6 +1076,7 @@ impl Default for PaymentRefundType {
refund_status: enums::RefundStatus::Pending,
merchant_account_id: None,
merchant_config_currency: None,
+ capture_method: None,
};
Self(data)
}
|
2025-02-12T19:48:53Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added `no-3ds cards` flow for new connector `Getnet`
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1) No-3DS AutoCapture
<img width="1725" alt="Screenshot 2025-02-17 at 9 29 29 PM" src="https://github.com/user-attachments/assets/5041b6b8-53c6-48e3-9c8e-587e3ffdbee1" />
2) 3DS AutoCapture
<img width="1728" alt="Screenshot 2025-02-17 at 9 30 03 PM" src="https://github.com/user-attachments/assets/ade93c4c-246f-48d4-bbda-ad1adf5d4568" />
3) No-3DS ManualCapture
<img width="1728" alt="Screenshot 2025-02-17 at 9 42 43 PM" src="https://github.com/user-attachments/assets/f6ce18d5-c292-4967-b208-e28c25fdf4af" />
4) 3DS ManualCapture
<img width="1728" alt="Screenshot 2025-02-17 at 9 30 38 PM" src="https://github.com/user-attachments/assets/69783c0f-ced4-4449-941d-d5c2670d8bcf" />
5) Void Payment
<img width="1723" alt="Screenshot 2025-02-17 at 9 30 57 PM" src="https://github.com/user-attachments/assets/bcb00a2c-89c6-4f9b-8d9e-5963b0442a2c" />
6) PSync
<img width="1728" alt="Screenshot 2025-02-17 at 9 31 11 PM" src="https://github.com/user-attachments/assets/3fb06a38-8e2f-4448-b56e-dbfde69e6409" />
7) Refund Payment
<img width="1726" alt="Screenshot 2025-02-17 at 9 32 08 PM" src="https://github.com/user-attachments/assets/b70d6e76-1ef1-4f0d-810f-328e583bdc3b" />
8) RSync
<img width="1728" alt="Screenshot 2025-02-17 at 9 32 20 PM" src="https://github.com/user-attachments/assets/ff0c432b-cad5-45fb-a568-060703aa1173" />
Webhook snapshot
<img width="1064" alt="Screenshot 2025-03-03 at 4 43 19 PM" src="https://github.com/user-attachments/assets/1c202674-f78d-4ba7-9baf-68c7a8de38df" />
1. Connector create
```
curl --location 'http://localhost:8080/account/merchant_1739434149/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "payment_processor",
"connector_name": "getnet",
"connector_account_details": {
"auth_type": "SignatureKey",
"api_key": "4cHLRE-Q7YcAP",
"key1": "515225-GetnetEuropeTEST",
"api_secret": "5c4a8a42-04a8-4970-a595-262f0ba0a108"
},
"test_mode": true,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"GBP"
]
}
}
]
}
],
"metadata": {
"city": "NY",
"unit": "245"
},
"connector_webhook_details": {
"merchant_secret": "5ac555d4-e7f7-409f-8147-d82c8c10ed53"
},
"business_country": "US",
"business_label": "default"
}'
```
Response
```
{
"connector_type": "payment_processor",
"connector_name": "getnet",
"connector_label": "getnet_US_default",
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"connector_account_details": {
"auth_type": "SignatureKey",
"api_key": "4c*********AP",
"key1": "51*******************ST",
"api_secret": "5c********************************08"
},
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"payment_experience": null,
"card_networks": [
"Visa",
"Mastercard"
],
"accepted_currencies": {
"type": "enable_only",
"list": [
"GBP"
]
},
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
}
],
"connector_webhook_details": {
"merchant_secret": "5ac555d4-e7f7-409f-8147-d82c8c10ed53",
"additional_secret": null
},
"metadata": {
"city": "NY",
"unit": "245"
},
"test_mode": true,
"disabled": false,
"frm_configs": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null
}
```
2. Manual Capture
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data-raw '{
"amount": 6540,
"currency": "GBP",
"amount_to_capture": 6540,
"confirm": true,
"profile_id": null,
"capture_method": "manual",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "no_three_ds",
"setup_future_usage": "on_session",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"customer_id": "customer123",
"phone_country_code": "+1",
"routing": {
"type": "single",
"data": "stripe"
},
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "5413330300001006",
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"card_cvc": "006",
"card_network": "Visa"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 6540,
"account_name": "transaction_processing"
}
],
"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": "128.0.0.1"
},
"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"
}
},
"connector_metadata": {
"noon": {
"order_category": "pay"
}
},
"payment_link": false,
"payment_link_config": {
"theme": "",
"logo": "",
"seller_name": "",
"sdk_layout": "",
"display_sdk_only": false,
"enabled_saved_payment_method": false
},
"payment_type": "normal",
"request_incremental_authorization": false,
"merchant_order_reference_id": "test_ord",
"session_expiry": 900
}
'
```
Response
```
{
"payment_id": "pay_yeIQORCXdgimJRzZTCVw",
"merchant_id": "merchant_1739434149",
"status": "requires_capture",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 6540,
"amount_received": null,
"connector": "getnet",
"client_secret": "pay_yeIQORCXdgimJRzZTCVw_secret_u9VvAVWDu490Tj2lA7Zr",
"created": "2025-02-13T08:11:07.353Z",
"currency": "GBP",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1006",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "541333",
"card_extended_bin": null,
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "customer123",
"created_at": 1739434267,
"expires": 1739437867,
"secret": "epk_667d69df4d134fc39f0a61703d75481e"
},
"manual_retry_allowed": false,
"connector_transaction_id": "068e3efc-4163-4020-96f7-7ed306bffa92",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-13T08:26:07.353Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-13T08:11:12.236Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null
}
```
```
curl --location 'http://localhost:8080/payments/pay_yeIQORCXdgimJRzZTCVw/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
"amount_to_capture": 6000,
"statement_descriptor_name": "Joseph",
"statement_descriptor_prefix" :"joseph",
"statement_descriptor_suffix": "JS"
}'
```
Response
```
{
"payment_id": "pay_yeIQORCXdgimJRzZTCVw",
"merchant_id": "merchant_1739434149",
"status": "partially_captured",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6000,
"connector": "getnet",
"client_secret": "pay_yeIQORCXdgimJRzZTCVw_secret_u9VvAVWDu490Tj2lA7Zr",
"created": "2025-02-13T08:11:07.353Z",
"currency": "GBP",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1006",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "541333",
"card_extended_bin": null,
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "51cff4a6-6a2b-43f4-8496-9979e55d1621",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-13T08:26:07.353Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_wSdofMDXLzBUvjp1kh4i",
"payment_method_status": null,
"updated": "2025-02-13T08:12:03.769Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null
}
```
3. Automatic capture
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data-raw '{
"amount": 6540,
"currency": "GBP",
"amount_to_capture": 6540,
"confirm": true,
"profile_id": null,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "no_three_ds",
"setup_future_usage": "on_session",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"customer_id": "customer123",
"phone_country_code": "+1",
"routing": {
"type": "single",
"data": "stripe"
},
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "5413330300001006",
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"card_cvc": "006",
"card_network": "Visa"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 6540,
"account_name": "transaction_processing"
}
],
"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": "128.0.0.1"
},
"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"
}
},
"connector_metadata": {
"noon": {
"order_category": "pay"
}
},
"payment_link": false,
"payment_link_config": {
"theme": "",
"logo": "",
"seller_name": "",
"sdk_layout": "",
"display_sdk_only": false,
"enabled_saved_payment_method": false
},
"payment_type": "normal",
"request_incremental_authorization": false,
"merchant_order_reference_id": "test_ord",
"session_expiry": 900
}
'
```
Response
```
{
"payment_id": "pay_VMzczCzFIwowXXE9w8OS",
"merchant_id": "merchant_1739434149",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "getnet",
"client_secret": "pay_VMzczCzFIwowXXE9w8OS_secret_vuIqC7LndTSFj11rDMV7",
"created": "2025-02-13T08:13:27.282Z",
"currency": "GBP",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1006",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "541333",
"card_extended_bin": null,
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "customer123",
"created_at": 1739434407,
"expires": 1739438007,
"secret": "epk_3dd3731f7cc24c7f8a7df6e8eeae7535"
},
"manual_retry_allowed": false,
"connector_transaction_id": "839fc50f-02ba-4314-83a6-056595d0bac0",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-13T08:28:27.282Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-13T08:13:30.109Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null
}
```
Refund
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
"payment_id": "pay_VMzczCzFIwowXXE9w8OS",
"amount": 600,
"reason": "Customer returned product",
"refund_type": "instant",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
Response
```
{
"refund_id": "ref_SCNfNPs3TV8wEk1pVvoS",
"payment_id": "pay_VMzczCzFIwowXXE9w8OS",
"amount": 600,
"currency": "GBP",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-13T08:14:13.071Z",
"updated_at": "2025-02-13T08:14:14.387Z",
"connector": "getnet",
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"split_refunds": null
}
```
Void
```
curl --location 'http://localhost:8080/payments/pay_LQ2EiF97FKn0yt0jgmk5/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
"cancellation_reason": "requested_by_customer"
}'
```
Response
```
{
"payment_id": "pay_LQ2EiF97FKn0yt0jgmk5",
"merchant_id": "merchant_1739434149",
"status": "cancelled",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "getnet",
"client_secret": "pay_LQ2EiF97FKn0yt0jgmk5_secret_C1NVCNguIV0C3f508eM7",
"created": "2025-02-13T08:15:07.592Z",
"currency": "GBP",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1006",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "541333",
"card_extended_bin": null,
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": "requested_by_customer",
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "d89b3a2f-3d0d-4654-91f9-0f2e67f40b49",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-13T08:30:07.592Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_8qg5T41lSXYx0qs5KU86",
"payment_method_status": null,
"updated": "2025-02-13T08:15:17.782Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null
}
```
PSync
```
curl --location 'http://localhost:8080/payments/pay_LQ2EiF97FKn0yt0jgmk5?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_6HkhcQvkti3OGp1PFsRSwRzKaPnitoH7k854sEOKfOkRypAq1PCNScAYw7VrDBcJ'
```
Response
```
{
"payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
"merchant_id": "merchant_1739379077",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "getnet",
"client_secret": "pay_qXgED4jGf5ncCz2EO3q8_secret_tiBwvvMYD4dIUewZe8H9",
"created": "2025-02-12T19:02:54.488Z",
"currency": "USD",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "customer@gmail.com",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": [
{
"refund_id": "ref_FXURRXerycqpduKOCtP2",
"payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
"amount": 600,
"currency": "USD",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-12T19:02:59.241Z",
"updated_at": "2025-02-12T19:03:02.765Z",
"connector": "getnet",
"profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
"merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
"split_refunds": null
}
],
"disputes": null,
"attempts": [
{
"attempt_id": "pay_qXgED4jGf5ncCz2EO3q8_1",
"status": "charged",
"amount": 6540,
"order_tax_amount": null,
"currency": "USD",
"connector": "getnet",
"error_message": null,
"payment_method": "card",
"connector_transaction_id": "b0c93eb0-d018-42e0-ac36-bf4a6e47f51d",
"capture_method": "automatic",
"authentication_type": "no_three_ds",
"created_at": "2025-02-12T19:02:54.488Z",
"modified_at": "2025-02-12T19:02:56.271Z",
"cancellation_reason": null,
"mandate_id": null,
"error_code": null,
"payment_token": null,
"connector_metadata": null,
"payment_experience": null,
"payment_method_type": "credit",
"reference_id": null,
"unified_code": null,
"unified_message": null,
"client_source": null,
"client_version": null
}
],
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1006",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "541333",
"card_extended_bin": null,
"card_exp_month": "02",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "guest@example.com"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "customer@gmail.com",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "b0c93eb0-d018-42e0-ac36-bf4a6e47f51d",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
}
},
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-12T19:17:54.488Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_r8XyBKhMfwgSeu9RMRxt",
"payment_method_status": "active",
"updated": "2025-02-12T19:02:56.256Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null
}
```
RSync
```
curl --location 'http://localhost:8080/refunds/ref_SCNfNPs3TV8wEk1pVvoS' \
--header 'Accept: application/json' \
--header 'api-key: dev_6HkhcQvkti3OGp1PFsRSwRzKaPnitoH7k854sEOKfOkRypAq1PCNScAYw7VrDBcJ'
```
Response
```
{
"refund_id": "ref_FXURRXerycqpduKOCtP2",
"payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
"amount": 600,
"currency": "USD",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-12T19:02:59.241Z",
"updated_at": "2025-02-12T19:03:02.765Z",
"connector": "getnet",
"profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
"merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
"split_refunds": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
cb256dcdac0533af51a6c77eef0039121a8ee110
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7240
|
Bug: [FEATURE]: Add `customer_list_saved_payment_methods` to OLAP (v2)
Needed for the dashboard
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index ba795d40594..cd076aa0d5b 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -2498,6 +2498,47 @@
]
}
},
+ "/v2/customers/{id}/saved-payment-methods": {
+ "delete": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - List Customer Saved Payment Methods",
+ "description": "List the payment methods saved for a customer",
+ "operationId": "List Customer Saved Payment Methods",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The unique identifier for the customer",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Payment Methods Retrieved",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Customer Not Found"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
"/v2/payment-method-session": {
"post": {
"tags": [
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index cc6f1b0e411..088ced76085 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -135,6 +135,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payment_method::payment_method_update_api,
routes::payment_method::payment_method_retrieve_api,
routes::payment_method::payment_method_delete_api,
+ routes::payment_method::list_customer_payment_method_api,
//Routes for payment method session
routes::payment_method::payment_method_session_create,
diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs
index 3c1f66e6e76..15318322398 100644
--- a/crates/openapi/src/routes/payment_method.rs
+++ b/crates/openapi/src/routes/payment_method.rs
@@ -322,6 +322,26 @@ pub async fn payment_method_update_api() {}
#[cfg(feature = "v2")]
pub async fn payment_method_delete_api() {}
+/// Payment Method - List Customer Saved Payment Methods
+///
+/// List the payment methods saved for a customer
+#[utoipa::path(
+ delete,
+ path = "/v2/customers/{id}/saved-payment-methods",
+ params (
+ ("id" = String, Path, description = "The unique identifier for the customer"),
+ ),
+ responses(
+ (status = 200, description = "Payment Methods Retrieved", body = CustomerPaymentMethodsListResponse),
+ (status = 404, description = "Customer Not Found"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "List Customer Saved Payment Methods",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn list_customer_payment_method_api() {}
+
/// Payment Method Session - Create
///
/// Create a payment method session for a customer
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 5bdb0f0819e..19b1bb3c7d7 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1099,6 +1099,23 @@ pub async fn list_payment_methods_for_session(
))
}
+#[cfg(all(feature = "v2", feature = "olap"))]
+#[instrument(skip_all)]
+pub async fn list_saved_payment_methods_for_customer(
+ state: SessionState,
+ merchant_account: domain::MerchantAccount,
+ key_store: domain::MerchantKeyStore,
+ customer_id: id_type::GlobalCustomerId,
+) -> RouterResponse<api::CustomerPaymentMethodsListResponse> {
+ let customer_payment_methods =
+ list_customer_payment_method_core(&state, &merchant_account, &key_store, &customer_id)
+ .await?;
+
+ Ok(hyperswitch_domain_models::api::ApplicationResponse::Json(
+ customer_payment_methods,
+ ))
+}
+
#[cfg(feature = "v2")]
/// Container for the inputs required for the required fields
struct RequiredFieldsInput {
@@ -1463,11 +1480,7 @@ fn get_pm_list_context(
Ok(payment_method_retrieval_context)
}
-#[cfg(all(
- feature = "v2",
- feature = "payment_methods_v2",
- feature = "customer_v2"
-))]
+#[cfg(all(feature = "v2", feature = "olap"))]
pub async fn list_customer_payment_method_core(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index c5e1f8a1082..0609ba8d1a2 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1015,6 +1015,10 @@ impl Customers {
.route(web::get().to(customers::customers_retrieve))
.route(web::delete().to(customers::customers_delete)),
)
+ .service(
+ web::resource("/{id}/saved-payment-methods")
+ .route(web::get().to(payment_methods::list_customer_payment_method_api)),
+ )
}
route
}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 86f1874ab09..9f3332855e3 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -579,6 +579,43 @@ pub async fn initiate_pm_collect_link_flow(
.await
}
+#[cfg(all(feature = "v2", feature = "olap"))]
+#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
+pub async fn list_customer_payment_method_api(
+ state: web::Data<AppState>,
+ customer_id: web::Path<id_type::GlobalCustomerId>,
+ req: HttpRequest,
+ query_payload: web::Query<api_models::payment_methods::PaymentMethodListRequest>,
+) -> HttpResponse {
+ let flow = Flow::CustomerPaymentMethodsList;
+ let payload = query_payload.into_inner();
+ let customer_id = customer_id.into_inner();
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, auth: auth::AuthenticationData, _, _| {
+ payment_methods_routes::list_saved_payment_methods_for_customer(
+ state,
+ auth.merchant_account,
+ auth.key_store,
+ customer_id.clone(),
+ )
+ },
+ auth::auth_type(
+ &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::JWTAuth {
+ permission: Permission::MerchantCustomerRead,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
/// Generate a form link for collecting payment methods for a customer
#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodCollectLink))]
|
2025-02-11T07:39:41Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add `customer_list_saved_payment_methods` to OLAP and allow JWT Auth
This endpoint allows retrieving saved payment methods for a customer
This PR enables the endpoint to be used from the dashboard
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Request
```bash
curl --location 'http://localhost:8080/v2/customers/12345_cus_0195187353c47d438edd6044cadb0969/saved-payment-methods' \
--header 'api-key: dev_Z0aXn9A50mSviMWnWLC02YHDhCxoLdKawgHzVMRwErbyyYQ5O4XvqjNYMQoCCaT1' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_9glqJzp3eRd6XljDKDE9'
```
- Response
```json
{
"customer_payment_methods": [
{
"id": "12345_pm_019518761b3075e0a4da6035422ce961",
"customer_id": "12345_cus_0195187353c47d438edd6044cadb0969",
"payment_method_type": "card",
"payment_method_subtype": "credit",
"recurring_enabled": true,
"payment_method_data": {
"card": {
"issuer_country": null,
"last4_digits": "4242",
"expiry_month": "02",
"expiry_year": "2025",
"card_holder_name": "joseph Doe",
"card_fingerprint": null,
"nick_name": null,
"card_network": null,
"card_isin": null,
"card_issuer": null,
"card_type": null,
"saved_to_locker": true
}
},
"bank": null,
"created": "2025-02-18T09:49:08.273Z",
"requires_cvv": true,
"last_used_at": "2025-02-18T09:49:08.273Z",
"is_default": false,
"billing": null
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
b38a958a9218df2ae4b10c38ca81f4e862ebde3d
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7224
|
Bug: [BUG] Fix just run_v2
### Feature Description
A trait in Dynamic Routing wasn't feature gated, which led to the command `just run_v2` not working.
This is to be fixed
### Possible Implementation
Just have to feature gate the trait
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index a08f80354bf..6a21dddc066 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -2,9 +2,11 @@
//!
//! Functions that are used to perform the retrieval of merchant's
//! routing dict, configs, defaults
+use std::fmt::Debug;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use std::str::FromStr;
-use std::{fmt::Debug, sync::Arc};
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
+use std::sync::Arc;
use api_models::routing as routing_types;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
@@ -13,7 +15,7 @@ use common_utils::{ext_traits::Encode, id_type, types::keymanager::KeyManagerSta
use diesel_models::configs;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use diesel_models::dynamic_routing_stats::DynamicRoutingStatsNew;
-#[cfg(feature = "v1")]
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use diesel_models::routing_algorithm;
use error_stack::ResultExt;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
@@ -21,14 +23,16 @@ use external_services::grpc_client::dynamic_routing::{
contract_routing_client::ContractBasedDynamicRouting,
success_rate_client::SuccessBasedDynamicRouting,
};
-#[cfg(feature = "v1")]
+#[cfg(all(feature = "dynamic_routing", 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"))]
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use router_env::{instrument, tracing};
use rustc_hash::FxHashSet;
-use storage_impl::redis::cache::{self, Cacheable};
+use storage_impl::redis::cache;
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
+use storage_impl::redis::cache::Cacheable;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use crate::db::errors::StorageErrorExt;
@@ -41,7 +45,7 @@ use crate::{
types::{domain, storage},
utils::StringExt,
};
-#[cfg(feature = "v1")]
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use crate::{core::metrics as core_metrics, types::transformers::ForeignInto};
pub const SUCCESS_BASED_DYNAMIC_ROUTING_ALGORITHM: &str =
"Success rate based dynamic routing algorithm";
@@ -566,6 +570,7 @@ pub fn get_default_config_key(
}
}
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
#[async_trait::async_trait]
pub trait DynamicRoutingCache {
async fn get_cached_dynamic_routing_config_for_profile(
@@ -584,6 +589,7 @@ pub trait DynamicRoutingCache {
Fut: futures::Future<Output = errors::CustomResult<T, errors::StorageError>> + Send;
}
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
#[async_trait::async_trait]
impl DynamicRoutingCache for routing_types::SuccessBasedRoutingConfig {
async fn get_cached_dynamic_routing_config_for_profile(
@@ -620,6 +626,7 @@ impl DynamicRoutingCache for routing_types::SuccessBasedRoutingConfig {
}
}
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
#[async_trait::async_trait]
impl DynamicRoutingCache for routing_types::ContractBasedRoutingConfig {
async fn get_cached_dynamic_routing_config_for_profile(
@@ -1502,7 +1509,7 @@ where
Ok(ApplicationResponse::Json(updated_routing_record))
}
-#[cfg(feature = "v1")]
+#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
#[instrument(skip_all)]
pub async fn default_specific_dynamic_routing_setup(
state: &SessionState,
|
2025-02-08T07:19:30Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
The command `just run_v2` errored out due to missing feature flags on Dynamic Routing trait.
This PR fixes that.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
v2 server should run
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
90ea0764aeb8524cac88031e1e887966a5c4fa76
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7222
|
Bug: [BUG] Void Reason accepted as string for Nmi
### Bug Description
We were accepting void_reason as string, but since Nmi accepts specific values for void_reason.
### Expected Behavior
Enum should be created for void_reason.
### Actual Behavior
If cancellation_request is passed as any random string, the request fails.
### Steps To Reproduce
Create a cancellation request for Nmi with cancellation_reason as a random string.
### Context For The Bug
_No response_
### Environment
Integ, Sandbox, Prod
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 1e8b745107d..d6f1cb1962f 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -783,19 +783,43 @@ pub struct NmiCancelRequest {
pub transaction_type: TransactionType,
pub security_key: Secret<String>,
pub transactionid: String,
- pub void_reason: Option<String>,
+ pub void_reason: NmiVoidReason,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub enum NmiVoidReason {
+ Fraud,
+ UserCancel,
+ IccRejected,
+ IccCardRemoved,
+ IccNoConfirmation,
+ PosTimeout,
}
impl TryFrom<&types::PaymentsCancelRouterData> for NmiCancelRequest {
type Error = Error;
fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
let auth = NmiAuthType::try_from(&item.connector_auth_type)?;
- Ok(Self {
- transaction_type: TransactionType::Void,
- security_key: auth.api_key,
- transactionid: item.request.connector_transaction_id.clone(),
- void_reason: item.request.cancellation_reason.clone(),
- })
+ match &item.request.cancellation_reason {
+ Some(cancellation_reason) => {
+ let void_reason: NmiVoidReason = serde_json::from_str(&format!("\"{}\"", cancellation_reason))
+ .map_err(|_| errors::ConnectorError::NotSupported {
+ message: format!("Json deserialise error: unknown variant `{}` expected to be one of `fraud`, `user_cancel`, `icc_rejected`, `icc_card_removed`, `icc_no_confirmation`, `pos_timeout`. This cancellation_reason", cancellation_reason),
+ connector: "nmi"
+ })?;
+ Ok(Self {
+ transaction_type: TransactionType::Void,
+ security_key: auth.api_key,
+ transactionid: item.request.connector_transaction_id.clone(),
+ void_reason,
+ })
+ }
+ None => Err(errors::ConnectorError::MissingRequiredField {
+ field_name: "cancellation_reason",
+ }
+ .into()),
+ }
}
}
|
2025-02-07T13:30:40Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Previously, we were accepting void_reason as string, but since Nmi accepts specific values for void_reason, those values have been added to an enum.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Issue Link: https://github.com/juspay/hyperswitch/issues/7222
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
**Postman Tests**
**1. Create Payment**
-Request
```
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_XtFublrRhWIHc7iuKjgQtABwUOjTGaEujjdXNQLUs8cI4xaPZiS4YOAO6gMjQ8fK' \
--data-raw '{
"amount": 3000,
"currency": "USD",
"confirm": true,
"capture_method": "manual",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 3000,
"customer_id": "StripeCustomer",
"email": "guest@example.com",
"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": "4100000000000100",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "410"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "someone",
"last_name": "happy"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "someone",
"last_name": "happy"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
-Response
```
{
"payment_id": "pay_uPyEZvr3oVAvYsVvZ0jN",
"merchant_id": "postman_merchant_GHAction_dd590ad1-bf12-47a6-bde5-586f878b3ba1",
"status": "processing",
"amount": 3000,
"net_amount": 3000,
"shipping_cost": null,
"amount_capturable": 3000,
"amount_received": null,
"connector": "nmi",
"client_secret": "pay_uPyEZvr3oVAvYsVvZ0jN_secret_9j87TpZlvvlMpSC5eFDq",
"created": "2025-02-10T04:51:56.569Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0100",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "410000",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_hdl9v3A1JuIvmH2tO02R",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1739163116,
"expires": 1739166716,
"secret": "epk_515db508176144d8a80582b802c6da31"
},
"manual_retry_allowed": false,
"connector_transaction_id": "10396960775",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_uPyEZvr3oVAvYsVvZ0jN_1",
"payment_link": null,
"profile_id": "pro_qonNkZSegDkXycMtUZsb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EtKPhtxukFIa5pSEBtsO",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-10T05:06:56.569Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-10T04:51:59.965Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**2. Psync**
-Request
```
curl --location 'localhost:8080/payments/pay_uPyEZvr3oVAvYsVvZ0jN?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_XtFublrRhWIHc7iuKjgQtABwUOjTGaEujjdXNQLUs8cI4xaPZiS4YOAO6gMjQ8fK'
```
-Response
```
{
"payment_id": "pay_uPyEZvr3oVAvYsVvZ0jN",
"merchant_id": "postman_merchant_GHAction_dd590ad1-bf12-47a6-bde5-586f878b3ba1",
"status": "requires_capture",
"amount": 3000,
"net_amount": 3000,
"shipping_cost": null,
"amount_capturable": 3000,
"amount_received": null,
"connector": "nmi",
"client_secret": "pay_uPyEZvr3oVAvYsVvZ0jN_secret_9j87TpZlvvlMpSC5eFDq",
"created": "2025-02-10T04:51:56.569Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0100",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "410000",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_hdl9v3A1JuIvmH2tO02R",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "10396960775",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_uPyEZvr3oVAvYsVvZ0jN_1",
"payment_link": null,
"profile_id": "pro_qonNkZSegDkXycMtUZsb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EtKPhtxukFIa5pSEBtsO",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-10T05:06:56.569Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-10T04:54:48.886Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**3. Cancel (Invalid Cancellation Reason)**
-Request
```
curl --location 'localhost:8080/payments/pay_uPyEZvr3oVAvYsVvZ0jN/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_XtFublrRhWIHc7iuKjgQtABwUOjTGaEujjdXNQLUs8cI4xaPZiS4YOAO6gMjQ8fK' \
--data '{
"cancellation_reason": "abcde"
}'
```
-Response
```
{
"error": {
"type": "invalid_request",
"message": "Payment method type not supported",
"code": "IR_19",
"reason": "Json deserialise error: unknown variant `abcde` expected to be one of `fraud`, `user_cancel`, `icc_rejected`, `icc_card_removed`, `icc_no_confirmation`, `pos_timeout`. This cancellation_reason is not supported by nmi"
}
}
```
**4. Cancel (Valid Cancellation Reason)**
-Request
```
curl --location 'localhost:8080/payments/pay_uPyEZvr3oVAvYsVvZ0jN/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_XtFublrRhWIHc7iuKjgQtABwUOjTGaEujjdXNQLUs8cI4xaPZiS4YOAO6gMjQ8fK' \
--data '{
"cancellation_reason": "fraud"
}'
```
-Response
```
{
"payment_id": "pay_uPyEZvr3oVAvYsVvZ0jN",
"merchant_id": "postman_merchant_GHAction_dd590ad1-bf12-47a6-bde5-586f878b3ba1",
"status": "processing",
"amount": 3000,
"net_amount": 3000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "nmi",
"client_secret": "pay_uPyEZvr3oVAvYsVvZ0jN_secret_9j87TpZlvvlMpSC5eFDq",
"created": "2025-02-10T04:51:56.569Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0100",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "410000",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_hdl9v3A1JuIvmH2tO02R",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": "fraud",
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "10396960775",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_uPyEZvr3oVAvYsVvZ0jN_1",
"payment_link": null,
"profile_id": "pro_qonNkZSegDkXycMtUZsb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EtKPhtxukFIa5pSEBtsO",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-10T05:06:56.569Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-10T04:58:20.070Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**5. Psync**
-Request
```
curl --location 'localhost:8080/payments/pay_uPyEZvr3oVAvYsVvZ0jN?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_XtFublrRhWIHc7iuKjgQtABwUOjTGaEujjdXNQLUs8cI4xaPZiS4YOAO6gMjQ8fK'
```
-Response
```
{
"payment_id": "pay_uPyEZvr3oVAvYsVvZ0jN",
"merchant_id": "postman_merchant_GHAction_dd590ad1-bf12-47a6-bde5-586f878b3ba1",
"status": "cancelled",
"amount": 3000,
"net_amount": 3000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "nmi",
"client_secret": "pay_uPyEZvr3oVAvYsVvZ0jN_secret_9j87TpZlvvlMpSC5eFDq",
"created": "2025-02-10T04:51:56.569Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0100",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "410000",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_hdl9v3A1JuIvmH2tO02R",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "someone",
"last_name": "happy"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": "fraud",
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "10396960775",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_uPyEZvr3oVAvYsVvZ0jN_1",
"payment_link": null,
"profile_id": "pro_qonNkZSegDkXycMtUZsb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_EtKPhtxukFIa5pSEBtsO",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-10T05:06:56.569Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-10T04:59:47.927Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**Cypress Test Screenshots**
**No3DSAutoCapture**

**No3DSManualCapture**

**3DSAutoCapture**

**3DSManualCapture**

**Refund**

**Void**

**Headless Tests**

Note: Please note that subsequent cypress tests for the same flows might fail because NMI has a validation from their end which prevents duplicate transactions from going through, and throws an error similar to "Duplicate transaction REFID:198369517" for the same.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
9f334c1ebcf0e8ee15ae2af608fb8f27fab2a6b2
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7217
|
Bug: feat(core): add api for hypersense integration
# Hypersense
### Description:
#### An AI Ops tool build for Payments Cost Observability
- Monitor your overall transaction payment-related costs across multiple regions, PSPs, and businesses.
- Obtain actionable insights to optimise costs, track cost deviations, and effectively audit PSP invoices.
Learn more: [Hypersense site](https://www.hypersense.io/)
## Purpose of Change
To integrate hypersense with hyperswitch dashboard.
## Proposed Changes
- add endpoints for, get `token`, `verify_token` and `signout` for `hypersense` integration.
- limit the scope of the use of token by introducing a new type of token, `ExternalToken`
containing enum `ExternalServiceType`
## Additional Changes
#### `external_service_auth` module and `ExternalToken`
- `external_service_auth` is a generic service used to issue, verify and invalidate `ExternalToken`,
which can be associated with an external service using the enum field `external_service_type: ExternalServiceType` in the `ExternalToken`.
- Essentially a new service can be integrated by simply creating routes and handlers, and calling the same core functions
specified in `external_service_auth` modules.
|
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index 2124ff1aff9..9a2a0ca8396 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -2,6 +2,7 @@ pub mod apple_pay_certificates_migration;
pub mod connector_onboarding;
pub mod customer;
pub mod dispute;
+pub mod external_service_auth;
pub mod gsm;
mod locker_migration;
pub mod payment;
diff --git a/crates/api_models/src/events/external_service_auth.rs b/crates/api_models/src/events/external_service_auth.rs
new file mode 100644
index 00000000000..31196150b2c
--- /dev/null
+++ b/crates/api_models/src/events/external_service_auth.rs
@@ -0,0 +1,30 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::external_service_auth::{
+ ExternalSignoutTokenRequest, ExternalTokenResponse, ExternalVerifyTokenRequest,
+ ExternalVerifyTokenResponse,
+};
+
+impl ApiEventMetric for ExternalTokenResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ExternalServiceAuth)
+ }
+}
+
+impl ApiEventMetric for ExternalVerifyTokenRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ExternalServiceAuth)
+ }
+}
+
+impl ApiEventMetric for ExternalVerifyTokenResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ExternalServiceAuth)
+ }
+}
+
+impl ApiEventMetric for ExternalSignoutTokenRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ExternalServiceAuth)
+ }
+}
diff --git a/crates/api_models/src/external_service_auth.rs b/crates/api_models/src/external_service_auth.rs
new file mode 100644
index 00000000000..775529c4359
--- /dev/null
+++ b/crates/api_models/src/external_service_auth.rs
@@ -0,0 +1,35 @@
+use common_utils::{id_type, pii};
+use masking::Secret;
+
+#[derive(Debug, serde::Serialize)]
+pub struct ExternalTokenResponse {
+ pub token: Secret<String>,
+}
+#[derive(Debug, serde::Serialize, serde::Deserialize)]
+pub struct ExternalVerifyTokenRequest {
+ pub token: Secret<String>,
+}
+
+#[derive(Debug, serde::Serialize, serde::Deserialize)]
+pub struct ExternalSignoutTokenRequest {
+ pub token: Secret<String>,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(untagged)]
+pub enum ExternalVerifyTokenResponse {
+ Hypersense {
+ user_id: String,
+ merchant_id: id_type::MerchantId,
+ name: Secret<String>,
+ email: pii::Email,
+ },
+}
+
+impl ExternalVerifyTokenResponse {
+ pub fn get_user_id(&self) -> &str {
+ match self {
+ Self::Hypersense { user_id, .. } => user_id,
+ }
+ }
+}
diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index 60d1d11f27d..03df84a9d74 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -16,6 +16,7 @@ pub mod ephemeral_key;
#[cfg(feature = "errors")]
pub mod errors;
pub mod events;
+pub mod external_service_auth;
pub mod feature_matrix;
pub mod files;
pub mod gsm;
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 2e90d646e9e..556090858fb 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -99,6 +99,7 @@ pub enum ApiEventsType {
ApplePayCertificatesMigration,
FraudCheck,
Recon,
+ ExternalServiceAuth,
Dispute {
dispute_id: String,
},
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index c22cecc20f9..18b3ad14358 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -18,6 +18,7 @@ pub mod customers;
pub mod disputes;
pub mod encryption;
pub mod errors;
+pub mod external_service_auth;
pub mod files;
#[cfg(feature = "frm")]
pub mod fraud_check;
diff --git a/crates/router/src/core/external_service_auth.rs b/crates/router/src/core/external_service_auth.rs
new file mode 100644
index 00000000000..92c8f5b249d
--- /dev/null
+++ b/crates/router/src/core/external_service_auth.rs
@@ -0,0 +1,94 @@
+use api_models::external_service_auth as external_service_auth_api;
+use common_utils::fp_utils;
+use error_stack::ResultExt;
+use masking::ExposeInterface;
+
+use crate::{
+ core::errors::{self, RouterResponse},
+ services::{
+ api as service_api,
+ authentication::{self, ExternalServiceType, ExternalToken},
+ },
+ SessionState,
+};
+
+pub async fn generate_external_token(
+ state: SessionState,
+ user: authentication::UserFromToken,
+ external_service_type: ExternalServiceType,
+) -> RouterResponse<external_service_auth_api::ExternalTokenResponse> {
+ let token = ExternalToken::new_token(
+ user.user_id.clone(),
+ user.merchant_id.clone(),
+ &state.conf,
+ external_service_type.clone(),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable_lazy(|| {
+ format!(
+ "Failed to create external token for params [user_id, mid, external_service_type] [{}, {:?}, {:?}]",
+ user.user_id, user.merchant_id, external_service_type,
+ )
+ })?;
+
+ Ok(service_api::ApplicationResponse::Json(
+ external_service_auth_api::ExternalTokenResponse {
+ token: token.into(),
+ },
+ ))
+}
+
+pub async fn signout_external_token(
+ state: SessionState,
+ json_payload: external_service_auth_api::ExternalSignoutTokenRequest,
+) -> RouterResponse<()> {
+ let token = authentication::decode_jwt::<ExternalToken>(&json_payload.token.expose(), &state)
+ .await
+ .change_context(errors::ApiErrorResponse::Unauthorized)?;
+
+ authentication::blacklist::insert_user_in_blacklist(&state, &token.user_id)
+ .await
+ .change_context(errors::ApiErrorResponse::InvalidJwtToken)?;
+
+ Ok(service_api::ApplicationResponse::StatusOk)
+}
+
+pub async fn verify_external_token(
+ state: SessionState,
+ json_payload: external_service_auth_api::ExternalVerifyTokenRequest,
+ external_service_type: ExternalServiceType,
+) -> RouterResponse<external_service_auth_api::ExternalVerifyTokenResponse> {
+ let token_from_payload = json_payload.token.expose();
+
+ let token = authentication::decode_jwt::<ExternalToken>(&token_from_payload, &state)
+ .await
+ .change_context(errors::ApiErrorResponse::Unauthorized)?;
+
+ fp_utils::when(
+ authentication::blacklist::check_user_in_blacklist(&state, &token.user_id, token.exp)
+ .await?,
+ || Err(errors::ApiErrorResponse::InvalidJwtToken),
+ )?;
+
+ token.check_service_type(&external_service_type)?;
+
+ let user_in_db = state
+ .global_store
+ .find_user_by_id(&token.user_id)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("User not found in database")?;
+
+ let email = user_in_db.email.clone();
+ let name = user_in_db.name;
+
+ Ok(service_api::ApplicationResponse::Json(
+ external_service_auth_api::ExternalVerifyTokenResponse::Hypersense {
+ user_id: user_in_db.user_id,
+ merchant_id: token.merchant_id,
+ name,
+ email,
+ },
+ ))
+}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 9b43d7f2b16..18e8e7cdccf 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -144,6 +144,7 @@ pub fn mk_app(
.service(routes::MerchantConnectorAccount::server(state.clone()))
.service(routes::RelayWebhooks::server(state.clone()))
.service(routes::Webhooks::server(state.clone()))
+ .service(routes::Hypersense::server(state.clone()))
.service(routes::Relay::server(state.clone()));
#[cfg(feature = "oltp")]
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index 80906570d7c..b589d4755f8 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -23,6 +23,7 @@ pub mod files;
pub mod fraud_check;
pub mod gsm;
pub mod health;
+pub mod hypersense;
pub mod lock_utils;
#[cfg(feature = "v1")]
pub mod locker_migration;
@@ -69,9 +70,9 @@ pub use self::app::PaymentMethodsSession;
pub use self::app::Recon;
pub use self::app::{
ApiKeys, AppState, ApplePayCertificatesMigration, Cache, Cards, Configs, ConnectorOnboarding,
- Customers, Disputes, EphemeralKey, FeatureMatrix, Files, Forex, Gsm, Health, Mandates,
- MerchantAccount, MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll,
- Profile, ProfileNew, Refunds, Relay, RelayWebhooks, SessionState, User, Webhooks,
+ Customers, Disputes, EphemeralKey, FeatureMatrix, Files, Forex, Gsm, Health, Hypersense,
+ Mandates, MerchantAccount, MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments,
+ Poll, Profile, ProfileNew, Refunds, Relay, RelayWebhooks, SessionState, User, Webhooks,
};
#[cfg(feature = "olap")]
pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents};
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index c5e1f8a1082..f69f17e5ed8 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -85,6 +85,7 @@ pub use crate::{
use crate::{
configs::{secrets_transformers, Settings},
db::kafka_store::{KafkaStore, TenantID},
+ routes::hypersense as hypersense_routes,
};
#[derive(Clone)]
@@ -1311,6 +1312,27 @@ impl Recon {
}
}
+pub struct Hypersense;
+
+impl Hypersense {
+ pub fn server(state: AppState) -> Scope {
+ web::scope("/hypersense")
+ .app_data(web::Data::new(state))
+ .service(
+ web::resource("/token")
+ .route(web::get().to(hypersense_routes::get_hypersense_token)),
+ )
+ .service(
+ web::resource("/verify_token")
+ .route(web::post().to(hypersense_routes::verify_hypersense_token)),
+ )
+ .service(
+ web::resource("/signout")
+ .route(web::post().to(hypersense_routes::signout_hypersense_token)),
+ )
+ }
+}
+
#[cfg(feature = "olap")]
pub struct Blocklist;
diff --git a/crates/router/src/routes/hypersense.rs b/crates/router/src/routes/hypersense.rs
new file mode 100644
index 00000000000..a018dfa6605
--- /dev/null
+++ b/crates/router/src/routes/hypersense.rs
@@ -0,0 +1,76 @@
+use actix_web::{web, HttpRequest, HttpResponse};
+use api_models::external_service_auth as external_service_auth_api;
+use router_env::Flow;
+
+use super::AppState;
+use crate::{
+ core::{api_locking, external_service_auth},
+ services::{
+ api,
+ authentication::{self, ExternalServiceType},
+ },
+};
+
+pub async fn get_hypersense_token(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
+ let flow = Flow::HypersenseTokenRequest;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ (),
+ |state, user, _, _| {
+ external_service_auth::generate_external_token(
+ state,
+ user,
+ ExternalServiceType::Hypersense,
+ )
+ },
+ &authentication::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn signout_hypersense_token(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<external_service_auth_api::ExternalSignoutTokenRequest>,
+) -> HttpResponse {
+ let flow = Flow::HypersenseSignoutToken;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &http_req,
+ json_payload.into_inner(),
+ |state, _: (), json_payload, _| {
+ external_service_auth::signout_external_token(state, json_payload)
+ },
+ &authentication::NoAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn verify_hypersense_token(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<external_service_auth_api::ExternalVerifyTokenRequest>,
+) -> HttpResponse {
+ let flow = Flow::HypersenseVerifyToken;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &http_req,
+ json_payload.into_inner(),
+ |state, _: (), json_payload, _| {
+ external_service_auth::verify_external_token(
+ state,
+ json_payload,
+ ExternalServiceType::Hypersense,
+ )
+ },
+ &authentication::NoAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index ce9dda97c9f..a50a27b9ec4 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -39,6 +39,7 @@ pub enum ApiIdentifier {
ApplePayCertificatesMigration,
Relay,
Documentation,
+ Hypersense,
PaymentMethodsSession,
}
@@ -311,6 +312,10 @@ impl From<Flow> for ApiIdentifier {
Flow::FeatureMatrix => Self::Documentation,
+ Flow::HypersenseTokenRequest
+ | Flow::HypersenseVerifyToken
+ | Flow::HypersenseSignoutToken => Self::Hypersense,
+
Flow::PaymentMethodSessionCreate
| Flow::PaymentMethodSessionRetrieve
| Flow::PaymentMethodSessionUpdateSavedPaymentMethod => Self::PaymentMethodsSession,
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index edf127ac30f..502ebb5099f 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -13,9 +13,7 @@ use api_models::payouts;
use api_models::{payment_methods::PaymentMethodListRequest, payments};
use async_trait::async_trait;
use common_enums::TokenPurpose;
-#[cfg(feature = "v2")]
-use common_utils::fp_utils;
-use common_utils::{date_time, id_type};
+use common_utils::{date_time, fp_utils, id_type};
#[cfg(feature = "v2")]
use diesel_models::ephemeral_key;
use error_stack::{report, ResultExt};
@@ -195,6 +193,13 @@ impl AuthenticationType {
}
}
+#[derive(Clone, Debug, Eq, PartialEq, Serialize, serde::Deserialize, strum::Display)]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum ExternalServiceType {
+ Hypersense,
+}
+
#[cfg(feature = "olap")]
#[derive(Clone, Debug)]
pub struct UserFromSinglePurposeToken {
@@ -3857,3 +3862,44 @@ impl ReconToken {
jwt::generate_jwt(&token_payload, settings).await
}
}
+#[derive(serde::Serialize, serde::Deserialize)]
+pub struct ExternalToken {
+ pub user_id: String,
+ pub merchant_id: id_type::MerchantId,
+ pub exp: u64,
+ pub external_service_type: ExternalServiceType,
+}
+
+impl ExternalToken {
+ pub async fn new_token(
+ user_id: String,
+ merchant_id: id_type::MerchantId,
+ settings: &Settings,
+ external_service_type: ExternalServiceType,
+ ) -> 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();
+
+ let token_payload = Self {
+ user_id,
+ merchant_id,
+ exp,
+ external_service_type,
+ };
+ jwt::generate_jwt(&token_payload, settings).await
+ }
+
+ pub fn check_service_type(
+ &self,
+ required_service_type: &ExternalServiceType,
+ ) -> RouterResult<()> {
+ Ok(fp_utils::when(
+ &self.external_service_type != required_service_type,
+ || {
+ Err(errors::ApiErrorResponse::AccessForbidden {
+ resource: required_service_type.to_string(),
+ })
+ },
+ )?)
+ }
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index b88effea34f..3eda63bdbaa 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -543,6 +543,12 @@ pub enum Flow {
RelayRetrieve,
/// Incoming Relay Webhook Receive
IncomingRelayWebhookReceive,
+ /// Generate Hypersense Token
+ HypersenseTokenRequest,
+ /// Verify Hypersense Token
+ HypersenseVerifyToken,
+ /// Signout Hypersense Token
+ HypersenseSignoutToken,
/// Payment Method Session Create
PaymentMethodSessionCreate,
/// Payment Method Session Retrieve
|
2025-02-07T11:38:25Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
#### Endpoints
- GET `hypersense/token` (returns hypersense token).
- POST `hypersense/verify_token` (verifies the token passed as payload).
- POST `hypersense/signout` (invalidates the token).
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
#### `external_service_auth` module and `ExternalToken`
- `external_service_auth` is a generic service used to issue, verify and invalidate `ExternalToken`,
which can be associated with an external service using the enum field `external_service_type: ExternalServiceType` in the `ExternalToken`.
- Essentially a new service can be integrated by simply creating routes and handlers, and calling the same core functions
specified in `external_service_auth` modules.
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
### Hypersense
#### Description:
##### An AI Ops tool build for Payments Cost Observability
- Monitor your overall transaction payment-related costs across multiple regions, PSPs, and businesses.
- Obtain actionable insights to optimise costs, track cost deviations, and effectively audit PSP invoices.
Learn more: [Hypersense site](https://www.hypersense.io/)
#### Purpose of Change
To integrate hypersense with hyperswitch dashboard.
## Fixes #7217
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. get the hypersense_token from the response by hitting this curl.
```sh
curl --location '<BASE_URL>/hypersense/token' \
--header 'Authorization: Bearer <TOKEN>'
```
2. using the token obtained above try hitting this to verify.
```sh
curl --location '<BASE_URL>/hypersense/verify_token' \
--header 'Content-Type: application/json' \
--data '{
"token": "<HYPERSENSE_TOKEN>"
}'
```
3. signout to invalidate this token
```sh
curl --location '<BASE_URL>//hypersense/signout' \
--header 'Content-Type: application/json' \
--data '{
"token": "<HYPERSENSE_TOKEN>"
}'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
90ea0764aeb8524cac88031e1e887966a5c4fa76
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7198
|
Bug: [BUG] Incorrect mapping of attempt status in NMI connector
### Bug Description
When the payment status is `processing`, the backend was returning an incorrect error message. The message incorrectly stated that the issue was with the capture method, whereas it should indicate that the payment status
is `processing` and the expected states are `requires_capture` or `partially_captured_and_capturable`. It is due to the incorrect mapping of one of the attempt status in NMI connector.
This fix ensures the correct error message is displayed.
Payments - Create:
<img width="1644" alt="Image" src="https://github.com/user-attachments/assets/a3c9e22d-a6d7-41fa-a07b-e693d1775499" />
Payments - Capture:
<img width="1601" alt="Image" src="https://github.com/user-attachments/assets/2a7e0363-d15a-4a20-af9b-8fcc1143ac27" />
### Expected Behavior
it should return an error indicating that the payment status is `processing` and the expected states are `requires_capture` or `partially_captured_and_capturable`.
Payments - Create:
<img width="1644" alt="Image" src="https://github.com/user-attachments/assets/a0e2ac87-a749-4c11-8c0f-e5ff661faadf" />
Payments - Capture:
<img width="1604" alt="Image" src="https://github.com/user-attachments/assets/664cf433-497e-4554-ae54-35cc03a3057b" />
### Actual Behavior
It actually returned an incorrect error message stating that the issue was with the capture method.
Payments - Create:
<img width="1644" alt="Image" src="https://github.com/user-attachments/assets/47249be9-1354-4b36-9ffd-6dd0d4d4175d" />
Payments - Capture:
<img width="1601" alt="Image" src="https://github.com/user-attachments/assets/4c76a4c1-6b55-4f8a-a5c7-69262ce1edcf" />
### Steps To Reproduce
1. Payment Connector - Create
Request -
```
curl --location 'http://localhost:8080/account/:merchant_id/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
"connector_type": "payment_processor",
"connector_name": "nmi",
"connector_account_details": {
"auth_type": "BodyKey",
"api_key": "API KEY",
"key1": "KEY1"
},
"test_mode": true,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
},
{
"payment_method_type": "debit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
}
]
}
],
"metadata": {
"city": "NY",
"unit": "245"
},
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret"
},
"business_country": "US",
"business_label": "default"
}'
```
2. Payments - Create
Request -
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "manual",
"customer_id": "StripeCustomer",
"email": "guest@example.com",
"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": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
}
},
"shipping": {
"address": {
"line1": "123",
"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"
}
}'
```
3. Payments - Capture
Request -
```
curl --location 'http://localhost:8080/payments/pay_nbmtZ5WEPRqu5YrSFf1c/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
"amount_to_capture": 6540
}'
```
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution: Mac
2. Rust version (output of `rustc --version`): `1.83.0`
3. App version (output of `cargo r --features vergen -- --version`): `router 2025.01.27.0-30-ge0ec27d-dirty-e0ec27d-2025-02-05T09:54:57.000000000Z`
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 19f03cb1b2c..473901f007d 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -910,7 +910,7 @@ impl TryFrom<types::PaymentsResponseRouterData<StandardResponse>>
{
enums::AttemptStatus::CaptureInitiated
} else {
- enums::AttemptStatus::Authorizing
+ enums::AttemptStatus::Authorized
},
),
Response::Declined | Response::Error => (
|
2025-02-05T21:11:50Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
After making a `capture` call following the `Payments-Create` call, the backend was returning an incorrect error message, incorrectly indicating an issue with the `capture_method`. This is because, after the `Payments-Create` call, the payment status was being set to `processing` instead of `requires_capture` due to an incorrect mapping of an attempt status in the NMI connector. This fix ensures that the correct payment status is displayed.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
1. Payments Connector - Create (NMI)
Request -
```
curl --location 'http://localhost:8080/account/:merchant_id/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
"connector_type": "payment_processor",
"connector_name": "nmi",
"connector_account_details": {
"auth_type": "BodyKey",
"api_key": "API KEY",
"key1": "KEY1"
},
"test_mode": true,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
},
{
"payment_method_type": "debit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
}
]
}
],
"metadata": {
"city": "NY",
"unit": "245"
},
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret"
},
"business_country": "US",
"business_label": "default"
}'
```
Response -
```
{
"connector_type": "payment_processor",
"connector_name": "nmi",
"connector_label": "nmi_US_default",
"merchant_connector_id": "mca_lSdgOhqb7xkLIwFG5RmF",
"profile_id": "pro_8TCRT4W0cFxSiwrX6UZX",
"connector_account_details": {
"auth_type": "BodyKey",
"api_key": "8Y****************************Sm",
"key1": "ch********************************************59"
},
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"payment_experience": null,
"card_networks": [
"Visa",
"Mastercard"
],
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
},
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "debit",
"payment_experience": null,
"card_networks": [
"Visa",
"Mastercard"
],
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
},
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
}
],
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret",
"additional_secret": null
},
"metadata": {
"city": "NY",
"unit": "245"
},
"test_mode": true,
"disabled": false,
"frm_configs": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null
}
```
2. Payments - Create
Request -
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "manual",
"customer_id": "StripeCustomer",
"email": "guest@example.com",
"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": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
}
},
"shipping": {
"address": {
"line1": "123",
"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"
}
}'
```
Response -
```
{
"payment_id": "pay_nbmtZ5WEPRqu5YrSFf1c",
"merchant_id": "merchant_1738782997",
"status": "requires_capture",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 6540,
"amount_received": null,
"connector": "nmi",
"client_secret": "pay_nbmtZ5WEPRqu5YrSFf1c_secret_q4r6QTPpGIfAFzq1pTSQ",
"created": "2025-02-05T19:16:45.353Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": null,
"email": "guest@example.com",
"phone": null,
"phone_country_code": null
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0026",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "401200",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_E4a0G0TyXfI9zRhUKhdt",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "123",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": null
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1738783005,
"expires": 1738786605,
"secret": "epk_9e27e24364464098900da2a7c078d441"
},
"manual_retry_allowed": false,
"connector_transaction_id": "10384074477",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_nbmtZ5WEPRqu5YrSFf1c_1",
"payment_link": null,
"profile_id": "pro_8TCRT4W0cFxSiwrX6UZX",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_lSdgOhqb7xkLIwFG5RmF",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-05T19:31:45.353Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-05T19:16:49.957Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
3. Payments - Capture
Request -
```
curl --location 'http://localhost:8080/payments/pay_WjH16MusMwAlPgWjbkqt/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
"amount_to_capture": 65400
}'
```
Response -
```
{
"error": {
"type": "invalid_request",
"message": "amount_to_capture is greater than amount",
"code": "IR_06"
}
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3da637e6960f73a3a69aef98b9de2e6de01fcb5e
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7212
|
Bug: feat(connector): add template code for stripebilling
add a template code for stripe billing connector
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 641c06b366e..b653b099733 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -263,6 +263,7 @@ square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
+stripebilling.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/"
@@ -336,6 +337,7 @@ cards = [
"square",
"stax",
"stripe",
+ "stripebilling",
"threedsecureio",
"thunes",
"worldpay",
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index af2c7500add..8ca1b7bed19 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -109,6 +109,7 @@ square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
+stripebilling.base_url = "https://api.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/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index e79bb79f8fa..2bf69f793d2 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -113,6 +113,7 @@ square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
+stripebilling.base_url = "https://api.stripe.com/"
taxjar.base_url = "https://api.taxjar.com/v2/"
thunes.base_url = "https://api.limonetik.com/"
trustpay.base_url = "https://tpgw.trustpay.eu/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 67682388d4a..c26bc180cb7 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -113,6 +113,7 @@ square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
stripe.base_url_file_upload = "https://files.stripe.com/"
+stripebilling.base_url = "https://api.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/"
diff --git a/config/development.toml b/config/development.toml
index f5d258d4789..ab744e8eeb2 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -209,6 +209,7 @@ cards = [
"square",
"stax",
"stripe",
+ "stripebilling",
"taxjar",
"threedsecureio",
"thunes",
@@ -334,6 +335,7 @@ square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
+stripebilling.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/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 993ecaa0a06..48a925e7dcc 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -195,6 +195,7 @@ square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
+stripebilling.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/"
@@ -290,6 +291,7 @@ cards = [
"square",
"stax",
"stripe",
+ "stripebilling",
"taxjar",
"threedsecureio",
"thunes",
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index c65cd99d935..cadca5fad02 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -123,6 +123,7 @@ pub enum RoutableConnectors {
Square,
Stax,
Stripe,
+ //Stripebilling,
// Taxjar,
Trustpay,
// Thunes
@@ -263,6 +264,7 @@ pub enum Connector {
Square,
Stax,
Stripe,
+ // Stripebilling,
Taxjar,
Threedsecureio,
//Thunes,
@@ -410,6 +412,7 @@ impl Connector {
| Self::Shift4
| Self::Square
| Self::Stax
+ // | Self::Stripebilling
| Self::Taxjar
// | Self::Thunes
| Self::Trustpay
@@ -546,6 +549,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Square => Self::Square,
RoutableConnectors::Stax => Self::Stax,
RoutableConnectors::Stripe => Self::Stripe,
+ // RoutableConnectors::Stripebilling => Self::Stripebilling,
RoutableConnectors::Trustpay => Self::Trustpay,
RoutableConnectors::Tsys => Self::Tsys,
RoutableConnectors::Volt => Self::Volt,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 97a2bdb77bb..bf815d5c2ca 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -57,6 +57,7 @@ pub mod redsys;
pub mod shift4;
pub mod square;
pub mod stax;
+pub mod stripebilling;
pub mod taxjar;
pub mod thunes;
pub mod tsys;
@@ -83,8 +84,9 @@ pub use self::{
nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay, novalnet::Novalnet, nuvei::Nuvei,
paybox::Paybox, payeezy::Payeezy, paystack::Paystack, payu::Payu, placetopay::Placetopay,
powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay,
- redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes,
- tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
+ redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, stripebilling::Stripebilling,
+ taxjar::Taxjar, thunes::Thunes, tsys::Tsys,
+ unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen,
zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
new file mode 100644
index 00000000000..e05fb8b8e33
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -0,0 +1,573 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as stripebilling;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Stripebilling {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Stripebilling {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Stripebilling {}
+impl api::PaymentSession for Stripebilling {}
+impl api::ConnectorAccessToken for Stripebilling {}
+impl api::MandateSetup for Stripebilling {}
+impl api::PaymentAuthorize for Stripebilling {}
+impl api::PaymentSync for Stripebilling {}
+impl api::PaymentCapture for Stripebilling {}
+impl api::PaymentVoid for Stripebilling {}
+impl api::Refund for Stripebilling {}
+impl api::RefundExecute for Stripebilling {}
+impl api::RefundSync for Stripebilling {}
+impl api::PaymentToken for Stripebilling {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Stripebilling
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Stripebilling
+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 Stripebilling {
+ fn id(&self) -> &'static str {
+ "stripebilling"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.stripebilling.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = stripebilling::StripebillingAuthType::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: stripebilling::StripebillingErrorResponse = res
+ .response
+ .parse_struct("StripebillingErrorResponse")
+ .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 Stripebilling {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Stripebilling {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Stripebilling {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
+ for Stripebilling
+{
+}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData>
+ for Stripebilling
+{
+ 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 = stripebilling::StripebillingRouterData::from((amount, req));
+ let connector_req =
+ stripebilling::StripebillingPaymentsRequest::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: stripebilling::StripebillingPaymentsResponse = res
+ .response
+ .parse_struct("Stripebilling 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 Stripebilling {
+ 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: stripebilling::StripebillingPaymentsResponse = res
+ .response
+ .parse_struct("stripebilling 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 Stripebilling {
+ 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: stripebilling::StripebillingPaymentsResponse = res
+ .response
+ .parse_struct("Stripebilling 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 Stripebilling {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Stripebilling {
+ 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 =
+ stripebilling::StripebillingRouterData::from((refund_amount, req));
+ let connector_req =
+ stripebilling::StripebillingRefundRequest::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: stripebilling::RefundResponse = res
+ .response
+ .parse_struct("stripebilling 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 Stripebilling {
+ 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: stripebilling::RefundResponse = res
+ .response
+ .parse_struct("stripebilling 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 Stripebilling {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl ConnectorSpecifications for Stripebilling {}
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
new file mode 100644
index 00000000000..dcaa2474639
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -0,0 +1,232 @@
+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 StripebillingRouterData<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 StripebillingRouterData<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 StripebillingPaymentsRequest {
+ amount: StringMinorUnit,
+ card: StripebillingCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct StripebillingCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&StripebillingRouterData<&PaymentsAuthorizeRouterData>>
+ for StripebillingPaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &StripebillingRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = StripebillingCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct StripebillingAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for StripebillingAuthType {
+ 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 StripebillingPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<StripebillingPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: StripebillingPaymentStatus) -> Self {
+ match item {
+ StripebillingPaymentStatus::Succeeded => Self::Charged,
+ StripebillingPaymentStatus::Failed => Self::Failure,
+ StripebillingPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct StripebillingPaymentsResponse {
+ status: StripebillingPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, StripebillingPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, StripebillingPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct StripebillingRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&StripebillingRouterData<&RefundsRouterData<F>>> for StripebillingRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &StripebillingRouterData<&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 StripebillingErrorResponse {
+ 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 243afaa5f41..86bed027071 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -153,6 +153,7 @@ default_imp_for_authorize_session_token!(
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::UnifiedAuthenticationService,
connectors::Volt,
@@ -240,6 +241,7 @@ default_imp_for_calculate_tax!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Thunes,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -305,6 +307,7 @@ default_imp_for_session_update!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Mifinity,
connectors::Mollie,
@@ -392,6 +395,7 @@ default_imp_for_post_session_tokens!(
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Mifinity,
connectors::Mollie,
@@ -487,6 +491,7 @@ default_imp_for_complete_authorize!(
connectors::Redsys,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -573,6 +578,7 @@ default_imp_for_incremental_authorization!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -658,6 +664,7 @@ default_imp_for_create_customer!(
connectors::Redsys,
connectors::Shift4,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -737,6 +744,7 @@ default_imp_for_connector_redirect_response!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -816,6 +824,7 @@ default_imp_for_pre_processing_steps!(
connectors::Redsys,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -903,6 +912,7 @@ default_imp_for_post_processing_steps!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -991,6 +1001,7 @@ default_imp_for_approve!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1079,6 +1090,7 @@ default_imp_for_reject!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1167,6 +1179,7 @@ default_imp_for_webhook_source_verification!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1256,6 +1269,7 @@ default_imp_for_accept_dispute!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1344,6 +1358,7 @@ default_imp_for_submit_evidence!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1432,6 +1447,7 @@ default_imp_for_defend_dispute!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1529,6 +1545,7 @@ default_imp_for_file_upload!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1608,6 +1625,7 @@ default_imp_for_payouts!(
connectors::Shift4,
connectors::Square,
connectors::Stax,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -1696,6 +1714,7 @@ default_imp_for_payouts_create!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1785,6 +1804,7 @@ default_imp_for_payouts_retrieve!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1874,6 +1894,7 @@ default_imp_for_payouts_eligibility!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1962,6 +1983,7 @@ default_imp_for_payouts_fulfill!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2051,6 +2073,7 @@ default_imp_for_payouts_cancel!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2140,6 +2163,7 @@ default_imp_for_payouts_quote!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2229,6 +2253,7 @@ default_imp_for_payouts_recipient!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2318,6 +2343,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2408,6 +2434,7 @@ default_imp_for_frm_sale!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2498,6 +2525,7 @@ default_imp_for_frm_checkout!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2588,6 +2616,7 @@ default_imp_for_frm_transaction!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2678,6 +2707,7 @@ default_imp_for_frm_fulfillment!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2768,6 +2798,7 @@ default_imp_for_frm_record_return!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2854,6 +2885,7 @@ default_imp_for_revoking_mandates!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2942,6 +2974,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -3028,6 +3061,7 @@ default_imp_for_uas_post_authentication!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -3114,6 +3148,7 @@ default_imp_for_uas_authentication!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -3201,6 +3236,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 003c3cc46d1..ef339c22a4b 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -263,6 +263,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -352,6 +353,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -436,6 +438,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -525,6 +528,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -613,6 +617,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -702,6 +707,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -801,6 +807,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -892,6 +899,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -983,6 +991,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1074,6 +1083,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1165,6 +1175,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1256,6 +1267,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1347,6 +1359,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1438,6 +1451,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1529,6 +1543,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1618,6 +1633,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1709,6 +1725,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1800,6 +1817,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1891,6 +1909,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -1982,6 +2001,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2073,6 +2093,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
@@ -2161,6 +2182,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Tsys,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 4c4801801f0..5b46184c363 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -88,6 +88,7 @@ pub struct Connectors {
pub square: ConnectorParams,
pub stax: ConnectorParams,
pub stripe: ConnectorParamsWithFileUploadUrl,
+ pub stripebilling: ConnectorParams,
pub taxjar: ConnectorParams,
pub threedsecureio: ConnectorParams,
pub thunes: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index de9d86fdd79..c4720f60ff6 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -44,8 +44,9 @@ pub use hyperswitch_connectors::connectors::{
nuvei::Nuvei, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, paystack, paystack::Paystack,
payu, payu::Payu, placetopay, placetopay::Placetopay, powertranz, powertranz::Powertranz,
prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, redsys,
- redsys::Redsys, shift4, shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar,
- taxjar::Taxjar, thunes, thunes::Thunes, tsys, tsys::Tsys, unified_authentication_service,
+ redsys::Redsys, shift4, shift4::Shift4, square, square::Square, stax, stax::Stax,
+ stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, thunes, thunes::Thunes,
+ tsys, tsys::Tsys, unified_authentication_service,
unified_authentication_service::UnifiedAuthenticationService, volt, volt::Volt, wellsfargo,
wellsfargo::Wellsfargo, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit,
xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
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 997a40c9393..d19afa5368e 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1041,6 +1041,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Shift4,
connector::Taxjar,
connector::Trustpay,
@@ -1508,6 +1509,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Shift4,
connector::Taxjar,
connector::Trustpay,
@@ -1888,6 +1890,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Shift4,
connector::Taxjar,
connector::Trustpay,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index e9e3ea10cd6..af5b5e54cbe 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -467,6 +467,7 @@ default_imp_for_connector_request_id!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Taxjar,
connector::Threedsecureio,
connector::Trustpay,
@@ -1427,6 +1428,7 @@ default_imp_for_fraud_check!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Taxjar,
connector::Threedsecureio,
connector::Trustpay,
@@ -1965,6 +1967,7 @@ default_imp_for_connector_authentication!(
connector::Square,
connector::Stax,
connector::Stripe,
+ connector::Stripebilling,
connector::Taxjar,
connector::Trustpay,
connector::Tsys,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index d4b9d1eafce..a32e0457dfa 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -519,6 +519,7 @@ impl ConnectorData {
enums::Connector::Stripe => {
Ok(ConnectorEnum::Old(Box::new(connector::Stripe::new())))
}
+ // enums::Connector::Stripebilling => Ok(ConnectorEnum::Old(Box::new(connector::Stripebilling))),
enums::Connector::Wise => Ok(ConnectorEnum::Old(Box::new(connector::Wise::new()))),
enums::Connector::Worldline => {
Ok(ConnectorEnum::Old(Box::new(&connector::Worldline)))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 8938461eec4..4d90d9c8299 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -305,6 +305,7 @@ 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::Stripebilling => Self::Stripebilling,
// api_enums::Connector::Taxjar => Self::Taxjar,
// api_enums::Connector::Thunes => Self::Thunes,
api_enums::Connector::Trustpay => Self::Trustpay,
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index d0eb96efcc8..09718d56181 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -83,6 +83,7 @@ mod shift4;
mod square;
mod stax;
mod stripe;
+mod stripebilling;
mod taxjar;
mod trustpay;
mod tsys;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 6509e1e411f..d30a5008887 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -316,5 +316,8 @@ api_key= "API Key"
[moneris]
api_key= "API Key"
+[stripebilling]
+api_key= "API Key"
+
[paystack]
api_key = "API Key"
\ No newline at end of file
diff --git a/crates/router/tests/connectors/stripebilling.rs b/crates/router/tests/connectors/stripebilling.rs
new file mode 100644
index 00000000000..8fccb9cb885
--- /dev/null
+++ b/crates/router/tests/connectors/stripebilling.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct StripebillingTest;
+impl ConnectorActions for StripebillingTest {}
+impl utils::Connector for StripebillingTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Stripebilling;
+ utils::construct_connector_data_old(
+ Box::new(Stripebilling::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .stripebilling
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "stripebilling".to_string()
+ }
+}
+
+static CONNECTOR: StripebillingTest = StripebillingTest {};
+
+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/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 521e58136aa..bb40cc51eaa 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -87,6 +87,7 @@ pub struct ConnectorAuthentication {
pub square: Option<BodyKey>,
pub stax: Option<HeaderKey>,
pub stripe: Option<HeaderKey>,
+ pub stripebilling: Option<HeaderKey>,
pub taxjar: Option<HeaderKey>,
pub threedsecureio: Option<HeaderKey>,
pub thunes: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 2a6a14ec755..85fa1330a9a 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -161,6 +161,7 @@ square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
stripe.base_url = "https://api.stripe.com/"
+stripebilling.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/"
@@ -255,6 +256,7 @@ cards = [
"square",
"stax",
"stripe",
+ "stripebilling",
"taxjar",
"threedsecureio",
"thunes",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index f2c55f54adc..046042bfa73 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
2025-02-09T07:26:58Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
connector integration template code for stripe billing.
Issue: This PR closes the issue #7212
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
No testing required since its a template code
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
cdfbb82ffa893d65d1707d6795f07c0a71e8d0a9
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7186
|
Bug: Update openssl dependency
Update openssl dependency from `version = "0.10.66"` to `version = "0.10.70"`
|
diff --git a/Cargo.lock b/Cargo.lock
index 7583fb2eeee..8a637917c61 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5336,9 +5336,9 @@ dependencies = [
[[package]]
name = "openssl"
-version = "0.10.66"
+version = "0.10.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
+checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
dependencies = [
"bitflags 2.6.0",
"cfg-if 1.0.0",
@@ -5368,9 +5368,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
-version = "0.9.103"
+version = "0.9.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
+checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
dependencies = [
"cc",
"libc",
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index db65482628f..c5e4a431521 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -83,7 +83,7 @@ num_cpus = "1.16.0"
num-traits = "0.2.19"
once_cell = "1.19.0"
openidconnect = "3.5.0" # TODO: remove reqwest
-openssl = "0.10.64"
+openssl = "0.10.70"
quick-xml = { version = "0.31.0", features = ["serialize"] }
rand = "0.8.5"
rand_chacha = "0.3.1"
|
2025-02-04T14:16:22Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [x] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Update openssl dependency from `version = "0.10.66"` to `version = "0.10.70"`
This pr also updates openssl-sys transitive dependency from `version = "0.9.103"` to `version = "0.9.105"`
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
openssl patch version `0.10.70` release
We've had to update the `openssl` crate due to the advisory GHSA-rpmj-rpgj-qmpm that was recently published against the crate.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Verified by code compilation
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
e2ddcc26b84e4ddcd69005080e19d211b1604827
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7260
|
Bug: [FEATURE] Add support for network tokenization for v2/payment-methods
Description:
Add support for network tokenization for v2/payment-methods create api.
Implementation:
for v2/payment-methods api, if the payment method is card and merchant opted for network tokenization, then card should be tokenized with network via token service.
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index ba795d40594..f386d554dda 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -13741,6 +13741,14 @@
}
],
"nullable": true
+ },
+ "network_tokenization": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NetworkTokenization"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index ba18cbba506..a228f5fbda1 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -135,6 +135,10 @@ pub struct PaymentMethodCreate {
/// The billing details of the payment method
#[schema(value_type = Option<Address>)]
pub billing: Option<payments::Address>,
+
+ /// The network tokenization configuration if applicable
+ #[schema(value_type = Option<NetworkTokenization>)]
+ pub network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
@@ -547,7 +551,15 @@ pub struct CardDetail {
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[derive(
- Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema, strum::EnumString, strum::Display,
+ Debug,
+ serde::Deserialize,
+ serde::Serialize,
+ Clone,
+ ToSchema,
+ strum::EnumString,
+ strum::Display,
+ Eq,
+ PartialEq,
)]
#[serde(rename_all = "snake_case")]
pub enum CardType {
diff --git a/crates/cards/src/lib.rs b/crates/cards/src/lib.rs
index 0c0fb9d47a1..765fa7c6f8c 100644
--- a/crates/cards/src/lib.rs
+++ b/crates/cards/src/lib.rs
@@ -7,7 +7,7 @@ use masking::{PeekInterface, StrongSecret};
use serde::{de, Deserialize, Serialize};
use time::{util::days_in_year_month, Date, Duration, PrimitiveDateTime, Time};
-pub use crate::validate::{CardNumber, CardNumberStrategy, CardNumberValidationErr};
+pub use crate::validate::{CardNumber, CardNumberStrategy, CardNumberValidationErr, NetworkToken};
#[derive(Serialize)]
pub struct CardSecurityCode(StrongSecret<u16>);
diff --git a/crates/cards/src/validate.rs b/crates/cards/src/validate.rs
index 725d05b4807..b8b9cdbf185 100644
--- a/crates/cards/src/validate.rs
+++ b/crates/cards/src/validate.rs
@@ -24,6 +24,10 @@ pub struct CardNumberValidationErr(&'static str);
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)]
pub struct CardNumber(StrongSecret<String, CardNumberStrategy>);
+//Network Token
+#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)]
+pub struct NetworkToken(StrongSecret<String, CardNumberStrategy>);
+
impl CardNumber {
pub fn get_card_isin(&self) -> String {
self.0.peek().chars().take(6).collect::<String>()
@@ -102,6 +106,30 @@ impl CardNumber {
}
}
+impl NetworkToken {
+ pub fn get_card_isin(&self) -> String {
+ self.0.peek().chars().take(6).collect::<String>()
+ }
+
+ pub fn get_extended_card_bin(&self) -> String {
+ self.0.peek().chars().take(8).collect::<String>()
+ }
+ pub fn get_card_no(&self) -> String {
+ self.0.peek().chars().collect::<String>()
+ }
+ pub fn get_last4(&self) -> String {
+ self.0
+ .peek()
+ .chars()
+ .rev()
+ .take(4)
+ .collect::<String>()
+ .chars()
+ .rev()
+ .collect::<String>()
+ }
+}
+
impl FromStr for CardNumber {
type Err = CardNumberValidationErr;
@@ -131,6 +159,35 @@ impl FromStr for CardNumber {
}
}
+impl FromStr for NetworkToken {
+ type Err = CardNumberValidationErr;
+
+ fn from_str(network_token: &str) -> Result<Self, Self::Err> {
+ // Valid test cards for threedsecureio
+ let valid_test_network_tokens = vec![
+ "4000100511112003",
+ "6000100611111203",
+ "3000100811111072",
+ "9000100111111111",
+ ];
+ #[cfg(not(target_arch = "wasm32"))]
+ let valid_test_network_tokens = match router_env_which() {
+ Env::Development | Env::Sandbox => valid_test_network_tokens,
+ Env::Production => vec![],
+ };
+
+ let network_token = network_token.split_whitespace().collect::<String>();
+
+ let is_network_token_valid = sanitize_card_number(&network_token)?;
+
+ if valid_test_network_tokens.contains(&network_token.as_str()) || is_network_token_valid {
+ Ok(Self(StrongSecret::new(network_token)))
+ } else {
+ Err(CardNumberValidationErr("network token invalid"))
+ }
+ }
+}
+
pub fn sanitize_card_number(card_number: &str) -> Result<bool, CardNumberValidationErr> {
let is_card_number_valid = Ok(card_number)
.and_then(validate_card_number_chars)
@@ -195,6 +252,14 @@ impl TryFrom<String> for CardNumber {
}
}
+impl TryFrom<String> for NetworkToken {
+ type Error = CardNumberValidationErr;
+
+ fn try_from(value: String) -> Result<Self, Self::Error> {
+ Self::from_str(&value)
+ }
+}
+
impl Deref for CardNumber {
type Target = StrongSecret<String, CardNumberStrategy>;
@@ -203,6 +268,14 @@ impl Deref for CardNumber {
}
}
+impl Deref for NetworkToken {
+ type Target = StrongSecret<String, CardNumberStrategy>;
+
+ fn deref(&self) -> &StrongSecret<String, CardNumberStrategy> {
+ &self.0
+ }
+}
+
impl<'de> Deserialize<'de> for CardNumber {
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
let s = String::deserialize(d)?;
@@ -210,6 +283,13 @@ impl<'de> Deserialize<'de> for CardNumber {
}
}
+impl<'de> Deserialize<'de> for NetworkToken {
+ fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
+ let s = String::deserialize(d)?;
+ Self::from_str(&s).map_err(serde::de::Error::custom)
+ }
+}
+
pub enum CardNumberStrategy {}
impl<T> Strategy<T> for CardNumberStrategy
diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml
index 6b76e6ac195..13d5266dabd 100644
--- a/crates/hyperswitch_connectors/Cargo.toml
+++ b/crates/hyperswitch_connectors/Cargo.toml
@@ -9,6 +9,7 @@ license.workspace = true
frm = ["hyperswitch_domain_models/frm", "hyperswitch_interfaces/frm"]
payouts = ["hyperswitch_domain_models/payouts", "api_models/payouts", "hyperswitch_interfaces/payouts"]
v1 = ["api_models/v1", "hyperswitch_domain_models/v1", "common_utils/v1"]
+v2 = ["api_models/v2", "hyperswitch_domain_models/v2", "common_utils/v2"]
[dependencies]
actix-http = "3.6.0"
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index b42c02606c1..b953fa73754 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -18,6 +18,7 @@ use hyperswitch_domain_models::{
types::PayoutsRouterData,
};
use hyperswitch_domain_models::{
+ network_tokenization::NetworkTokenNumber,
payment_method_data::{
ApplePayWalletData, GooglePayWalletData, NetworkTokenData, PaymentMethodData,
SamsungPayWalletData, WalletData,
@@ -430,7 +431,7 @@ pub struct CaptureOptions {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct NetworkTokenizedCard {
- number: cards::CardNumber,
+ number: NetworkTokenNumber,
expiration_month: Secret<String>,
expiration_year: Secret<String>,
cryptogram: Option<Secret<String>>,
@@ -1400,10 +1401,10 @@ impl
let payment_information =
PaymentInformation::NetworkToken(Box::new(NetworkTokenPaymentInformation {
tokenized_card: NetworkTokenizedCard {
- number: token_data.token_number,
- expiration_month: token_data.token_exp_month,
- expiration_year: token_data.token_exp_year,
- cryptogram: token_data.token_cryptogram.clone(),
+ number: token_data.get_network_token(),
+ expiration_month: token_data.get_network_token_expiry_month(),
+ expiration_year: token_data.get_network_token_expiry_year(),
+ cryptogram: token_data.get_cryptogram().clone(),
transaction_type: "1".to_string(),
},
}));
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index aec4d31072d..741d87ac6a1 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -19,6 +19,7 @@ use common_utils::{
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
address::{Address, AddressDetails, PhoneDetails},
+ network_tokenization::NetworkTokenNumber,
payment_method_data::{self, Card, CardDetailsForNetworkTransactionId, PaymentMethodData},
router_data::{
ApplePayPredecryptData, ErrorResponse, PaymentMethodToken, RecurringMandatePaymentData,
@@ -2922,13 +2923,24 @@ impl CardData for api_models::payouts::CardPayout {
pub trait NetworkTokenData {
fn get_card_issuer(&self) -> Result<CardIssuer, Error>;
fn get_expiry_year_4_digit(&self) -> Secret<String>;
+ fn get_network_token(&self) -> NetworkTokenNumber;
+ fn get_network_token_expiry_month(&self) -> Secret<String>;
+ fn get_network_token_expiry_year(&self) -> Secret<String>;
+ fn get_cryptogram(&self) -> Option<Secret<String>>;
}
impl NetworkTokenData for payment_method_data::NetworkTokenData {
+ #[cfg(feature = "v1")]
fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
get_card_issuer(self.token_number.peek())
}
+ #[cfg(feature = "v2")]
+ fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
+ get_card_issuer(self.network_token.peek())
+ }
+
+ #[cfg(feature = "v1")]
fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.token_exp_year.peek().clone();
if year.len() == 2 {
@@ -2936,4 +2948,53 @@ impl NetworkTokenData for payment_method_data::NetworkTokenData {
}
Secret::new(year)
}
+
+ #[cfg(feature = "v2")]
+ fn get_expiry_year_4_digit(&self) -> Secret<String> {
+ let mut year = self.network_token_exp_year.peek().clone();
+ if year.len() == 2 {
+ year = format!("20{}", year);
+ }
+ Secret::new(year)
+ }
+
+ #[cfg(feature = "v1")]
+ fn get_network_token(&self) -> NetworkTokenNumber {
+ self.token_number.clone()
+ }
+
+ #[cfg(feature = "v2")]
+ fn get_network_token(&self) -> NetworkTokenNumber {
+ self.network_token.clone()
+ }
+
+ #[cfg(feature = "v1")]
+ fn get_network_token_expiry_month(&self) -> Secret<String> {
+ self.token_exp_month.clone()
+ }
+
+ #[cfg(feature = "v2")]
+ fn get_network_token_expiry_month(&self) -> Secret<String> {
+ self.network_token_exp_month.clone()
+ }
+
+ #[cfg(feature = "v1")]
+ fn get_network_token_expiry_year(&self) -> Secret<String> {
+ self.token_exp_year.clone()
+ }
+
+ #[cfg(feature = "v2")]
+ fn get_network_token_expiry_year(&self) -> Secret<String> {
+ self.network_token_exp_year.clone()
+ }
+
+ #[cfg(feature = "v1")]
+ fn get_cryptogram(&self) -> Option<Secret<String>> {
+ self.token_cryptogram.clone()
+ }
+
+ #[cfg(feature = "v2")]
+ fn get_cryptogram(&self) -> Option<Secret<String>> {
+ self.cryptogram.clone()
+ }
}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index bd6dd2e5371..c47353f282d 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -11,6 +11,7 @@ pub mod mandates;
pub mod merchant_account;
pub mod merchant_connector_account;
pub mod merchant_key_store;
+pub mod network_tokenization;
pub mod payment_address;
pub mod payment_method_data;
pub mod payment_methods;
diff --git a/crates/hyperswitch_domain_models/src/network_tokenization.rs b/crates/hyperswitch_domain_models/src/network_tokenization.rs
new file mode 100644
index 00000000000..bf87c750509
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/network_tokenization.rs
@@ -0,0 +1,231 @@
+use std::fmt::Debug;
+
+use api_models::enums as api_enums;
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+use cards::CardNumber;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use cards::{CardNumber, NetworkToken};
+use common_utils::id_type;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardData {
+ pub card_number: CardNumber,
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+ pub card_security_code: Secret<String>,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardData {
+ pub card_number: CardNumber,
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub card_security_code: Option<Secret<String>>,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderData {
+ pub consent_id: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderData {
+ pub consent_id: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApiPayload {
+ pub service: String,
+ pub card_data: Secret<String>, //encrypted card data
+ pub order_data: OrderData,
+ pub key_id: String,
+ pub should_send_token: bool,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct CardNetworkTokenResponse {
+ pub payload: Secret<String>, //encrypted payload
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardNetworkTokenResponsePayload {
+ pub card_brand: api_enums::CardNetwork,
+ pub card_fingerprint: Option<Secret<String>>,
+ pub card_reference: String,
+ pub correlation_id: String,
+ pub customer_id: String,
+ pub par: String,
+ pub token: CardNumber,
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_isin: String,
+ pub token_last_four: String,
+ pub token_status: String,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GenerateNetworkTokenResponsePayload {
+ pub card_brand: api_enums::CardNetwork,
+ pub card_fingerprint: Option<Secret<String>>,
+ pub card_reference: String,
+ pub correlation_id: String,
+ pub customer_id: String,
+ pub par: String,
+ pub token: NetworkToken,
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_isin: String,
+ pub token_last_four: String,
+ pub token_status: String,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize)]
+pub struct GetCardToken {
+ pub card_reference: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize)]
+pub struct GetCardToken {
+ pub card_reference: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+#[derive(Debug, Deserialize)]
+pub struct AuthenticationDetails {
+ pub cryptogram: Secret<String>,
+ pub token: CardNumber, //network token
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TokenDetails {
+ pub exp_month: Secret<String>,
+ pub exp_year: Secret<String>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct TokenResponse {
+ pub authentication_details: AuthenticationDetails,
+ pub network: api_enums::CardNetwork,
+ pub token_details: TokenDetails,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DeleteCardToken {
+ pub card_reference: String, //network token requestor ref id
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DeleteCardToken {
+ pub card_reference: String, //network token requestor ref id
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum DeleteNetworkTokenStatus {
+ Success,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct NetworkTokenErrorInfo {
+ pub code: String,
+ pub developer_message: String,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct NetworkTokenErrorResponse {
+ pub error_message: String,
+ pub error_info: NetworkTokenErrorInfo,
+}
+
+#[derive(Debug, Deserialize, Eq, PartialEq)]
+pub struct DeleteNetworkTokenResponse {
+ pub status: DeleteNetworkTokenStatus,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CheckTokenStatus {
+ pub card_reference: String,
+ pub customer_id: id_type::CustomerId,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CheckTokenStatus {
+ pub card_reference: String,
+ pub customer_id: id_type::GlobalCustomerId,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum TokenStatus {
+ Active,
+ Inactive,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CheckTokenStatusResponsePayload {
+ pub token_expiry_month: Secret<String>,
+ pub token_expiry_year: Secret<String>,
+ pub token_status: TokenStatus,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct CheckTokenStatusResponse {
+ pub payload: CheckTokenStatusResponsePayload,
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+pub type NetworkTokenNumber = CardNumber;
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub type NetworkTokenNumber = NetworkToken;
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index e96368080d9..2f8375b47c0 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -1,5 +1,6 @@
use api_models::{
- mandates, payment_methods,
+ mandates,
+ payment_methods::{self},
payments::{
additional_info as payment_additional_types, AmazonPayRedirectData, ExtendedCardInfo,
},
@@ -587,6 +588,10 @@ pub struct SepaAndBacsBillingDetails {
pub name: Secret<String>,
}
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
pub struct NetworkTokenData {
pub token_number: cards::CardNumber,
@@ -602,6 +607,37 @@ pub struct NetworkTokenData {
pub eci: Option<String>,
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
+pub struct NetworkTokenData {
+ pub network_token: cards::NetworkToken,
+ pub network_token_exp_month: Secret<String>,
+ pub network_token_exp_year: Secret<String>,
+ pub cryptogram: Option<Secret<String>>,
+ pub card_issuer: Option<String>, //since network token is tied to card, so its issuer will be same as card issuer
+ pub card_network: Option<common_enums::CardNetwork>,
+ pub card_type: Option<payment_methods::CardType>,
+ pub card_issuing_country: Option<String>,
+ pub bank_code: Option<String>,
+ pub card_holder_name: Option<Secret<String>>,
+ pub nick_name: Option<Secret<String>>,
+ pub eci: Option<String>,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
+pub struct NetworkTokenDetails {
+ pub network_token: cards::NetworkToken,
+ pub network_token_exp_month: Secret<String>,
+ pub network_token_exp_year: Secret<String>,
+ pub card_issuer: Option<String>, //since network token is tied to card, so its issuer will be same as card issuer
+ pub card_network: Option<common_enums::CardNetwork>,
+ pub card_type: Option<payment_methods::CardType>,
+ pub card_issuing_country: Option<api_enums::CountryAlpha2>,
+ pub card_holder_name: Option<Secret<String>>,
+ pub nick_name: Option<Secret<String>>,
+}
+
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum MobilePaymentData {
@@ -1726,3 +1762,85 @@ impl From<GooglePayWalletData> for payment_methods::PaymentMethodDataWalletInfo
}
}
}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub enum PaymentMethodsData {
+ Card(CardDetailsPaymentMethod),
+ BankDetails(payment_methods::PaymentMethodDataBankCreds), //PaymentMethodDataBankCreds and its transformations should be moved to the domain models
+ WalletDetails(payment_methods::PaymentMethodDataWalletInfo), //PaymentMethodDataWalletInfo and its transformations should be moved to the domain models
+ NetworkToken(NetworkTokenDetailsPaymentMethod),
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct NetworkTokenDetailsPaymentMethod {
+ pub last4_digits: Option<String>,
+ pub issuer_country: Option<String>,
+ pub network_token_expiry_month: Option<Secret<String>>,
+ pub network_token_expiry_year: Option<Secret<String>>,
+ pub nick_name: Option<Secret<String>>,
+ pub card_holder_name: Option<Secret<String>>,
+ pub card_isin: Option<String>,
+ pub card_issuer: Option<String>,
+ pub card_network: Option<api_enums::CardNetwork>,
+ pub card_type: Option<String>,
+ #[serde(default = "saved_in_locker_default")]
+ pub saved_to_locker: bool,
+}
+
+fn saved_in_locker_default() -> bool {
+ true
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct CardDetailsPaymentMethod {
+ pub last4_digits: Option<String>,
+ pub issuer_country: Option<String>,
+ pub expiry_month: Option<Secret<String>>,
+ pub expiry_year: Option<Secret<String>>,
+ pub nick_name: Option<Secret<String>>,
+ pub card_holder_name: Option<Secret<String>>,
+ pub card_isin: Option<String>,
+ pub card_issuer: Option<String>,
+ pub card_network: Option<api_enums::CardNetwork>,
+ pub card_type: Option<String>,
+ #[serde(default = "saved_in_locker_default")]
+ pub saved_to_locker: bool,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+impl From<payment_methods::CardDetail> for CardDetailsPaymentMethod {
+ fn from(item: payment_methods::CardDetail) -> Self {
+ Self {
+ issuer_country: item.card_issuing_country.map(|c| c.to_string()),
+ last4_digits: Some(item.card_number.get_last4()),
+ expiry_month: Some(item.card_exp_month),
+ expiry_year: Some(item.card_exp_year),
+ card_holder_name: item.card_holder_name,
+ nick_name: item.nick_name,
+ card_isin: None,
+ card_issuer: item.card_issuer,
+ card_network: item.card_network,
+ card_type: item.card_type.map(|card| card.to_string()),
+ saved_to_locker: true,
+ }
+ }
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+impl From<NetworkTokenDetails> for NetworkTokenDetailsPaymentMethod {
+ fn from(item: NetworkTokenDetails) -> Self {
+ Self {
+ issuer_country: item.card_issuing_country.map(|c| c.to_string()),
+ last4_digits: Some(item.network_token.get_last4()),
+ network_token_expiry_month: Some(item.network_token_exp_month),
+ network_token_expiry_year: Some(item.network_token_exp_year),
+ card_holder_name: item.card_holder_name,
+ nick_name: item.nick_name,
+ card_isin: None,
+ card_issuer: item.card_issuer,
+ card_network: item.card_network,
+ card_type: item.card_type.map(|card| card.to_string()),
+ saved_to_locker: true,
+ }
+ }
+}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 0c90b0d0244..e3a8264217c 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -9,7 +9,10 @@ use common_utils::{
use error_stack::ResultExt;
use masking::{ExposeInterface, Secret};
-use crate::{payment_address::PaymentAddress, payment_method_data, payments};
+use crate::{
+ network_tokenization::NetworkTokenNumber, payment_address::PaymentAddress, payment_method_data,
+ payments,
+};
#[cfg(feature = "v2")]
use crate::{
payments::{
@@ -294,7 +297,7 @@ pub struct PazeDecryptedData {
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PazeToken {
- pub payment_token: cards::CardNumber,
+ pub payment_token: NetworkTokenNumber,
pub token_expiration_month: Secret<String>,
pub token_expiration_year: Secret<String>,
pub payment_account_reference: Secret<String>,
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 6257d3e0832..d590797d642 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -33,8 +33,8 @@ payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_connectors
payout_retry = ["payouts"]
recon = ["email", "api_models/recon"]
retry = []
-v2 = ["customer_v2", "payment_methods_v2", "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2"]
-v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1", "common_utils/v1"]
+v2 = ["customer_v2", "payment_methods_v2", "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2", "hyperswitch_connectors/v2"]
+v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1", "common_utils/v1", "hyperswitch_connectors/v1"]
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2", "hyperswitch_domain_models/payment_methods_v2", "storage_impl/payment_methods_v2", "common_utils/payment_methods_v2"]
dynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing", "api_models/dynamic_routing"]
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 69749500dab..a7e4e0f61d3 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -4,7 +4,9 @@ use api_models::{enums, payments, webhooks};
use cards::CardNumber;
use common_utils::{errors::ParsingError, ext_traits::Encode, id_type, pii, types::MinorUnit};
use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::router_request_types::SubmitEvidenceRequestData;
+use hyperswitch_domain_models::{
+ network_tokenization::NetworkTokenNumber, router_request_types::SubmitEvidenceRequestData,
+};
use masking::{ExposeInterface, PeekInterface};
use reqwest::Url;
use serde::{Deserialize, Serialize};
@@ -640,6 +642,7 @@ pub enum AdyenPaymentMethod<'a> {
PayEasy(Box<JCSVoucherData>),
Pix(Box<PmdForPaymentType>),
NetworkToken(Box<AdyenNetworkTokenData>),
+ AdyenPaze(Box<AdyenPazeData>),
}
#[derive(Debug, Clone, Serialize)]
@@ -1145,6 +1148,21 @@ pub struct AdyenCard {
network_payment_reference: Option<Secret<String>>,
}
+#[serde_with::skip_serializing_none]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenPazeData {
+ #[serde(rename = "type")]
+ payment_type: PaymentType,
+ number: NetworkTokenNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Option<Secret<String>>,
+ holder_name: Option<Secret<String>>,
+ brand: Option<CardBrand>, //Mandatory for mandate using network_txns_id
+ network_payment_reference: Option<Secret<String>>,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CardBrand {
@@ -1244,7 +1262,7 @@ pub struct AdyenApplePay {
pub struct AdyenNetworkTokenData {
#[serde(rename = "type")]
payment_type: PaymentType,
- number: CardNumber,
+ number: NetworkTokenNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
holder_name: Option<Secret<String>>,
@@ -2208,7 +2226,7 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
}
domain::WalletData::Paze(_) => match item.payment_method_token.clone() {
Some(types::PaymentMethodToken::PazeDecrypt(paze_decrypted_data)) => {
- let data = AdyenCard {
+ let data = AdyenPazeData {
payment_type: PaymentType::NetworkToken,
number: paze_decrypted_data.token.payment_token,
expiry_month: paze_decrypted_data.token.token_expiration_month,
@@ -2222,7 +2240,7 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
.and_then(get_adyen_card_network),
network_payment_reference: None,
};
- Ok(AdyenPaymentMethod::AdyenCard(Box::new(data)))
+ Ok(AdyenPaymentMethod::AdyenPaze(Box::new(data)))
}
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Cybersource"),
@@ -2737,8 +2755,8 @@ impl
let card_holder_name = item.router_data.get_optional_billing_full_name();
let adyen_network_token = AdyenNetworkTokenData {
payment_type: PaymentType::NetworkToken,
- number: token_data.token_number.clone(),
- expiry_month: token_data.token_exp_month.clone(),
+ number: token_data.get_network_token(),
+ expiry_month: token_data.get_network_token_expiry_month(),
expiry_year: token_data.get_expiry_year_4_digit(),
holder_name: card_holder_name,
brand: Some(brand), // FIXME: Remove hardcoding
@@ -5600,8 +5618,8 @@ impl TryFrom<(&domain::NetworkTokenData, Option<Secret<String>>)> for AdyenPayme
) -> Result<Self, Self::Error> {
let adyen_network_token = AdyenNetworkTokenData {
payment_type: PaymentType::NetworkToken,
- number: token_data.token_number.clone(),
- expiry_month: token_data.token_exp_month.clone(),
+ number: token_data.get_network_token(),
+ expiry_month: token_data.get_network_token_expiry_month(),
expiry_year: token_data.get_expiry_year_4_digit(),
holder_name: card_holder_name,
brand: None, // FIXME: Remove hardcoding
@@ -5650,7 +5668,7 @@ impl
directory_response: "Y".to_string(),
authentication_response: "Y".to_string(),
token_authentication_verification_value: token_data
- .token_cryptogram
+ .get_cryptogram()
.clone()
.unwrap_or_default(),
eci: Some("02".to_string()),
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 28f5d016e5a..0aca263b5c7 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -22,6 +22,7 @@ use diesel_models::{enums, types::OrderDetailsWithAmount};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
mandates,
+ network_tokenization::NetworkTokenNumber,
payments::payment_attempt::PaymentAttempt,
router_request_types::{
AuthoriseIntegrityObject, CaptureIntegrityObject, RefundIntegrityObject,
@@ -3181,13 +3182,30 @@ pub fn get_refund_integrity_object<T>(
pub trait NetworkTokenData {
fn get_card_issuer(&self) -> Result<CardIssuer, Error>;
fn get_expiry_year_4_digit(&self) -> Secret<String>;
+ fn get_network_token(&self) -> NetworkTokenNumber;
+ fn get_network_token_expiry_month(&self) -> Secret<String>;
+ fn get_network_token_expiry_year(&self) -> Secret<String>;
+ fn get_cryptogram(&self) -> Option<Secret<String>>;
}
impl NetworkTokenData for domain::NetworkTokenData {
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
get_card_issuer(self.token_number.peek())
}
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
+ get_card_issuer(self.network_token.peek())
+ }
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.token_exp_year.peek().clone();
if year.len() == 2 {
@@ -3195,6 +3213,67 @@ impl NetworkTokenData for domain::NetworkTokenData {
}
Secret::new(year)
}
+
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_expiry_year_4_digit(&self) -> Secret<String> {
+ let mut year = self.network_token_exp_year.peek().clone();
+ if year.len() == 2 {
+ year = format!("20{}", year);
+ }
+ Secret::new(year)
+ }
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
+ fn get_network_token(&self) -> NetworkTokenNumber {
+ self.token_number.clone()
+ }
+
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_network_token(&self) -> NetworkTokenNumber {
+ self.network_token.clone()
+ }
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
+ fn get_network_token_expiry_month(&self) -> Secret<String> {
+ self.token_exp_month.clone()
+ }
+
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_network_token_expiry_month(&self) -> Secret<String> {
+ self.network_token_exp_month.clone()
+ }
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
+ fn get_network_token_expiry_year(&self) -> Secret<String> {
+ self.token_exp_year.clone()
+ }
+
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_network_token_expiry_year(&self) -> Secret<String> {
+ self.network_token_exp_year.clone()
+ }
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+ ))]
+ fn get_cryptogram(&self) -> Option<Secret<String>> {
+ self.token_cryptogram.clone()
+ }
+
+ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+ fn get_cryptogram(&self) -> Option<Secret<String>> {
+ self.cryptogram.clone()
+ }
}
pub fn convert_uppercase<'de, D, T>(v: D) -> Result<T, D::Error>
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index 54cae42ceb3..82d05956fc8 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -444,4 +444,6 @@ pub enum NetworkTokenizationError {
DeleteNetworkTokenFailed,
#[error("Network token service not configured")]
NetworkTokenizationServiceNotConfigured,
+ #[error("Failed while calling Network Token Service API")]
+ ApiError,
}
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 5bdb0f0819e..6ebc7bde5e4 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -47,9 +47,9 @@ use hyperswitch_domain_models::api::{GenericLinks, GenericLinksData};
feature = "customer_v2"
))]
use hyperswitch_domain_models::mandates::CommonMandateReference;
-use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-use masking::ExposeInterface;
+use hyperswitch_domain_models::payment_method_data;
+use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent};
use masking::{PeekInterface, Secret};
use router_env::{instrument, tracing};
use time::Duration;
@@ -737,6 +737,7 @@ pub(crate) async fn get_payment_method_create_request(
card_detail,
),
billing: None,
+ network_tokenization: None,
};
Ok(payment_method_request)
}
@@ -853,6 +854,7 @@ pub async fn create_payment_method(
req: api::PaymentMethodCreate,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
+ profile: &domain::Profile,
) -> RouterResponse<api::PaymentMethodResponse> {
use common_utils::ext_traits::ValueExt;
@@ -910,6 +912,9 @@ pub async fn create_payment_method(
let payment_method_data = pm_types::PaymentMethodVaultingData::from(req.payment_method_data);
+ let payment_method_data =
+ populate_bin_details_for_payment_method(state, &payment_method_data).await;
+
let vaulting_result = vault_payment_method(
state,
&payment_method_data,
@@ -919,6 +924,25 @@ pub async fn create_payment_method(
)
.await;
+ let network_tokenization_resp = network_tokenize_and_vault_the_pmd(
+ state,
+ &payment_method_data,
+ merchant_account,
+ key_store,
+ req.network_tokenization,
+ profile.is_network_tokenization_enabled,
+ &customer_id,
+ )
+ .await
+ .map_err(|e| {
+ services::logger::error!(
+ "Failed to network tokenize the payment method for customer: {}. Error: {} ",
+ customer_id.get_string_repr(),
+ e
+ );
+ })
+ .ok();
+
let response = match vaulting_result {
Ok((vaulting_resp, fingerprint_id)) => {
let pm_update = create_pm_additional_data_update(
@@ -929,6 +953,7 @@ pub async fn create_payment_method(
Some(req.payment_method_type),
Some(req.payment_method_subtype),
Some(fingerprint_id),
+ network_tokenization_resp,
)
.await
.attach_printable("Unable to create Payment method data")?;
@@ -972,6 +997,145 @@ pub async fn create_payment_method(
Ok(services::ApplicationResponse::Json(response))
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Clone, Debug)]
+pub struct NetworkTokenPaymentMethodDetails {
+ network_token_requestor_reference_id: String,
+ network_token_locker_id: String,
+ network_token_pmd: Encryptable<Secret<serde_json::Value>>,
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn network_tokenize_and_vault_the_pmd(
+ state: &SessionState,
+ payment_method_data: &pm_types::PaymentMethodVaultingData,
+ merchant_account: &domain::MerchantAccount,
+ key_store: &domain::MerchantKeyStore,
+ network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
+ network_tokenization_enabled_for_profile: bool,
+ customer_id: &id_type::GlobalCustomerId,
+) -> RouterResult<NetworkTokenPaymentMethodDetails> {
+ when(!network_tokenization_enabled_for_profile, || {
+ Err(report!(errors::ApiErrorResponse::NotSupported {
+ message: "Network Tokenization is not enabled for this payment method".to_string()
+ }))
+ })?;
+
+ let is_network_tokenization_enabled_for_pm = network_tokenization
+ .as_ref()
+ .map(|nt| matches!(nt.enable, common_enums::NetworkTokenizationToggle::Enable))
+ .unwrap_or(false);
+
+ let card_data = match payment_method_data {
+ pm_types::PaymentMethodVaultingData::Card(data)
+ if is_network_tokenization_enabled_for_pm =>
+ {
+ Ok(data)
+ }
+ _ => Err(report!(errors::ApiErrorResponse::NotSupported {
+ message: "Network Tokenization is not supported for this payment method".to_string()
+ })),
+ }?;
+
+ let (resp, network_token_req_ref_id) =
+ network_tokenization::make_card_network_tokenization_request(state, card_data, customer_id)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to generate network token")?;
+
+ let network_token_vaulting_data = pm_types::PaymentMethodVaultingData::NetworkToken(resp);
+ let vaulting_resp = vault::add_payment_method_to_vault(
+ state,
+ merchant_account,
+ &network_token_vaulting_data,
+ None,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to vault the network token data")?;
+
+ let key_manager_state = &(state).into();
+ let network_token = match network_token_vaulting_data {
+ pm_types::PaymentMethodVaultingData::Card(card) => {
+ payment_method_data::PaymentMethodsData::Card(
+ payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
+ )
+ }
+ pm_types::PaymentMethodVaultingData::NetworkToken(network_token) => {
+ payment_method_data::PaymentMethodsData::NetworkToken(
+ payment_method_data::NetworkTokenDetailsPaymentMethod::from(network_token.clone()),
+ )
+ }
+ };
+
+ let network_token_pmd =
+ cards::create_encrypted_data(key_manager_state, key_store, network_token)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to encrypt Payment method data")?;
+
+ Ok(NetworkTokenPaymentMethodDetails {
+ network_token_requestor_reference_id: network_token_req_ref_id,
+ network_token_locker_id: vaulting_resp.vault_id.get_string_repr().clone(),
+ network_token_pmd,
+ })
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn populate_bin_details_for_payment_method(
+ state: &SessionState,
+ payment_method_data: &pm_types::PaymentMethodVaultingData,
+) -> pm_types::PaymentMethodVaultingData {
+ match payment_method_data {
+ pm_types::PaymentMethodVaultingData::Card(card) => {
+ let card_isin = card.card_number.get_card_isin();
+
+ if card.card_issuer.is_some()
+ && card.card_network.is_some()
+ && card.card_type.is_some()
+ && card.card_issuing_country.is_some()
+ {
+ pm_types::PaymentMethodVaultingData::Card(card.clone())
+ } else {
+ let card_info = state
+ .store
+ .get_card_info(&card_isin)
+ .await
+ .map_err(|error| services::logger::error!(card_info_error=?error))
+ .ok()
+ .flatten();
+
+ pm_types::PaymentMethodVaultingData::Card(payment_methods::CardDetail {
+ card_number: card.card_number.clone(),
+ card_exp_month: card.card_exp_month.clone(),
+ card_exp_year: card.card_exp_year.clone(),
+ card_holder_name: card.card_holder_name.clone(),
+ nick_name: card.nick_name.clone(),
+ card_issuing_country: card_info.as_ref().and_then(|val| {
+ val.card_issuing_country
+ .as_ref()
+ .map(|c| api_enums::CountryAlpha2::from_str(c))
+ .transpose()
+ .ok()
+ .flatten()
+ }),
+ card_network: card_info.as_ref().and_then(|val| val.card_network.clone()),
+ card_issuer: card_info.as_ref().and_then(|val| val.card_issuer.clone()),
+ card_type: card_info.as_ref().and_then(|val| {
+ val.card_type
+ .as_ref()
+ .map(|c| payment_methods::CardType::from_str(c))
+ .transpose()
+ .ok()
+ .flatten()
+ }),
+ })
+ }
+ }
+ _ => payment_method_data.clone(),
+ }
+}
+
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[instrument(skip_all)]
pub async fn payment_method_intent_create(
@@ -1293,6 +1457,7 @@ pub async fn create_payment_method_for_intent(
Ok(response)
}
+#[allow(clippy::too_many_arguments)]
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn create_pm_additional_data_update(
pmd: &pm_types::PaymentMethodVaultingData,
@@ -1302,10 +1467,18 @@ pub async fn create_pm_additional_data_update(
payment_method_type: Option<api_enums::PaymentMethod>,
payment_method_subtype: Option<api_enums::PaymentMethodType>,
vault_fingerprint_id: Option<String>,
+ nt_data: Option<NetworkTokenPaymentMethodDetails>,
) -> RouterResult<storage::PaymentMethodUpdate> {
let card = match pmd {
pm_types::PaymentMethodVaultingData::Card(card) => {
- api::PaymentMethodsData::Card(card.clone().into())
+ payment_method_data::PaymentMethodsData::Card(
+ payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
+ )
+ }
+ pm_types::PaymentMethodVaultingData::NetworkToken(network_token) => {
+ payment_method_data::PaymentMethodsData::NetworkToken(
+ payment_method_data::NetworkTokenDetailsPaymentMethod::from(network_token.clone()),
+ )
}
};
let key_manager_state = &(state).into();
@@ -1321,9 +1494,11 @@ pub async fn create_pm_additional_data_update(
payment_method_type_v2: payment_method_type,
payment_method_subtype,
payment_method_data: Some(pmd.into()),
- network_token_requestor_reference_id: None,
- network_token_locker_id: None,
- network_token_payment_method_data: None,
+ network_token_requestor_reference_id: nt_data
+ .clone()
+ .map(|data| data.network_token_requestor_reference_id),
+ network_token_locker_id: nt_data.clone().map(|data| data.network_token_locker_id),
+ network_token_payment_method_data: nt_data.map(|data| data.network_token_pmd.into()),
locker_fingerprint_id: vault_fingerprint_id,
};
@@ -1633,6 +1808,7 @@ pub async fn update_payment_method_core(
payment_method.get_payment_method_type(),
payment_method.get_payment_method_subtype(),
Some(fingerprint_id),
+ None,
)
.await
.attach_printable("Unable to create Payment method data")?;
diff --git a/crates/router/src/core/payment_methods/network_tokenization.rs b/crates/router/src/core/payment_methods/network_tokenization.rs
index bb730caad2b..6799a1cf5ba 100644
--- a/crates/router/src/core/payment_methods/network_tokenization.rs
+++ b/crates/router/src/core/payment_methods/network_tokenization.rs
@@ -1,7 +1,9 @@
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use std::fmt::Debug;
-use api_models::{enums as api_enums, payment_methods::PaymentMethodsData};
-use cards::CardNumber;
+use api_models::payment_methods as api_payment_methods;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use cards::{CardNumber, NetworkToken};
use common_utils::{
errors::CustomResult,
ext_traits::{BytesExt, Encode},
@@ -9,10 +11,17 @@ use common_utils::{
metrics::utils::record_operation_time,
request::RequestContent,
};
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
use error_stack::ResultExt;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use error_stack::{report, ResultExt};
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use hyperswitch_domain_models::payment_method_data::NetworkTokenDetails;
use josekit::jwe;
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
-use serde::{Deserialize, Serialize};
use super::transformers::DeleteCardResp;
use crate::{
@@ -24,142 +33,132 @@ use crate::{
types::{api, domain},
};
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CardData {
- card_number: CardNumber,
- exp_month: Secret<String>,
- exp_year: Secret<String>,
- card_security_code: Secret<String>,
-}
+pub const NETWORK_TOKEN_SERVICE: &str = "NETWORK_TOKEN";
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct OrderData {
- consent_id: String,
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
+pub async fn mk_tokenization_req(
+ state: &routes::SessionState,
+ payload_bytes: &[u8],
customer_id: id_type::CustomerId,
-}
-
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ApiPayload {
- service: String,
- card_data: Secret<String>, //encrypted card data
- order_data: OrderData,
- key_id: String,
- should_send_token: bool,
-}
-
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct CardNetworkTokenResponse {
- payload: Secret<String>, //encrypted payload
-}
+ tokenization_service: &settings::NetworkTokenizationService,
+) -> CustomResult<
+ (domain::CardNetworkTokenResponsePayload, Option<String>),
+ errors::NetworkTokenizationError,
+> {
+ let enc_key = tokenization_service.public_key.peek().clone();
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CardNetworkTokenResponsePayload {
- pub card_brand: api_enums::CardNetwork,
- pub card_fingerprint: Option<Secret<String>>,
- pub card_reference: String,
- pub correlation_id: String,
- pub customer_id: String,
- pub par: String,
- pub token: CardNumber,
- pub token_expiry_month: Secret<String>,
- pub token_expiry_year: Secret<String>,
- pub token_isin: String,
- pub token_last_four: String,
- pub token_status: String,
-}
+ let key_id = tokenization_service.key_id.clone();
-#[derive(Debug, Serialize)]
-pub struct GetCardToken {
- card_reference: String,
- customer_id: id_type::CustomerId,
-}
-#[derive(Debug, Deserialize)]
-pub struct AuthenticationDetails {
- cryptogram: Secret<String>,
- token: CardNumber, //network token
-}
+ let jwt = encryption::encrypt_jwe(
+ payload_bytes,
+ enc_key,
+ services::EncryptionAlgorithm::A128GCM,
+ Some(key_id.as_str()),
+ )
+ .await
+ .change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
+ .attach_printable("Error on jwe encrypt")?;
-#[derive(Debug, Serialize, Deserialize)]
-pub struct TokenDetails {
- exp_month: Secret<String>,
- exp_year: Secret<String>,
-}
+ let order_data = domain::OrderData {
+ consent_id: uuid::Uuid::new_v4().to_string(),
+ customer_id,
+ };
-#[derive(Debug, Deserialize)]
-pub struct TokenResponse {
- authentication_details: AuthenticationDetails,
- network: api_enums::CardNetwork,
- token_details: TokenDetails,
-}
+ let api_payload = domain::ApiPayload {
+ service: NETWORK_TOKEN_SERVICE.to_string(),
+ card_data: Secret::new(jwt),
+ order_data,
+ key_id,
+ should_send_token: true,
+ };
-#[derive(Debug, Serialize, Deserialize)]
-pub struct DeleteCardToken {
- card_reference: String, //network token requestor ref id
- customer_id: id_type::CustomerId,
-}
+ let mut request = services::Request::new(
+ services::Method::Post,
+ tokenization_service.generate_token_url.as_str(),
+ );
+ request.add_header(headers::CONTENT_TYPE, "application/json".into());
+ request.add_header(
+ headers::AUTHORIZATION,
+ tokenization_service
+ .token_service_api_key
+ .peek()
+ .clone()
+ .into_masked(),
+ );
+ request.add_default_headers();
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-#[serde(rename_all = "UPPERCASE")]
-pub enum DeleteNetworkTokenStatus {
- Success,
-}
+ request.set_body(RequestContent::Json(Box::new(api_payload)));
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct NetworkTokenErrorInfo {
- code: String,
- developer_message: String,
-}
+ logger::info!("Request to generate token: {:?}", request);
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct NetworkTokenErrorResponse {
- error_message: String,
- error_info: NetworkTokenErrorInfo,
-}
+ let response = services::call_connector_api(state, request, "generate_token")
+ .await
+ .change_context(errors::NetworkTokenizationError::ApiError);
-#[derive(Debug, Deserialize, Eq, PartialEq)]
-pub struct DeleteNetworkTokenResponse {
- status: DeleteNetworkTokenStatus,
-}
+ let res = response
+ .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
+ .attach_printable("Error while receiving response")
+ .and_then(|inner| match inner {
+ Err(err_res) => {
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ .response
+ .parse_struct("Card Network Tokenization Response")
+ .change_context(
+ errors::NetworkTokenizationError::ResponseDeserializationFailed,
+ )?;
+ logger::error!(
+ error_code = %parsed_error.error_info.code,
+ developer_message = %parsed_error.error_info.developer_message,
+ "Network tokenization error: {}",
+ parsed_error.error_message
+ );
+ Err(errors::NetworkTokenizationError::ResponseDeserializationFailed)
+ .attach_printable(format!("Response Deserialization Failed: {err_res:?}"))
+ }
+ Ok(res) => Ok(res),
+ })
+ .inspect_err(|err| {
+ logger::error!("Error while deserializing response: {:?}", err);
+ })?;
-#[derive(Debug, Serialize, Deserialize)]
-pub struct CheckTokenStatus {
- card_reference: String,
- customer_id: id_type::CustomerId,
-}
+ let network_response: domain::CardNetworkTokenResponse = res
+ .response
+ .parse_struct("Card Network Tokenization Response")
+ .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "UPPERCASE")]
-pub enum TokenStatus {
- Active,
- Inactive,
-}
+ let dec_key = tokenization_service.private_key.peek().clone();
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CheckTokenStatusResponsePayload {
- token_expiry_month: Secret<String>,
- token_expiry_year: Secret<String>,
- token_status: TokenStatus,
-}
+ let card_network_token_response = services::decrypt_jwe(
+ network_response.payload.peek(),
+ services::KeyIdCheck::SkipKeyIdCheck,
+ dec_key,
+ jwe::RSA_OAEP_256,
+ )
+ .await
+ .change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
+ .attach_printable(
+ "Failed to decrypt the tokenization response from the tokenization service",
+ )?;
-#[derive(Debug, Deserialize)]
-pub struct CheckTokenStatusResponse {
- payload: CheckTokenStatusResponsePayload,
+ let cn_response: domain::CardNetworkTokenResponsePayload =
+ serde_json::from_str(&card_network_token_response)
+ .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
+ Ok((cn_response.clone(), Some(cn_response.card_reference)))
}
-pub const NETWORK_TOKEN_SERVICE: &str = "NETWORK_TOKEN";
-
-pub async fn mk_tokenization_req(
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn generate_network_token(
state: &routes::SessionState,
payload_bytes: &[u8],
- customer_id: id_type::CustomerId,
+ customer_id: id_type::GlobalCustomerId,
tokenization_service: &settings::NetworkTokenizationService,
-) -> CustomResult<(CardNetworkTokenResponsePayload, Option<String>), errors::NetworkTokenizationError>
-{
+) -> CustomResult<
+ (domain::GenerateNetworkTokenResponsePayload, String),
+ errors::NetworkTokenizationError,
+> {
let enc_key = tokenization_service.public_key.peek().clone();
let key_id = tokenization_service.key_id.clone();
@@ -174,12 +173,12 @@ pub async fn mk_tokenization_req(
.change_context(errors::NetworkTokenizationError::SaveNetworkTokenFailed)
.attach_printable("Error on jwe encrypt")?;
- let order_data = OrderData {
+ let order_data = domain::OrderData {
consent_id: uuid::Uuid::new_v4().to_string(),
customer_id,
};
- let api_payload = ApiPayload {
+ let api_payload = domain::ApiPayload {
service: NETWORK_TOKEN_SERVICE.to_string(),
card_data: Secret::new(jwt),
order_data,
@@ -208,14 +207,14 @@ pub async fn mk_tokenization_req(
let response = services::call_connector_api(state, request, "generate_token")
.await
- .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed);
+ .change_context(errors::NetworkTokenizationError::ApiError);
let res = response
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: NetworkTokenErrorResponse = err_res
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -236,11 +235,11 @@ pub async fn mk_tokenization_req(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let network_response: CardNetworkTokenResponse = res
+ let network_response: domain::CardNetworkTokenResponse = res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
- logger::debug!("Network Token Response: {:?}", network_response); //added for debugging, will be removed
+ logger::debug!("Network Token Response: {:?}", network_response);
let dec_key = tokenization_service.private_key.peek().clone();
@@ -256,19 +255,25 @@ pub async fn mk_tokenization_req(
"Failed to decrypt the tokenization response from the tokenization service",
)?;
- let cn_response: CardNetworkTokenResponsePayload =
+ let cn_response: domain::GenerateNetworkTokenResponsePayload =
serde_json::from_str(&card_network_token_response)
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
- Ok((cn_response.clone(), Some(cn_response.card_reference)))
+ Ok((cn_response.clone(), cn_response.card_reference))
}
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
pub async fn make_card_network_tokenization_request(
state: &routes::SessionState,
card: &domain::Card,
customer_id: &id_type::CustomerId,
-) -> CustomResult<(CardNetworkTokenResponsePayload, Option<String>), errors::NetworkTokenizationError>
-{
- let card_data = CardData {
+) -> CustomResult<
+ (domain::CardNetworkTokenResponsePayload, Option<String>),
+ errors::NetworkTokenizationError,
+> {
+ let card_data = domain::CardData {
card_number: card.card_number.clone(),
exp_month: card.card_exp_month.clone(),
exp_year: card.card_exp_year.clone(),
@@ -308,18 +313,74 @@ pub async fn make_card_network_tokenization_request(
}
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn make_card_network_tokenization_request(
+ state: &routes::SessionState,
+ card: &api_payment_methods::CardDetail,
+ customer_id: &id_type::GlobalCustomerId,
+) -> CustomResult<(NetworkTokenDetails, String), errors::NetworkTokenizationError> {
+ let card_data = domain::CardData {
+ card_number: card.card_number.clone(),
+ exp_month: card.card_exp_month.clone(),
+ exp_year: card.card_exp_year.clone(),
+ card_security_code: None,
+ };
+
+ let payload = card_data
+ .encode_to_string_of_json()
+ .and_then(|x| x.encode_to_string_of_json())
+ .change_context(errors::NetworkTokenizationError::RequestEncodingFailed)?;
+
+ let payload_bytes = payload.as_bytes();
+ let network_tokenization_service = match &state.conf.network_tokenization_service {
+ Some(nt_service) => Ok(nt_service.get_inner()),
+ None => Err(report!(
+ errors::NetworkTokenizationError::NetworkTokenizationServiceNotConfigured
+ )),
+ }?;
+
+ let (resp, network_token_req_ref_id) = record_operation_time(
+ async {
+ generate_network_token(
+ state,
+ payload_bytes,
+ customer_id.clone(),
+ network_tokenization_service,
+ )
+ .await
+ .inspect_err(|e| logger::error!(error=?e, "Error while making tokenization request"))
+ },
+ &metrics::GENERATE_NETWORK_TOKEN_TIME,
+ router_env::metric_attributes!(("locker", "rust")),
+ )
+ .await?;
+
+ let network_token_details = NetworkTokenDetails {
+ network_token: resp.token,
+ network_token_exp_month: resp.token_expiry_month,
+ network_token_exp_year: resp.token_expiry_year,
+ card_issuer: card.card_issuer.clone(),
+ card_network: Some(resp.card_brand),
+ card_type: card.card_type.clone(),
+ card_issuing_country: card.card_issuing_country,
+ card_holder_name: card.card_holder_name.clone(),
+ nick_name: card.nick_name.clone(),
+ };
+ Ok((network_token_details, network_token_req_ref_id))
+}
+
#[cfg(feature = "v1")]
pub async fn get_network_token(
state: &routes::SessionState,
customer_id: id_type::CustomerId,
network_token_requestor_ref_id: String,
tokenization_service: &settings::NetworkTokenizationService,
-) -> CustomResult<TokenResponse, errors::NetworkTokenizationError> {
+) -> CustomResult<domain::TokenResponse, errors::NetworkTokenizationError> {
let mut request = services::Request::new(
services::Method::Post,
tokenization_service.fetch_token_url.as_str(),
);
- let payload = GetCardToken {
+ let payload = domain::GetCardToken {
card_reference: network_token_requestor_ref_id,
customer_id,
};
@@ -342,14 +403,14 @@ pub async fn get_network_token(
// Send the request using `call_connector_api`
let response = services::call_connector_api(state, request, "get network token")
.await
- .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed);
+ .change_context(errors::NetworkTokenizationError::ApiError);
let res = response
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: NetworkTokenErrorResponse = err_res
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Card Network Tokenization Response")
.change_context(
@@ -367,7 +428,75 @@ pub async fn get_network_token(
Ok(res) => Ok(res),
})?;
- let token_response: TokenResponse = res
+ let token_response: domain::TokenResponse = res
+ .response
+ .parse_struct("Get Network Token Response")
+ .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
+ logger::info!("Fetch Network Token Response: {:?}", token_response);
+
+ Ok(token_response)
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn get_network_token(
+ state: &routes::SessionState,
+ customer_id: &id_type::GlobalCustomerId,
+ network_token_requestor_ref_id: String,
+ tokenization_service: &settings::NetworkTokenizationService,
+) -> CustomResult<domain::TokenResponse, errors::NetworkTokenizationError> {
+ let mut request = services::Request::new(
+ services::Method::Post,
+ tokenization_service.fetch_token_url.as_str(),
+ );
+ let payload = domain::GetCardToken {
+ card_reference: network_token_requestor_ref_id,
+ customer_id: customer_id.clone(),
+ };
+
+ request.add_header(headers::CONTENT_TYPE, "application/json".into());
+ request.add_header(
+ headers::AUTHORIZATION,
+ tokenization_service
+ .token_service_api_key
+ .clone()
+ .peek()
+ .clone()
+ .into_masked(),
+ );
+ request.add_default_headers();
+ request.set_body(RequestContent::Json(Box::new(payload)));
+
+ logger::info!("Request to fetch network token: {:?}", request);
+
+ // Send the request using `call_connector_api`
+ let response = services::call_connector_api(state, request, "get network token")
+ .await
+ .change_context(errors::NetworkTokenizationError::ApiError);
+
+ let res = response
+ .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
+ .attach_printable("Error while receiving response")
+ .and_then(|inner| match inner {
+ Err(err_res) => {
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
+ .response
+ .parse_struct("Card Network Tokenization Response")
+ .change_context(
+ errors::NetworkTokenizationError::ResponseDeserializationFailed,
+ )?;
+ logger::error!(
+ error_code = %parsed_error.error_info.code,
+ developer_message = %parsed_error.error_info.developer_message,
+ "Network tokenization error: {}",
+ parsed_error.error_message
+ );
+ Err(errors::NetworkTokenizationError::ResponseDeserializationFailed)
+ .attach_printable(format!("Response Deserialization Failed: {err_res:?}"))
+ }
+ Ok(res) => Ok(res),
+ })?;
+
+ let token_response: domain::TokenResponse = res
.response
.parse_struct("Get Network Token Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
@@ -415,9 +544,11 @@ pub async fn get_token_from_tokenization_service(
.network_token_payment_method_data
.clone()
.map(|x| x.into_inner().expose())
- .and_then(|v| serde_json::from_value::<PaymentMethodsData>(v).ok())
+ .and_then(|v| serde_json::from_value::<api_payment_methods::PaymentMethodsData>(v).ok())
.and_then(|pmd| match pmd {
- PaymentMethodsData::Card(token) => Some(api::CardDetailFromLocker::from(token)),
+ api_payment_methods::PaymentMethodsData::Card(token) => {
+ Some(api::CardDetailFromLocker::from(token))
+ }
_ => None,
})
.ok_or(errors::ApiErrorResponse::InternalServerError)
@@ -452,9 +583,11 @@ pub async fn do_status_check_for_network_token(
.network_token_payment_method_data
.clone()
.map(|x| x.into_inner().expose())
- .and_then(|v| serde_json::from_value::<PaymentMethodsData>(v).ok())
+ .and_then(|v| serde_json::from_value::<api_payment_methods::PaymentMethodsData>(v).ok())
.and_then(|pmd| match pmd {
- PaymentMethodsData::Card(token) => Some(api::CardDetailFromLocker::from(token)),
+ api_payment_methods::PaymentMethodsData::Card(token) => {
+ Some(api::CardDetailFromLocker::from(token))
+ }
_ => None,
});
let network_token_requestor_reference_id = payment_method_info
@@ -507,6 +640,10 @@ pub async fn do_status_check_for_network_token(
}
}
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
pub async fn check_token_status_with_tokenization_service(
state: &routes::SessionState,
customer_id: &id_type::CustomerId,
@@ -518,7 +655,7 @@ pub async fn check_token_status_with_tokenization_service(
services::Method::Post,
tokenization_service.check_token_status_url.as_str(),
);
- let payload = CheckTokenStatus {
+ let payload = domain::CheckTokenStatus {
card_reference: network_token_requestor_reference_id,
customer_id: customer_id.clone(),
};
@@ -539,13 +676,13 @@ pub async fn check_token_status_with_tokenization_service(
// Send the request using `call_connector_api`
let response = services::call_connector_api(state, request, "Check Network token Status")
.await
- .change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed);
+ .change_context(errors::NetworkTokenizationError::ApiError);
let res = response
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: NetworkTokenErrorResponse = err_res
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(
@@ -566,20 +703,35 @@ pub async fn check_token_status_with_tokenization_service(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let check_token_status_response: CheckTokenStatusResponse = res
+ let check_token_status_response: domain::CheckTokenStatusResponse = res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
match check_token_status_response.payload.token_status {
- TokenStatus::Active => Ok((
+ domain::TokenStatus::Active => Ok((
Some(check_token_status_response.payload.token_expiry_month),
Some(check_token_status_response.payload.token_expiry_year),
)),
- TokenStatus::Inactive => Ok((None, None)),
+ domain::TokenStatus::Inactive => Ok((None, None)),
}
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn check_token_status_with_tokenization_service(
+ _state: &routes::SessionState,
+ _customer_id: &id_type::GlobalCustomerId,
+ _network_token_requestor_reference_id: String,
+ _tokenization_service: &settings::NetworkTokenizationService,
+) -> CustomResult<(Option<Secret<String>>, Option<Secret<String>>), errors::NetworkTokenizationError>
+{
+ todo!()
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
pub async fn delete_network_token_from_locker_and_token_service(
state: &routes::SessionState,
customer_id: &id_type::CustomerId,
@@ -624,6 +776,10 @@ pub async fn delete_network_token_from_locker_and_token_service(
Ok(resp)
}
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
pub async fn delete_network_token_from_tokenization_service(
state: &routes::SessionState,
network_token_requestor_reference_id: String,
@@ -634,7 +790,7 @@ pub async fn delete_network_token_from_tokenization_service(
services::Method::Post,
tokenization_service.delete_token_url.as_str(),
);
- let payload = DeleteCardToken {
+ let payload = domain::DeleteCardToken {
card_reference: network_token_requestor_reference_id,
customer_id: customer_id.clone(),
};
@@ -657,13 +813,13 @@ pub async fn delete_network_token_from_tokenization_service(
// Send the request using `call_connector_api`
let response = services::call_connector_api(state, request, "delete network token")
.await
- .change_context(errors::NetworkTokenizationError::DeleteNetworkTokenFailed);
+ .change_context(errors::NetworkTokenizationError::ApiError);
let res = response
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)
.attach_printable("Error while receiving response")
.and_then(|inner| match inner {
Err(err_res) => {
- let parsed_error: NetworkTokenErrorResponse = err_res
+ let parsed_error: domain::NetworkTokenErrorResponse = err_res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(
@@ -684,17 +840,29 @@ pub async fn delete_network_token_from_tokenization_service(
logger::error!("Error while deserializing response: {:?}", err);
})?;
- let delete_token_response: DeleteNetworkTokenResponse = res
+ let delete_token_response: domain::DeleteNetworkTokenResponse = res
.response
.parse_struct("Delete Network Tokenization Response")
.change_context(errors::NetworkTokenizationError::ResponseDeserializationFailed)?;
logger::info!("Delete Network Token Response: {:?}", delete_token_response);
- if delete_token_response.status == DeleteNetworkTokenStatus::Success {
+ if delete_token_response.status == domain::DeleteNetworkTokenStatus::Success {
Ok(true)
} else {
Err(errors::NetworkTokenizationError::DeleteNetworkTokenFailed)
.attach_printable("Delete Token at Token service failed")
}
}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+pub async fn delete_network_token_from_locker_and_token_service(
+ _state: &routes::SessionState,
+ _customer_id: &id_type::GlobalCustomerId,
+ _merchant_id: &id_type::MerchantId,
+ _payment_method_id: String,
+ _network_token_locker_id: Option<String>,
+ _network_token_requestor_reference_id: String,
+) -> errors::RouterResult<DeleteCardResp> {
+ todo!()
+}
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index c4d3eafe463..947ae97b119 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -545,6 +545,7 @@ pub fn generate_pm_vaulting_req_from_update_request(
card_holder_name: update_card.card_holder_name,
nick_name: update_card.nick_name,
}),
+ _ => todo!(), //todo! - since support for network tokenization is not added PaymentMethodUpdateData. should be handled later.
}
}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 86f1874ab09..49018faa634 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -85,6 +85,7 @@ pub async fn create_payment_method_api(
req,
&auth.merchant_account,
&auth.key_store,
+ &auth.profile,
))
.await
},
diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs
index 9a87b6d28be..270ed3ca64d 100644
--- a/crates/router/src/types/domain.rs
+++ b/crates/router/src/types/domain.rs
@@ -20,6 +20,10 @@ mod callback_mapper {
pub use hyperswitch_domain_models::callback_mapper::CallbackMapper;
}
+mod network_tokenization {
+ pub use hyperswitch_domain_models::network_tokenization::*;
+}
+
pub use customers::*;
pub use merchant_account::*;
@@ -48,6 +52,7 @@ pub use consts::*;
pub use event::*;
pub use merchant_connector_account::*;
pub use merchant_key_store::*;
+pub use network_tokenization::*;
pub use payment_methods::*;
pub use payments::*;
#[cfg(feature = "olap")]
diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rs
index c40d6fedfe7..d639bc44bc8 100644
--- a/crates/router/src/types/payment_methods.rs
+++ b/crates/router/src/types/payment_methods.rs
@@ -1,6 +1,8 @@
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use common_utils::generate_id;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+use hyperswitch_domain_models::payment_method_data::NetworkTokenDetails;
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use masking::Secret;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
@@ -115,6 +117,7 @@ impl VaultingInterface for VaultDelete {
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub enum PaymentMethodVaultingData {
Card(api::CardDetail),
+ NetworkToken(NetworkTokenDetails),
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
@@ -122,6 +125,7 @@ impl VaultingDataInterface for PaymentMethodVaultingData {
fn get_vaulting_data_key(&self) -> String {
match &self {
Self::Card(card) => card.card_number.to_string(),
+ Self::NetworkToken(network_token) => network_token.network_token.to_string(),
}
}
}
|
2025-01-30T07:49:02Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
add support for network tokenization for v2/payment-methods
- added network tokenization support for create+confirm payment methods api v2
- introduced new type for network token
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
test cases -
enable network tokenization for profile
payment-method create api -
```
curl --location 'http://localhost:8080/v2/payment-methods' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: pro_1Z1F459LoQzRTieDsLW2' \
--header 'api-key: dev_sewkgvR4aMq0tWNzDD6Y7IsNr9kPTS9ee19eQOGUaNLXWsqfxusLWu0ZGy2XU3pK' \
--data '{
"customer_id": "12345_cus_0194f66341a27da1af6dc6b7b86cfaeb",
"payment_method_type": "card",
"payment_method_subtype": "credit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "03",
"card_exp_year": "2025",
"card_holder_name": "joseph Doe"
}
},
"network_tokenization":{
"enable":"Enable"
}
}'
```
verify in payment methods table.
<img width="1726" alt="Screenshot 2025-02-14 at 1 08 29 PM" src="https://github.com/user-attachments/assets/2721dce4-c1ad-4a6f-b548-73939211f9a5" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
b38a958a9218df2ae4b10c38ca81f4e862ebde3d
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7203
|
Bug: feat(vsaas): Add platform merchant validations for payment intent
Currently `payment_intent` stores `platform_merchant_id`. This can be used to identify if the payment was created by platform merchant.
If the payment was initialized by platform merchant, the merchant who is the owner of the payment should not be able to do any operations on the payment and vice versa.
So, we need those validations on payment intents to check if the current merchant can be allowed to perform those operations even if the authentication module allows it.
|
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index c830b7618d0..bdb0548d6a4 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -45,7 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>,
> {
@@ -70,6 +71,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[IntentStatus::Failed, IntentStatus::Succeeded],
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index c6679e481f1..b41247003bd 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -12,6 +12,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -46,7 +47,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsCancelRequest, PaymentData<F>>,
> {
@@ -70,6 +71,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index ebe49f59f64..2bb8dd279e5 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, types::MultipleCaptureData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -45,7 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<
'a,
@@ -76,6 +77,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
payment_attempt = db
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id,
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index 81ffa8e992f..93b7ffa6c19 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -8,7 +8,11 @@ use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payments::operations::{self, ValidateStatusForOperation},
+ payments::{
+ helpers,
+ operations::{self, ValidateStatusForOperation},
+ },
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
types::{
@@ -142,7 +146,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentCaptureData<F>, PaymentsCaptureReques
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<PaymentCaptureData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -154,6 +158,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentCaptureData<F>, PaymentsCaptureReques
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
self.validate_status_for_operation(payment_intent.status)?;
let active_attempt_id = payment_intent
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 72c04c6a549..f1279f394b2 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -72,6 +72,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
+
payment_intent.setup_future_usage = request
.setup_future_usage
.or(payment_intent.setup_future_usage);
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 64191f77c6d..84ff9933875 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -106,6 +106,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
+
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 71d99d03e41..7245188059e 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -170,6 +170,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
self.validate_status_for_operation(payment_intent.status)?;
let client_secret = header_payload
.client_secret
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index 6419376f090..9f3a9e5248e 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -9,7 +9,11 @@ use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payments::operations::{self, ValidateStatusForOperation},
+ payments::{
+ helpers,
+ operations::{self, ValidateStatusForOperation},
+ },
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
types::{
@@ -119,7 +123,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetriev
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<PaymentStatusData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -131,6 +135,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetriev
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
let payment_attempt = payment_intent
.active_attempt_id
.as_ref()
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index 3cc26e7b67f..0041209eb0f 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -10,6 +10,7 @@ use crate::{
core::{
errors::{self, RouterResult},
payments::{self, helpers, operations},
+ utils::ValidatePlatformMerchant,
},
db::errors::StorageErrorExt,
routes::{app::ReqState, SessionState},
@@ -89,7 +90,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -99,6 +100,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
let payment_data = payments::PaymentIntentData {
flow: PhantomData,
payment_intent,
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 0e189583d0a..9f21dbc9981 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -73,6 +73,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::authenticate_client_secret(Some(request.client_secret.peek()), &payment_intent)?;
let mut payment_attempt = db
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index e5321b1f984..1591b1d6a47 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentAddress, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -43,7 +44,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<'a, F, PaymentsCancelRequest, PaymentData<F>>>
{
let db = &*state.store;
@@ -66,6 +67,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 0e94fbe09c6..be4f804a8a7 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -68,6 +68,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index ec59ba3473e..9bca88c6d04 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -10,7 +10,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, ValidateRequest};
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
- payments::{self, operations, operations::ValidateStatusForOperation},
+ payments::{self, helpers, operations, operations::ValidateStatusForOperation},
},
routes::SessionState,
types::{api, domain, storage::enums},
@@ -112,6 +112,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
self.validate_status_for_operation(payment_intent.status)?;
let client_secret = header_payload
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 1da9a1a2264..299d7237807 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -68,6 +68,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once Merchant ID auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 44f0c9172f9..c458f95ad97 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -213,7 +213,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>,
> {
@@ -225,6 +225,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve
request,
self,
merchant_account.storage_scheme,
+ platform_merchant_account,
)
.await
}
@@ -252,6 +253,7 @@ async fn get_tracker_for_sync<
any(feature = "v2", feature = "v1"),
not(feature = "payment_methods_v2")
))]
+#[allow(clippy::too_many_arguments)]
async fn get_tracker_for_sync<
'a,
F: Send + Clone,
@@ -264,6 +266,7 @@ async fn get_tracker_for_sync<
request: &api::PaymentsRetrieveRequest,
operation: Op,
storage_scheme: enums::MerchantStorageScheme,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>>
{
let (payment_intent, mut payment_attempt, currency, amount);
@@ -274,6 +277,7 @@ async fn get_tracker_for_sync<
merchant_account.get_id(),
key_store,
storage_scheme,
+ platform_merchant_account,
)
.await?;
@@ -579,6 +583,7 @@ pub async fn get_payment_intent_payment_attempt(
merchant_id: &common_utils::id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
+ _platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<(storage::PaymentIntent, storage::PaymentAttempt)> {
let key_manager_state: KeyManagerState = state.into();
let db = &*state.store;
@@ -662,4 +667,6 @@ pub async fn get_payment_intent_payment_attempt(
get_pi_pa()
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 0e60407aa7c..ac37513f2b9 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -81,6 +81,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index 4782d237e21..ba5ba772f82 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -21,9 +21,10 @@ use crate::{
core::{
errors::{self, RouterResult},
payments::{
- self,
+ self, helpers,
operations::{self, ValidateStatusForOperation},
},
+ utils::ValidatePlatformMerchant,
},
db::errors::StorageErrorExt,
routes::{app::ReqState, SessionState},
@@ -135,7 +136,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -145,6 +146,9 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
self.validate_status_for_operation(payment_intent.status)?;
let PaymentsUpdateIntentRequest {
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 2c816ad39d1..95c50f2f17e 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -15,6 +15,7 @@ use crate::{
self, helpers, operations, CustomerDetails, IncrementalAuthorizationDetails,
PaymentAddress,
},
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
services,
@@ -48,7 +49,7 @@ impl<F: Send + Clone + Sync>
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<
'a,
@@ -77,6 +78,9 @@ impl<F: Send + Clone + Sync>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_allowed_statuses(
payment_intent.status,
&[enums::IntentStatus::RequiresCapture],
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 5b9c90f3add..bcda2af8768 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -79,6 +79,8 @@ impl<F: Send + Clone + Sync>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 71cc3dceebb..aa8204b7e9d 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1680,3 +1680,36 @@ pub(crate) fn validate_profile_id_from_auth_layer<T: GetProfileId + std::fmt::De
(None, None) | (None, Some(_)) => Ok(()),
}
}
+
+pub(crate) trait ValidatePlatformMerchant {
+ fn get_platform_merchant_id(&self) -> Option<&common_utils::id_type::MerchantId>;
+
+ fn validate_platform_merchant(
+ &self,
+ auth_platform_merchant_id: Option<&common_utils::id_type::MerchantId>,
+ ) -> CustomResult<(), errors::ApiErrorResponse> {
+ let data_platform_merchant_id = self.get_platform_merchant_id();
+ match (data_platform_merchant_id, auth_platform_merchant_id) {
+ (Some(data_platform_merchant_id), Some(auth_platform_merchant_id)) => {
+ common_utils::fp_utils::when(
+ data_platform_merchant_id != auth_platform_merchant_id,
+ || {
+ Err(report!(errors::ApiErrorResponse::PaymentNotFound)).attach_printable(format!(
+ "Data platform merchant id: {data_platform_merchant_id:?} does not match with auth platform merchant id: {auth_platform_merchant_id:?}"))
+ },
+ )
+ }
+ (Some(_), None) | (None, Some(_)) => {
+ Err(report!(errors::ApiErrorResponse::InvalidPlatformOperation))
+ .attach_printable("Platform merchant id is missing in either data or auth")
+ }
+ (None, None) => Ok(()),
+ }
+ }
+}
+
+impl ValidatePlatformMerchant for storage::PaymentIntent {
+ fn get_platform_merchant_id(&self) -> Option<&common_utils::id_type::MerchantId> {
+ self.platform_merchant_id.as_ref()
+ }
+}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 5f9fe729eeb..09f3f1df330 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -508,6 +508,7 @@ pub async fn list_payment_method_api(
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
+ // TODO (#7195): Fill platform_merchant_account in the client secret auth and pass it here.
cards::list_payment_methods(state, auth.merchant_account, auth.key_store, req)
},
&*auth,
|
2025-02-06T13:49:12Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Currently payment_intent stores platform_merchant_id. This can be used to identify if the payment was created by platform merchant.
If the payment was initialized by platform merchant, the merchant who is the owner of the payment should not be able to do any operations on the payment and vice versa.
So, we need those validations on payment intents to check if the current merchant can be allowed to perform those operations even if the authentication module allows it.
These payment ops are modified in the process.
| Operation | Validation Added | Auth Used |
| ---------------------------------------- | ---------------- | ------------------------------ |
| Payment Approve | Yes | JWT + API Key |
| Payment Cancel | Yes | API Key |
| Payment Capture | Yes | API Key |
| Complete Authorize | No | Client Secret + API Key |
| Payment Confirm | No | Client Secret + API Key |
| Payment Reject | Yes | API Key |
| Payment Post Session Tokens | No | Publishable Key Auth |
| Payment Session | No | Publishable Key Auth |
| Payment Start | No | Merchant ID Auth |
| Payment Status | No | Client Secret + API Key + JWT |
| Payment Update | No | Publishable Key Auth + API Key |
| Payment Update Intent | Yes | API Key |
| Payment Incremental Authorization | Yes | API Key |
| Payment Session Update / Tax Calculation | No | Publishable Key Auth |
| Payment Create | No | API Key + JWT |
| Payment Intent Create | No | API Key + JWT |
| Payment Session Intent | No | Publishable Key Auth |
| Payment Get Intent | Yes | API Key |
| Payment Confirm Intent | No | Publishable Key Auth |
| Payment Get | Yes | API Key + JWT |
| Payment Capture V2 | Yes | API Key + JWT |
| Payment Get Intent | Yes | API Key |
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #7203.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Create two merchant accounts and make one platform. Refer #6882 to know what is a platform merchant and how to create a platform merchant account.
2. Create a payment for normal merchant account using platform merchant account
```bash
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-connected-merchant-id: merchant_1739261637' \
--header 'api-key: PLATFORM_API_KEY' \
--data '{
"amount": 6545,
"currency": "USD"
}'
```
3. Try to make any of the above mentioned operations using normal merchant account and it will throw error. Using payment cancel as an example.
```bash
curl --location 'http://localhost:8080/payments/pay_Hj5V6MPOVqIL44ODkX1j/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: NORMAL_MERCHANT_API_KEY' \
--data '{
"cancellation_reason": "requested_by_customer"
}'
```
```json
{
"error": {
"type": "invalid_request",
"message": "Invalid platform account operation",
"code": "IR_44"
}
}
```
- And the API should work if hit with platform merchant account api key
```bash
curl --location 'http://localhost:8080/payments/pay_Hj5V6MPOVqIL44ODkX1j/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-connected-merchant-id: merchant_1739261637' \
--header 'api-key: PLATFORM_API_KEY' \
--data '{
"cancellation_reason": "requested_by_customer"
}'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
9772cb36ee038023bee6d970d424e494b2e7aef6
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7184
|
Bug: disable stripe
disable stripe
|
2025-02-04T10:36:41Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
disable sprite.
closes #7184
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
...
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
ci should pass
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
55bb284ba063dc84e80b4f0d83c82ec7c30ad4c5
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7177
|
Bug: refactor(router): add revenue_recovery_metadata to payment intent in diesel and api model for v2 flow
Add the following fields to the api and diesel models Feature meta data
retry_count: Total number of billing connector + recovery retries for a payment intent.
payment_connector_transmission: It's supposed to tell if the payment_connector has been called or not.
billing_connector_id: To update the invoice at billing connector.
active_attempt_payment_connector_id : Process tracker needs payment merchant connector account id to schedule the retry attempt.
billing_connector_mit_token_details : MIT related information given by billing connector contains two fields.
1. customer_id : Customer Id of the customer in billing connector
2. payment_processor_token : The token used by the payment processor to retry the payment.
payment_method_type: This represents payment Method type like Card,Crypto,Mandate etc..
payment_method_subtype : This represents the subtype of the payment method like Credit, CryptoCurrency etc..
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cadae4fa45c..3a43b1bfca2 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -5793,6 +5793,23 @@
}
}
},
+ "BillingConnectorPaymentDetails": {
+ "type": "object",
+ "required": [
+ "payment_processor_token",
+ "connector_customer_id"
+ ],
+ "properties": {
+ "payment_processor_token": {
+ "type": "string",
+ "description": "Payment Processor Token to process the Revenue Recovery Payment"
+ },
+ "connector_customer_id": {
+ "type": "string",
+ "description": "Billing Connector's Customer Id"
+ }
+ }
+ },
"BlikBankRedirectAdditionalData": {
"type": "object",
"properties": {
@@ -9025,6 +9042,14 @@
}
],
"nullable": true
+ },
+ "payment_revenue_recovery_metadata": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentRevenueRecoveryMetadata"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -13167,6 +13192,13 @@
"bank_acquirer"
]
},
+ "PaymentConnectorTransmission": {
+ "type": "string",
+ "enum": [
+ "ConnectorCallFailed",
+ "ConnectorCallSucceeded"
+ ]
+ },
"PaymentCreatePaymentLinkConfig": {
"allOf": [
{
@@ -14926,6 +14958,49 @@
}
}
},
+ "PaymentRevenueRecoveryMetadata": {
+ "type": "object",
+ "required": [
+ "total_retry_count",
+ "payment_connector_transmission",
+ "billing_connector_id",
+ "active_attempt_payment_connector_id",
+ "billing_connector_payment_details",
+ "payment_method_type",
+ "payment_method_subtype"
+ ],
+ "properties": {
+ "total_retry_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Total number of billing connector + recovery retries for a payment intent.",
+ "example": "1",
+ "minimum": 0
+ },
+ "payment_connector_transmission": {
+ "$ref": "#/components/schemas/PaymentConnectorTransmission"
+ },
+ "billing_connector_id": {
+ "type": "string",
+ "description": "Billing Connector Id to update the invoices",
+ "example": "mca_1234567890"
+ },
+ "active_attempt_payment_connector_id": {
+ "type": "string",
+ "description": "Payment Connector Id to retry the payments",
+ "example": "mca_1234567890"
+ },
+ "billing_connector_payment_details": {
+ "$ref": "#/components/schemas/BillingConnectorPaymentDetails"
+ },
+ "payment_method_type": {
+ "$ref": "#/components/schemas/PaymentMethod"
+ },
+ "payment_method_subtype": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ }
+ },
"PaymentType": {
"type": "string",
"description": "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/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index bec25529af9..01e6343ffcd 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5,6 +5,8 @@ use std::{
};
pub mod additional_info;
use cards::CardNumber;
+#[cfg(feature = "v2")]
+use common_enums::enums::PaymentConnectorTransmission;
use common_enums::ProductType;
#[cfg(feature = "v2")]
use common_utils::id_type::GlobalPaymentId;
@@ -7102,12 +7104,28 @@ pub struct PaymentsStartRequest {
}
/// additional data that might be required by hyperswitch
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct FeatureMetadata {
+ /// Redirection response coming in request as metadata field only for redirection scenarios
+ #[schema(value_type = Option<RedirectResponse>)]
+ pub redirect_response: Option<RedirectResponse>,
+ /// Additional tags to be used for global search
+ #[schema(value_type = Option<Vec<String>>)]
+ pub search_tags: Option<Vec<HashedString<WithType>>>,
+ /// Recurring payment details required for apple pay Merchant Token
+ pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
+ /// revenue recovery data for payment intent
+ pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
+}
+
+/// additional data that might be required by hyperswitch
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
#[schema(value_type = Option<RedirectResponse>)]
pub redirect_response: Option<RedirectResponse>,
- // TODO: Convert this to hashedstrings to avoid PII sensitive data
/// Additional tags to be used for global search
#[schema(value_type = Option<Vec<String>>)]
pub search_tags: Option<Vec<HashedString<WithType>>>,
@@ -7968,3 +7986,36 @@ mod billing_from_payment_method_data {
assert!(billing_details.is_none());
}
}
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+pub struct PaymentRevenueRecoveryMetadata {
+ /// Total number of billing connector + recovery retries for a payment intent.
+ #[schema(value_type = u16,example = "1")]
+ pub total_retry_count: u16,
+ /// Flag for the payment connector's call
+ pub payment_connector_transmission: PaymentConnectorTransmission,
+ /// Billing Connector Id to update the invoices
+ #[schema(value_type = String, example = "mca_1234567890")]
+ pub billing_connector_id: id_type::MerchantConnectorAccountId,
+ /// Payment Connector Id to retry the payments
+ #[schema(value_type = String, example = "mca_1234567890")]
+ pub active_attempt_payment_connector_id: id_type::MerchantConnectorAccountId,
+ /// Billing Connector Payment Details
+ #[schema(value_type = BillingConnectorPaymentDetails)]
+ pub billing_connector_payment_details: BillingConnectorPaymentDetails,
+ /// Payment Method Type
+ #[schema(example = "pay_later", value_type = PaymentMethod)]
+ pub payment_method_type: common_enums::PaymentMethod,
+ /// PaymentMethod Subtype
+ #[schema(example = "klarna", value_type = PaymentMethodType)]
+ pub payment_method_subtype: common_enums::PaymentMethodType,
+}
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[cfg(feature = "v2")]
+pub struct BillingConnectorPaymentDetails {
+ /// Payment Processor Token to process the Revenue Recovery Payment
+ pub payment_processor_token: String,
+ /// Billing Connector's Customer Id
+ pub connector_customer_id: String,
+}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 2a5219f4dea..015160d7cdf 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3767,3 +3767,12 @@ pub enum AdyenSplitType {
/// The value-added tax charged on the payment, booked to your platforms liable balance account.
Vat,
}
+
+#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(rename = "snake_case")]
+pub enum PaymentConnectorTransmission {
+ /// Failed to call the payment connector
+ ConnectorCallFailed,
+ /// Payment Connector call succeeded
+ ConnectorCallSucceeded,
+}
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index 7806a7c6e1b..6bc8aee2893 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -1,10 +1,12 @@
+#[cfg(feature = "v2")]
+use common_enums::{enums::PaymentConnectorTransmission, PaymentMethod, PaymentMethodType};
use common_utils::{hashing::HashedString, pii, types::MinorUnit};
use diesel::{
sql_types::{Json, Jsonb},
AsExpression, FromSqlRow,
};
use masking::{Secret, WithType};
-use serde::{Deserialize, Serialize};
+use serde::{self, Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Jsonb)]
pub struct OrderDetailsWithAmount {
@@ -40,12 +42,26 @@ impl masking::SerializableSecret for OrderDetailsWithAmount {}
common_utils::impl_to_sql_from_sql_json!(OrderDetailsWithAmount);
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct FeatureMetadata {
+ /// Redirection response coming in request as metadata field only for redirection scenarios
+ pub redirect_response: Option<RedirectResponse>,
+ /// Additional tags to be used for global search
+ pub search_tags: Option<Vec<HashedString<WithType>>>,
+ /// Recurring payment details required for apple pay Merchant Token
+ pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
+ /// revenue recovery data for payment intent
+ pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
+}
+
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
pub redirect_response: Option<RedirectResponse>,
- // TODO: Convert this to hashedstrings to avoid PII sensitive data
/// Additional tags to be used for global search
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
@@ -106,3 +122,31 @@ pub struct RedirectResponse {
}
impl masking::SerializableSecret for RedirectResponse {}
common_utils::impl_to_sql_from_sql_json!(RedirectResponse);
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+pub struct PaymentRevenueRecoveryMetadata {
+ /// Total number of billing connector + recovery retries for a payment intent.
+ pub total_retry_count: u16,
+ /// Flag for the payment connector's call
+ pub payment_connector_transmission: PaymentConnectorTransmission,
+ /// Billing Connector Id to update the invoices
+ pub billing_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+ /// Payment Connector Id to retry the payments
+ pub active_attempt_payment_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+ /// Billing Connector Payment Details
+ pub billing_connector_payment_details: BillingConnectorPaymentDetails,
+ ///Payment Method Type
+ pub payment_method_type: PaymentMethod,
+ /// PaymentMethod Subtype
+ pub payment_method_subtype: PaymentMethodType,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+#[cfg(feature = "v2")]
+pub struct BillingConnectorPaymentDetails {
+ /// Payment Processor Token to process the Revenue Recovery Payment
+ pub payment_processor_token: String,
+ /// Billing Connector's Customer Id
+ pub connector_customer_id: String,
+}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index bd6dd2e5371..b2546e3a049 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -40,10 +40,17 @@ use api_models::payments::{
RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit,
RedirectResponse as ApiRedirectResponse,
};
+#[cfg(feature = "v2")]
+use api_models::payments::{
+ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails,
+ PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata,
+};
use diesel_models::types::{
ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata,
OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse,
};
+#[cfg(feature = "v2")]
+use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata};
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub enum RemoteStorageObject<T: ForeignIDRef> {
@@ -78,18 +85,57 @@ pub trait ApiModelToDieselModelConvertor<F> {
fn convert_back(self) -> F;
}
+#[cfg(feature = "v1")]
+impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
+ fn convert_from(from: ApiFeatureMetadata) -> Self {
+ let ApiFeatureMetadata {
+ redirect_response,
+ search_tags,
+ apple_pay_recurring_details,
+ } = from;
+
+ Self {
+ redirect_response: redirect_response.map(RedirectResponse::convert_from),
+ search_tags,
+ apple_pay_recurring_details: apple_pay_recurring_details
+ .map(ApplePayRecurringDetails::convert_from),
+ }
+ }
+
+ fn convert_back(self) -> ApiFeatureMetadata {
+ let Self {
+ redirect_response,
+ search_tags,
+ apple_pay_recurring_details,
+ } = self;
+
+ ApiFeatureMetadata {
+ redirect_response: redirect_response
+ .map(|redirect_response| redirect_response.convert_back()),
+ search_tags,
+ apple_pay_recurring_details: apple_pay_recurring_details
+ .map(|value| value.convert_back()),
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
fn convert_from(from: ApiFeatureMetadata) -> Self {
let ApiFeatureMetadata {
redirect_response,
search_tags,
apple_pay_recurring_details,
+ payment_revenue_recovery_metadata,
} = from;
+
Self {
redirect_response: redirect_response.map(RedirectResponse::convert_from),
search_tags,
apple_pay_recurring_details: apple_pay_recurring_details
.map(ApplePayRecurringDetails::convert_from),
+ payment_revenue_recovery_metadata: payment_revenue_recovery_metadata
+ .map(PaymentRevenueRecoveryMetadata::convert_from),
}
}
@@ -98,13 +144,17 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
redirect_response,
search_tags,
apple_pay_recurring_details,
+ payment_revenue_recovery_metadata,
} = self;
+
ApiFeatureMetadata {
redirect_response: redirect_response
.map(|redirect_response| redirect_response.convert_back()),
search_tags,
apple_pay_recurring_details: apple_pay_recurring_details
.map(|value| value.convert_back()),
+ payment_revenue_recovery_metadata: payment_revenue_recovery_metadata
+ .map(|value| value.convert_back()),
}
}
}
@@ -204,6 +254,56 @@ impl ApiModelToDieselModelConvertor<ApiApplePayRecurringDetails> for ApplePayRec
}
}
+#[cfg(feature = "v2")]
+impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for PaymentRevenueRecoveryMetadata {
+ fn convert_from(from: ApiRevenueRecoveryMetadata) -> Self {
+ Self {
+ total_retry_count: from.total_retry_count,
+ payment_connector_transmission: from.payment_connector_transmission,
+ billing_connector_id: from.billing_connector_id,
+ active_attempt_payment_connector_id: from.active_attempt_payment_connector_id,
+ billing_connector_payment_details: BillingConnectorPaymentDetails::convert_from(
+ from.billing_connector_payment_details,
+ ),
+ payment_method_type: from.payment_method_type,
+ payment_method_subtype: from.payment_method_subtype,
+ }
+ }
+
+ fn convert_back(self) -> ApiRevenueRecoveryMetadata {
+ ApiRevenueRecoveryMetadata {
+ total_retry_count: self.total_retry_count,
+ payment_connector_transmission: self.payment_connector_transmission,
+ billing_connector_id: self.billing_connector_id,
+ active_attempt_payment_connector_id: self.active_attempt_payment_connector_id,
+ billing_connector_payment_details: self
+ .billing_connector_payment_details
+ .convert_back(),
+ payment_method_type: self.payment_method_type,
+ payment_method_subtype: self.payment_method_subtype,
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
+impl ApiModelToDieselModelConvertor<ApiBillingConnectorPaymentDetails>
+ for BillingConnectorPaymentDetails
+{
+ fn convert_from(from: ApiBillingConnectorPaymentDetails) -> Self {
+ Self {
+ payment_processor_token: from.payment_processor_token,
+ connector_customer_id: from.connector_customer_id,
+ }
+ }
+
+ fn convert_back(self) -> ApiBillingConnectorPaymentDetails {
+ ApiBillingConnectorPaymentDetails {
+ payment_processor_token: self.payment_processor_token,
+ connector_customer_id: self.connector_customer_id,
+ }
+ }
+}
+
impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsWithAmount {
fn convert_from(from: ApiOrderDetailsWithAmount) -> Self {
let ApiOrderDetailsWithAmount {
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index cc6f1b0e411..e5c9c6fa81f 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -466,6 +466,9 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::BacsBankTransferInstructions,
api_models::payments::RedirectResponse,
api_models::payments::RequestSurchargeDetails,
+ api_models::payments::PaymentRevenueRecoveryMetadata,
+ api_models::payments::BillingConnectorPaymentDetails,
+ api_models::enums::PaymentConnectorTransmission,
api_models::payments::PaymentAttemptResponse,
api_models::payments::PaymentAttemptAmountDetails,
api_models::payments::CaptureResponse,
|
2025-02-03T17:31:54Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Adds the following fields to the api and diesel models Feature meta data
retry_count: Total number of billing connector + recovery retries for a payment intent.
payment_connector_transmission: It's supposed to tell if the payment_connector has been called or not.
billing_connector_id: To update the invoice at billing connector.
active_attempt_payment_connector_id : Process tracker needs payment merchant connector account id to schedule the retry attempt.
billing_connector_mit_token_details: MIT related information given by billing connector contains two fields.
1. customer_id : Customer Id of the customer in billing connector
2. payment_processor_token : The token used by the payment processor to retry the payment.
payment_method_type: This represents payment Method type like Card,Crypto,Mandate etc..
payment_method_subtype : This represents the subtype of the payment method like Credit, CryptoCurrency etc..
Note This PR closes #7177
### Additional Changes
- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Motivation and Context
## How did you test it?
Create Intent Request
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_7iySXObGOGY3S9g2OgXlwnQIYJACCsn72FDRXcs6lNlSpheMRHD8bzg0WcUpb9KL' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_vxOhrwYLpaKZXp6llHo1' \
--data-raw '{
"amount_details": {
"order_amount": 100,
"currency": "USD"
},
"capture_method":"manual",
"authentication_type": "no_three_ds",
"billing": {
"address": {
"first_name": "John",
"last_name": "Dough"
},
"email": "example@example.com"
},
"shipping": {
"address": {
"first_name": "John",
"last_name": "Dough",
"city": "Karwar",
"zip": "581301",
"state": "Karnataka"
},
"email": "example@example.com"
},
"feature_metadata":{
"revenue_recovery_metadata" : {
"retry_count": 3,
"payment_connector_transmission" : true,
"billing_connector_id" : "test12345678",
"active_attempt_payment_connector_id" : "test123456",
"billing_connector_mit_token_details":{
"payment_processor_token":"payment_12312466363",
"connector_customer_id" : "customer_id123"
},
"payment_method_type" : "card",
"payment_method_subtype": "credit"
}
}
}'
```
create-intent response
```
{
"id": "12345_pay_0194cccc5bdd74f0bcd98e2fe0800208",
"status": "requires_payment_method",
"amount_details": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null
},
"client_secret": "12345_pay_0194cccc5bdd74f0bcd98e2fe0800208_secret_0194cccc5bf17ac3b8513527e11145c5",
"profile_id": "pro_vxOhrwYLpaKZXp6llHo1",
"merchant_reference_id": null,
"routing_algorithm_id": null,
"capture_method": "manual",
"authentication_type": "no_three_ds",
"billing": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"line3": null,
"zip": null,
"state": null,
"first_name": "John",
"last_name": "Dough"
},
"phone": null,
"email": "example@example.com"
},
"shipping": {
"address": {
"city": "Karwar",
"country": null,
"line1": null,
"line2": null,
"line3": null,
"zip": "581301",
"state": "Karnataka",
"first_name": "John",
"last_name": "Dough"
},
"phone": null,
"email": "example@example.com"
},
"customer_id": null,
"customer_present": "present",
"description": null,
"return_url": null,
"setup_future_usage": "on_session",
"apply_mit_exemption": "Skip",
"statement_descriptor": null,
"order_details": null,
"allowed_payment_method_types": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"revenue_recovery_metadata": {
"retry_count": 3,
"payment_connector_transmission": true,
"billing_connector_id": "test12345678",
"active_attempt_payment_connector_id": "test123456",
"billing_connector_mit_token_details": {
"payment_processor_token": "payment_12312466363",
"connector_customer_id": "customer_id123"
},
"payment_method_type": "card",
"payment_method_subtype": "credit"
}
},
"payment_link_enabled": "Skip",
"payment_link_config": null,
"request_incremental_authorization": "default",
"expires_on": "2025-02-03T17:27:12.529Z",
"frm_metadata": null,
"request_external_three_ds_authentication": "Skip"
}
```
get intent response
```
{
"id": "12345_pay_0194cccc5bdd74f0bcd98e2fe0800208",
"status": "requires_payment_method",
"amount_details": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null
},
"client_secret": "12345_pay_0194cccc5bdd74f0bcd98e2fe0800208_secret_0194cccc5bf17ac3b8513527e11145c5",
"profile_id": "pro_vxOhrwYLpaKZXp6llHo1",
"merchant_reference_id": null,
"routing_algorithm_id": null,
"capture_method": "manual",
"authentication_type": "no_three_ds",
"billing": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"line3": null,
"zip": null,
"state": null,
"first_name": "John",
"last_name": "Dough"
},
"phone": null,
"email": "example@example.com"
},
"shipping": {
"address": {
"city": "Karwar",
"country": null,
"line1": null,
"line2": null,
"line3": null,
"zip": "581301",
"state": "Karnataka",
"first_name": "John",
"last_name": "Dough"
},
"phone": null,
"email": "example@example.com"
},
"customer_id": null,
"customer_present": "present",
"description": null,
"return_url": null,
"setup_future_usage": "on_session",
"apply_mit_exemption": "Skip",
"statement_descriptor": null,
"order_details": null,
"allowed_payment_method_types": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"revenue_recovery_metadata": {
"retry_count": 3,
"payment_connector_transmission": true,
"billing_connector_id": "test12345678",
"active_attempt_payment_connector_id": "test123456",
"billing_connector_mit_token_details": {
"payment_processor_token": "payment_12312466363",
"connector_customer_id": "customer_id123"
},
"payment_method_type": "card",
"payment_method_subtype": "credit"
}
},
"payment_link_enabled": "Skip",
"payment_link_config": null,
"request_incremental_authorization": "default",
"expires_on": "2025-02-03T17:27:12.529Z",
"frm_metadata": null,
"request_external_three_ds_authentication": "Skip"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
b09905ecb4c7b33576b3ca1f13affe5341ea6e6f
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7175
|
Bug: [CYPRESS] Add Cypress Tests for Card Payment Methods in `Braintree` Connectors
Implement end-to-end Cypress tests to validate **card payment flow configs** for the **Braintree** and **Authorize.net** payment connectors. These tests should cover various flows.
|
2025-02-13T11:25:00Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
Adding Cypress Test Case Flows related Configs for the `Braintree` Payment Processor.
~_Note: The Connector Update Test will fail until https://github.com/juspay/hyperswitch/pull/7622 is not merged to the `main` branch._~ (#7622 is Merged)
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Missing Configs for `Braintree` Connector.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<img width="700" alt="image" src="https://github.com/user-attachments/assets/28d84bc1-1890-4b22-baf4-e94de421c233" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
2c9b8abdb58d5b97f9d01a112569ad82b99ea00d
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7190
|
Bug: [FEATURE]: Add Payments - List to v2
`Payments - List` endpoint is needed for the dashboard
|
diff --git a/api-reference-v2/api-reference/payments/payments--list.mdx b/api-reference-v2/api-reference/payments/payments--list.mdx
new file mode 100644
index 00000000000..80350a5705e
--- /dev/null
+++ b/api-reference-v2/api-reference/payments/payments--list.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/payments/list
+---
\ No newline at end of file
diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json
index 8fd3b64230b..d935ec84a61 100644
--- a/api-reference-v2/mint.json
+++ b/api-reference-v2/mint.json
@@ -43,7 +43,8 @@
"api-reference/payments/payments--payment-methods-list",
"api-reference/payments/payments--confirm-intent",
"api-reference/payments/payments--get",
- "api-reference/payments/payments--create-and-confirm-intent"
+ "api-reference/payments/payments--create-and-confirm-intent",
+ "api-reference/payments/payments--list"
]
},
{
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cedd4abcca6..4d68da7cec7 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -2258,6 +2258,341 @@
]
}
},
+ "/v2/payments/list": {
+ "get": {
+ "tags": [
+ "Payments"
+ ],
+ "summary": "Payments - List",
+ "description": "To list the *payments*",
+ "operationId": "List all Payments",
+ "parameters": [
+ {
+ "name": "payment_id",
+ "in": "path",
+ "description": "The identifier for payment",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ },
+ "example": "pay_fafa124123"
+ },
+ {
+ "name": "profile_id",
+ "in": "path",
+ "description": "The identifier for business profile",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ },
+ "example": "pay_fafa124123"
+ },
+ {
+ "name": "customer_id",
+ "in": "path",
+ "description": "The identifier for customer",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
+ },
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44"
+ },
+ {
+ "name": "starting_after",
+ "in": "path",
+ "description": "A cursor for use in pagination, fetch the next list after some object",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ },
+ "example": "pay_fafa124123"
+ },
+ {
+ "name": "ending_before",
+ "in": "path",
+ "description": "A cursor for use in pagination, fetch the previous list before some object",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ },
+ "example": "pay_fafa124123"
+ },
+ {
+ "name": "limit",
+ "in": "path",
+ "description": "limit on the number of objects to return",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int32",
+ "default": 10,
+ "maximum": 100,
+ "minimum": 0
+ }
+ },
+ {
+ "name": "offset",
+ "in": "path",
+ "description": "The starting point within a list of objects",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int32",
+ "nullable": true,
+ "minimum": 0
+ }
+ },
+ {
+ "name": "created",
+ "in": "path",
+ "description": "The time at which payment is created",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time",
+ "nullable": true
+ },
+ "example": "2022-09-10T10:11:12Z"
+ },
+ {
+ "name": "created.lt",
+ "in": "path",
+ "description": "Time less than the payment created time",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time",
+ "nullable": true
+ },
+ "example": "2022-09-10T10:11:12Z"
+ },
+ {
+ "name": "created.gt",
+ "in": "path",
+ "description": "Time greater than the payment created time",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time",
+ "nullable": true
+ },
+ "example": "2022-09-10T10:11:12Z"
+ },
+ {
+ "name": "created.lte",
+ "in": "path",
+ "description": "Time less than or equals to the payment created time",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time",
+ "nullable": true
+ },
+ "example": "2022-09-10T10:11:12Z"
+ },
+ {
+ "name": "created.gte",
+ "in": "path",
+ "description": "Time greater than or equals to the payment created time",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time",
+ "nullable": true
+ },
+ "example": "2022-09-10T10:11:12Z"
+ },
+ {
+ "name": "start_amount",
+ "in": "path",
+ "description": "The start amount to filter list of transactions which are greater than or equal to the start amount",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ },
+ {
+ "name": "end_amount",
+ "in": "path",
+ "description": "The end amount to filter list of transactions which are less than or equal to the end amount",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ },
+ {
+ "name": "connector",
+ "in": "path",
+ "description": "The connector to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Connector"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "currency",
+ "in": "path",
+ "description": "The currency to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Currency"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "status",
+ "in": "path",
+ "description": "The payment status to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/IntentStatus"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "path",
+ "description": "The payment method type to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethod"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "payment_method_subtype",
+ "in": "path",
+ "description": "The payment method subtype to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "authentication_type",
+ "in": "path",
+ "description": "The authentication type to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AuthenticationType"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "merchant_connector_id",
+ "in": "path",
+ "description": "The merchant connector id to filter payments list",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ },
+ {
+ "name": "order_on",
+ "in": "path",
+ "description": "The field on which the payments list should be sorted",
+ "required": true,
+ "schema": {
+ "$ref": "#/components/schemas/SortOn"
+ }
+ },
+ {
+ "name": "order_by",
+ "in": "path",
+ "description": "The order in which payments list should be sorted",
+ "required": true,
+ "schema": {
+ "$ref": "#/components/schemas/SortBy"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "path",
+ "description": "The card networks to filter payments list",
+ "required": true,
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CardNetwork"
+ }
+ ],
+ "nullable": true
+ }
+ },
+ {
+ "name": "merchant_order_reference_id",
+ "in": "path",
+ "description": "The identifier for merchant order reference id",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved a payment list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentListResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "No payments found"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ },
+ {
+ "jwt_key": []
+ }
+ ]
+ }
+ },
"/v2/payment-methods": {
"post": {
"tags": [
@@ -7931,14 +8266,6 @@
"type": "object",
"description": "Details of customer attached to this payment",
"properties": {
- "id": {
- "type": "string",
- "description": "The identifier for the customer.",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "nullable": true,
- "maxLength": 64,
- "minLength": 1
- },
"name": {
"type": "string",
"description": "The customer's name",
@@ -12346,10 +12673,25 @@
}
}
},
- "OrderDetailsWithAmount": {
+ "Order": {
"type": "object",
"required": [
- "product_name",
+ "on",
+ "by"
+ ],
+ "properties": {
+ "on": {
+ "$ref": "#/components/schemas/SortOn"
+ },
+ "by": {
+ "$ref": "#/components/schemas/SortBy"
+ }
+ }
+ },
+ "OrderDetailsWithAmount": {
+ "type": "object",
+ "required": [
+ "product_name",
"quantity",
"amount"
],
@@ -13546,74 +13888,32 @@
}
}
},
- "PaymentListConstraints": {
+ "PaymentListResponse": {
"type": "object",
+ "required": [
+ "count",
+ "total_count",
+ "data"
+ ],
"properties": {
- "customer_id": {
- "type": "string",
- "description": "The identifier for customer",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "nullable": true,
- "maxLength": 64,
- "minLength": 1
- },
- "starting_after": {
- "type": "string",
- "description": "A cursor for use in pagination, fetch the next list after some object",
- "example": "pay_fafa124123",
- "nullable": true
- },
- "ending_before": {
- "type": "string",
- "description": "A cursor for use in pagination, fetch the previous list before some object",
- "example": "pay_fafa124123",
- "nullable": true
- },
- "limit": {
+ "count": {
"type": "integer",
- "format": "int32",
- "description": "limit on the number of objects to return",
- "default": 10,
- "maximum": 100,
+ "description": "The number of payments included in the current response",
"minimum": 0
},
- "created": {
- "type": "string",
- "format": "date-time",
- "description": "The time at which payment is created",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "created.lt": {
- "type": "string",
- "format": "date-time",
- "description": "Time less than the payment created time",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "created.gt": {
- "type": "string",
- "format": "date-time",
- "description": "Time greater than the payment created time",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "created.lte": {
- "type": "string",
- "format": "date-time",
- "description": "Time less than or equals to the payment created time",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
+ "total_count": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The total number of available payments for given constraints"
},
- "created.gte": {
- "type": "string",
- "format": "date-time",
- "description": "Time greater than or equals to the payment created time",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentsListResponseItem"
+ },
+ "description": "The list of payments response objects"
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethod": {
"type": "string",
@@ -15774,6 +16074,217 @@
},
"additionalProperties": false
},
+ "PaymentsListResponseItem": {
+ "type": "object",
+ "required": [
+ "id",
+ "merchant_id",
+ "profile_id",
+ "status",
+ "amount",
+ "created",
+ "attempt_count",
+ "return_url"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "Unique identifier for the payment",
+ "example": "12345_pay_01926c58bc6e77c09e809964e72af8c8",
+ "maxLength": 64,
+ "minLength": 32
+ },
+ "merchant_id": {
+ "type": "string",
+ "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
+ "example": "merchant_1668273825",
+ "maxLength": 255
+ },
+ "profile_id": {
+ "type": "string",
+ "description": "The business profile that is associated with this payment"
+ },
+ "customer_id": {
+ "type": "string",
+ "description": "The identifier for the customer",
+ "example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 32
+ },
+ "payment_method_id": {
+ "type": "string",
+ "description": "Identifier for Payment Method used for the payment",
+ "nullable": true
+ },
+ "status": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/IntentStatus"
+ }
+ ],
+ "default": "requires_confirmation"
+ },
+ "amount": {
+ "$ref": "#/components/schemas/PaymentAmountDetailsResponse"
+ },
+ "created": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time when the payment was created",
+ "example": "2022-09-10T10:11:12Z"
+ },
+ "payment_method_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethod"
+ }
+ ],
+ "nullable": true
+ },
+ "payment_method_subtype": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ ],
+ "nullable": true
+ },
+ "connector": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Connector"
+ }
+ ],
+ "nullable": true
+ },
+ "merchant_connector_id": {
+ "type": "string",
+ "description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
+ "nullable": true
+ },
+ "customer": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerDetailsResponse"
+ }
+ ],
+ "nullable": true
+ },
+ "merchant_reference_id": {
+ "type": "string",
+ "description": "The reference id for the order in the merchant's system. This value can be passed by the merchant.",
+ "nullable": true
+ },
+ "connector_payment_id": {
+ "type": "string",
+ "description": "A unique identifier for a payment provided by the connector",
+ "example": "993672945374576J",
+ "nullable": true
+ },
+ "connector_response_reference_id": {
+ "type": "string",
+ "description": "Reference to the capture at connector side",
+ "nullable": true
+ },
+ "metadata": {
+ "type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
+ "nullable": true
+ },
+ "description": {
+ "type": "string",
+ "description": "A description of the payment",
+ "example": "It's my first payment request",
+ "nullable": true
+ },
+ "authentication_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AuthenticationType"
+ }
+ ],
+ "default": "three_ds",
+ "nullable": true
+ },
+ "capture_method": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CaptureMethod"
+ }
+ ],
+ "nullable": true
+ },
+ "setup_future_usage": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/FutureUsage"
+ }
+ ],
+ "nullable": true
+ },
+ "attempt_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Total number of attempts associated with this payment"
+ },
+ "error": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ErrorDetails"
+ }
+ ],
+ "nullable": true
+ },
+ "cancellation_reason": {
+ "type": "string",
+ "description": "If the payment was cancelled the reason will be provided here",
+ "nullable": true
+ },
+ "order_details": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/OrderDetailsWithAmount"
+ },
+ "description": "Information about the product , quantity and amount for connectors. (e.g. Klarna)",
+ "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]",
+ "nullable": true
+ },
+ "return_url": {
+ "type": "string",
+ "description": "The URL to redirect after the completion of the operation",
+ "example": "https://hyperswitch.io"
+ },
+ "statement_descriptor": {
+ "type": "string",
+ "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
+ "example": "Hyperswitch Router",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "allowed_payment_method_types": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "description": "Allowed Payment Method Types for a given PaymentIntent",
+ "nullable": true
+ },
+ "authorization_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Total number of authorizations happened in an incremental_authorization payment",
+ "nullable": true
+ },
+ "modified_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Date time at which payment was updated",
+ "example": "2022-09-10T10:11:12Z",
+ "nullable": true
+ }
+ }
+ },
"PaymentsRequest": {
"type": "object",
"required": [
@@ -20352,6 +20863,20 @@
"contain"
]
},
+ "SortBy": {
+ "type": "string",
+ "enum": [
+ "asc",
+ "desc"
+ ]
+ },
+ "SortOn": {
+ "type": "string",
+ "enum": [
+ "amount",
+ "created"
+ ]
+ },
"SplitPaymentsRequest": {
"oneOf": [
{
diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index 4e672927284..ccda5fd402d 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -11,7 +11,7 @@ use super::{
))]
use crate::payment_methods::CustomerPaymentMethodsListResponse;
#[cfg(feature = "v1")]
-use crate::payments::{PaymentListResponse, PaymentListResponseV2};
+use crate::payments::{PaymentListFilterConstraints, PaymentListResponseV2};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use crate::{events, payment_methods::CustomerPaymentMethodsListResponse};
use crate::{
@@ -23,16 +23,15 @@ use crate::{
PaymentMethodUpdate,
},
payments::{
- self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints,
- PaymentListFilterConstraints, PaymentListFilters, PaymentListFiltersV2,
- PaymentsAggregateResponse, PaymentsApproveRequest, PaymentsCancelRequest,
- PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
- PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
- PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse,
- PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,
- PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
- PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsResponse,
- PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
+ self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints, PaymentListFilters,
+ PaymentListFiltersV2, PaymentListResponse, PaymentsAggregateResponse,
+ PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
+ PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
+ PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
+ PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
+ PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
+ PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
+ PaymentsResponse, PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
RedirectionResponse,
},
};
@@ -350,6 +349,7 @@ impl ApiEventMetric for PaymentMethodCollectLinkResponse {
}
}
+#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListFilterConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
@@ -373,7 +373,6 @@ impl ApiEventMetric for PaymentListConstraints {
}
}
-#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f996de726e4..222373f538f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -8,8 +8,6 @@ use cards::CardNumber;
#[cfg(feature = "v2")]
use common_enums::enums::PaymentConnectorTransmission;
use common_enums::ProductType;
-#[cfg(feature = "v2")]
-use common_utils::id_type::GlobalPaymentId;
use common_utils::{
consts::default_payments_list_limit,
crypto,
@@ -97,6 +95,7 @@ pub struct CustomerDetails {
pub phone_country_code: Option<String>,
}
+#[cfg(feature = "v1")]
/// Details of customer attached to this payment
#[derive(
Debug, Default, serde::Serialize, serde::Deserialize, Clone, ToSchema, PartialEq, Setter,
@@ -123,6 +122,27 @@ pub struct CustomerDetailsResponse {
pub phone_country_code: Option<String>,
}
+#[cfg(feature = "v2")]
+/// Details of customer attached to this payment
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema, PartialEq, Setter)]
+pub struct CustomerDetailsResponse {
+ /// The customer's name
+ #[schema(max_length = 255, value_type = Option<String>, example = "John Doe")]
+ pub name: Option<Secret<String>>,
+
+ /// The customer's email address
+ #[schema(max_length = 255, value_type = Option<String>, example = "johntest@test.com")]
+ pub email: Option<Email>,
+
+ /// The customer's phone number
+ #[schema(value_type = Option<String>, max_length = 10, example = "9123456789")]
+ pub phone: Option<Secret<String>>,
+
+ /// The country code for the customer's phone number
+ #[schema(max_length = 2, example = "+1")]
+ pub phone_country_code: Option<String>,
+}
+
// Serialize is required because the api event requires Serialize to be implemented
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
#[serde(deny_unknown_fields)]
@@ -4862,6 +4882,139 @@ pub struct PaymentsResponse {
pub card_discovery: Option<enums::CardDiscovery>,
}
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, serde::Serialize, ToSchema)]
+pub struct PaymentsListResponseItem {
+ /// Unique identifier for the payment
+ #[schema(
+ min_length = 32,
+ max_length = 64,
+ example = "12345_pay_01926c58bc6e77c09e809964e72af8c8",
+ value_type = String,
+ )]
+ pub id: id_type::GlobalPaymentId,
+
+ /// This is an identifier for the merchant account. This is inferred from the API key
+ /// provided during the request
+ #[schema(max_length = 255, example = "merchant_1668273825", value_type = String)]
+ pub merchant_id: id_type::MerchantId,
+
+ /// The business profile that is associated with this payment
+ #[schema(value_type = String)]
+ pub profile_id: id_type::ProfileId,
+
+ /// The identifier for the customer
+ #[schema(
+ min_length = 32,
+ max_length = 64,
+ example = "12345_cus_01926c58bc6e77c09e809964e72af8c8",
+ value_type = Option<String>
+ )]
+ pub customer_id: Option<id_type::GlobalCustomerId>,
+
+ /// Identifier for Payment Method used for the payment
+ #[schema(value_type = Option<String>)]
+ pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
+
+ /// Status of the payment
+ #[schema(value_type = IntentStatus, example = "failed", default = "requires_confirmation")]
+ pub status: api_enums::IntentStatus,
+
+ /// Amount related information for this payment and attempt
+ pub amount: PaymentAmountDetailsResponse,
+
+ /// Time when the payment was created
+ #[schema(example = "2022-09-10T10:11:12Z")]
+ #[serde(with = "common_utils::custom_serde::iso8601")]
+ pub created: PrimitiveDateTime,
+
+ /// The payment method type for this payment attempt
+ #[schema(value_type = Option<PaymentMethod>, example = "wallet")]
+ pub payment_method_type: Option<api_enums::PaymentMethod>,
+
+ #[schema(value_type = Option<PaymentMethodType>, example = "apple_pay")]
+ pub payment_method_subtype: Option<api_enums::PaymentMethodType>,
+
+ /// The connector used for the payment
+ #[schema(value_type = Option<Connector>, example = "stripe")]
+ pub connector: Option<String>,
+
+ /// Identifier of the connector ( merchant connector account ) which was chosen to make the payment
+ #[schema(value_type = Option<String>)]
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+
+ /// Details of the customer
+ pub customer: Option<CustomerDetailsResponse>,
+
+ /// The reference id for the order in the merchant's system. This value can be passed by the merchant.
+ #[schema(value_type = Option<String>)]
+ pub merchant_reference_id: Option<id_type::PaymentReferenceId>,
+
+ /// A unique identifier for a payment provided by the connector
+ #[schema(value_type = Option<String>, example = "993672945374576J")]
+ pub connector_payment_id: Option<String>,
+
+ /// Reference to the capture at connector side
+ pub connector_response_reference_id: Option<String>,
+
+ /// Metadata is useful for storing additional, unstructured information on an object.
+ #[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
+ pub metadata: Option<Secret<serde_json::Value>>,
+
+ /// A description of the payment
+ #[schema(example = "It's my first payment request")]
+ pub description: Option<String>,
+
+ /// The transaction authentication can be set to undergo payer authentication. By default, the authentication will be marked as NO_THREE_DS
+ #[schema(value_type = Option<AuthenticationType>, example = "no_three_ds", default = "three_ds")]
+ pub authentication_type: Option<api_enums::AuthenticationType>,
+
+ /// This is the instruction for capture/ debit the money from the users' card. On the other hand authorization refers to blocking the amount on the users' payment method.
+ #[schema(value_type = Option<CaptureMethod>, example = "automatic")]
+ pub capture_method: Option<api_enums::CaptureMethod>,
+
+ /// Indicates that you intend to make future payments with this Payment’s payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
+ #[schema(value_type = Option<FutureUsage>, example = "off_session")]
+ pub setup_future_usage: Option<api_enums::FutureUsage>,
+
+ /// Total number of attempts associated with this payment
+ pub attempt_count: i16,
+
+ /// Error details for the payment if any
+ pub error: Option<ErrorDetails>,
+
+ /// If the payment was cancelled the reason will be provided here
+ pub cancellation_reason: Option<String>,
+
+ /// Information about the product , quantity and amount for connectors. (e.g. Klarna)
+ #[schema(value_type = Option<Vec<OrderDetailsWithAmount>>, example = r#"[{
+ "product_name": "gillete creme",
+ "quantity": 15,
+ "amount" : 900
+ }]"#)]
+ pub order_details: Option<Vec<Secret<OrderDetailsWithAmount>>>,
+
+ /// The URL to redirect after the completion of the operation
+ #[schema(value_type = String, example = "https://hyperswitch.io")]
+ pub return_url: Option<common_utils::types::Url>,
+
+ /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.
+ #[schema(value_type = Option<String>, max_length = 255, example = "Hyperswitch Router")]
+ pub statement_descriptor: Option<common_utils::types::StatementDescriptor>,
+
+ /// Allowed Payment Method Types for a given PaymentIntent
+ #[schema(value_type = Option<Vec<PaymentMethodType>>)]
+ pub allowed_payment_method_types: Option<Vec<common_enums::PaymentMethodType>>,
+
+ /// Total number of authorizations happened in an incremental_authorization payment
+ pub authorization_count: Option<i32>,
+
+ /// Date time at which payment was updated
+ #[schema(example = "2022-09-10T10:11:12Z")]
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
+ pub modified_at: Option<PrimitiveDateTime>,
+}
+
// Serialize is implemented because, this will be serialized in the api events.
// Usually request types should not have serialize implemented.
//
@@ -5417,6 +5570,7 @@ pub struct ExternalAuthenticationDetailsResponse {
pub error_message: Option<String>,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
#[serde(deny_unknown_fields)]
pub struct PaymentListConstraints {
@@ -5481,6 +5635,131 @@ pub struct PaymentListConstraints {
pub created_gte: Option<PrimitiveDateTime>,
}
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, utoipa::IntoParams)]
+#[serde(deny_unknown_fields)]
+pub struct PaymentListConstraints {
+ /// The identifier for payment
+ #[param(example = "pay_fafa124123", value_type = Option<String>)]
+ pub payment_id: Option<id_type::GlobalPaymentId>,
+
+ /// The identifier for business profile
+ #[param(example = "pay_fafa124123", value_type = Option<String>)]
+ pub profile_id: Option<id_type::ProfileId>,
+
+ /// The identifier for customer
+ #[param(
+ max_length = 64,
+ min_length = 1,
+ example = "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ value_type = Option<String>,
+ )]
+ pub customer_id: Option<id_type::GlobalCustomerId>,
+
+ /// A cursor for use in pagination, fetch the next list after some object
+ #[param(example = "pay_fafa124123", value_type = Option<String>)]
+ pub starting_after: Option<id_type::GlobalPaymentId>,
+
+ /// A cursor for use in pagination, fetch the previous list before some object
+ #[param(example = "pay_fafa124123", value_type = Option<String>)]
+ pub ending_before: Option<id_type::GlobalPaymentId>,
+
+ /// limit on the number of objects to return
+ #[param(default = 10, maximum = 100)]
+ #[serde(default = "default_payments_list_limit")]
+ pub limit: u32,
+
+ /// The starting point within a list of objects
+ pub offset: Option<u32>,
+
+ /// The time at which payment is created
+ #[param(example = "2022-09-10T10:11:12Z")]
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
+ pub created: Option<PrimitiveDateTime>,
+
+ /// Time less than the payment created time
+ #[param(example = "2022-09-10T10:11:12Z")]
+ #[serde(
+ default,
+ with = "common_utils::custom_serde::iso8601::option",
+ rename = "created.lt"
+ )]
+ pub created_lt: Option<PrimitiveDateTime>,
+
+ /// Time greater than the payment created time
+ #[param(example = "2022-09-10T10:11:12Z")]
+ #[serde(
+ default,
+ with = "common_utils::custom_serde::iso8601::option",
+ rename = "created.gt"
+ )]
+ pub created_gt: Option<PrimitiveDateTime>,
+
+ /// Time less than or equals to the payment created time
+ #[param(example = "2022-09-10T10:11:12Z")]
+ #[serde(
+ default,
+ with = "common_utils::custom_serde::iso8601::option",
+ rename = "created.lte"
+ )]
+ pub created_lte: Option<PrimitiveDateTime>,
+
+ /// Time greater than or equals to the payment created time
+ #[param(example = "2022-09-10T10:11:12Z")]
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
+ #[serde(rename = "created.gte")]
+ pub created_gte: Option<PrimitiveDateTime>,
+
+ /// The start amount to filter list of transactions which are greater than or equal to the start amount
+ pub start_amount: Option<i64>,
+ /// The end amount to filter list of transactions which are less than or equal to the end amount
+ pub end_amount: Option<i64>,
+ /// The connector to filter payments list
+ #[param(value_type = Option<Connector>)]
+ pub connector: Option<api_enums::Connector>,
+ /// The currency to filter payments list
+ #[param(value_type = Option<Currency>)]
+ pub currency: Option<enums::Currency>,
+ /// The payment status to filter payments list
+ #[param(value_type = Option<IntentStatus>)]
+ pub status: Option<enums::IntentStatus>,
+ /// The payment method type to filter payments list
+ #[param(value_type = Option<PaymentMethod>)]
+ pub payment_method_type: Option<enums::PaymentMethod>,
+ /// The payment method subtype to filter payments list
+ #[param(value_type = Option<PaymentMethodType>)]
+ pub payment_method_subtype: Option<enums::PaymentMethodType>,
+ /// The authentication type to filter payments list
+ #[param(value_type = Option<AuthenticationType>)]
+ pub authentication_type: Option<enums::AuthenticationType>,
+ /// The merchant connector id to filter payments list
+ #[param(value_type = Option<String>)]
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ /// The field on which the payments list should be sorted
+ #[serde(default)]
+ pub order_on: SortOn,
+ /// The order in which payments list should be sorted
+ #[serde(default)]
+ pub order_by: SortBy,
+ /// The card networks to filter payments list
+ #[param(value_type = Option<CardNetwork>)]
+ pub card_network: Option<enums::CardNetwork>,
+ /// The identifier for merchant order reference id
+ pub merchant_order_reference_id: Option<String>,
+}
+
+#[cfg(feature = "v2")]
+impl PaymentListConstraints {
+ pub fn has_no_attempt_filters(&self) -> bool {
+ self.connector.is_none()
+ && self.payment_method_type.is_none()
+ && self.payment_method_subtype.is_none()
+ && self.authentication_type.is_none()
+ && self.merchant_connector_id.is_none()
+ && self.card_network.is_none()
+ }
+}
+
#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse {
@@ -5490,6 +5769,16 @@ pub struct PaymentListResponse {
pub data: Vec<PaymentsResponse>,
}
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, serde::Serialize, ToSchema)]
+pub struct PaymentListResponse {
+ /// The number of payments included in the current response
+ pub count: usize,
+ /// The total number of available payments for given constraints
+ pub total_count: i64,
+ /// The list of payments response objects
+ pub data: Vec<PaymentsListResponseItem>,
+}
#[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)]
pub struct IncrementalAuthorizationResponse {
/// The unique identifier of authorization
@@ -5519,6 +5808,7 @@ pub struct PaymentListResponseV2 {
pub data: Vec<PaymentsResponse>,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct PaymentListFilterConstraints {
/// The identifier for payment
@@ -5562,6 +5852,7 @@ pub struct PaymentListFilterConstraints {
pub card_discovery: Option<Vec<enums::CardDiscovery>>,
}
+#[cfg(feature = "v1")]
impl PaymentListFilterConstraints {
pub fn has_no_attempt_filters(&self) -> bool {
self.connector.is_none()
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index 60393211968..cfcbc2bd199 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -412,6 +412,64 @@ impl PaymentAttempt {
))
}
+ #[cfg(feature = "v2")]
+ #[allow(clippy::too_many_arguments)]
+ pub async fn get_total_count_of_attempts(
+ conn: &PgPooledConn,
+ merchant_id: &common_utils::id_type::MerchantId,
+ active_attempt_ids: &[String],
+ connector: Option<String>,
+ payment_method_type: Option<enums::PaymentMethod>,
+ payment_method_subtype: Option<enums::PaymentMethodType>,
+ authentication_type: Option<enums::AuthenticationType>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ card_network: Option<enums::CardNetwork>,
+ ) -> StorageResult<i64> {
+ let mut filter = <Self as HasTable>::table()
+ .count()
+ .filter(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(dsl::id.eq_any(active_attempt_ids.to_owned()))
+ .into_boxed();
+
+ if let Some(connector) = connector {
+ filter = filter.filter(dsl::connector.eq(connector));
+ }
+
+ if let Some(payment_method_type) = payment_method_type {
+ filter = filter.filter(dsl::payment_method_type_v2.eq(payment_method_type));
+ }
+ if let Some(payment_method_subtype) = payment_method_subtype {
+ filter = filter.filter(dsl::payment_method_subtype.eq(payment_method_subtype));
+ }
+ if let Some(authentication_type) = authentication_type {
+ filter = filter.filter(dsl::authentication_type.eq(authentication_type));
+ }
+ if let Some(merchant_connector_id) = merchant_connector_id {
+ filter = filter.filter(dsl::merchant_connector_id.eq(merchant_connector_id))
+ }
+ if let Some(card_network) = card_network {
+ filter = filter.filter(dsl::card_network.eq(card_network))
+ }
+
+ router_env::logger::debug!(query = %debug_query::<Pg, _>(&filter).to_string());
+
+ // TODO: Remove these logs after debugging the issue for delay in count query
+ let start_time = std::time::Instant::now();
+ router_env::logger::debug!("Executing count query start_time: {:?}", start_time);
+ let result = db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
+ filter.get_result_async::<i64>(conn),
+ db_metrics::DatabaseOperation::Filter,
+ )
+ .await
+ .change_context(DatabaseError::Others)
+ .attach_printable("Error filtering count of payments");
+
+ let duration = start_time.elapsed();
+ router_env::logger::debug!("Completed count query in {:?}", duration);
+
+ result
+ }
+
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn get_total_count_of_attempts(
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index af462443cdf..ce586408fc3 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -199,6 +199,21 @@ pub trait PaymentAttemptInterface {
card_discovery: Option<Vec<storage_enums::CardDiscovery>>,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<i64, errors::StorageError>;
+
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[allow(clippy::too_many_arguments)]
+ async fn get_total_count_of_filtered_payment_attempts(
+ &self,
+ merchant_id: &id_type::MerchantId,
+ active_attempt_ids: &[String],
+ connector: Option<api_models::enums::Connector>,
+ payment_method_type: Option<storage_enums::PaymentMethod>,
+ payment_method_subtype: Option<storage_enums::PaymentMethodType>,
+ authentication_type: Option<storage_enums::AuthenticationType>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ card_network: Option<storage_enums::CardNetwork>,
+ storage_scheme: storage_enums::MerchantStorageScheme,
+ ) -> error_stack::Result<i64, errors::StorageError>;
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index b2335550cf5..be7e55e45ab 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -120,6 +120,30 @@ pub trait PaymentIntentInterface {
storage_scheme: common_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, errors::StorageError>;
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_filtered_payment_intents_attempt(
+ &self,
+ state: &KeyManagerState,
+ merchant_id: &id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ merchant_key_store: &MerchantKeyStore,
+ storage_scheme: common_enums::MerchantStorageScheme,
+ ) -> error_stack::Result<
+ Vec<(
+ PaymentIntent,
+ Option<super::payment_attempt::PaymentAttempt>,
+ )>,
+ errors::StorageError,
+ >;
+
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_filtered_active_attempt_ids_for_total_count(
+ &self,
+ merchant_id: &id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ storage_scheme: common_enums::MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<Option<String>>, errors::StorageError>;
+
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
@@ -1077,6 +1101,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
}
}
+#[cfg(feature = "v1")]
pub enum PaymentIntentFetchConstraints {
Single {
payment_intent_id: id_type::PaymentId,
@@ -1084,6 +1109,7 @@ pub enum PaymentIntentFetchConstraints {
List(Box<PaymentIntentListParams>),
}
+#[cfg(feature = "v1")]
impl PaymentIntentFetchConstraints {
pub fn get_profile_id_list(&self) -> Option<Vec<id_type::ProfileId>> {
if let Self::List(pi_list_params) = self {
@@ -1094,6 +1120,26 @@ impl PaymentIntentFetchConstraints {
}
}
+#[cfg(feature = "v2")]
+pub enum PaymentIntentFetchConstraints {
+ Single {
+ payment_intent_id: id_type::GlobalPaymentId,
+ },
+ List(Box<PaymentIntentListParams>),
+}
+
+#[cfg(feature = "v2")]
+impl PaymentIntentFetchConstraints {
+ pub fn get_profile_id(&self) -> Option<id_type::ProfileId> {
+ if let Self::List(pi_list_params) = self {
+ pi_list_params.profile_id.clone()
+ } else {
+ None
+ }
+ }
+}
+
+#[cfg(feature = "v1")]
pub struct PaymentIntentListParams {
pub offset: u32,
pub starting_at: Option<PrimitiveDateTime>,
@@ -1117,6 +1163,30 @@ pub struct PaymentIntentListParams {
pub merchant_order_reference_id: Option<String>,
}
+#[cfg(feature = "v2")]
+pub struct PaymentIntentListParams {
+ pub offset: u32,
+ pub starting_at: Option<PrimitiveDateTime>,
+ pub ending_at: Option<PrimitiveDateTime>,
+ pub amount_filter: Option<api_models::payments::AmountFilter>,
+ pub connector: Option<api_models::enums::Connector>,
+ pub currency: Option<common_enums::Currency>,
+ pub status: Option<common_enums::IntentStatus>,
+ pub payment_method_type: Option<common_enums::PaymentMethod>,
+ pub payment_method_subtype: Option<common_enums::PaymentMethodType>,
+ pub authentication_type: Option<common_enums::AuthenticationType>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ pub profile_id: Option<id_type::ProfileId>,
+ pub customer_id: Option<id_type::GlobalCustomerId>,
+ pub starting_after_id: Option<id_type::GlobalPaymentId>,
+ pub ending_before_id: Option<id_type::GlobalPaymentId>,
+ pub limit: Option<u32>,
+ pub order: api_models::payments::Order,
+ pub card_network: Option<common_enums::CardNetwork>,
+ pub merchant_order_reference_id: Option<String>,
+}
+
+#[cfg(feature = "v1")]
impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchConstraints {
fn from(value: api_models::payments::PaymentListConstraints) -> Self {
let api_models::payments::PaymentListConstraints {
@@ -1155,6 +1225,73 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
}
}
+#[cfg(feature = "v2")]
+impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchConstraints {
+ fn from(value: api_models::payments::PaymentListConstraints) -> Self {
+ let api_models::payments::PaymentListConstraints {
+ customer_id,
+ starting_after,
+ ending_before,
+ limit,
+ created,
+ created_lt,
+ created_gt,
+ created_lte,
+ created_gte,
+ payment_id,
+ profile_id,
+ start_amount,
+ end_amount,
+ connector,
+ currency,
+ status,
+ payment_method_type,
+ payment_method_subtype,
+ authentication_type,
+ merchant_connector_id,
+ order_on,
+ order_by,
+ card_network,
+ merchant_order_reference_id,
+ offset,
+ } = value;
+ if let Some(payment_intent_id) = payment_id {
+ Self::Single { payment_intent_id }
+ } else {
+ Self::List(Box::new(PaymentIntentListParams {
+ offset: offset.unwrap_or_default(),
+ starting_at: created_gte.or(created_gt).or(created),
+ ending_at: created_lte.or(created_lt).or(created),
+ amount_filter: (start_amount.is_some() || end_amount.is_some()).then_some({
+ api_models::payments::AmountFilter {
+ start_amount,
+ end_amount,
+ }
+ }),
+ connector,
+ currency,
+ status,
+ payment_method_type,
+ payment_method_subtype,
+ authentication_type,
+ merchant_connector_id,
+ profile_id,
+ customer_id,
+ starting_after_id: starting_after,
+ ending_before_id: ending_before,
+ limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V1)),
+ order: api_models::payments::Order {
+ on: order_on,
+ by: order_by,
+ },
+ card_network,
+ merchant_order_reference_id,
+ }))
+ }
+ }
+}
+
+#[cfg(feature = "v1")]
impl From<common_utils::types::TimeRange> for PaymentIntentFetchConstraints {
fn from(value: common_utils::types::TimeRange) -> Self {
Self::List(Box::new(PaymentIntentListParams {
@@ -1182,6 +1319,7 @@ impl From<common_utils::types::TimeRange> for PaymentIntentFetchConstraints {
}
}
+#[cfg(feature = "v1")]
impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentFetchConstraints {
fn from(value: api_models::payments::PaymentListFilterConstraints) -> Self {
let api_models::payments::PaymentListFilterConstraints {
@@ -1233,6 +1371,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
}
}
+#[cfg(feature = "v1")]
impl<T> TryFrom<(T, Option<Vec<id_type::ProfileId>>)> for PaymentIntentFetchConstraints
where
Self: From<T>,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index e5c9c6fa81f..12e42320b40 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -127,6 +127,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payments::payments_create_and_confirm_intent,
routes::payments::payments_connector_session,
routes::payments::list_payment_methods,
+ routes::payments::payments_list,
//Routes for payment methods
routes::payment_method::create_payment_method_api,
@@ -375,6 +376,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ConnectorTokenDetails,
api_models::payments::PaymentsRequest,
api_models::payments::PaymentsResponse,
+ api_models::payments::PaymentsListResponseItem,
api_models::payments::PaymentRetrieveBody,
api_models::payments::PaymentsRetrieveRequest,
api_models::payments::PaymentsCaptureRequest,
@@ -437,7 +439,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::SamsungPayCardBrand,
api_models::payments::SamsungPayTokenData,
api_models::payments::PaymentsCancelRequest,
- api_models::payments::PaymentListConstraints,
+ api_models::payments::PaymentListResponse,
api_models::payments::CashappQr,
api_models::payments::BankTransferData,
api_models::payments::BankTransferNextStepsData,
@@ -493,6 +495,9 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsConfirmIntentResponse,
api_models::payments::AmountDetailsResponse,
api_models::payments::BankCodeResponse,
+ api_models::payments::Order,
+ api_models::payments::SortOn,
+ api_models::payments::SortBy,
api_models::payments::PaymentMethodListResponseForPayments,
api_models::payments::ResponsePaymentMethodTypesForPayments,
api_models::payment_methods::RequiredFieldInfo,
diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs
index ceccd53c4dd..633e0685e60 100644
--- a/crates/openapi/src/routes/payments.rs
+++ b/crates/openapi/src/routes/payments.rs
@@ -457,6 +457,7 @@ pub fn payments_cancel() {}
/// Payments - List
///
/// To list the *payments*
+#[cfg(feature = "v1")]
#[utoipa::path(
get,
path = "/payments/list",
@@ -846,3 +847,21 @@ pub(crate) enum ForceSync {
security(("publishable_key" = []))
)]
pub fn list_payment_methods() {}
+
+/// Payments - List
+///
+/// To list the *payments*
+#[cfg(feature = "v2")]
+#[utoipa::path(
+ get,
+ path = "/v2/payments/list",
+ params(api_models::payments::PaymentListConstraints),
+ responses(
+ (status = 200, description = "Successfully retrieved a payment list", body = PaymentListResponse),
+ (status = 404, description = "No payments found")
+ ),
+ tag = "Payments",
+ operation_id = "List all Payments",
+ security(("api_key" = []), ("jwt_key" = []))
+)]
+pub fn payments_list() {}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 6edd2b7c65d..fdead461448 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5214,6 +5214,82 @@ pub async fn list_payments(
))
}
+#[cfg(all(feature = "v2", feature = "olap"))]
+pub async fn list_payments(
+ state: SessionState,
+ merchant: domain::MerchantAccount,
+ key_store: domain::MerchantKeyStore,
+ constraints: api::PaymentListConstraints,
+) -> RouterResponse<payments_api::PaymentListResponse> {
+ common_utils::metrics::utils::record_operation_time(
+ async {
+ let limit = &constraints.limit;
+ helpers::validate_payment_list_request_for_joins(*limit)?;
+ let db: &dyn StorageInterface = state.store.as_ref();
+ let fetch_constraints = constraints.clone().into();
+ let list: Vec<(storage::PaymentIntent, Option<storage::PaymentAttempt>)> = db
+ .get_filtered_payment_intents_attempt(
+ &(&state).into(),
+ merchant.get_id(),
+ &fetch_constraints,
+ &key_store,
+ merchant.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ let data: Vec<api_models::payments::PaymentsListResponseItem> =
+ list.into_iter().map(ForeignFrom::foreign_from).collect();
+
+ let active_attempt_ids = db
+ .get_filtered_active_attempt_ids_for_total_count(
+ merchant.get_id(),
+ &fetch_constraints,
+ merchant.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while retrieving active_attempt_ids for merchant")?;
+
+ let total_count = if constraints.has_no_attempt_filters() {
+ i64::try_from(active_attempt_ids.len())
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while converting from usize to i64")
+ } else {
+ let active_attempt_ids = active_attempt_ids
+ .into_iter()
+ .flatten()
+ .collect::<Vec<String>>();
+
+ db.get_total_count_of_filtered_payment_attempts(
+ merchant.get_id(),
+ &active_attempt_ids,
+ constraints.connector,
+ constraints.payment_method_type,
+ constraints.payment_method_subtype,
+ constraints.authentication_type,
+ constraints.merchant_connector_id,
+ constraints.card_network,
+ merchant.storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while retrieving total count of payment attempts")
+ }?;
+
+ Ok(services::ApplicationResponse::Json(
+ api_models::payments::PaymentListResponse {
+ count: data.len(),
+ total_count,
+ data,
+ },
+ ))
+ },
+ &metrics::PAYMENT_LIST_LATENCY,
+ router_env::metric_attributes!(("merchant_id", merchant.get_id().clone())),
+ )
+ .await
+}
+
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn apply_filters_on_payments(
state: SessionState,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 7302831e509..03998e135d1 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2770,6 +2770,54 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
}
}
+#[cfg(feature = "v2")]
+impl ForeignFrom<(storage::PaymentIntent, Option<storage::PaymentAttempt>)>
+ for api_models::payments::PaymentsListResponseItem
+{
+ fn foreign_from((pi, pa): (storage::PaymentIntent, Option<storage::PaymentAttempt>)) -> Self {
+ Self {
+ id: pi.id,
+ merchant_id: pi.merchant_id,
+ profile_id: pi.profile_id,
+ customer_id: pi.customer_id,
+ payment_method_id: pa.as_ref().and_then(|p| p.payment_method_id.clone()),
+ status: pi.status,
+ amount: api_models::payments::PaymentAmountDetailsResponse::foreign_from((
+ &pi.amount_details,
+ pa.as_ref().map(|p| &p.amount_details),
+ )),
+ created: pi.created_at,
+ payment_method_type: pa.as_ref().and_then(|p| p.payment_method_type.into()),
+ payment_method_subtype: pa.as_ref().and_then(|p| p.payment_method_subtype.into()),
+ connector: pa.as_ref().and_then(|p| p.connector.clone()),
+ merchant_connector_id: pa.as_ref().and_then(|p| p.merchant_connector_id.clone()),
+ customer: None,
+ merchant_reference_id: pi.merchant_reference_id,
+ connector_payment_id: pa.as_ref().and_then(|p| p.connector_payment_id.clone()),
+ connector_response_reference_id: pa
+ .as_ref()
+ .and_then(|p| p.connector_response_reference_id.clone()),
+ metadata: pi.metadata,
+ description: pi.description.map(|val| val.get_string_repr().to_string()),
+ authentication_type: pi.authentication_type,
+ capture_method: Some(pi.capture_method),
+ setup_future_usage: Some(pi.setup_future_usage),
+ attempt_count: pi.attempt_count,
+ error: pa
+ .as_ref()
+ .and_then(|p| p.error.as_ref())
+ .map(|e| api_models::payments::ErrorDetails::foreign_from(e.clone())),
+ cancellation_reason: pa.as_ref().and_then(|p| p.cancellation_reason.clone()),
+ order_details: None,
+ return_url: pi.return_url,
+ statement_descriptor: pi.statement_descriptor,
+ allowed_payment_method_types: pi.allowed_payment_method_types,
+ authorization_count: pi.authorization_count,
+ modified_at: pa.as_ref().map(|p| p.modified_at),
+ }
+ }
+}
+
#[cfg(feature = "v1")]
impl ForeignFrom<ephemeral_key::EphemeralKey> for api::ephemeral_key::EphemeralKeyCreateResponse {
fn foreign_from(from: ephemeral_key::EphemeralKey) -> Self {
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index d21c345b5fe..a8189468b16 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1735,6 +1735,34 @@ impl PaymentAttemptInterface for KafkaStore {
.await
}
+ #[cfg(feature = "v2")]
+ async fn get_total_count_of_filtered_payment_attempts(
+ &self,
+ merchant_id: &id_type::MerchantId,
+ active_attempt_ids: &[String],
+ connector: Option<api_models::enums::Connector>,
+ payment_method_type: Option<common_enums::PaymentMethod>,
+ payment_method_subtype: Option<common_enums::PaymentMethodType>,
+ authentication_type: Option<common_enums::AuthenticationType>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ card_network: Option<common_enums::CardNetwork>,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<i64, errors::DataStorageError> {
+ self.diesel_store
+ .get_total_count_of_filtered_payment_attempts(
+ merchant_id,
+ active_attempt_ids,
+ connector,
+ payment_method_type,
+ payment_method_subtype,
+ authentication_type,
+ merchant_connector_id,
+ card_network,
+ storage_scheme,
+ )
+ .await
+ }
+
#[cfg(feature = "v1")]
async fn find_attempts_by_merchant_id_payment_id(
&self,
@@ -1914,6 +1942,32 @@ impl PaymentIntentInterface for KafkaStore {
.await
}
+ #[cfg(all(feature = "olap", feature = "v2"))]
+ async fn get_filtered_payment_intents_attempt(
+ &self,
+ state: &KeyManagerState,
+ merchant_id: &id_type::MerchantId,
+ constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<
+ Vec<(
+ hyperswitch_domain_models::payments::PaymentIntent,
+ Option<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
+ )>,
+ errors::DataStorageError,
+ > {
+ self.diesel_store
+ .get_filtered_payment_intents_attempt(
+ state,
+ merchant_id,
+ constraints,
+ key_store,
+ storage_scheme,
+ )
+ .await
+ }
+
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
@@ -1952,6 +2006,21 @@ impl PaymentIntentInterface for KafkaStore {
)
.await
}
+ #[cfg(all(feature = "olap", feature = "v2"))]
+ async fn get_filtered_active_attempt_ids_for_total_count(
+ &self,
+ merchant_id: &id_type::MerchantId,
+ constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<Vec<Option<String>>, errors::DataStorageError> {
+ self.diesel_store
+ .get_filtered_active_attempt_ids_for_total_count(
+ merchant_id,
+ constraints,
+ storage_scheme,
+ )
+ .await
+ }
}
#[async_trait::async_trait]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 3da65e968b6..ea8e978fab7 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -572,6 +572,7 @@ impl Payments {
web::resource("/create-intent")
.route(web::post().to(payments::payments_create_intent)),
)
+ .service(web::resource("/list").route(web::get().to(payments::payments_list)))
.service(
web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)),
)
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index dd15079efed..1faaf9cc5ae 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -1234,6 +1234,35 @@ pub async fn payments_list(
.await
}
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
+#[cfg(all(feature = "olap", feature = "v2"))]
+pub async fn payments_list(
+ state: web::Data<app::AppState>,
+ req: actix_web::HttpRequest,
+ payload: web::Query<payment_types::PaymentListConstraints>,
+) -> impl Responder {
+ let flow = Flow::PaymentsList;
+ let payload = payload.into_inner();
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, auth: auth::AuthenticationData, req, _| {
+ payments::list_payments(state, auth.merchant_account, auth.key_store, req)
+ },
+ auth::auth_type(
+ &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::JWTAuth {
+ permission: Permission::MerchantPaymentRead,
+ },
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
#[instrument(skip_all, fields(flow = ?Flow::PaymentsList))]
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn profile_payments_list(
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 58159fc5688..74329844a76 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -1,5 +1,7 @@
#[cfg(feature = "v1")]
-pub use api_models::payments::{PaymentListResponse, PaymentListResponseV2};
+pub use api_models::payments::{
+ PaymentListFilterConstraints, PaymentListResponse, PaymentListResponseV2,
+};
#[cfg(feature = "v2")]
pub use api_models::payments::{
PaymentsConfirmIntentRequest, PaymentsCreateIntentRequest, PaymentsIntentResponse,
@@ -14,9 +16,8 @@ pub use api_models::{
CryptoData, CustomerAcceptance, CustomerDetailsResponse, MandateAmountData, MandateData,
MandateTransactionType, MandateType, MandateValidationFields, NextActionType,
OnlineMandate, OpenBankingSessionToken, PayLaterData, PaymentIdType,
- PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,
- PaymentListFiltersV2, PaymentMethodData, PaymentMethodDataRequest,
- PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
+ PaymentListConstraints, PaymentListFilters, PaymentListFiltersV2, PaymentMethodData,
+ PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
PaymentRetrieveBodyWithCredentials, PaymentsAggregateResponse, PaymentsApproveRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index c9d250d306b..f460bb99491 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -59,6 +59,22 @@ impl PaymentAttemptInterface for MockDb {
Err(StorageError::MockDbError)?
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_total_count_of_filtered_payment_attempts(
+ &self,
+ _merchant_id: &id_type::MerchantId,
+ _active_attempt_ids: &[String],
+ _connector: Option<api_models::enums::Connector>,
+ _payment_method_type: Option<common_enums::PaymentMethod>,
+ _payment_method_subtype: Option<common_enums::PaymentMethodType>,
+ _authentication_type: Option<common_enums::AuthenticationType>,
+ _merchanat_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ _card_network: Option<storage_enums::CardNetwork>,
+ _storage_scheme: storage_enums::MerchantStorageScheme,
+ ) -> CustomResult<i64, StorageError> {
+ Err(StorageError::MockDbError)?
+ }
+
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_attempt_id_merchant_id(
&self,
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index 6a46702e525..3c90ecbdc7f 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -28,6 +28,24 @@ impl PaymentIntentInterface for MockDb {
Err(StorageError::MockDbError)?
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_filtered_payment_intents_attempt(
+ &self,
+ state: &KeyManagerState,
+ merchant_id: &common_utils::id_type::MerchantId,
+ constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
+ merchant_key_store: &MerchantKeyStore,
+ storage_scheme: storage_enums::MerchantStorageScheme,
+ ) -> error_stack::Result<
+ Vec<(
+ PaymentIntent,
+ Option<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
+ )>,
+ StorageError,
+ > {
+ Err(StorageError::MockDbError)?
+ }
+
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
@@ -63,6 +81,17 @@ impl PaymentIntentInterface for MockDb {
Err(StorageError::MockDbError)?
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_filtered_active_attempt_ids_for_total_count(
+ &self,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
+ _storage_scheme: storage_enums::MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<Option<String>>, StorageError> {
+ // [#172]: Implement function for `MockDb`
+ Err(StorageError::MockDbError)?
+ }
+
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 7fb1d3ab80d..183470a87e1 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -507,6 +507,44 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
er.change_context(new_err)
})
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[instrument(skip_all)]
+ async fn get_total_count_of_filtered_payment_attempts(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ active_attempt_ids: &[String],
+ connector: Option<api_models::enums::Connector>,
+ payment_method_type: Option<common_enums::PaymentMethod>,
+ payment_method_subtype: Option<common_enums::PaymentMethodType>,
+ authentication_type: Option<common_enums::AuthenticationType>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ card_network: Option<common_enums::CardNetwork>,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<i64, errors::StorageError> {
+ let conn = self
+ .db_store
+ .get_replica_pool()
+ .get()
+ .await
+ .change_context(errors::StorageError::DatabaseConnectionError)?;
+
+ DieselPaymentAttempt::get_total_count_of_attempts(
+ &conn,
+ merchant_id,
+ active_attempt_ids,
+ connector.map(|val| val.to_string()),
+ payment_method_type,
+ payment_method_subtype,
+ authentication_type,
+ merchant_connector_id,
+ card_network,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
+ }
}
#[async_trait::async_trait]
@@ -1424,6 +1462,34 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
)
.await
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[instrument(skip_all)]
+ async fn get_total_count_of_filtered_payment_attempts(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ active_attempt_ids: &[String],
+ connector: Option<api_models::enums::Connector>,
+ payment_method_type: Option<common_enums::PaymentMethod>,
+ payment_method_subtype: Option<common_enums::PaymentMethodType>,
+ authentication_type: Option<common_enums::AuthenticationType>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ card_network: Option<common_enums::CardNetwork>,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<i64, errors::StorageError> {
+ self.router_store
+ .get_total_count_of_filtered_payment_attempts(
+ merchant_id,
+ active_attempt_ids,
+ connector,
+ payment_method_type,
+ payment_method_subtype,
+ authentication_type,
+ merchant_connector_id,
+ card_network,
+ storage_scheme,
+ )
+ .await
+ }
}
impl DataModelExt for MandateAmountData {
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index b64d1aee364..e53a72c8734 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -164,6 +164,27 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
}
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[instrument(skip_all)]
+ async fn get_filtered_payment_intents_attempt(
+ &self,
+ state: &KeyManagerState,
+ merchant_id: &common_utils::id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ merchant_key_store: &MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<(PaymentIntent, Option<PaymentAttempt>)>, StorageError> {
+ self.router_store
+ .get_filtered_payment_intents_attempt(
+ state,
+ merchant_id,
+ constraints,
+ merchant_key_store,
+ storage_scheme,
+ )
+ .await
+ }
+
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn update_payment_intent(
@@ -459,6 +480,23 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
)
.await
}
+
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ async fn get_filtered_active_attempt_ids_for_total_count(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ storage_scheme: MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<Option<String>>, StorageError> {
+ self.router_store
+ .get_filtered_active_attempt_ids_for_total_count(
+ merchant_id,
+ constraints,
+ storage_scheme,
+ )
+ .await
+ }
+
#[cfg(feature = "v2")]
async fn find_payment_intent_by_merchant_reference_id_profile_id(
&self,
@@ -1086,6 +1124,303 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.await
}
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[instrument(skip_all)]
+ async fn get_filtered_payment_intents_attempt(
+ &self,
+ state: &KeyManagerState,
+ merchant_id: &common_utils::id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ merchant_key_store: &MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<(PaymentIntent, Option<PaymentAttempt>)>, StorageError> {
+ use diesel::NullableExpressionMethods as _;
+ use futures::{future::try_join_all, FutureExt};
+
+ use crate::DataModelExt;
+
+ let conn = connection::pg_connection_read(self).await.switch()?;
+ let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
+ let mut query = DieselPaymentIntent::table()
+ .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .left_join(
+ payment_attempt_schema::table
+ .on(pi_dsl::active_attempt_id.eq(pa_dsl::id.nullable())),
+ )
+ // Filtering on merchant_id for payment_attempt is not required for v2 as payment_attempt_ids are globally unique
+ .into_boxed();
+
+ query = match constraints {
+ PaymentIntentFetchConstraints::Single { payment_intent_id } => {
+ query.filter(pi_dsl::id.eq(payment_intent_id.to_owned()))
+ }
+ PaymentIntentFetchConstraints::List(params) => {
+ query = match params.order {
+ Order {
+ on: SortOn::Amount,
+ by: SortBy::Asc,
+ } => query.order(pi_dsl::amount.asc()),
+ Order {
+ on: SortOn::Amount,
+ by: SortBy::Desc,
+ } => query.order(pi_dsl::amount.desc()),
+ Order {
+ on: SortOn::Created,
+ by: SortBy::Asc,
+ } => query.order(pi_dsl::created_at.asc()),
+ Order {
+ on: SortOn::Created,
+ by: SortBy::Desc,
+ } => query.order(pi_dsl::created_at.desc()),
+ };
+
+ if let Some(limit) = params.limit {
+ query = query.limit(limit.into());
+ }
+
+ if let Some(customer_id) = ¶ms.customer_id {
+ query = query.filter(pi_dsl::customer_id.eq(customer_id.clone()));
+ }
+
+ if let Some(merchant_order_reference_id) = ¶ms.merchant_order_reference_id {
+ query = query.filter(
+ pi_dsl::merchant_reference_id.eq(merchant_order_reference_id.clone()),
+ )
+ }
+
+ if let Some(profile_id) = ¶ms.profile_id {
+ query = query.filter(pi_dsl::profile_id.eq(profile_id.clone()));
+ }
+
+ query = match (params.starting_at, ¶ms.starting_after_id) {
+ (Some(starting_at), _) => query.filter(pi_dsl::created_at.ge(starting_at)),
+ (None, Some(starting_after_id)) => {
+ // TODO: Fetch partial columns for this query since we only need some columns
+ let starting_at = self
+ .find_payment_intent_by_id(
+ state,
+ starting_after_id,
+ merchant_key_store,
+ storage_scheme,
+ )
+ .await?
+ .created_at;
+ query.filter(pi_dsl::created_at.ge(starting_at))
+ }
+ (None, None) => query,
+ };
+
+ query = match (params.ending_at, ¶ms.ending_before_id) {
+ (Some(ending_at), _) => query.filter(pi_dsl::created_at.le(ending_at)),
+ (None, Some(ending_before_id)) => {
+ // TODO: Fetch partial columns for this query since we only need some columns
+ let ending_at = self
+ .find_payment_intent_by_id(
+ state,
+ ending_before_id,
+ merchant_key_store,
+ storage_scheme,
+ )
+ .await?
+ .created_at;
+ query.filter(pi_dsl::created_at.le(ending_at))
+ }
+ (None, None) => query,
+ };
+
+ query = query.offset(params.offset.into());
+
+ query = match params.amount_filter {
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.between(start, end)),
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: None,
+ }) => query.filter(pi_dsl::amount.ge(start)),
+ Some(AmountFilter {
+ start_amount: None,
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.le(end)),
+ _ => query,
+ };
+
+ query = match ¶ms.currency {
+ Some(currency) => query.filter(pi_dsl::currency.eq(*currency)),
+ None => query,
+ };
+
+ query = match ¶ms.connector {
+ Some(connector) => query.filter(pa_dsl::connector.eq(*connector)),
+ None => query,
+ };
+
+ query = match ¶ms.status {
+ Some(status) => query.filter(pi_dsl::status.eq(*status)),
+ None => query,
+ };
+
+ query = match ¶ms.payment_method_type {
+ Some(payment_method_type) => {
+ query.filter(pa_dsl::payment_method_type_v2.eq(*payment_method_type))
+ }
+ None => query,
+ };
+
+ query = match ¶ms.payment_method_subtype {
+ Some(payment_method_subtype) => {
+ query.filter(pa_dsl::payment_method_subtype.eq(*payment_method_subtype))
+ }
+ None => query,
+ };
+
+ query = match ¶ms.authentication_type {
+ Some(authentication_type) => {
+ query.filter(pa_dsl::authentication_type.eq(*authentication_type))
+ }
+ None => query,
+ };
+
+ query = match ¶ms.merchant_connector_id {
+ Some(merchant_connector_id) => query
+ .filter(pa_dsl::merchant_connector_id.eq(merchant_connector_id.clone())),
+ None => query,
+ };
+
+ if let Some(card_network) = ¶ms.card_network {
+ query = query.filter(pa_dsl::card_network.eq(card_network.clone()));
+ }
+ query
+ }
+ };
+
+ logger::debug!(filter = %diesel::debug_query::<diesel::pg::Pg,_>(&query).to_string());
+
+ query
+ .get_results_async::<(
+ DieselPaymentIntent,
+ Option<diesel_models::payment_attempt::PaymentAttempt>,
+ )>(conn)
+ .await
+ .change_context(StorageError::DecryptionError)
+ .async_and_then(|output| async {
+ try_join_all(output.into_iter().map(
+ |(pi, pa): (_, Option<diesel_models::payment_attempt::PaymentAttempt>)| async {
+ let payment_intent = PaymentIntent::convert_back(
+ state,
+ pi,
+ merchant_key_store.key.get_inner(),
+ merchant_id.to_owned().into(),
+ );
+ let payment_attempt = pa
+ .async_map(|val| {
+ PaymentAttempt::convert_back(
+ state,
+ val,
+ merchant_key_store.key.get_inner(),
+ merchant_id.to_owned().into(),
+ )
+ })
+ .map(|val| val.transpose());
+
+ let output = futures::try_join!(payment_intent, payment_attempt);
+ output.change_context(StorageError::DecryptionError)
+ },
+ ))
+ .await
+ })
+ .await
+ .change_context(StorageError::DecryptionError)
+ }
+
+ #[cfg(all(feature = "v2", feature = "olap"))]
+ #[instrument(skip_all)]
+ async fn get_filtered_active_attempt_ids_for_total_count(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ constraints: &PaymentIntentFetchConstraints,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> error_stack::Result<Vec<Option<String>>, StorageError> {
+ let conn = connection::pg_connection_read(self).await.switch()?;
+ let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
+ let mut query = DieselPaymentIntent::table()
+ .select(pi_dsl::active_attempt_id)
+ .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .order(pi_dsl::created_at.desc())
+ .into_boxed();
+
+ query = match constraints {
+ PaymentIntentFetchConstraints::Single { payment_intent_id } => {
+ query.filter(pi_dsl::id.eq(payment_intent_id.to_owned()))
+ }
+ PaymentIntentFetchConstraints::List(params) => {
+ if let Some(customer_id) = ¶ms.customer_id {
+ query = query.filter(pi_dsl::customer_id.eq(customer_id.clone()));
+ }
+ if let Some(merchant_order_reference_id) = ¶ms.merchant_order_reference_id {
+ query = query.filter(
+ pi_dsl::merchant_reference_id.eq(merchant_order_reference_id.clone()),
+ )
+ }
+ if let Some(profile_id) = ¶ms.profile_id {
+ query = query.filter(pi_dsl::profile_id.eq(profile_id.clone()));
+ }
+
+ query = match params.starting_at {
+ Some(starting_at) => query.filter(pi_dsl::created_at.ge(starting_at)),
+ None => query,
+ };
+
+ query = match params.ending_at {
+ Some(ending_at) => query.filter(pi_dsl::created_at.le(ending_at)),
+ None => query,
+ };
+
+ query = match params.amount_filter {
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.between(start, end)),
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: None,
+ }) => query.filter(pi_dsl::amount.ge(start)),
+ Some(AmountFilter {
+ start_amount: None,
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.le(end)),
+ _ => query,
+ };
+
+ query = match ¶ms.currency {
+ Some(currency) => query.filter(pi_dsl::currency.eq(*currency)),
+ None => query,
+ };
+
+ query = match ¶ms.status {
+ Some(status) => query.filter(pi_dsl::status.eq(*status)),
+ None => query,
+ };
+
+ query
+ }
+ };
+
+ db_metrics::track_database_call::<<DieselPaymentIntent as HasTable>::Table, _, _>(
+ query.get_results_async::<Option<String>>(conn),
+ db_metrics::DatabaseOperation::Filter,
+ )
+ .await
+ .map_err(|er| {
+ StorageError::DatabaseError(
+ error_stack::report!(diesel_models::errors::DatabaseError::from(er))
+ .attach_printable("Error filtering payment records"),
+ )
+ .into()
+ })
+ }
+
#[cfg(all(feature = "v1", feature = "olap"))]
#[instrument(skip_all)]
async fn get_filtered_active_attempt_ids_for_total_count(
|
2025-02-05T08:06:09Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added `Payments - List` endpoint for v2
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Request:
```
curl --location 'http://localhost:8080/v2/payments/list?profile_id=pro_4jOKADI7FmJF09Sp30bM' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_syRDLhwbDPVbVgrDQDN5' \
--header 'api-key: dev_S529hQ8b0xLFAC4WvYFOgM9VFvUkxB8btBfmxVh83pejCCBmB33wK7ujJYoVcKAe'
```
- Response:
```json
{
"count": 3,
"total_count": 3,
"data": [
{
"id": "12345_pay_0195129a6d6b79c0b0fc459fc0fc4ba8",
"merchant_id": "cloth_seller_VbtyEBrzigIhWiWgxQWr",
"profile_id": "pro_4jOKADI7FmJF09Sp30bM",
"customer_id": "12345_cus_01951299cc277621a6c26053d1f98145",
"payment_method_id": null,
"status": "requires_payment_method",
"amount": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null,
"net_amount": 100,
"amount_to_capture": null,
"amount_capturable": 0,
"amount_captured": null
},
"created": "2025-02-17T06:31:05.333Z",
"payment_method_type": null,
"payment_method_subtype": null,
"connector": null,
"merchant_connector_id": null,
"customer": null,
"merchant_reference_id": null,
"connector_payment_id": null,
"connector_response_reference_id": null,
"metadata": null,
"description": null,
"authentication_type": "no_three_ds",
"capture_method": "manual",
"setup_future_usage": "on_session",
"attempt_count": 0,
"error": null,
"cancellation_reason": null,
"order_details": null,
"return_url": null,
"statement_descriptor": null,
"allowed_payment_method_types": null,
"authorization_count": 0,
"modified_at": null
},
{
"id": "12345_pay_0195129973837d138240f54b307544f6",
"merchant_id": "cloth_seller_VbtyEBrzigIhWiWgxQWr",
"profile_id": "pro_4jOKADI7FmJF09Sp30bM",
"customer_id": null,
"payment_method_id": null,
"status": "requires_payment_method",
"amount": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null,
"net_amount": 100,
"amount_to_capture": null,
"amount_capturable": 0,
"amount_captured": null
},
"created": "2025-02-17T06:30:01.356Z",
"payment_method_type": null,
"payment_method_subtype": null,
"connector": null,
"merchant_connector_id": null,
"customer": null,
"merchant_reference_id": null,
"connector_payment_id": null,
"connector_response_reference_id": null,
"metadata": null,
"description": null,
"authentication_type": "no_three_ds",
"capture_method": "manual",
"setup_future_usage": "on_session",
"attempt_count": 0,
"error": null,
"cancellation_reason": null,
"order_details": null,
"return_url": null,
"statement_descriptor": null,
"allowed_payment_method_types": null,
"authorization_count": 0,
"modified_at": null
},
{
"id": "12345_pay_019512991b037d12b1a6c6be6e9ec825",
"merchant_id": "cloth_seller_VbtyEBrzigIhWiWgxQWr",
"profile_id": "pro_4jOKADI7FmJF09Sp30bM",
"customer_id": null,
"payment_method_id": null,
"status": "requires_capture",
"amount": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null,
"net_amount": 100,
"amount_to_capture": null,
"amount_capturable": 100,
"amount_captured": 0
},
"created": "2025-02-17T06:29:38.704Z",
"payment_method_type": "card",
"payment_method_subtype": "credit",
"connector": "stripe",
"merchant_connector_id": "mca_ONJ7YPf8ct3Mnvxir8d3",
"customer": null,
"merchant_reference_id": null,
"connector_payment_id": "pi_3QtNq2EKQ8UQWeo41P082tvk",
"connector_response_reference_id": null,
"metadata": null,
"description": null,
"authentication_type": "no_three_ds",
"capture_method": "manual",
"setup_future_usage": "on_session",
"attempt_count": 0,
"error": null,
"cancellation_reason": null,
"order_details": null,
"return_url": null,
"statement_descriptor": null,
"allowed_payment_method_types": null,
"authorization_count": 0,
"modified_at": "2025-02-17T06:29:55.623Z"
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3607b30c26cc24341bf88f8ce9968e094fb7a60a
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7172
|
Bug: [Cypress] Add more connectors to GitHub CI
- Bluesnap
- PayPal
- Iatapay
|
2025-02-03T13:21:31Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR fixes NTID for PayPal by disabling it from running.
closes #7172
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
...
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
|NMI|PayPal|
|-|-|
|||
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ed8ef2466b7f059ed0f534aa1f3fca9b5ecbeefd
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7164
|
Bug: [FEATURE] : [CONNECTOR] Add Billwerk, Fiservemea, Tsys supported payment methods, currencies and countries in feature matrix
### Feature Description
Add Billwerk, Fiservemea, Tsys supported payment methods, currencies and countries in feature matrix
### Possible Implementation
Add Billwerk, Fiservemea, Tsys supported payment methods, currencies and countries in feature matrix
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 3457d330c9a..48db200f9c4 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -521,6 +521,18 @@ seicomart = { country = "JP", currency = "JPY" }
pay_easy = { country = "JP", currency = "JPY" }
boleto = { country = "BR", currency = "BRL" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.bambora]
credit = { country = "US,CA", currency = "USD" }
debit = { country = "US,CA", currency = "USD" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 079134e6d03..a24d213e665 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -280,6 +280,18 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD,CNY" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.authorizedotnet]
google_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 79ed26906ef..fcccd671146 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -294,6 +294,18 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.authorizedotnet]
google_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index a92deafb20a..d5e9d453899 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -296,6 +296,18 @@ walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" }
pix = { country = "BR", currency = "BRL" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.authorizedotnet]
google_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"
diff --git a/config/development.toml b/config/development.toml
index 13ed82c81f6..130a27f6746 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -512,6 +512,18 @@ pay_easy = { country = "JP", currency = "JPY" }
pix = { country = "BR", currency = "BRL" }
boleto = { country = "BR", currency = "BRL" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.bambora]
credit = { country = "US,CA", currency = "USD" }
debit = { country = "US,CA", currency = "USD" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 0031c37f022..6a36e7cd8df 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -435,6 +435,18 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD,CNY" }
+[pm_filters.tsys]
+credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
+
+[pm_filters.billwerk]
+credit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+debit = { country = "DE, DK, FR, SE", currency = "DKK, NOK" }
+
+[pm_filters.fiservemea]
+credit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+debit = { country = "DE, FR, IT, NL, PL, ES, ZA, GB, AE", currency = "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" }
+
[pm_filters.bambora]
credit = { country = "US,CA", currency = "USD" }
debit = { country = "US,CA", currency = "USD" }
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
index 3987039de97..b5ddef00358 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
@@ -2,6 +2,7 @@ pub mod transformers;
use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};
use base64::Engine;
+use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE,
errors::CustomResult,
@@ -22,7 +23,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, TokenizationRouterData,
@@ -40,6 +44,7 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
};
+use lazy_static::lazy_static;
use masking::{Mask, PeekInterface};
use transformers::{
self as billwerk, BillwerkAuthType, BillwerkCaptureRequest, BillwerkErrorResponse,
@@ -50,7 +55,7 @@ use transformers::{
use crate::{
constants::headers,
types::ResponseRouterData,
- utils::{construct_not_implemented_error_report, convert_amount, RefundsRequestData},
+ utils::{convert_amount, RefundsRequestData},
};
#[derive(Clone)]
@@ -153,25 +158,7 @@ impl ConnectorCommon for Billwerk {
}
}
-impl ConnectorValidation for Billwerk {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<common_enums::CaptureMethod>,
- _payment_method: common_enums::PaymentMethod,
- _pmt: Option<common_enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- common_enums::CaptureMethod::Automatic
- | common_enums::CaptureMethod::Manual
- | common_enums::CaptureMethod::SequentialAutomatic => Ok(()),
- common_enums::CaptureMethod::ManualMultiple
- | common_enums::CaptureMethod::Scheduled => Err(
- construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Billwerk {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Billwerk {
//TODO: implement sessions flow
@@ -818,4 +805,88 @@ impl IncomingWebhook for Billwerk {
}
}
-impl ConnectorSpecifications for Billwerk {}
+lazy_static! {
+ static ref BILLWERK_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::Interac,
+ common_enums::CardNetwork::CartesBancaires,
+ ];
+
+ let mut billwerk_supported_payment_methods = SupportedPaymentMethods::new();
+
+ billwerk_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ billwerk_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ billwerk_supported_payment_methods
+ };
+
+ static ref BILLWERK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Billwerk",
+ description: "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+
+ static ref BILLWERK_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+}
+
+impl ConnectorSpecifications for Billwerk {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*BILLWERK_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*BILLWERK_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*BILLWERK_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
index 13ec1870e04..b124949c078 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
@@ -21,7 +21,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
@@ -38,6 +41,7 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
+use lazy_static::lazy_static;
use masking::{ExposeInterface, Mask, PeekInterface};
use ring::hmac;
use time::OffsetDateTime;
@@ -249,24 +253,7 @@ impl ConnectorCommon for Fiservemea {
}
}
-impl ConnectorValidation for Fiservemea {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Fiservemea {}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Fiservemea {
fn get_headers(
@@ -791,4 +778,88 @@ impl webhooks::IncomingWebhook for Fiservemea {
}
}
-impl ConnectorSpecifications for Fiservemea {}
+lazy_static! {
+ static ref FISERVEMEA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::Interac,
+ common_enums::CardNetwork::CartesBancaires,
+ ];
+
+ let mut fiservemea_supported_payment_methods = SupportedPaymentMethods::new();
+
+ fiservemea_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ fiservemea_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ fiservemea_supported_payment_methods
+ };
+
+ static ref FISERVEMEA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Fiservemea",
+ description: "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+ };
+
+ static ref FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+}
+
+impl ConnectorSpecifications for Fiservemea {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*FISERVEMEA_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*FISERVEMEA_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys.rs b/crates/hyperswitch_connectors/src/connectors/tsys.rs
index 39c8f918699..7a0fe0bdc93 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys.rs
@@ -20,7 +20,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
@@ -40,6 +43,7 @@ use hyperswitch_interfaces::{
},
webhooks,
};
+use lazy_static::lazy_static;
use transformers as tsys;
use crate::{constants::headers, types::ResponseRouterData, utils};
@@ -104,24 +108,7 @@ impl ConnectorCommon for Tsys {
}
}
-impl ConnectorValidation for Tsys {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_supported_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Tsys {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Tsys {}
@@ -658,4 +645,85 @@ impl webhooks::IncomingWebhook for Tsys {
}
}
-impl ConnectorSpecifications for Tsys {}
+lazy_static! {
+ static ref TSYS_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::UnionPay,
+ ];
+
+ let mut tsys_supported_payment_methods = SupportedPaymentMethods::new();
+
+ tsys_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ tsys_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
+ tsys_supported_payment_methods
+ };
+
+ static ref TSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Tsys",
+ description: "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+ };
+
+ static ref TSYS_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+}
+
+impl ConnectorSpecifications for Tsys {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*TSYS_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*TSYS_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*TSYS_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
|
2025-02-02T18:20:24Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add Billwerk, Fiservemea, Tsys supported payment methods, currencies and countries in feature matrix
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
[#7164](https://github.com/juspay/hyperswitch/issues/7164)
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
Feature API curl:
```
curl --location 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_JQif2lR5NNugTdsi6xSqQ1ozsn6QA4r750wFN5yvwrAsRlcsdyk24VnEiYguAAxZ'
```
Response -
```
{
"connector_count": 3,
"connectors": [
{
"name": "BILLWERK",
"display_name": "Billwerk",
"description": "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"DK",
"DE",
"FR",
"SE"
],
"supported_currencies": [
"DKK",
"NOK"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"SE",
"FR",
"DE",
"DK"
],
"supported_currencies": [
"NOK",
"DKK"
]
}
],
"supported_webhook_flows": []
},
{
"name": "FISERVEMEA",
"display_name": "Fiservemea",
"description": "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"AE",
"PL",
"FR",
"ES",
"GB",
"ZA",
"DE",
"NL",
"IT"
],
"supported_currencies": [
"SSP",
"BIF",
"MOP",
"KMF",
"HNL",
"SYP",
"CVE",
"SGD",
"KHR",
"MXN",
"NPR",
"RUB",
"TMT",
"BRL",
"MRU",
"SHP",
"KPW",
"KZT",
"SLE",
"CZK",
"CAD",
"VUV",
"PYG",
"SOS",
"AFN",
"MVR",
"YER",
"ZAR",
"TTD",
"CHF",
"AMD",
"NGN",
"KYD",
"ERN",
"PKR",
"MZN",
"TJS",
"BTN",
"IDR",
"SCR",
"AED",
"MUR",
"CLP",
"XPF",
"TOP",
"PHP",
"THB",
"AZN",
"RON",
"DZD",
"SBD",
"PAB",
"HRK",
"KRW",
"SEK",
"BOB",
"LKR",
"SAR",
"KGS",
"NIO",
"RSD",
"PLN",
"NZD",
"BYN",
"SVC",
"GYD",
"SZL",
"USD",
"ISK",
"BMD",
"COP",
"SDG",
"TZS",
"KWD",
"UYU",
"JOD",
"CUP",
"LYD",
"LAK",
"DOP",
"AUD",
"VES",
"FJD",
"CRC",
"FKP",
"HKD",
"IRR",
"BDT",
"BBD",
"EUR",
"BHD",
"UAH",
"MGA",
"CNY",
"HTG",
"ALL",
"INR",
"GHS",
"MAD",
"TWD",
"MYR",
"BND",
"NAD",
"QAR",
"GIP",
"GEL",
"AOA",
"UGX",
"LSL",
"XAF",
"LBP",
"DJF",
"ETB",
"TND",
"XCD",
"SRD",
"GNF",
"BGN",
"GTQ",
"MWK",
"ZMW",
"MKD",
"HUF",
"PEN",
"RWF",
"DKK",
"BZD",
"IQD",
"ANG",
"ARS",
"GBP",
"WST",
"ZWL",
"PGK",
"TRY",
"KES",
"MDL",
"MNT",
"CDF",
"BAM",
"LRD",
"JPY",
"GMD",
"STN",
"VND",
"BWP",
"OMR",
"NOK",
"SLL",
"JMD",
"XOF",
"MMK",
"EGP",
"AWG",
"ILS",
"UZS",
"BSD"
]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay",
"DinersClub",
"Interac",
"CartesBancaires"
],
"supported_countries": [
"NL",
"ES",
"DE",
"PL",
"IT",
"AE",
"GB",
"ZA",
"FR"
],
"supported_currencies": [
"JOD",
"AED",
"ALL",
"BOB",
"ERN",
"LBP",
"PAB",
"HNL",
"AZN",
"TMT",
"DKK",
"AWG",
"PKR",
"LAK",
"PGK",
"JMD",
"CUP",
"PHP",
"BAM",
"THB",
"FKP",
"HRK",
"UYU",
"KZT",
"BYN",
"PLN",
"SDG",
"VND",
"NZD",
"KWD",
"CDF",
"SCR",
"VUV",
"CHF",
"USD",
"GYD",
"ANG",
"DOP",
"MKD",
"STN",
"SAR",
"QAR",
"PEN",
"RSD",
"BRL",
"KGS",
"SGD",
"TWD",
"BHD",
"KHR",
"MOP",
"GHS",
"UGX",
"XPF",
"SSP",
"CAD",
"TOP",
"OMR",
"MXN",
"BGN",
"RUB",
"MDL",
"GNF",
"PYG",
"SRD",
"AFN",
"MNT",
"NOK",
"XAF",
"BWP",
"NGN",
"GIP",
"CZK",
"MGA",
"DZD",
"YER",
"DJF",
"SBD",
"CNY",
"ZAR",
"LYD",
"BMD",
"MUR",
"NIO",
"UZS",
"GBP",
"VES",
"SVC",
"CVE",
"NPR",
"RON",
"KMF",
"BZD",
"KPW",
"SLL",
"LKR",
"AUD",
"LSL",
"XCD",
"TJS",
"KYD",
"UAH",
"ARS",
"NAD",
"SEK",
"GTQ",
"BSD",
"IDR",
"WST",
"AMD",
"BTN",
"HUF",
"ZMW",
"COP",
"BIF",
"FJD",
"INR",
"IRR",
"GEL",
"HTG",
"SOS",
"CLP",
"ISK",
"MVR",
"RWF",
"BBD",
"KRW",
"BDT",
"LRD",
"AOA",
"MMK",
"MWK",
"SLE",
"XOF",
"MRU",
"KES",
"MYR",
"MZN",
"SYP",
"SZL",
"TRY",
"SHP",
"TTD",
"GMD",
"TZS",
"ETB",
"ILS",
"IQD",
"CRC",
"BND",
"HKD",
"EGP",
"JPY",
"MAD",
"TND",
"EUR",
"ZWL"
]
}
],
"supported_webhook_flows": []
},
{
"name": "TSYS",
"display_name": "Tsys",
"description": "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay"
],
"supported_countries": [
"NA"
],
"supported_currencies": [
"CUP",
"SZL",
"GMD",
"AMD",
"MRU",
"BWP",
"SSP",
"QAR",
"XOF",
"VES",
"XAF",
"BBD",
"BSD",
"ETB",
"GBP",
"BHD",
"UYU",
"XCD",
"JPY",
"VUV",
"SAR",
"ZAR",
"MOP",
"MDL",
"IRR",
"SGD",
"MVR",
"BIF",
"BTN",
"STN",
"AED",
"TTD",
"TWD",
"UZS",
"KZT",
"ALL",
"UGX",
"DOP",
"BMD",
"FJD",
"KGS",
"KPW",
"ZMW",
"IQD",
"HRK",
"KMF",
"GTQ",
"LSL",
"NOK",
"MWK",
"CDF",
"KRW",
"ERN",
"RUB",
"GEL",
"MGA",
"OMR",
"HUF",
"HTG",
"PYG",
"MUR",
"HKD",
"BZD",
"LRD",
"SRD",
"THB",
"IDR",
"TJS",
"TRY",
"VND",
"JOD",
"PKR",
"GNF",
"LKR",
"TND",
"BDT",
"DJF",
"SDG",
"AOA",
"SVC",
"PEN",
"KYD",
"BRL",
"JMD",
"ISK",
"COP",
"BAM",
"BOB",
"CVE",
"INR",
"RWF",
"SCR",
"YER",
"LYD",
"MYR",
"LBP",
"CZK",
"NIO",
"SEK",
"DKK",
"UAH",
"USD",
"AZN",
"RON",
"HNL",
"SYP",
"CHF",
"PAB",
"NGN",
"NPR",
"AFN",
"CAD",
"ANG",
"GYD",
"MXN",
"BND",
"LAK",
"PGK",
"PLN",
"SHP",
"ARS",
"KWD",
"ILS",
"TMT",
"XPF",
"ZWL",
"FKP",
"CLP",
"AUD",
"DZD",
"GHS",
"PHP",
"NAD",
"TZS",
"CNY",
"MAD",
"NZD",
"MNT",
"WST",
"KHR",
"CRC",
"SLE",
"AWG",
"GIP",
"BGN",
"RSD",
"SOS",
"MKD",
"MMK",
"TOP",
"MZN",
"BYN",
"KES",
"EGP",
"EUR",
"SBD"
]
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": [
"Mastercard",
"Visa",
"AmericanExpress",
"Discover",
"JCB",
"UnionPay"
],
"supported_countries": [
"NA"
],
"supported_currencies": [
"AZN",
"SAR",
"ZWL",
"MRU",
"SZL",
"TRY",
"TOP",
"YER",
"LKR",
"ISK",
"NIO",
"TTD",
"BMD",
"PAB",
"MNT",
"BTN",
"SYP",
"HUF",
"CHF",
"UAH",
"DJF",
"DOP",
"XPF",
"MVR",
"WST",
"ZMW",
"TMT",
"TWD",
"LBP",
"PGK",
"XOF",
"ARS",
"PLN",
"MUR",
"MZN",
"NGN",
"MDL",
"SDG",
"SLE",
"VND",
"STN",
"KZT",
"THB",
"SGD",
"HRK",
"AUD",
"NAD",
"KHR",
"BSD",
"GEL",
"NOK",
"KPW",
"GNF",
"GHS",
"MWK",
"RUB",
"MAD",
"GMD",
"BWP",
"VUV",
"GTQ",
"BZD",
"MYR",
"BND",
"KMF",
"CVE",
"SSP",
"BBD",
"ALL",
"UZS",
"ERN",
"GYD",
"CUP",
"TJS",
"CZK",
"OMR",
"GIP",
"XCD",
"CNY",
"SBD",
"RON",
"KES",
"HKD",
"IQD",
"BDT",
"CDF",
"SEK",
"JPY",
"HNL",
"ETB",
"GBP",
"VES",
"TZS",
"MXN",
"XAF",
"CLP",
"AMD",
"LAK",
"EGP",
"NZD",
"SCR",
"SHP",
"ILS",
"KRW",
"SOS",
"MGA",
"JMD",
"ZAR",
"NPR",
"BAM",
"BIF",
"EUR",
"UYU",
"CRC",
"RSD",
"TND",
"PKR",
"SRD",
"AED",
"BOB",
"INR",
"MOP",
"USD",
"PEN",
"LRD",
"UGX",
"MMK",
"KGS",
"BRL",
"SVC",
"FKP",
"ANG",
"MKD",
"BGN",
"BHD",
"PHP",
"IRR",
"KYD",
"RWF",
"LSL",
"QAR",
"DKK",
"IDR",
"DZD",
"LYD",
"AWG",
"AFN",
"KWD",
"BYN",
"JOD",
"AOA",
"HTG",
"COP",
"FJD",
"CAD",
"PYG"
]
}
],
"supported_webhook_flows": []
},
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
2451e9b771dcef6ed88e17800e4e3ef434328044
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7181
|
Bug: [FEATURE] enable currencies and countries for different payment methods for Fiuu
### Feature Description
A few countries and currencies has to be enabled for Fiuu for below payment methods
- ApplePay
- GooglePay
For below countries and currencies
- MY and MYR
### Possible Implementation
Add this to pm_filters
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index d606f192e4e..81eb028a46a 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -380,7 +380,9 @@ red_pagos = { country = "UY", currency = "UYU" }
local_bank_transfer = { country = "CN", currency = "CNY" }
[pm_filters.fiuu]
-duit_now = { country ="MY", currency = "MYR" }
+duit_now = { country = "MY", currency = "MYR" }
+apple_pay = { country = "MY", currency = "MYR" }
+google_pay = { country = "MY", currency = "MYR" }
[payout_method_filters.adyenplatform]
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index ff5abd3fb03..c9045c88fa5 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -396,7 +396,9 @@ local_bank_transfer = { country = "CN", currency = "CNY" }
[pm_filters.fiuu]
-duit_now = { country ="MY", currency = "MYR" }
+duit_now = { country = "MY", currency = "MYR" }
+apple_pay = { country = "MY", currency = "MYR" }
+google_pay = { country = "MY", currency = "MYR" }
[payout_method_filters.adyenplatform]
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 208621433bb..7c383666750 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -398,7 +398,9 @@ local_bank_transfer = { country = "CN", currency = "CNY" }
[pm_filters.fiuu]
-duit_now = { country ="MY", currency = "MYR" }
+duit_now = { country = "MY", currency = "MYR" }
+apple_pay = { country = "MY", currency = "MYR" }
+google_pay = { country = "MY", currency = "MYR" }
[payout_method_filters.adyenplatform]
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" }
diff --git a/config/development.toml b/config/development.toml
index b293151a988..133a0cc0c3d 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -564,6 +564,8 @@ debit = { currency = "USD" }
[pm_filters.fiuu]
duit_now = { country = "MY", currency = "MYR" }
+apple_pay = { country = "MY", currency = "MYR" }
+google_pay = { country = "MY", currency = "MYR" }
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
|
2025-02-04T08:34:27Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR enables country Malaysia for processing APay and GPay transactions via Fiuu
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Helps process APay and GPay txns using MYR currency.
## How did you test it?
For valid currency - MYR
<img width="665" alt="Screenshot 2025-02-05 at 7 46 56 PM" src="https://github.com/user-attachments/assets/3611f5ae-0c69-4a11-9907-81ec4eca4385" />
For invalid currency - ex. USD
<img width="628" alt="Screenshot 2025-02-05 at 7 47 51 PM" src="https://github.com/user-attachments/assets/f12d3952-4f19-4526-a999-466426841eb2" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
55bb284ba063dc84e80b4f0d83c82ec7c30ad4c5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7155
|
Bug: [BUG] CASHTOCODE Error Message appearing as null
### Bug Description
There is a bug which causes error_message to appear as null on failed payments for Cashtocode.
### Expected Behavior
Error_message should not be null on failed payments for Cashtocode
### Actual Behavior
Error_message is null on failed payments for Cashtocode
### Steps To Reproduce
Error_message is null on failed payments for Cashtocode
### Context For The Bug
_No response_
### Environment
Integ, Sandbox, Prod
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index cc7ac381237..a2a8cf9df65 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -142,8 +142,8 @@ impl ConnectorCommon for Cashtocode {
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error.to_string(),
- message: response.error_description,
- reason: None,
+ message: response.error_description.clone(),
+ reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
})
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
index c139bc1524d..209092c6b6f 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
@@ -249,8 +249,8 @@ impl<F>
Err(ErrorResponse {
code: error_data.error.to_string(),
status_code: item.http_code,
- message: error_data.error_description,
- reason: None,
+ message: error_data.error_description.clone(),
+ reason: Some(error_data.error_description),
attempt_status: None,
connector_transaction_id: None,
}),
|
2025-01-31T09:49:08Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Error message from cashtocode is now populated in error reason along with error message as well.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Issue Link: https://github.com/juspay/hyperswitch/issues/7155
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Cashtocode cannot be tested locally due to unavailability of credentials.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
0c952cc148654468c7fec8e32620dff4178f6138
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7162
|
Bug: [FEATURE] : [CONNECTOR] Add Airwallex, Elavon, Novalnet, Xendit supported payment methods, currencies and countries in feature matrix
### Feature Description
Add Airwallex, Elavon, Novalnet, Xendit supported payment methods, currencies and countries in feature matrix
### Possible Implementation
Add Airwallex, Elavon, Novalnet, Xendit supported payment methods, currencies and countries in feature matrix
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 3464bcb1364..f79a31848c8 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -471,9 +471,9 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit
discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch
[mandates.supported_payment_methods]
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+wallet.paypal = { connector_list = "adyen,novalnet" } # Mandate supported payment method type and connector for wallets
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
bank_debit.ach = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit
bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
@@ -481,9 +481,9 @@ bank_debit.bacs = { connector_list = "adyen" }
bank_debit.sepa = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = { connector_list = "stripe,globalpay" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet" }
wallet.samsung_pay = { connector_list = "cybersource" }
-wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet" }
+wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet,novalnet" }
bank_redirect.giropay = { connector_list = "globalpay" }
@@ -536,6 +536,19 @@ seicomart = { country = "JP", currency = "JPY" }
pay_easy = { country = "JP", currency = "JPY" }
boleto = { country = "BR", currency = "BRL" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index f36bc77b68b..6990dbc4c6d 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -177,8 +177,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
@@ -288,6 +288,19 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD,CNY" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 1e88a9ebcb8..b70f351e074 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -177,8 +177,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
@@ -302,6 +302,19 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 05d29262c1f..397d1f3ed02 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -177,8 +177,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
@@ -304,6 +304,19 @@ walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" }
pix = { country = "BR", currency = "BRL" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
diff --git a/config/development.toml b/config/development.toml
index 279601eb830..b54762be438 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -529,6 +529,19 @@ pay_easy = { country = "JP", currency = "JPY" }
pix = { country = "BR", currency = "BRL" }
boleto = { country = "BR", currency = "BRL" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
@@ -805,8 +818,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index e78a26396e4..f9ac8b89300 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -454,6 +454,19 @@ vipps = { country = "NO", currency = "NOK" }
walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD,CNY" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+debit = { country = "AU,HK,SG,NZ,US", currency = "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" }
+google_pay = { country = "AU,HK,SG,NZ,US", currency = "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" }
+
+[pm_filters.elavon]
+credit = { country = "US", currency = "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" }
+debit = { country = "US", currency = "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" }
+
+[pm_filters.xendit]
+credit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+debit = { country = "ID,PH", currency = "IDR,PHP,USD,SGD,MYR" }
+
[pm_filters.tsys]
credit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
debit = { country = "NA", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, 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, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, 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, SOS, SRD, SSP, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, BYN, KPW, STN, MRU, VES" }
@@ -656,12 +669,12 @@ adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,hal
[mandates.supported_payment_methods]
pay_later.klarna = { connector_list = "adyen" }
-wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotnet" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet" }
+wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotnet,novalnet" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet" }
wallet.samsung_pay = { connector_list = "cybersource" }
-wallet.paypal = { connector_list = "adyen" }
-card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,bamboraapac" }
-card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,bamboraapac" }
+wallet.paypal = { connector_list = "adyen,novalnet" }
+card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac" }
+card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac" }
bank_debit.ach = { connector_list = "gocardless,adyen" }
bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" }
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
index c7482236264..e04406bfa81 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
@@ -1,6 +1,6 @@
pub mod transformers;
-use std::fmt::Debug;
+use std::{fmt::Debug, sync::LazyLock};
use api_models::webhooks::IncomingWebhookEvent;
use common_enums::{enums, CallConnectorAction, PaymentAction};
@@ -24,7 +24,10 @@ use hyperswitch_domain_models::{
PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,
PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData,
@@ -50,7 +53,7 @@ use transformers as airwallex;
use crate::{
constants::headers,
types::{RefreshTokenRouterData, ResponseRouterData},
- utils::{construct_not_supported_error_report, AccessTokenRequestInfo, RefundsRequestData},
+ utils::{AccessTokenRequestInfo, RefundsRequestData},
};
#[derive(Debug, Clone)]
@@ -128,24 +131,7 @@ impl ConnectorCommon for Airwallex {
}
}
-impl ConnectorValidation for Airwallex {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- construct_not_supported_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Airwallex {}
impl api::Payment for Airwallex {}
impl api::PaymentsPreProcessing for Airwallex {}
@@ -1109,4 +1095,100 @@ impl ConnectorRedirectResponse for Airwallex {
}
}
-impl ConnectorSpecifications for Airwallex {}
+static AIRWALLEX_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::Discover,
+ ];
+
+ let mut airwallex_supported_payment_methods = SupportedPaymentMethods::new();
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ airwallex_supported_payment_methods
+ });
+
+static AIRWALLEX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Airwallex",
+ description: "Airwallex is a multinational financial technology company offering financial services and software as a service (SaaS)",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static AIRWALLEX_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
+ enums::EventClass::Payments,
+ enums::EventClass::Refunds,
+ enums::EventClass::Disputes,
+];
+
+impl ConnectorSpecifications for Airwallex {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&AIRWALLEX_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*AIRWALLEX_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&AIRWALLEX_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon.rs b/crates/hyperswitch_connectors/src/connectors/elavon.rs
index 28ffecff731..d691b17efac 100644
--- a/crates/hyperswitch_connectors/src/connectors/elavon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/elavon.rs
@@ -1,7 +1,7 @@
pub mod transformers;
-use std::{collections::HashMap, str};
+use std::{collections::HashMap, str, sync::LazyLock};
-use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};
+use common_enums::{enums, CaptureMethod, PaymentMethod, PaymentMethodType};
use common_utils::{
errors::CustomResult,
request::{Method, Request, RequestBuilder, RequestContent},
@@ -9,7 +9,6 @@ use common_utils::{
};
use error_stack::report;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
router_data::{AccessToken, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
@@ -21,7 +20,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
@@ -42,11 +44,7 @@ use masking::{Secret, WithoutType};
use serde::Serialize;
use transformers as elavon;
-use crate::{
- constants::headers,
- types::ResponseRouterData,
- utils::{self, PaymentMethodDataType},
-};
+use crate::{constants::headers, types::ResponseRouterData, utils};
pub fn struct_to_xml<T: Serialize>(
item: &T,
@@ -581,31 +579,88 @@ impl webhooks::IncomingWebhook for Elavon {
}
}
-impl ConnectorValidation for Elavon {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<CaptureMethod>,
- _payment_method: PaymentMethod,
- _pmt: Option<PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- CaptureMethod::Automatic
- | CaptureMethod::Manual
- | CaptureMethod::SequentialAutomatic => Ok(()),
- CaptureMethod::ManualMultiple | CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
+impl ConnectorValidation for Elavon {}
+
+static ELAVON_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ CaptureMethod::Automatic,
+ CaptureMethod::Manual,
+ CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::Interac,
+ ];
+
+ let mut elavon_supported_payment_methods = SupportedPaymentMethods::new();
+
+ elavon_supported_payment_methods.add(
+ PaymentMethod::Card,
+ PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
),
- }
+ },
+ );
+
+ elavon_supported_payment_methods.add(
+ PaymentMethod::Card,
+ PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ elavon_supported_payment_methods
+});
+
+static ELAVON_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Elavon",
+ description: "Elavon, a wholly owned subsidiary of U.S. Bank, has been a global leader in payment processing for more than 30 years.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static ELAVON_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Elavon {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&ELAVON_CONNECTOR_INFO)
}
- fn validate_mandate_payment(
- &self,
- pm_type: Option<PaymentMethodType>,
- pm_data: PaymentMethodData,
- ) -> CustomResult<(), errors::ConnectorError> {
- let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]);
- utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*ELAVON_SUPPORTED_PAYMENT_METHODS)
}
-}
-impl ConnectorSpecifications for Elavon {}
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&ELAVON_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index a6f2e2fc643..68359879743 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -1,6 +1,6 @@
pub mod transformers;
use core::str;
-use std::collections::HashSet;
+use std::{collections::HashSet, sync::LazyLock};
use base64::Engine;
use common_enums::enums;
@@ -25,7 +25,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,
@@ -160,23 +163,6 @@ impl ConnectorCommon for Novalnet {
}
impl ConnectorValidation for Novalnet {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
-
fn validate_psync_reference_id(
&self,
data: &PaymentsSyncData,
@@ -997,4 +983,125 @@ impl webhooks::IncomingWebhook for Novalnet {
}
}
-impl ConnectorSpecifications for Novalnet {}
+static NOVALNET_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::UnionPay,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::Interac,
+ ];
+
+ let mut novalnet_supported_payment_methods = SupportedPaymentMethods::new();
+
+ novalnet_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ novalnet_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ novalnet_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None, // three-ds needed for googlepay
+ },
+ );
+
+ novalnet_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ novalnet_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::Paypal,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ novalnet_supported_payment_methods
+ });
+
+static NOVALNET_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Novalnet",
+ description: "Novalnet provides tailored, data-driven payment solutions that maximize acceptance, boost conversions, and deliver seamless customer experiences worldwide.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static NOVALNET_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 4] = [
+ enums::EventClass::Payments,
+ enums::EventClass::Refunds,
+ enums::EventClass::Disputes,
+ enums::EventClass::Mandates,
+];
+
+impl ConnectorSpecifications for Novalnet {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&NOVALNET_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*NOVALNET_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&NOVALNET_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index cd65b25fda4..72d995e05c7 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -1,4 +1,6 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::{enums, CallConnectorAction, CaptureMethod, PaymentAction, PaymentMethodType};
@@ -27,7 +29,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,
PaymentsSyncData, RefundsData, SetupMandateRequestData, SplitRefundsRequest,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
@@ -174,22 +179,6 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Xe
}
impl ConnectorValidation for Xendit {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- CaptureMethod::Automatic
- | CaptureMethod::Manual
- | CaptureMethod::SequentialAutomatic => Ok(()),
- CaptureMethod::ManualMultiple | CaptureMethod::Scheduled => Err(
- utils::construct_not_supported_error_report(capture_method, self.id()),
- ),
- }
- }
fn validate_mandate_payment(
&self,
pm_type: Option<PaymentMethodType>,
@@ -906,7 +895,85 @@ impl webhooks::IncomingWebhook for Xendit {
}
}
-impl ConnectorSpecifications for Xendit {}
+static XENDIT_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
+ let supported_capture_methods = vec![CaptureMethod::Automatic, CaptureMethod::Manual];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ common_enums::CardNetwork::Interac,
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::UnionPay,
+ ];
+
+ let mut xendit_supported_payment_methods = SupportedPaymentMethods::new();
+
+ xendit_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ xendit_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ xendit_supported_payment_methods
+});
+
+static XENDIT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Xendit",
+ description: "Xendit is a financial technology company that provides payment solutions and simplifies the payment process for businesses in Indonesia, the Philippines and Southeast Asia, from SMEs and e-commerce startups to large enterprises.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static XENDIT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
+
+impl ConnectorSpecifications for Xendit {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&XENDIT_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*XENDIT_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&XENDIT_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
impl ConnectorRedirectResponse for Xendit {
fn get_flow_type(
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 08a7e59357a..191e5585b3d 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -438,8 +438,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
|
2025-02-01T21:36:53Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add Airwallex, Elavon, Novalnet, Xendit supported payment methods, currencies and countries in feature matrix
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
Feature API curl:
```
curl --location 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ***'
```
Response -
```
{
"connector_count": 4,
"connectors": [
{
"name": "AIRWALLEX",
"display_name": "Airwallex",
"description": "Airwallex is a multinational financial technology company offering financial services and software as a service (SaaS)",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover"],
"supported_countries": ["AU","SG","HK","NZ","US"],
"supported_currencies": ["QAR", "NIO", "STN", "UGX", "VUV", "LKR", "PAB", "FJD", "PLN", "ZWL", "HKD", "AMD", "BHD", "CZK", "EUR", "ERN", "MUR", "TRY", "XPF", "BIF", "AED", "DZD", "SZL", "JPY", "SAR", "CVE", "AFN", "LYD", "BZD", "MOP", "UZS", "BTN", "KES", "NPR", "NAD", "TWD", "FKP", "LSL", "HRK", "ALL", "LBP", "IQD", "HNL", "KGS", "MWK", "PEN", "SEK", "GBP", "SSP", "LAK", "SCR", "SYP", "BYN", "BGN", "BMD", "CUP", "KPW", "KMF", "LRD", "SLL", "CAD", "SLE", "EGP", "BAM", "GNF", "ETB", "NOK", "JOD", "KWD", "MNT", "BDT", "MXN", "UAH", "WST", "TJS", "VND", "XAF", "BND", "ARS", "NGN", "BSD", "CNY", "KZT", "ILS", "MYR", "GYD", "GTQ", "TMT", "TOP", "SVC", "BBD", "MDL", "COP", "GEL", "AWG", "OMR", "SBD", "MKD", "CRC", "MVR", "XOF", "IRR", "MMK", "PHP", "AZN", "DKK", "SGD", "NZD", "IDR", "KRW", "HUF", "RSD", "YER", "BOB", "HTG", "XCD", "BWP", "DJF", "MGA", "USD", "AOA", "DOP", "TZS", "MAD", "CDF", "JMD", "GMD", "PKR", "KHR", "MRU", "SRD", "BRL", "INR", "THB", "VES", "RWF", "CHF", "ISK", "UYU", "ZMW", "CLP", "SDG", "TND", "KYD", "ZAR", "GIP", "RUB", "GHS", "TTD", "RON", "SHP", "PYG", "PGK", "AUD", "MZN", "SOS", "ANG"]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover"],
"supported_countries": ["AU","SG","HK","NZ","US"],
"supported_currencies": ["QAR", "NIO", "STN", "UGX", "VUV", "LKR", "PAB", "FJD", "PLN", "ZWL", "HKD", "AMD", "BHD", "CZK", "EUR", "ERN", "MUR", "TRY", "XPF", "BIF", "AED", "DZD", "SZL", "JPY", "SAR", "CVE", "AFN", "LYD", "BZD", "MOP", "UZS", "BTN", "KES", "NPR", "NAD", "TWD", "FKP", "LSL", "HRK", "ALL", "LBP", "IQD", "HNL", "KGS", "MWK", "PEN", "SEK", "GBP", "SSP", "LAK", "SCR", "SYP", "BYN", "BGN", "BMD", "CUP", "KPW", "KMF", "LRD", "SLL", "CAD", "SLE", "EGP", "BAM", "GNF", "ETB", "NOK", "JOD", "KWD", "MNT", "BDT", "MXN", "UAH", "WST", "TJS", "VND", "XAF", "BND", "ARS", "NGN", "BSD", "CNY", "KZT", "ILS", "MYR", "GYD", "GTQ", "TMT", "TOP", "SVC", "BBD", "MDL", "COP", "GEL", "AWG", "OMR", "SBD", "MKD", "CRC", "MVR", "XOF", "IRR", "MMK", "PHP", "AZN", "DKK", "SGD", "NZD", "IDR", "KRW", "HUF", "RSD", "YER", "BOB", "HTG", "XCD", "BWP", "DJF", "MGA", "USD", "AOA", "DOP", "TZS", "MAD", "CDF", "JMD", "GMD", "PKR", "KHR", "MRU", "SRD", "BRL", "INR", "THB", "VES", "RWF", "CHF", "ISK", "UYU", "ZMW", "CLP", "SDG", "TND", "KYD", "ZAR", "GIP", "RUB", "GHS", "TTD", "RON", "SHP", "PYG", "PGK", "AUD", "MZN", "SOS", "ANG"]
},
{
"payment_method": "wallet",
"payment_method_type": "google_pay",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"supported_countries": ["AU","SG","HK","NZ","US"],
"supported_currencies": ["QAR", "NIO", "STN", "UGX", "VUV", "LKR", "PAB", "FJD", "PLN", "ZWL", "HKD", "AMD", "BHD", "CZK", "EUR", "ERN", "MUR", "TRY", "XPF", "BIF", "AED", "DZD", "SZL", "JPY", "SAR", "CVE", "AFN", "LYD", "BZD", "MOP", "UZS", "BTN", "KES", "NPR", "NAD", "TWD", "FKP", "LSL", "HRK", "ALL", "LBP", "IQD", "HNL", "KGS", "MWK", "PEN", "SEK", "GBP", "SSP", "LAK", "SCR", "SYP", "BYN", "BGN", "BMD", "CUP", "KPW", "KMF", "LRD", "SLL", "CAD", "SLE", "EGP", "BAM", "GNF", "ETB", "NOK", "JOD", "KWD", "MNT", "BDT", "MXN", "UAH", "WST", "TJS", "VND", "XAF", "BND", "ARS", "NGN", "BSD", "CNY", "KZT", "ILS", "MYR", "GYD", "GTQ", "TMT", "TOP", "SVC", "BBD", "MDL", "COP", "GEL", "AWG", "OMR", "SBD", "MKD", "CRC", "MVR", "XOF", "IRR", "MMK", "PHP", "AZN", "DKK", "SGD", "NZD", "IDR", "KRW", "HUF", "RSD", "YER", "BOB", "HTG", "XCD", "BWP", "DJF", "MGA", "USD", "AOA", "DOP", "TZS", "MAD", "CDF", "JMD", "GMD", "PKR", "KHR", "MRU", "SRD", "BRL", "INR", "THB", "VES", "RWF", "CHF", "ISK", "UYU", "ZMW", "CLP", "SDG", "TND", "KYD", "ZAR", "GIP", "RUB", "GHS", "TTD", "RON", "SHP", "PYG", "PGK", "AUD", "MZN", "SOS", "ANG"]
}
],
"supported_webhook_flows": ["payments","refunds","disputes"]
},
{
"name": "ELAVON",
"display_name": "Elavon",
"description": "Elavon, a wholly owned subsidiary of U.S. Bank, has been a global leader in payment processing for more than 30 years.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover","CartesBancaires","Interac"],
"supported_countries": ["US"],
"supported_currencies": ["QAR", "NIO", "STN", "UGX", "VUV", "LKR", "PAB", "FJD", "PLN", "ZWL", "HKD", "AMD", "BHD", "CZK", "EUR", "ERN", "MUR", "TRY", "XPF", "BIF", "AED", "DZD", "SZL", "JPY", "SAR", "CVE", "AFN", "LYD", "BZD", "MOP", "UZS", "BTN", "KES", "NPR", "NAD", "TWD", "FKP", "LSL", "HRK", "ALL", "LBP", "IQD", "HNL", "KGS", "MWK", "PEN", "SEK", "GBP", "SSP", "LAK", "SCR", "SYP", "BYN", "BGN", "BMD", "CUP", "KPW", "KMF", "LRD", "SLL", "CAD", "SLE", "EGP", "BAM", "GNF", "ETB", "NOK", "JOD", "KWD", "MNT", "BDT", "MXN", "UAH", "WST", "TJS", "VND", "XAF", "BND", "ARS", "NGN", "BSD", "CNY", "KZT", "ILS", "MYR", "GYD", "GTQ", "TMT", "TOP", "SVC", "BBD", "MDL", "COP", "GEL", "AWG", "OMR", "SBD", "MKD", "CRC", "MVR", "XOF", "IRR", "MMK", "PHP", "AZN", "DKK", "SGD", "NZD", "IDR", "KRW", "HUF", "RSD", "YER", "BOB", "HTG", "XCD", "BWP", "DJF", "MGA", "USD", "AOA", "DOP", "TZS", "MAD", "CDF", "JMD", "GMD", "PKR", "KHR", "MRU", "SRD", "BRL", "INR", "THB", "VES", "RWF", "CHF", "ISK", "UYU", "ZMW", "CLP", "SDG", "TND", "KYD", "ZAR", "GIP", "RUB", "GHS", "TTD", "RON", "SHP", "PYG", "PGK", "AUD", "MZN", "SOS", "ANG"]
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "not_supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover","CartesBancaires","Interac"],
"supported_countries": ["US"],
"supported_currencies": ["QAR", "NIO", "STN", "UGX", "VUV", "LKR", "PAB", "FJD", "PLN", "ZWL", "HKD", "AMD", "BHD", "CZK", "EUR", "ERN", "MUR", "TRY", "XPF", "BIF", "AED", "DZD", "SZL", "JPY", "SAR", "CVE", "AFN", "LYD", "BZD", "MOP", "UZS", "BTN", "KES", "NPR", "NAD", "TWD", "FKP", "LSL", "HRK", "ALL", "LBP", "IQD", "HNL", "KGS", "MWK", "PEN", "SEK", "GBP", "SSP", "LAK", "SCR", "SYP", "BYN", "BGN", "BMD", "CUP", "KPW", "KMF", "LRD", "SLL", "CAD", "SLE", "EGP", "BAM", "GNF", "ETB", "NOK", "JOD", "KWD", "MNT", "BDT", "MXN", "UAH", "WST", "TJS", "VND", "XAF", "BND", "ARS", "NGN", "BSD", "CNY", "KZT", "ILS", "MYR", "GYD", "GTQ", "TMT", "TOP", "SVC", "BBD", "MDL", "COP", "GEL", "AWG", "OMR", "SBD", "MKD", "CRC", "MVR", "XOF", "IRR", "MMK", "PHP", "AZN", "DKK", "SGD", "NZD", "IDR", "KRW", "HUF", "RSD", "YER", "BOB", "HTG", "XCD", "BWP", "DJF", "MGA", "USD", "AOA", "DOP", "TZS", "MAD", "CDF", "JMD", "GMD", "PKR", "KHR", "MRU", "SRD", "BRL", "INR", "THB", "VES", "RWF", "CHF", "ISK", "UYU", "ZMW", "CLP", "SDG", "TND", "KYD", "ZAR", "GIP", "RUB", "GHS", "TTD", "RON", "SHP", "PYG", "PGK", "AUD", "MZN", "SOS", "ANG"]
}
],
"supported_webhook_flows": []
},
{
"name": "NOVALNET",
"display_name": "Novalnet",
"description": "Novalnet provides tailored, data-driven payment solutions that maximize acceptance, boost conversions, and deliver seamless customer experiences worldwide.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover","CartesBancaires","Interac"],
"supported_countries": [
"JP",
"PL",
"TW",
"MD",
"IL",
"MX",
"PT",
"ET",
"SG",
"AT",
"DZ",
"IT",
"SI",
"WS",
"PG",
"BM",
"KE",
"GY",
"US",
"AU",
"AM",
"GE",
"CH",
"AL",
"NL",
"AG",
"BZ",
"GB",
"SB",
"AE",
"ES",
"KW",
"BD",
"DE",
"KH",
"NI",
"BA",
"SC",
"CN",
"KR",
"KZ",
"BR",
"VN",
"TR",
"DM",
"BG",
"CZ",
"RU",
"LB",
"ST",
"PY",
"NP",
"SR",
"BO",
"CO",
"MY",
"AD",
"SH",
"BY",
"SK",
"TO",
"MW",
"KN",
"LT",
"UG",
"FI",
"VE",
"DJ",
"AZ",
"FR",
"IN",
"LK",
"MK",
"MO",
"IE",
"ID",
"BB",
"RW",
"CY",
"JO",
"VU",
"ZA",
"BW",
"MA",
"MG",
"ZM",
"CA",
"KY",
"EG",
"PK",
"SO",
"JM",
"UY",
"IS",
"NG",
"TZ",
"MV",
"FJ",
"GT",
"NZ",
"SY",
"PE",
"SL",
"HR",
"SM",
"CF",
"NO",
"CL",
"DK",
"TH",
"HK",
"PH",
"QA",
"BE",
"VA",
"GR",
"LY",
"RO",
"SA",
"SV",
"CD",
"YE",
"LC",
"LV",
"MT",
"EE",
"GI",
"OM",
"GD",
"RS",
"BN",
"ME",
"AR",
"HU",
"UZ",
"BI",
"MN",
"PA",
"GH",
"BH",
"CR",
"UA",
"VC",
"SE",
"MC",
"DO",
"TJ",
"GM",
"CU",
"BS",
"TN",
"HN"
],
"supported_currencies": [
"HUF",
"ILS",
"GEL",
"MVR",
"AZN",
"BBD",
"NOK",
"NPR",
"BYN",
"PLN",
"VND",
"HNL",
"TWD",
"XCD",
"SRD",
"EGP",
"OMR",
"DOP",
"UZS",
"MYR",
"UGX",
"BZD",
"SCR",
"CHF",
"KHR",
"RUB",
"KYD",
"BOB",
"MNT",
"SLL",
"CZK",
"BSD",
"BMD",
"CLP",
"KES",
"MOP",
"LBP",
"ISK",
"COP",
"AMD",
"ARS",
"VUV",
"HRK",
"NGN",
"CRC",
"MAD",
"ZMW",
"TND",
"STN",
"JMD",
"ALL",
"GHS",
"MXN",
"PYG",
"QAR",
"MKD",
"AED",
"JPY",
"SYP",
"GMD",
"BRL",
"TJS",
"WST",
"LKR",
"GIP",
"CNY",
"HKD",
"CUP",
"PGK",
"BWP",
"DZD",
"BGN",
"PEN",
"LYD",
"RWF",
"NIO",
"TZS",
"INR",
"EUR",
"RON",
"VES",
"PHP",
"TRY",
"ETB",
"JOD",
"USD",
"UAH",
"TOP",
"BDT",
"GTQ",
"AUD",
"YER",
"CDF",
"IDR",
"KRW",
"FJD",
"GBP",
"KWD",
"MDL",
"KZT",
"MWK",
"DKK",
"BAM",
"GYD",
"MGA",
"NZD",
"UYU",
"PKR",
"PAB",
"SHP",
"SVC",
"DJF",
"XAF",
"THB",
"BIF",
"SGD",
"SOS",
"RSD",
"ZAR",
"SEK",
"BHD",
"SAR",
"BND",
"SBD",
"CAD"
]
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover","CartesBancaires","Interac"],
"supported_countries": [
"TZ",
"BM",
"TO",
"LY",
"JP",
"TJ",
"KY",
"BN",
"MN",
"AD",
"TN",
"UA",
"SI",
"LV",
"BE",
"BB",
"MT",
"SV",
"VC",
"BO",
"MO",
"RS",
"SA",
"DJ",
"UY",
"VA",
"FR",
"RO",
"LC",
"FJ",
"ST",
"GH",
"LK",
"BY",
"LB",
"AM",
"BI",
"HK",
"CA",
"KZ",
"CH",
"MW",
"VN",
"CY",
"PY",
"BR",
"GD",
"SK",
"AU",
"GB",
"BH",
"IL",
"JO",
"ID",
"PH",
"UZ",
"JM",
"SO",
"BD",
"KN",
"DO",
"FI",
"BZ",
"CU",
"SG",
"GM",
"ZA",
"ES",
"AG",
"VU",
"DE",
"ME",
"MX",
"HN",
"MY",
"TR",
"EE",
"PE",
"HR",
"CO",
"TH",
"PG",
"CF",
"KW",
"DZ",
"CN",
"IS",
"NI",
"AE",
"GY",
"IE",
"VE",
"DM",
"NO",
"QA",
"EG",
"CZ",
"RU",
"CL",
"AL",
"CD",
"GE",
"MK",
"NG",
"TW",
"BW",
"KE",
"BA",
"AZ",
"DK",
"AR",
"NP",
"AT",
"NZ",
"GI",
"SR",
"YE",
"KR",
"MV",
"SE",
"US",
"OM",
"BS",
"PK",
"SB",
"NL",
"ET",
"GT",
"KH",
"SH",
"RW",
"CR",
"MG",
"LT",
"PT",
"SC",
"SM",
"SY",
"MA",
"PA",
"GR",
"UG",
"WS",
"ZM",
"PL",
"IT",
"MC",
"IN",
"SL",
"BG",
"HU",
"MD"
],
"supported_currencies": [
"MWK",
"SRD",
"ZMW",
"NZD",
"JOD",
"OMR",
"MNT",
"EGP",
"STN",
"HNL",
"CAD",
"ISK",
"MDL",
"COP",
"BMD",
"KRW",
"AED",
"XCD",
"RSD",
"RUB",
"BBD",
"TND",
"HUF",
"DOP",
"BZD",
"LBP",
"BSD",
"BWP",
"TZS",
"MKD",
"VUV",
"SOS",
"PHP",
"NOK",
"CZK",
"NGN",
"THB",
"SAR",
"CNY",
"USD",
"ARS",
"MAD",
"CDF",
"ILS",
"MXN",
"BHD",
"VES",
"FJD",
"NIO",
"GBP",
"HKD",
"SCR",
"TRY",
"KES",
"KZT",
"CUP",
"MGA",
"BAM",
"AZN",
"GIP",
"GTQ",
"IDR",
"PAB",
"BRL",
"GYD",
"TJS",
"UAH",
"BOB",
"UGX",
"MOP",
"SLL",
"BGN",
"CRC",
"MVR",
"GEL",
"WST",
"PLN",
"KWD",
"JMD",
"PKR",
"TOP",
"YER",
"DKK",
"BDT",
"GMD",
"BIF",
"SHP",
"QAR",
"DJF",
"DZD",
"ALL",
"ETB",
"AUD",
"SBD",
"SYP",
"HRK",
"CHF",
"PYG",
"BND",
"NPR",
"INR",
"MYR",
"GHS",
"SVC",
"UZS",
"JPY",
"RON",
"LKR",
"XAF",
"KYD",
"BYN",
"EUR",
"LYD",
"CLP",
"SEK",
"TWD",
"PGK",
"UYU",
"SGD",
"PEN",
"VND",
"KHR",
"ZAR",
"AMD",
"RWF"
]
},
{
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"supported_countries": [
"RU",
"GD",
"ID",
"SE",
"NO",
"TW",
"LY",
"GR",
"PT",
"AU",
"US",
"SV",
"CN",
"DZ",
"JM",
"KE",
"AM",
"GM",
"BD",
"MW",
"UY",
"WS",
"MN",
"MT",
"AR",
"GI",
"SG",
"HN",
"SL",
"PY",
"OM",
"TJ",
"CL",
"SK",
"AD",
"LK",
"GH",
"MK",
"SY",
"PE",
"KZ",
"TZ",
"NP",
"KR",
"SA",
"CR",
"ET",
"MD",
"HU",
"NI",
"JP",
"BE",
"CO",
"KH",
"MA",
"BN",
"IT",
"DJ",
"QA",
"MO",
"MX",
"MY",
"UZ",
"RO",
"PG",
"JO",
"AE",
"RS",
"CD",
"MV",
"CA",
"MC",
"TN",
"AG",
"BA",
"KN",
"BZ",
"EE",
"VE",
"ZM",
"CZ",
"FI",
"GE",
"RW",
"VC",
"BO",
"PA",
"KW",
"VN",
"SR",
"CF",
"FJ",
"NG",
"IE",
"VU",
"UG",
"IN",
"CH",
"SO",
"CY",
"PL",
"PK",
"BS",
"BY",
"BR",
"TO",
"SM",
"GB",
"TR",
"DE",
"BW",
"GT",
"AT",
"MG",
"EG",
"AL",
"DK",
"FR",
"LT",
"TH",
"UA",
"YE",
"DM",
"HR",
"BB",
"BI",
"HK",
"LB",
"NZ",
"PH",
"SH",
"LV",
"AZ",
"GY",
"BH",
"BG",
"ZA",
"ME",
"SB",
"ES",
"IS",
"KY",
"SC",
"SI",
"ST",
"NL",
"VA",
"LC",
"CU",
"IL",
"DO",
"BM"
],
"supported_currencies": [
"CLP",
"MKD",
"GTQ",
"VUV",
"YER",
"MYR",
"PAB",
"THB",
"USD",
"PLN",
"ILS",
"KHR",
"ISK",
"CZK",
"LBP",
"MWK",
"TOP",
"AMD",
"SVC",
"XAF",
"TJS",
"VES",
"NGN",
"UGX",
"DZD",
"PHP",
"BMD",
"IDR",
"CUP",
"CDF",
"GYD",
"EUR",
"PGK",
"BAM",
"BDT",
"AUD",
"GMD",
"GIP",
"CNY",
"DJF",
"INR",
"KZT",
"TRY",
"BHD",
"AED",
"GEL",
"AZN",
"RSD",
"BOB",
"GHS",
"HUF",
"KYD",
"PYG",
"RON",
"SCR",
"EGP",
"BND",
"MVR",
"COP",
"TWD",
"CRC",
"BZD",
"MNT",
"OMR",
"TZS",
"JPY",
"ZMW",
"BWP",
"NOK",
"KRW",
"HNL",
"SYP",
"MOP",
"SAR",
"RUB",
"SRD",
"ALL",
"NIO",
"MAD",
"BIF",
"MDL",
"SLL",
"BYN",
"STN",
"ZAR",
"RWF",
"TND",
"DKK",
"QAR",
"UAH",
"NPR",
"UYU",
"DOP",
"LKR",
"NZD",
"KES",
"WST",
"MXN",
"BSD",
"PEN",
"PKR",
"BGN",
"ARS",
"SEK",
"VND",
"SOS",
"HRK",
"LYD",
"CHF",
"SGD",
"XCD",
"MGA",
"ETB",
"CAD",
"JOD",
"GBP",
"JMD",
"BRL",
"FJD",
"BBD",
"SHP",
"KWD",
"SBD",
"HKD",
"UZS"
]
},
{
"payment_method": "wallet",
"payment_method_type": "paypal",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"supported_countries": [
"BY",
"ET",
"MV",
"SM",
"AL",
"DZ",
"PG",
"AT",
"DO",
"MD",
"PL",
"TW",
"KN",
"CU",
"BR",
"PT",
"NP",
"BW",
"KR",
"LT",
"MG",
"PK",
"CN",
"TZ",
"VN",
"GD",
"IN",
"SL",
"GB",
"ES",
"ME",
"BN",
"GH",
"SO",
"SR",
"TR",
"UA",
"LV",
"OM",
"LC",
"NL",
"HR",
"PH",
"LK",
"PY",
"IE",
"TJ",
"DE",
"SA",
"CO",
"BB",
"JM",
"NZ",
"DK",
"AG",
"MX",
"GE",
"AE",
"ID",
"MT",
"CD",
"UZ",
"MW",
"GT",
"BG",
"NO",
"CL",
"GY",
"ST",
"ZA",
"BA",
"EE",
"AD",
"JO",
"VE",
"GI",
"NG",
"WS",
"PE",
"SB",
"FR",
"GM",
"NI",
"IS",
"KE",
"MO",
"CZ",
"SK",
"SG",
"SI",
"KY",
"TH",
"DJ",
"BO",
"FJ",
"MA",
"FI",
"AU",
"SC",
"VU",
"BH",
"IT",
"CR",
"UG",
"LY",
"SV",
"SY",
"MC",
"US",
"MY",
"QA",
"GR",
"MN",
"MK",
"TN",
"VA",
"JP",
"AM",
"TO",
"AR",
"IL",
"VC",
"BS",
"CY",
"KZ",
"RO",
"BE",
"KW",
"RU",
"ZM",
"SH",
"HU",
"BM",
"HN",
"SE",
"LB",
"BZ",
"EG",
"RW",
"BD",
"BI",
"CH",
"HK",
"CA",
"CF",
"PA",
"UY",
"RS",
"DM",
"KH",
"YE",
"AZ"
],
"supported_currencies": [
"SHP",
"CAD",
"NPR",
"RON",
"SLL",
"GIP",
"ALL",
"ZMW",
"BMD",
"NOK",
"AMD",
"BYN",
"GEL",
"GHS",
"AUD",
"ZAR",
"CZK",
"UAH",
"EUR",
"KWD",
"RWF",
"BBD",
"XAF",
"CNY",
"MVR",
"GBP",
"BHD",
"HUF",
"TOP",
"SCR",
"HKD",
"MDL",
"IDR",
"TJS",
"BZD",
"RUB",
"NIO",
"EGP",
"ARS",
"SGD",
"COP",
"AZN",
"MNT",
"UGX",
"MGA",
"NGN",
"LKR",
"SVC",
"CDF",
"PHP",
"VUV",
"PGK",
"BDT",
"LYD",
"MYR",
"CRC",
"SEK",
"TWD",
"JOD",
"BSD",
"PKR",
"LBP",
"INR",
"JPY",
"HNL",
"THB",
"TZS",
"DKK",
"JMD",
"PEN",
"BGN",
"PAB",
"GTQ",
"CLP",
"KYD",
"BAM",
"KZT",
"TND",
"MOP",
"MWK",
"STN",
"UZS",
"PLN",
"KES",
"BRL",
"BOB",
"NZD",
"SOS",
"USD",
"TRY",
"GYD",
"BIF",
"GMD",
"HRK",
"UYU",
"DOP",
"VND",
"SYP",
"XCD",
"ISK",
"YER",
"CHF",
"BWP",
"QAR",
"SAR",
"DZD",
"VES",
"KHR",
"KRW",
"WST",
"ETB",
"SRD",
"BND",
"DJF",
"CUP",
"FJD",
"MAD",
"MXN",
"ILS",
"PYG",
"AED",
"SBD",
"OMR",
"MKD",
"RSD"
]
},
{
"payment_method": "wallet",
"payment_method_type": "google_pay",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual","sequential_automatic"],
"supported_countries": [
"MX",
"DE",
"CD",
"BM",
"KY",
"MD",
"BI",
"LV",
"MA",
"SE",
"SC",
"FI",
"BO",
"KE",
"JM",
"FR",
"MT",
"PT",
"BW",
"CY",
"PK",
"GB",
"HN",
"JO",
"SY",
"HR",
"YE",
"TR",
"UG",
"AZ",
"SR",
"RW",
"DZ",
"FJ",
"LT",
"PH",
"MW",
"KN",
"AD",
"CZ",
"VU",
"MY",
"HU",
"CH",
"SM",
"AR",
"SL",
"IN",
"EE",
"DK",
"CA",
"GI",
"BH",
"MN",
"BR",
"NL",
"SO",
"UY",
"CR",
"TZ",
"IT",
"MC",
"BA",
"KW",
"DO",
"SI",
"PA",
"PL",
"BN",
"KH",
"TO",
"GE",
"QA",
"BZ",
"CU",
"ET",
"EG",
"NG",
"GD",
"GY",
"PG",
"BY",
"JP",
"BG",
"RS",
"DJ",
"LB",
"AL",
"BB",
"TH",
"TJ",
"PE",
"DM",
"GM",
"MK",
"SG",
"UZ",
"US",
"AT",
"GT",
"AU",
"MO",
"VN",
"VC",
"WS",
"CL",
"PY",
"CF",
"IL",
"OM",
"GH",
"HK",
"IS",
"MV",
"NP",
"SB",
"GR",
"SK",
"NO",
"RU",
"ZA",
"LY",
"ES",
"MG",
"KR",
"BE",
"BD",
"IE",
"RO",
"TN",
"VA",
"NZ",
"AG",
"ZM",
"SH",
"LK",
"TW",
"VE",
"BS",
"AE",
"ST",
"UA",
"KZ",
"SA",
"CN",
"ID",
"NI",
"ME",
"AM",
"LC",
"CO",
"SV"
],
"supported_currencies": [
"BYN",
"JOD",
"KZT",
"SHP",
"MVR",
"SCR",
"TWD",
"LKR",
"GHS",
"RUB",
"BND",
"MDL",
"TRY",
"CNY",
"EGP",
"TOP",
"XCD",
"CHF",
"MOP",
"BDT",
"DKK",
"ETB",
"NIO",
"BAM",
"SBD",
"JMD",
"BIF",
"HKD",
"GEL",
"TND",
"KHR",
"JPY",
"MXN",
"PGK",
"MAD",
"UZS",
"GYD",
"AED",
"KRW",
"RSD",
"RWF",
"GBP",
"LBP",
"TJS",
"SOS",
"KES",
"CZK",
"DJF",
"HNL",
"RON",
"SLL",
"BWP",
"NGN",
"UYU",
"WST",
"BGN",
"ZAR",
"INR",
"BSD",
"BHD",
"ILS",
"HRK",
"CRC",
"DOP",
"GMD",
"CLP",
"FJD",
"MGA",
"USD",
"VND",
"SEK",
"SVC",
"LYD",
"CDF",
"GIP",
"PAB",
"CAD",
"HUF",
"SGD",
"MKD",
"PYG",
"YER",
"BZD",
"COP",
"DZD",
"BRL",
"EUR",
"PHP",
"SRD",
"SYP",
"ARS",
"TZS",
"NZD",
"PKR",
"ALL",
"VES",
"ZMW",
"BBD",
"UGX",
"MYR",
"PLN",
"UAH",
"VUV",
"MWK",
"IDR",
"NOK",
"PEN",
"AUD",
"NPR",
"BMD",
"AZN",
"GTQ",
"OMR",
"QAR",
"SAR",
"ISK",
"KWD",
"KYD",
"MNT",
"XAF",
"THB",
"STN",
"CUP",
"BOB",
"AMD"
]
}
],
"supported_webhook_flows": ["payments","refunds","disputes","mandates"]
},
{
"name": "XENDIT",
"display_name": "Xendit",
"description": "Xendit is a financial technology company that provides payment solutions and simplifies the payment process for businesses in Indonesia, the Philippines and Southeast Asia, from SMEs and e-commerce startups to large enterprises.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover"],
"supported_countries": ["PH","ID"],
"supported_currencies": ["SGD","IDR","USD","PHP","MYR"]
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": ["automatic","manual"],
"three_ds": "supported",
"no_three_ds": "supported",
"supported_card_networks": ["Visa","Mastercard","AmericanExpress","JCB","DinersClub","UnionPay","Discover","CartesBancaires","Interac"],
"supported_countries": ["ID","PH"],
"supported_currencies": ["SGD","PHP","MYR","IDR","USD"]
}
],
"supported_webhook_flows": []
},
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ab3dcea82fafc3cef9e1da9ac98c20d27f127652
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7142
|
Bug: [BUG] Deutschebank Payment Method Card not appearing in Dashboard
### Bug Description
In Dashboard, card payment method is not appearing for Deutschebank Connector.
### Expected Behavior
In Dashboard, card payment method should appear for Deutschebank Connector.
### Actual Behavior
In Dashboard, card payment method is not appearing for Deutschebank Connector.
### Steps To Reproduce
1. Go to Dashboard
2. Go to Connectors
3. Go to Payment Processors
4. Find Deutschebank and click on Connect
5. Card Payment Method does not appear for Deutschebank
### Context For The Bug
_No response_
### Environment
Integ/Sandbox/Prod
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 2ab348d5dd5..190114fee3a 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1408,6 +1408,14 @@ api_secret="Shared Secret"
[deutschebank]
[[deutschebank.bank_debit]]
payment_method_type = "sepa"
+[[deutschebank.credit]]
+ payment_method_type = "Visa"
+[[deutschebank.credit]]
+ payment_method_type = "Mastercard"
+[[deutschebank.debit]]
+ payment_method_type = "Visa"
+[[deutschebank.debit]]
+ payment_method_type = "Mastercard"
[deutschebank.connector_auth.SignatureKey]
api_key="Client ID"
key1="Merchant ID"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 5b963e07801..f1745587a6e 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1143,6 +1143,14 @@ type="Text"
[deutschebank]
[[deutschebank.bank_debit]]
payment_method_type = "sepa"
+[[deutschebank.credit]]
+ payment_method_type = "Visa"
+[[deutschebank.credit]]
+ payment_method_type = "Mastercard"
+[[deutschebank.debit]]
+ payment_method_type = "Visa"
+[[deutschebank.debit]]
+ payment_method_type = "Mastercard"
[deutschebank.connector_auth.SignatureKey]
api_key="Client ID"
key1="Merchant ID"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 50c13dc8596..2a83d62ee9c 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1357,6 +1357,14 @@ api_secret="Shared Secret"
[deutschebank]
[[deutschebank.bank_debit]]
payment_method_type = "sepa"
+[[deutschebank.credit]]
+ payment_method_type = "Visa"
+[[deutschebank.credit]]
+ payment_method_type = "Mastercard"
+[[deutschebank.debit]]
+ payment_method_type = "Visa"
+[[deutschebank.debit]]
+ payment_method_type = "Mastercard"
[deutschebank.connector_auth.SignatureKey]
api_key="Client ID"
key1="Merchant ID"
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
index f98d6843be7..d7dcb63c476 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
@@ -1016,6 +1016,25 @@ lazy_static! {
}
);
+ deutschebank_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails{
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ non_three_ds: common_enums::FeatureStatus::NotSupported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ }
+ );
+
deutschebank_supported_payment_methods
};
|
2025-01-17T11:13:19Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added support for Debit Card payments for deutschebank and upgraded the toml files for deutschebank card payments to be available on dashboard.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Issue link: https://github.com/juspay/hyperswitch/issues/7142
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
**Cypress Tests**
**1. No3DSManualCapture**

**2. 3DSAutoCapture**

**3. 3DSManualCapture**

**4. No3DSAutoCapture**

**5. VoidPayment**

**6. SyncPayment**

**7. RefundPayment**

**8. SyncRefund**

Note: Currently, no 3ds for card payments are not being supported for Deutschebank. Hence, no 3ds flows are expected to return an error message saying that the payment method type is not supported, and has been handled in the cypress tests accordingly.
**Postman Tests**
**1. Authorize (Manual)**
- Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"capture_method": "manual",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
"customer_id": "cybersourcecustomer",
"email": "est@example.com",
"name": "Cardholder",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
"card": {
"card_number": "4761739090000088",
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"customer_acceptance": {
"acceptance_type": "online"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "sundari",
"last_name": "sundari"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "sundari",
"last_name": "sundari"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
}
}'
```
- Response
```
{
"payment_id": "pay_VYJlbbqy1tGwgMKNNMS0",
"merchant_id": "postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef",
"status": "requires_customer_action",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 6540,
"amount_received": null,
"connector": "deutschebank",
"client_secret": "pay_VYJlbbqy1tGwgMKNNMS0_secret_uWdbMvvFhN5neSR2m7sT",
"created": "2025-02-07T09:16:02.733Z",
"currency": "USD",
"customer_id": "cybersourcecustomer",
"customer": {
"id": "cybersourcecustomer",
"name": "Cardholder",
"email": "est@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0088",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "476173",
"card_extended_bin": null,
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "est@example.com",
"name": "Cardholder",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_VYJlbbqy1tGwgMKNNMS0/postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef/pay_VYJlbbqy1tGwgMKNNMS0_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": "deutschebank_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cybersourcecustomer",
"created_at": 1738919762,
"expires": 1738923362,
"secret": "epk_8ce2d93171bb4bea96f1e56dfea65cd2"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-07T09:31:02.732Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-07T09:16:05.420Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**2. Capture (Manual)**
- Request
```
curl --location 'http://localhost:8080/payments/pay_VYJlbbqy1tGwgMKNNMS0/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--data '{
"amount_to_capture": 6540,
"statement_descriptor_name": "Joseph",
"statement_descriptor_suffix": "JS"
}'
```
- Response
```
{
"payment_id": "pay_VYJlbbqy1tGwgMKNNMS0",
"merchant_id": "postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "deutschebank",
"client_secret": "pay_VYJlbbqy1tGwgMKNNMS0_secret_uWdbMvvFhN5neSR2m7sT",
"created": "2025-02-07T09:16:02.733Z",
"currency": "USD",
"customer_id": "cybersourcecustomer",
"customer": {
"id": "cybersourcecustomer",
"name": "Cardholder",
"email": "est@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0088",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "476173",
"card_extended_bin": null,
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "est@example.com",
"name": "Cardholder",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": "deutschebank_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "aimoDpjSq14oJvh2739kzO",
"frm_message": null,
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-07T09:31:02.732Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_dH797tZ7R7P9NceVZtYp",
"payment_method_status": null,
"updated": "2025-02-07T09:19:23.370Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**3. Authorize + Capture**
- Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
"customer_id": "cybersourcecustomer",
"email": "guest@example.com",
"name": "Cardholder",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
"card": {
"card_number": "4761739090000088",
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"customer_acceptance": {
"acceptance_type": "online"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "sundari",
"last_name": "sundari"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "sundari",
"last_name": "sundari"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
}
}'
```
- Response
```
{
"payment_id": "pay_8pRLiEWHkOeMw9ryMExB",
"merchant_id": "postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef",
"status": "requires_customer_action",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 6540,
"amount_received": null,
"connector": "deutschebank",
"client_secret": "pay_8pRLiEWHkOeMw9ryMExB_secret_0W1NOqKC4RaQLzILUxHq",
"created": "2025-02-07T09:20:23.732Z",
"currency": "USD",
"customer_id": "cybersourcecustomer",
"customer": {
"id": "cybersourcecustomer",
"name": "Cardholder",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0088",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "476173",
"card_extended_bin": null,
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "Cardholder",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_8pRLiEWHkOeMw9ryMExB/postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef/pay_8pRLiEWHkOeMw9ryMExB_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cybersourcecustomer",
"created_at": 1738920023,
"expires": 1738923623,
"secret": "epk_460a392543454485a6e7b3de41b70987"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-07T09:35:23.732Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-02-07T09:20:26.230Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**4. PSync**
- Request
```
curl --location 'http://localhost:8080/payments/pay_8pRLiEWHkOeMw9ryMExB?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy'
```
- Response
```
{
"payment_id": "pay_8pRLiEWHkOeMw9ryMExB",
"merchant_id": "postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "deutschebank",
"client_secret": "pay_8pRLiEWHkOeMw9ryMExB_secret_0W1NOqKC4RaQLzILUxHq",
"created": "2025-02-07T09:20:23.732Z",
"currency": "USD",
"customer_id": "cybersourcecustomer",
"customer": {
"id": "cybersourcecustomer",
"name": "Cardholder",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0088",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "476173",
"card_extended_bin": null,
"card_exp_month": "12",
"card_exp_year": "34",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "sundari",
"last_name": "sundari"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "Cardholder",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "8v7juyo5zIQNmXpQHJLAu8",
"frm_message": null,
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-07T09:35:23.732Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_3VYVyVeYFKFYTqR8cI8T",
"payment_method_status": "active",
"updated": "2025-02-07T09:21:17.333Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**5. Refund**
- Request
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--data '{
"payment_id": "pay_dOajGFWsngnaGOito5FB",
"amount": 6540,
"reason": "Customer returned product",
"refund_type": "instant",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
- Response
```
{
"refund_id": "ref_ltBCndOVl9ezefLoG5xY",
"payment_id": "pay_dOajGFWsngnaGOito5FB",
"amount": 6540,
"currency": "USD",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-07T09:22:57.166Z",
"updated_at": "2025-02-07T09:22:59.401Z",
"connector": "deutschebank",
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"split_refunds": null
}
```
**6. RSync**
- Request
```
curl --location 'http://localhost:8080/refunds/ref_ltBCndOVl9ezefLoG5xY' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy'
```
- Response
```
{
"refund_id": "ref_ltBCndOVl9ezefLoG5xY",
"payment_id": "pay_dOajGFWsngnaGOito5FB",
"amount": 6540,
"currency": "USD",
"status": "succeeded",
"reason": "Customer returned product",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"error_message": null,
"error_code": null,
"unified_code": null,
"unified_message": null,
"created_at": "2025-02-07T09:22:57.166Z",
"updated_at": "2025-02-07T09:22:59.401Z",
"connector": "deutschebank",
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"split_refunds": null
}
```
**7. Cancel/Void**
- Request
```
curl --location 'http://localhost:8080/payments/pay_dFNJrNoDmMvDjyNHOZZ8/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--data '{
"cancellation_reason": "requested_by_customer"
}'
```
- Response
```
{
"payment_id": "pay_dFNJrNoDmMvDjyNHOZZ8",
"merchant_id": "postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef",
"status": "cancelled",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "deutschebank",
"client_secret": "pay_dFNJrNoDmMvDjyNHOZZ8_secret_e0dJDcM0P0A5zoldbsRo",
"created": "2025-02-07T09:24:24.880Z",
"currency": "USD",
"customer_id": "cybersourcecustomer",
"customer": {
"id": "cybersourcecustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0088",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "476173",
"card_extended_bin": null,
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "likhin",
"last_name": "bopanna"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "likhin",
"last_name": "bopanna"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": "requested_by_customer",
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "06e3oGyHNckEEvC7hSkBuc",
"frm_message": null,
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_Lyy6g89emaIu0psz0vqt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4gnJLSe89ta8S61C5CKI",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-02-07T09:39:24.880Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_fnfOzrvmb3FRjxxF2ib5",
"payment_method_status": null,
"updated": "2025-02-07T09:24:55.194Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**8. Supported Payments**
-Request
```
curl --location --request GET 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_vsCAxEbJ8IhgM93GZetzz1HjLbUaqalLZxBmnepYDtM7JJgVisFHVMyV3auU1gHy' \
--header 'X-Merchant-Id: postman_merchant_GHAction_f13d2dc3-29d6-41af-9e24-e25eb75d31ef' \
--data '{
}'
```
-Response
```
{
"connector_count": 3,
"connectors": [
{
"name": "BAMBORA",
"description": "Bambora is a leading online payment provider in Canada and United States.",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"non_three_ds": "supported",
"supported_card_networks": [
"Visa",
"Mastercard",
"AmericanExpress",
"Discover",
"JCB",
"DinersClub"
],
"supported_countries": [
"CA",
"US"
],
"supported_currencies": [
"USD"
]
}
],
"supported_webhook_flows": []
},
{
"name": "DEUTSCHEBANK",
"description": "Deutsche Bank is a German multinational investment bank and financial services company ",
"category": "bank_acquirer",
"supported_payment_methods": [
{
"payment_method": "bank_debit",
"payment_method_type": "sepa",
"mandates": "supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"supported_countries": null,
"supported_currencies": null
},
{
"payment_method": "card",
"payment_method_type": "credit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"non_three_ds": "not_supported",
"supported_card_networks": [
"Visa",
"Mastercard"
],
"supported_countries": null,
"supported_currencies": null
},
{
"payment_method": "card",
"payment_method_type": "debit",
"mandates": "not_supported",
"refunds": "supported",
"supported_capture_methods": [
"automatic",
"manual",
"sequential_automatic"
],
"three_ds": "supported",
"non_three_ds": "not_supported",
"supported_card_networks": [
"Visa",
"Mastercard"
],
"supported_countries": null,
"supported_currencies": null
}
],
"supported_webhook_flows": []
},
{
"name": "ZSL",
"description": "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers",
"category": "payment_gateway",
"supported_payment_methods": [
{
"payment_method": "bank_transfer",
"payment_method_type": "local_bank_transfer",
"mandates": "not_supported",
"refunds": "not_supported",
"supported_capture_methods": [
"automatic"
],
"supported_countries": [
"CN"
],
"supported_currencies": [
"CNY"
]
}
],
"supported_webhook_flows": []
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
55bb284ba063dc84e80b4f0d83c82ec7c30ad4c5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7138
|
Bug: [BUG] Trustly and Ideal Failing Payments for Ayden Fixed
Trustly and Ideal Failing Payments for Ayden Fixed
|
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index c9bfdbf3d4a..8aba3573f68 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -148,7 +148,7 @@ pub struct LineItem {
pub struct AdyenPaymentRequest<'a> {
amount: Amount,
merchant_account: Secret<String>,
- payment_method: AdyenPaymentMethod<'a>,
+ payment_method: PaymentMethod<'a>,
mpi_data: Option<AdyenMpiData>,
reference: String,
return_url: String,
@@ -527,22 +527,37 @@ pub struct Amount {
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
+pub enum PaymentMethod<'a> {
+ AdyenPaymentMethod(Box<AdyenPaymentMethod<'a>>),
+ AdyenMandatePaymentMethod(Box<AdyenMandate>),
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
pub enum AdyenPaymentMethod<'a> {
- AdyenAffirm(Box<PmdForPaymentType>),
+ #[serde(rename = "affirm")]
+ AdyenAffirm,
+ #[serde(rename = "scheme")]
AdyenCard(Box<AdyenCard>),
- AdyenKlarna(Box<PmdForPaymentType>),
- AdyenPaypal(Box<PmdForPaymentType>),
+ #[serde(rename = "klarna")]
+ AdyenKlarna,
+ #[serde(rename = "paypal")]
+ AdyenPaypal,
+ #[serde(rename = "networkToken")]
+ AdyenPaze(Box<AdyenPazeData>),
#[serde(rename = "afterpaytouch")]
- AfterPay(Box<PmdForPaymentType>),
- AlmaPayLater(Box<PmdForPaymentType>),
- AliPay(Box<PmdForPaymentType>),
- AliPayHk(Box<PmdForPaymentType>),
+ AfterPay,
+ #[serde(rename = "alma")]
+ AlmaPayLater,
+ AliPay,
+ #[serde(rename = "alipay_hk")]
+ AliPayHk,
ApplePay(Box<AdyenApplePay>),
- #[serde(rename = "atome")]
Atome,
- BancontactCard(Box<BancontactCardData>),
- Bizum(Box<PmdForPaymentType>),
+ #[serde(rename = "scheme")]
+ BancontactCard(Box<AdyenCard>),
+ Bizum,
Blik(Box<BlikRedirectionData>),
#[serde(rename = "boletobancario")]
BoletoBancario,
@@ -556,21 +571,24 @@ pub enum AdyenPaymentMethod<'a> {
Gpay(Box<AdyenGPay>),
#[serde(rename = "gopay_wallet")]
GoPay(Box<GoPayData>),
- Ideal(Box<BankRedirectionWithIssuer<'a>>),
+ Ideal,
#[serde(rename = "kakaopay")]
Kakaopay(Box<KakaoPayData>),
- Mandate(Box<AdyenMandate>),
Mbway(Box<MbwayData>),
- MobilePay(Box<PmdForPaymentType>),
+ MobilePay,
#[serde(rename = "momo_wallet")]
Momo(Box<MomoData>),
#[serde(rename = "momo_atm")]
MomoAtm,
#[serde(rename = "touchngo")]
TouchNGo(Box<TouchNGoData>),
+ #[serde(rename = "onlineBanking_CZ")]
OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>),
- OnlineBankingFinland(Box<PmdForPaymentType>),
+ #[serde(rename = "ebanking_FI")]
+ OnlineBankingFinland,
+ #[serde(rename = "onlineBanking_PL")]
OnlineBankingPoland(Box<OnlineBankingPolandData>),
+ #[serde(rename = "onlineBanking_SK")]
OnlineBankingSlovakia(Box<OnlineBankingSlovakiaData>),
#[serde(rename = "molpay_ebanking_fpx_MY")]
OnlineBankingFpx(Box<OnlineBankingFpxData>),
@@ -592,9 +610,11 @@ pub enum AdyenPaymentMethod<'a> {
Walley,
#[serde(rename = "wechatpayWeb")]
WeChatPayWeb,
+ #[serde(rename = "ach")]
AchDirectDebit(Box<AchDirectDebitData>),
#[serde(rename = "sepadirectdebit")]
SepaDirectDebit(Box<SepaDirectDebitData>),
+ #[serde(rename = "directdebit_GB")]
BacsDirectDebit(Box<BacsDirectDebitData>),
SamsungPay(Box<SamsungPayPmData>),
#[serde(rename = "doku_bca_va")]
@@ -617,7 +637,9 @@ pub enum AdyenPaymentMethod<'a> {
Indomaret(Box<DokuBankData>),
#[serde(rename = "doku_alfamart")]
Alfamart(Box<DokuBankData>),
+ #[serde(rename = "givex")]
PaymentMethodBalance(Box<BalancePmData>),
+ #[serde(rename = "giftcard")]
AdyenGiftCard(Box<GiftCardData>),
#[serde(rename = "swish")]
Swish,
@@ -637,15 +659,9 @@ pub enum AdyenPaymentMethod<'a> {
Seicomart(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
PayEasy(Box<JCSVoucherData>),
- Pix(Box<PmdForPaymentType>),
+ Pix,
+ #[serde(rename = "networkToken")]
NetworkToken(Box<AdyenNetworkTokenData>),
- AdyenPaze(Box<AdyenPazeData>),
-}
-
-#[derive(Debug, Clone, Serialize)]
-pub struct PmdForPaymentType {
- #[serde(rename = "type")]
- payment_type: PaymentType,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
@@ -660,8 +676,6 @@ pub struct JCSVoucherData {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BalancePmData {
- #[serde(rename = "type")]
- payment_type: GiftCardBrand,
number: Secret<String>,
cvc: Secret<String>,
}
@@ -669,8 +683,6 @@ pub struct BalancePmData {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GiftCardData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
brand: GiftCardBrand,
number: Secret<String>,
cvc: Secret<String>,
@@ -679,8 +691,6 @@ pub struct GiftCardData {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AchDirectDebitData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
bank_account_number: Secret<String>,
bank_location_id: Secret<String>,
owner_name: Secret<String>,
@@ -698,45 +708,25 @@ pub struct SepaDirectDebitData {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BacsDirectDebitData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
bank_account_number: Secret<String>,
bank_location_id: Secret<String>,
holder_name: Secret<String>,
}
-#[derive(Debug, Clone, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct BancontactCardData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
- brand: String,
- number: CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- holder_name: Secret<String>,
-}
-
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MbwayData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
telephone_number: Secret<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct SamsungPayPmData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
#[serde(rename = "samsungPayToken")]
samsung_pay_token: Secret<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct OnlineBankingCzechRepublicData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
issuer: OnlineBankingCzechRepublicBanks,
}
@@ -774,8 +764,6 @@ impl TryFrom<&common_enums::BankNames> for OnlineBankingCzechRepublicBanks {
#[derive(Debug, Clone, Serialize)]
pub struct OnlineBankingPolandData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
issuer: OnlineBankingPolandBanks,
}
@@ -854,8 +842,6 @@ impl TryFrom<&common_enums::BankNames> for OnlineBankingPolandBanks {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OnlineBankingSlovakiaData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
issuer: OnlineBankingSlovakiaBanks,
}
@@ -1108,8 +1094,6 @@ impl TryFrom<&common_enums::BankNames> for OpenBankingUKIssuer {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BlikRedirectionData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
blik_code: Secret<String>,
}
@@ -1117,8 +1101,6 @@ pub struct BlikRedirectionData {
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BankRedirectionWithIssuer<'a> {
- #[serde(rename = "type")]
- payment_type: PaymentType,
issuer: Option<&'a str>,
}
@@ -1134,8 +1116,6 @@ pub struct AdyenMandate {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenCard {
- #[serde(rename = "type")]
- payment_type: PaymentType,
number: CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
@@ -1149,8 +1129,6 @@ pub struct AdyenCard {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenPazeData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
number: NetworkTokenNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
@@ -1239,16 +1217,12 @@ pub struct TouchNGoData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenGPay {
- #[serde(rename = "type")]
- payment_type: PaymentType,
#[serde(rename = "googlePayToken")]
google_pay_token: Secret<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenApplePay {
- #[serde(rename = "type")]
- payment_type: PaymentType,
#[serde(rename = "applePayToken")]
apple_pay_token: Secret<String>,
}
@@ -1257,8 +1231,6 @@ pub struct AdyenApplePay {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenNetworkTokenData {
- #[serde(rename = "type")]
- payment_type: PaymentType,
number: NetworkTokenNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
@@ -1362,6 +1334,7 @@ pub enum PaymentType {
Scheme,
#[serde(rename = "networkToken")]
NetworkToken,
+ #[serde(rename = "trustly")]
Trustly,
#[serde(rename = "touchngo")]
TouchNGo,
@@ -1555,34 +1528,6 @@ impl TryFrom<&common_enums::BankNames> for AdyenTestBankNames<'_> {
}
}
-pub struct AdyenBankNames<'a>(&'a str);
-
-impl TryFrom<&common_enums::BankNames> for AdyenBankNames<'_> {
- type Error = Error;
- fn try_from(bank: &common_enums::BankNames) -> Result<Self, Self::Error> {
- Ok(match bank {
- common_enums::BankNames::AbnAmro => Self("0031"),
- common_enums::BankNames::AsnBank => Self("0761"),
- common_enums::BankNames::Bunq => Self("0802"),
- common_enums::BankNames::Ing => Self("0721"),
- common_enums::BankNames::Knab => Self("0801"),
- common_enums::BankNames::N26 => Self("0807"),
- common_enums::BankNames::NationaleNederlanden => Self("0808"),
- common_enums::BankNames::Rabobank => Self("0021"),
- common_enums::BankNames::Regiobank => Self("0771"),
- common_enums::BankNames::Revolut => Self("0805"),
- common_enums::BankNames::SnsBank => Self("0751"),
- common_enums::BankNames::TriodosBank => Self("0511"),
- common_enums::BankNames::VanLanschot => Self("0161"),
- common_enums::BankNames::Yoursafe => Self("0806"),
- _ => Err(errors::ConnectorError::NotSupported {
- message: String::from("BankRedirect"),
- connector: "Adyen",
- })?,
- })
- }
-}
-
impl TryFrom<&types::ConnectorAuthType> for AdyenAuthType {
type Error = Error;
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
@@ -1676,7 +1621,6 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for AdyenBalanceRequest<'_
match gift_card_data.as_ref() {
domain::GiftCardData::Givex(gift_card_data) => {
let balance_pm = BalancePmData {
- payment_type: GiftCardBrand::Givex,
number: gift_card_data.number.clone(),
cvc: gift_card_data.cvc.clone(),
};
@@ -1943,7 +1887,6 @@ impl TryFrom<(&domain::BankDebitData, &types::PaymentsAuthorizeRouterData)>
..
} => Ok(AdyenPaymentMethod::AchDirectDebit(Box::new(
AchDirectDebitData {
- payment_type: PaymentType::AchDirectDebit,
bank_account_number: account_number.clone(),
bank_location_id: routing_number.clone(),
owner_name: item.get_billing_full_name()?,
@@ -1961,12 +1904,12 @@ impl TryFrom<(&domain::BankDebitData, &types::PaymentsAuthorizeRouterData)>
..
} => Ok(AdyenPaymentMethod::BacsDirectDebit(Box::new(
BacsDirectDebitData {
- payment_type: PaymentType::BacsDirectDebit,
bank_account_number: account_number.clone(),
bank_location_id: sort_code.clone(),
holder_name: item.get_billing_full_name()?,
},
))),
+
domain::BankDebitData::BecsBankDebit { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
@@ -2031,7 +1974,6 @@ impl TryFrom<&domain::GiftCardData> for AdyenPaymentMethod<'_> {
domain::GiftCardData::PaySafeCard {} => Ok(AdyenPaymentMethod::PaySafeCard),
domain::GiftCardData::Givex(givex_data) => {
let gift_card_pm = GiftCardData {
- payment_type: PaymentType::Giftcard,
brand: GiftCardBrand::Givex,
number: givex_data.number.clone(),
cvc: givex_data.cvc.clone(),
@@ -2064,7 +2006,6 @@ impl TryFrom<(&domain::Card, Option<Secret<String>>)> for AdyenPaymentMethod<'_>
(card, card_holder_name): (&domain::Card, Option<Secret<String>>),
) -> Result<Self, Self::Error> {
let adyen_card = AdyenCard {
- payment_type: PaymentType::Scheme,
number: card.card_number.clone(),
expiry_month: card.card_exp_month.clone(),
expiry_year: card.get_expiry_year_4_digit(),
@@ -2143,37 +2084,20 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
match wallet_data {
domain::WalletData::GooglePay(data) => {
let gpay_data = AdyenGPay {
- payment_type: PaymentType::Googlepay,
google_pay_token: Secret::new(data.tokenization_data.token.to_owned()),
};
Ok(AdyenPaymentMethod::Gpay(Box::new(gpay_data)))
}
domain::WalletData::ApplePay(data) => {
let apple_pay_data = AdyenApplePay {
- payment_type: PaymentType::Applepay,
apple_pay_token: Secret::new(data.payment_data.to_string()),
};
Ok(AdyenPaymentMethod::ApplePay(Box::new(apple_pay_data)))
}
- domain::WalletData::PaypalRedirect(_) => {
- let wallet = PmdForPaymentType {
- payment_type: PaymentType::Paypal,
- };
- Ok(AdyenPaymentMethod::AdyenPaypal(Box::new(wallet)))
- }
- domain::WalletData::AliPayRedirect(_) => {
- let alipay_data = PmdForPaymentType {
- payment_type: PaymentType::Alipay,
- };
- Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data)))
- }
- domain::WalletData::AliPayHkRedirect(_) => {
- let alipay_hk_data = PmdForPaymentType {
- payment_type: PaymentType::AlipayHk,
- };
- Ok(AdyenPaymentMethod::AliPayHk(Box::new(alipay_hk_data)))
- }
+ domain::WalletData::PaypalRedirect(_) => Ok(AdyenPaymentMethod::AdyenPaypal),
+ domain::WalletData::AliPayRedirect(_) => Ok(AdyenPaymentMethod::AliPay),
+ domain::WalletData::AliPayHkRedirect(_) => Ok(AdyenPaymentMethod::AliPayHk),
domain::WalletData::GoPayRedirect(_) => {
let go_pay_data = GoPayData {};
Ok(AdyenPaymentMethod::GoPay(Box::new(go_pay_data)))
@@ -2197,21 +2121,14 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
domain::WalletData::MbWayRedirect(_) => {
let phone_details = item.get_billing_phone()?;
let mbway_data = MbwayData {
- payment_type: PaymentType::Mbway,
telephone_number: phone_details.get_number_with_country_code()?,
};
Ok(AdyenPaymentMethod::Mbway(Box::new(mbway_data)))
}
- domain::WalletData::MobilePayRedirect(_) => {
- let data = PmdForPaymentType {
- payment_type: PaymentType::MobilePay,
- };
- Ok(AdyenPaymentMethod::MobilePay(Box::new(data)))
- }
+ domain::WalletData::MobilePayRedirect(_) => Ok(AdyenPaymentMethod::MobilePay),
domain::WalletData::WeChatPayRedirect(_) => Ok(AdyenPaymentMethod::WeChatPayWeb),
domain::WalletData::SamsungPay(samsung_data) => {
let data = SamsungPayPmData {
- payment_type: PaymentType::Samsungpay,
samsung_pay_token: samsung_data.payment_credential.token_data.data.to_owned(),
};
Ok(AdyenPaymentMethod::SamsungPay(Box::new(data)))
@@ -2219,7 +2136,6 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
domain::WalletData::Paze(_) => match item.payment_method_token.clone() {
Some(types::PaymentMethodToken::PazeDecrypt(paze_decrypted_data)) => {
let data = AdyenPazeData {
- payment_type: PaymentType::NetworkToken,
number: paze_decrypted_data.token.payment_token,
expiry_month: paze_decrypted_data.token.token_expiration_month,
expiry_year: paze_decrypted_data.token.token_expiration_year,
@@ -2308,14 +2224,11 @@ impl
) = value;
match pay_later_data {
domain::payments::PayLaterData::KlarnaRedirect { .. } => {
- let klarna = PmdForPaymentType {
- payment_type: PaymentType::Klarna,
- };
check_required_field(shopper_email, "email")?;
check_required_field(shopper_reference, "customer_id")?;
check_required_field(country_code, "billing.country")?;
- Ok(AdyenPaymentMethod::AdyenKlarna(Box::new(klarna)))
+ Ok(AdyenPaymentMethod::AdyenKlarna)
}
domain::payments::PayLaterData::AffirmRedirect { .. } => {
check_required_field(shopper_email, "email")?;
@@ -2323,11 +2236,7 @@ impl
check_required_field(telephone_number, "billing.phone")?;
check_required_field(billing_address, "billing")?;
- Ok(AdyenPaymentMethod::AdyenAffirm(Box::new(
- PmdForPaymentType {
- payment_type: PaymentType::Affirm,
- },
- )))
+ Ok(AdyenPaymentMethod::AdyenAffirm)
}
domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
check_required_field(shopper_email, "email")?;
@@ -2341,9 +2250,7 @@ impl
| api_enums::CountryAlpha2::FR
| api_enums::CountryAlpha2::ES
| api_enums::CountryAlpha2::GB => Ok(AdyenPaymentMethod::ClearPay),
- _ => Ok(AdyenPaymentMethod::AfterPay(Box::new(PmdForPaymentType {
- payment_type: PaymentType::Afterpaytouch,
- }))),
+ _ => Ok(AdyenPaymentMethod::AfterPay),
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
@@ -2371,11 +2278,7 @@ impl
check_required_field(shopper_email, "email")?;
check_required_field(billing_address, "billing")?;
check_required_field(delivery_address, "shipping")?;
- Ok(AdyenPaymentMethod::AlmaPayLater(Box::new(
- PmdForPaymentType {
- payment_type: PaymentType::Alma,
- },
- )))
+ Ok(AdyenPaymentMethod::AlmaPayLater)
}
domain::payments::PayLaterData::AtomeRedirect { .. } => {
check_required_field(shopper_email, "email")?;
@@ -2397,15 +2300,13 @@ impl
impl
TryFrom<(
&domain::BankRedirectData,
- Option<bool>,
&types::PaymentsAuthorizeRouterData,
)> for AdyenPaymentMethod<'_>
{
type Error = Error;
fn try_from(
- (bank_redirect_data, test_mode, item): (
+ (bank_redirect_data, item): (
&domain::BankRedirectData,
- Option<bool>,
&types::PaymentsAuthorizeRouterData,
),
) -> Result<Self, Self::Error> {
@@ -2415,39 +2316,33 @@ impl
card_exp_month,
card_exp_year,
..
- } => Ok(AdyenPaymentMethod::BancontactCard(Box::new(
- BancontactCardData {
- payment_type: PaymentType::Scheme,
- brand: "bcmc".to_string(),
- number: card_number
- .as_ref()
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "bancontact_card.card_number",
- })?
- .clone(),
- expiry_month: card_exp_month
- .as_ref()
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "bancontact_card.card_exp_month",
- })?
- .clone(),
- expiry_year: card_exp_year
- .as_ref()
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "bancontact_card.card_exp_year",
- })?
- .clone(),
- holder_name: item.get_billing_full_name()?,
- },
- ))),
- domain::BankRedirectData::Bizum { .. } => {
- Ok(AdyenPaymentMethod::Bizum(Box::new(PmdForPaymentType {
- payment_type: PaymentType::Bizum,
- })))
- }
+ } => Ok(AdyenPaymentMethod::BancontactCard(Box::new(AdyenCard {
+ brand: Some(CardBrand::Bcmc),
+ number: card_number
+ .as_ref()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "bancontact_card.card_number",
+ })?
+ .clone(),
+ expiry_month: card_exp_month
+ .as_ref()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "bancontact_card.card_exp_month",
+ })?
+ .clone(),
+ expiry_year: card_exp_year
+ .as_ref()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "bancontact_card.card_exp_year",
+ })?
+ .clone(),
+ holder_name: Some(item.get_billing_full_name()?),
+ cvc: None,
+ network_payment_reference: None,
+ }))),
+ domain::BankRedirectData::Bizum { .. } => Ok(AdyenPaymentMethod::Bizum),
domain::BankRedirectData::Blik { blik_code } => {
Ok(AdyenPaymentMethod::Blik(Box::new(BlikRedirectionData {
- payment_type: PaymentType::Blik,
blik_code: Secret::new(blik_code.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "blik_code",
@@ -2457,7 +2352,6 @@ impl
}
domain::BankRedirectData::Eps { bank_name, .. } => Ok(AdyenPaymentMethod::Eps(
Box::new(BankRedirectionWithIssuer {
- payment_type: PaymentType::Eps,
issuer: Some(
AdyenTestBankNames::try_from(&bank_name.ok_or(
errors::ConnectorError::MissingRequiredField {
@@ -2468,55 +2362,24 @@ impl
),
}),
)),
- domain::BankRedirectData::Ideal { bank_name, .. } => {
- let issuer = if test_mode.unwrap_or(true) {
- Some(
- AdyenTestBankNames::try_from(&bank_name.ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "ideal.bank_name",
- },
- )?)?
- .0,
- )
- } else {
- Some(
- AdyenBankNames::try_from(&bank_name.ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "ideal.bank_name",
- },
- )?)?
- .0,
- )
- };
- Ok(AdyenPaymentMethod::Ideal(Box::new(
- BankRedirectionWithIssuer {
- payment_type: PaymentType::Ideal,
- issuer,
- },
- )))
- }
+ domain::BankRedirectData::Ideal { .. } => Ok(AdyenPaymentMethod::Ideal),
domain::BankRedirectData::OnlineBankingCzechRepublic { issuer } => {
Ok(AdyenPaymentMethod::OnlineBankingCzechRepublic(Box::new(
OnlineBankingCzechRepublicData {
- payment_type: PaymentType::OnlineBankingCzechRepublic,
issuer: OnlineBankingCzechRepublicBanks::try_from(issuer)?,
},
)))
}
- domain::BankRedirectData::OnlineBankingFinland { .. } => Ok(
- AdyenPaymentMethod::OnlineBankingFinland(Box::new(PmdForPaymentType {
- payment_type: PaymentType::OnlineBankingFinland,
- })),
- ),
+ domain::BankRedirectData::OnlineBankingFinland { .. } => {
+ Ok(AdyenPaymentMethod::OnlineBankingFinland)
+ }
domain::BankRedirectData::OnlineBankingPoland { issuer } => Ok(
AdyenPaymentMethod::OnlineBankingPoland(Box::new(OnlineBankingPolandData {
- payment_type: PaymentType::OnlineBankingPoland,
issuer: OnlineBankingPolandBanks::try_from(issuer)?,
})),
),
domain::BankRedirectData::OnlineBankingSlovakia { issuer } => Ok(
AdyenPaymentMethod::OnlineBankingSlovakia(Box::new(OnlineBankingSlovakiaData {
- payment_type: PaymentType::OnlineBankingSlovakia,
issuer: OnlineBankingSlovakiaBanks::try_from(issuer)?,
})),
),
@@ -2589,11 +2452,7 @@ impl
domain::BankTransferData::MandiriVaBankTransfer {} => Ok(
AdyenPaymentMethod::MandiriVa(Box::new(DokuBankData::try_from(item)?)),
),
- domain::BankTransferData::Pix { .. } => {
- Ok(AdyenPaymentMethod::Pix(Box::new(PmdForPaymentType {
- payment_type: PaymentType::Pix,
- })))
- }
+ domain::BankTransferData::Pix { .. } => Ok(AdyenPaymentMethod::Pix),
domain::BankTransferData::AchBankTransfer { .. }
| domain::BankTransferData::SepaBankTransfer { .. }
| domain::BankTransferData::BacsBankTransfer { .. }
@@ -2673,9 +2532,9 @@ impl
.ok_or_else(missing_field_err("mandate_id"))?,
),
};
- Ok::<AdyenPaymentMethod<'_>, Self::Error>(AdyenPaymentMethod::Mandate(Box::new(
- adyen_mandate,
- )))
+ Ok::<PaymentMethod<'_>, Self::Error>(PaymentMethod::AdyenMandatePaymentMethod(
+ Box::new(adyen_mandate),
+ ))
}
payments::MandateReferenceId::NetworkMandateId(network_mandate_id) => {
match item.router_data.request.payment_method_data {
@@ -2695,7 +2554,6 @@ impl
let card_holder_name = item.router_data.get_optional_billing_full_name();
let adyen_card = AdyenCard {
- payment_type: PaymentType::Scheme,
number: card_details_for_network_transaction_id.card_number.clone(),
expiry_month: card_details_for_network_transaction_id
.card_exp_month
@@ -2708,7 +2566,9 @@ impl
brand: Some(brand),
network_payment_reference: Some(Secret::new(network_mandate_id)),
};
- Ok(AdyenPaymentMethod::AdyenCard(Box::new(adyen_card)))
+ Ok(PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::AdyenCard(Box::new(adyen_card)),
+ )))
}
domain::PaymentMethodData::CardRedirect(_)
| domain::PaymentMethodData::Wallet(_)
@@ -2742,7 +2602,6 @@ impl
let brand = CardBrand::try_from(&card_issuer)?;
let card_holder_name = item.router_data.get_optional_billing_full_name();
let adyen_network_token = AdyenNetworkTokenData {
- payment_type: PaymentType::NetworkToken,
number: token_data.get_network_token(),
expiry_month: token_data.get_network_token_expiry_month(),
expiry_year: token_data.get_expiry_year_4_digit(),
@@ -2752,8 +2611,8 @@ impl
network_mandate_id.network_transaction_id,
)),
};
- Ok(AdyenPaymentMethod::NetworkToken(Box::new(
- adyen_network_token,
+ Ok(PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::NetworkToken(Box::new(adyen_network_token)),
)))
}
@@ -2853,7 +2712,10 @@ impl
let additional_data = get_additional_data(item.router_data);
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 payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((card_data, card_holder_name))?,
+ ));
+
let shopper_email = item.router_data.get_optional_billing_email();
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
let (store, splits) = match item.router_data.request.split_payments.as_ref() {
@@ -2919,7 +2781,10 @@ impl
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_router_return_url()?;
- let payment_method = AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?;
+ let payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?,
+ ));
+
let country_code = get_country_code(item.router_data.get_optional_billing());
let (store, splits) = match item.router_data.request.split_payments.as_ref() {
Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
@@ -2982,7 +2847,9 @@ impl
let recurring_processing_model = get_recurring_processing_model(item.router_data)?.0;
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 payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((voucher_data, item.router_data))?,
+ ));
let return_url = item.router_data.request.get_router_return_url()?;
let social_security_number = get_social_security_number(voucher_data);
let billing_address =
@@ -3047,7 +2914,10 @@ impl
let amount = get_amount_data(item);
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 payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((bank_transfer_data, item.router_data))?,
+ ));
+
let return_url = item.router_data.request.get_router_return_url()?;
let (store, splits) = match item.router_data.request.split_payments.as_ref() {
Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
@@ -3108,7 +2978,9 @@ impl
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let return_url = item.router_data.request.get_router_return_url()?;
- let payment_method = AdyenPaymentMethod::try_from(gift_card_data)?;
+ let payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from(gift_card_data)?,
+ ));
let (store, splits) = match item.router_data.request.split_payments.as_ref() {
Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
adyen_split_payment,
@@ -3172,11 +3044,9 @@ impl
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_router_return_url()?;
- let payment_method = AdyenPaymentMethod::try_from((
- bank_redirect_data,
- item.router_data.test_mode,
- item.router_data,
- ))?;
+ let payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((bank_redirect_data, item.router_data))?,
+ ));
let (shopper_locale, country) = get_redirect_extra_details(item.router_data)?;
let line_items = Some(get_line_items(item));
let billing_address =
@@ -3274,7 +3144,9 @@ impl
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
let browser_info = get_browser_info(item.router_data)?;
let additional_data = get_additional_data(item.router_data);
- let payment_method = AdyenPaymentMethod::try_from((wallet_data, item.router_data))?;
+ let payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((wallet_data, item.router_data))?,
+ ));
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let channel = get_channel_type(item.router_data.request.payment_method_type);
let (recurring_processing_model, store_payment_method, shopper_reference) =
@@ -3374,16 +3246,17 @@ impl
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let line_items = Some(get_line_items(item));
let telephone_number = get_telephone_number(item.router_data);
- let payment_method = AdyenPaymentMethod::try_from((
- paylater_data,
- &country_code,
- &shopper_email,
- &shopper_reference,
- &shopper_name,
- &telephone_number,
- &billing_address,
- &delivery_address,
- ))?;
+ let payment_method =
+ PaymentMethod::AdyenPaymentMethod(Box::new(AdyenPaymentMethod::try_from((
+ paylater_data,
+ &country_code,
+ &shopper_email,
+ &shopper_reference,
+ &shopper_name,
+ &telephone_number,
+ &billing_address,
+ &delivery_address,
+ ))?));
let (store, splits) = match item.router_data.request.split_payments.as_ref() {
Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
adyen_split_payment,
@@ -3440,7 +3313,10 @@ impl
let (item, card_redirect_data) = value;
let amount = get_amount_data(item);
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
- let payment_method = AdyenPaymentMethod::try_from(card_redirect_data)?;
+ let payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from(card_redirect_data)?,
+ ));
+
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let return_url = item.router_data.request.get_router_return_url()?;
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
@@ -5594,7 +5470,6 @@ impl TryFrom<(&domain::NetworkTokenData, Option<Secret<String>>)> for AdyenPayme
(token_data, card_holder_name): (&domain::NetworkTokenData, Option<Secret<String>>),
) -> Result<Self, Self::Error> {
let adyen_network_token = AdyenNetworkTokenData {
- payment_type: PaymentType::NetworkToken,
number: token_data.get_network_token(),
expiry_month: token_data.get_network_token_expiry_month(),
expiry_year: token_data.get_expiry_year_4_digit(),
@@ -5638,7 +5513,10 @@ impl
let additional_data = get_additional_data(item.router_data);
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 payment_method = PaymentMethod::AdyenPaymentMethod(Box::new(
+ AdyenPaymentMethod::try_from((token_data, card_holder_name))?,
+ ));
+
let shopper_email = item.router_data.request.email.clone();
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
let mpi_data = AdyenMpiData {
|
2025-01-29T11:56:59Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
`Trustly` and `Ideal` Bank Redirect payments were failing for `Ayden`.
`Trustly` error message: `Required object 'paymentMethod' is not provided.`
`Ideal` error message: `Could not find issuer for issuerId`
For `Trustly`, populated the `paymentMethod` to fix the issue.
`Ideal` is moving to a more centralized infrastructure to process payments, which does not need issuer. So removed issuer field from connector request body.
Reference: https://docs.adyen.com/payment-methods/ideal/api-only/
Multiple PMTs were failing due to this error `Required object 'paymentMethod' is not provided.` fixed.
Also, cypress test for `Giropay` and `Sofort` is removed for connector `Adyen`. These payment methods have been deprecated and removed in this PR: https://github.com/juspay/hyperswitch/pull/7100
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch-cloud/issues/8251
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
No-3DS auto capture
<img width="1720" alt="Screenshot 2025-02-10 at 5 25 26 PM" src="https://github.com/user-attachments/assets/0ca86a25-1c0c-41cf-9348-9676b1254cf7" />
3DS auto capture
<img width="1715" alt="Screenshot 2025-02-10 at 5 25 46 PM" src="https://github.com/user-attachments/assets/fb4f99ae-2d89-4833-8e1c-f918c303020d" />
No-3DS manual capture
<img width="1724" alt="Screenshot 2025-02-10 at 5 26 06 PM" src="https://github.com/user-attachments/assets/407799ef-67de-4f26-b458-a5a4329303f4" />
3DS manual capture
<img width="1727" alt="Screenshot 2025-02-10 at 5 26 54 PM" src="https://github.com/user-attachments/assets/6dcf53b9-4c2e-45c9-a521-8985090032f8" />
Bank Redirect -- All test cases in bank redirect is passed, other than `ideal`. Ideal's cypress test failing as ideal itself is redirecting to some other origin.
<img width="1722" alt="Screenshot 2025-02-10 at 5 36 47 PM" src="https://github.com/user-attachments/assets/a823e7cb-744a-455f-b004-63b6834fb63c" />
<img width="1725" alt="Screenshot 2025-02-10 at 5 36 56 PM" src="https://github.com/user-attachments/assets/ab0369c1-d49c-4606-9830-63992c701040" />
1. Trustly
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_6yAsmqONdJRee1Za1RsUCvaXlSG6kp8qU12QlluTaHycTOiojrk2b3huLTRPT2ds' \
--data-raw '{
"amount": 1000,
"currency": "EUR",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 1000,
"payment_method": "bank_redirect",
"payment_method_type": "trustly",
"payment_method_data": {
"bank_redirect": {
"trustly": {
"billing_details": {
"billing_name": "John Doe"
},
"bank_name": "ing",
"preferred_language": "en",
"country": "FI"
}
}
},
"customer_id": "StripeCustomer",
"email": "abcdef123@gmail.com",
"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": "FI"
}
},
"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"
}
}
'
```
Response
```
{
"payment_id": "pay_VXuewdMlK3cNlnjOG6Ni",
"merchant_id": "merchant_1738137594",
"status": "requires_customer_action",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 1000,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_VXuewdMlK3cNlnjOG6Ni_secret_iJqTyE7HzC1WPREUTMkm",
"created": "2025-01-29T11:00:14.555Z",
"currency": "EUR",
"customer_id": null,
"customer": null,
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "bank_redirect",
"payment_method_data": {
"bank_redirect": {
"type": "BankRedirectResponse",
"bank_name": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_VXuewdMlK3cNlnjOG6Ni/merchant_1738137594/pay_VXuewdMlK3cNlnjOG6Ni_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "trustly",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "VBLF93X8LV2D97V5",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "VBLF93X8LV2D97V5",
"payment_link": null,
"profile_id": "pro_LqHTmp6SEFvZsZEzNevb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_iC4SXg873LfMdmklc82l",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-29T11:15:14.555Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-29T11:00:15.006Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
2. Ideal
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_6yAsmqONdJRee1Za1RsUCvaXlSG6kp8qU12QlluTaHycTOiojrk2b3huLTRPT2ds' \
--data-raw '{
"amount": 100,
"currency": "EUR",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 100,
"customer_id": "StripeCustomer",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"payment_method": "bank_redirect",
"payment_method_type": "ideal",
"payment_method_data": {
"bank_redirect": {
"ideal": {
"billing_details": {
"billing_name": "Example",
"email": "guest@example.com"
},
"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": "8056594427",
"country_code": "+91"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "NL",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"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": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 6540,
"account_name": "transaction_processing"
}
]
}'
```
Response
```
{
"payment_id": "pay_Bs4sZJUYU8Bn6dGeXclU",
"merchant_id": "merchant_1738137594",
"status": "requires_customer_action",
"amount": 100,
"net_amount": 100,
"shipping_cost": null,
"amount_capturable": 100,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_Bs4sZJUYU8Bn6dGeXclU_secret_AFpcBZamAqPIKy2HqZKP",
"created": "2025-01-29T10:56:33.114Z",
"currency": "EUR",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "bank_redirect",
"payment_method_data": {
"bank_redirect": {
"type": "BankRedirectResponse",
"bank_name": "ing"
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "NL",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "NL",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_Bs4sZJUYU8Bn6dGeXclU/merchant_1738137594/pay_Bs4sZJUYU8Bn6dGeXclU_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "ideal",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1738148193,
"expires": 1738151793,
"secret": "epk_725ec96a42464776b2490a336cd39d60"
},
"manual_retry_allowed": null,
"connector_transaction_id": "CRFMZRL9WB7WCCV5",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "CRFMZRL9WB7WCCV5",
"payment_link": null,
"profile_id": "pro_LqHTmp6SEFvZsZEzNevb",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_iC4SXg873LfMdmklc82l",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-29T11:11:33.114Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-29T10:56:33.760Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
90fbb62ecd418b85804c6ae824843237ff740302
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7114
|
Bug: add stripe in network_transaction_id_supported_connectors list
add stripe in network_transaction_id_supported_connectors list
|
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 3537834fd07..90a34403637 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -191,7 +191,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card
[network_transaction_id_supported_connectors]
-connector_list = "adyen"
+connector_list = "adyen,stripe"
[payouts]
payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility
|
2025-01-24T06:47:08Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
adding `stripe` in connector list for network transaction id.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
a9a1ded77e2ba0cc7fa9763ce2da4bb0852d82af
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7126
|
Bug: Refactor(customer) : Return redacted customer instead of error.
Instead of returning error for querying deleted customer, we should return Customer with redacted values to help in frontend.
|
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 4f69cf41963..dabc9d37086 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -463,7 +463,7 @@ pub async fn retrieve_customer(
let key_manager_state = &(&state).into();
let response = db
- .find_customer_by_customer_id_merchant_id(
+ .find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
key_manager_state,
&customer_id,
merchant_account.get_id(),
@@ -471,7 +471,9 @@ pub async fn retrieve_customer(
merchant_account.storage_scheme,
)
.await
- .switch()?;
+ .switch()?
+ .ok_or(errors::CustomersErrorResponse::CustomerNotFound)?;
+
let address = match &response.address_id {
Some(address_id) => Some(api_models::payments::AddressDetails::from(
db.find_address_by_address_id(key_manager_state, address_id, &key_store)
|
2025-01-27T13:10:56Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Return redacted customer response instead of error when querying deleted customers.
## Motivation and Context
Upon merging this PR, the API will return deleted Customer with redacted values instead of error.
https://github.com/juspay/hyperswitch/issues/7126
## How did you test it?
- Create Customer API Call
```
curl --location 'http://localhost:8080/customers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
- Delete API Call for same customer
```
curl --location --request DELETE 'http://localhost:8080/customers/cus_vl2xIM4vJGaOVanI9rLl' \
--header 'Accept: application/json' \
--header 'api-key: *****'
```
- Retrieve Customer API call for the same customer
```
curl --location 'http://localhost:8080/customers/cus_PEkI9z16lQRq2xAXOol5' \
--header 'Accept: application/json' \
--header 'api-key: dev_CN6BIH4qBtQTtH3smdKKJEwcyuaxiQgu9Yv6houFWmaOmgjhLtSNOGFLEDagthEZ'
```
- Response from the above API Call
```
{"customer_id":"cus_PEkI9z16lQRq2xAXOol5","name":"Redacted","email":"Redacted","phone":"Redacted","phone_country_code":"Redacted","description":"Redacted","address":{"city":"Redacted","country":"US","line1":"Redacted","line2":"Redacted","line3":"Redacted","zip":"Redacted","state":"Redacted","first_name":"Redacted","last_name":"Redacted"},"created_at":"2025-01-28T07:15:35.740Z","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"default_payment_method_id":null}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ecab2b1f512eb7e78ca2e75c20b3adc753b97a2f
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7128
|
Bug: fix(diesel_models, api_models): mask `poc_email` and `data_value` for DashboardMetadata
## Current behaviour
- `poc_email` isn't masked for `DashboardMetadata` which leads to it being logged both at API and diesel query level.
Example:
<img width="1114" alt="Image" src="https://github.com/user-attachments/assets/8aa98114-b492-40bf-bddf-68323f86ffc0" />
## Proposed Changes
- (api_models): change the `poc_email` type to `Secret<String>`
- Add some `pii::Email` validation to check for input validity
- (diesel_models): change `data_value` to `Secret<serde_json::Value>`
|
diff --git a/crates/api_models/src/user/dashboard_metadata.rs b/crates/api_models/src/user/dashboard_metadata.rs
index 1d606ef63e8..f15029a7a49 100644
--- a/crates/api_models/src/user/dashboard_metadata.rs
+++ b/crates/api_models/src/user/dashboard_metadata.rs
@@ -94,7 +94,7 @@ pub struct ProdIntent {
pub business_label: Option<String>,
pub business_location: Option<CountryAlpha2>,
pub display_name: Option<String>,
- pub poc_email: Option<String>,
+ pub poc_email: Option<Secret<String>>,
pub business_type: Option<String>,
pub business_identifier: Option<String>,
pub business_website: Option<String>,
diff --git a/crates/diesel_models/src/user/dashboard_metadata.rs b/crates/diesel_models/src/user/dashboard_metadata.rs
index 291b4d2a3e6..004fc86693b 100644
--- a/crates/diesel_models/src/user/dashboard_metadata.rs
+++ b/crates/diesel_models/src/user/dashboard_metadata.rs
@@ -1,5 +1,6 @@
use common_utils::id_type;
use diesel::{query_builder::AsChangeset, Identifiable, Insertable, Queryable, Selectable};
+use masking::Secret;
use time::PrimitiveDateTime;
use crate::{enums, schema::dashboard_metadata};
@@ -12,7 +13,7 @@ pub struct DashboardMetadata {
pub merchant_id: id_type::MerchantId,
pub org_id: id_type::OrganizationId,
pub data_key: enums::DashboardMetadata,
- pub data_value: serde_json::Value,
+ pub data_value: Secret<serde_json::Value>,
pub created_by: String,
pub created_at: PrimitiveDateTime,
pub last_modified_by: String,
@@ -28,7 +29,7 @@ pub struct DashboardMetadataNew {
pub merchant_id: id_type::MerchantId,
pub org_id: id_type::OrganizationId,
pub data_key: enums::DashboardMetadata,
- pub data_value: serde_json::Value,
+ pub data_value: Secret<serde_json::Value>,
pub created_by: String,
pub created_at: PrimitiveDateTime,
pub last_modified_by: String,
@@ -41,7 +42,7 @@ pub struct DashboardMetadataNew {
#[diesel(table_name = dashboard_metadata)]
pub struct DashboardMetadataUpdateInternal {
pub data_key: enums::DashboardMetadata,
- pub data_value: serde_json::Value,
+ pub data_value: Secret<serde_json::Value>,
pub last_modified_by: String,
pub last_modified_at: PrimitiveDateTime,
}
@@ -50,7 +51,7 @@ pub struct DashboardMetadataUpdateInternal {
pub enum DashboardMetadataUpdate {
UpdateData {
data_key: enums::DashboardMetadata,
- data_value: serde_json::Value,
+ data_value: Secret<serde_json::Value>,
last_modified_by: String,
},
}
diff --git a/crates/router/src/core/user/dashboard_metadata.rs b/crates/router/src/core/user/dashboard_metadata.rs
index 689762c1f43..2ea2ba1d3d8 100644
--- a/crates/router/src/core/user/dashboard_metadata.rs
+++ b/crates/router/src/core/user/dashboard_metadata.rs
@@ -1,12 +1,16 @@
+use std::str::FromStr;
+
use api_models::user::dashboard_metadata::{self as api, GetMultipleMetaDataPayload};
#[cfg(feature = "email")]
use common_enums::EntityType;
+use common_utils::pii;
use diesel_models::{
enums::DashboardMetadata as DBEnum, user::dashboard_metadata::DashboardMetadata,
};
use error_stack::{report, ResultExt};
#[cfg(feature = "email")]
use masking::ExposeInterface;
+use masking::PeekInterface;
#[cfg(feature = "email")]
use router_env::logger;
@@ -447,6 +451,11 @@ async fn insert_metadata(
metadata
}
types::MetaData::ProdIntent(data) => {
+ if let Some(poc_email) = &data.poc_email {
+ let inner_poc_email = poc_email.peek().as_str();
+ pii::Email::from_str(inner_poc_email)
+ .change_context(UserErrors::EmailParsingError)?;
+ }
let mut metadata = utils::insert_user_scoped_metadata_to_db(
state,
user.user_id.clone(),
diff --git a/crates/router/src/services/email/types.rs b/crates/router/src/services/email/types.rs
index 476cd1292f6..1b88f648678 100644
--- a/crates/router/src/services/email/types.rs
+++ b/crates/router/src/services/email/types.rs
@@ -454,7 +454,7 @@ impl BizEmailProd {
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_NEW_PROD_INTENT,
user_name: data.poc_name.unwrap_or_default().into(),
- poc_email: data.poc_email.unwrap_or_default().into(),
+ poc_email: data.poc_email.unwrap_or_default(),
legal_business_name: data.legal_business_name.unwrap_or_default(),
business_location: data
.business_location
diff --git a/crates/router/src/utils/user/dashboard_metadata.rs b/crates/router/src/utils/user/dashboard_metadata.rs
index b5e16290fca..f5836f25fa7 100644
--- a/crates/router/src/utils/user/dashboard_metadata.rs
+++ b/crates/router/src/utils/user/dashboard_metadata.rs
@@ -10,7 +10,7 @@ use diesel_models::{
user::dashboard_metadata::{DashboardMetadata, DashboardMetadataNew, DashboardMetadataUpdate},
};
use error_stack::{report, ResultExt};
-use masking::Secret;
+use masking::{ExposeInterface, PeekInterface, Secret};
use router_env::logger;
use crate::{
@@ -37,7 +37,7 @@ pub async fn insert_merchant_scoped_metadata_to_db(
merchant_id,
org_id,
data_key: metadata_key,
- data_value,
+ data_value: Secret::from(data_value),
created_by: user_id.clone(),
created_at: now,
last_modified_by: user_id,
@@ -70,7 +70,7 @@ pub async fn insert_user_scoped_metadata_to_db(
merchant_id,
org_id,
data_key: metadata_key,
- data_value,
+ data_value: Secret::from(data_value),
created_by: user_id.clone(),
created_at: now,
last_modified_by: user_id,
@@ -143,7 +143,7 @@ pub async fn update_merchant_scoped_metadata(
metadata_key,
DashboardMetadataUpdate::UpdateData {
data_key: metadata_key,
- data_value,
+ data_value: Secret::from(data_value),
last_modified_by: user_id,
},
)
@@ -171,7 +171,7 @@ pub async fn update_user_scoped_metadata(
metadata_key,
DashboardMetadataUpdate::UpdateData {
data_key: metadata_key,
- data_value,
+ data_value: Secret::from(data_value),
last_modified_by: user_id,
},
)
@@ -183,7 +183,7 @@ pub fn deserialize_to_response<T>(data: Option<&DashboardMetadata>) -> UserResul
where
T: serde::de::DeserializeOwned,
{
- data.map(|metadata| serde_json::from_value(metadata.data_value.clone()))
+ data.map(|metadata| serde_json::from_value(metadata.data_value.clone().expose()))
.transpose()
.change_context(UserErrors::InternalServerError)
.attach_printable("Error Serializing Metadata from DB")
@@ -278,17 +278,18 @@ pub fn parse_string_to_enums(query: String) -> UserResult<GetMultipleMetaDataPay
})
}
-fn not_contains_string(value: &Option<String>, value_to_be_checked: &str) -> bool {
- value
- .as_ref()
- .is_some_and(|mail| !mail.contains(value_to_be_checked))
+fn not_contains_string(value: Option<&str>, value_to_be_checked: &str) -> bool {
+ value.is_some_and(|mail| !mail.contains(value_to_be_checked))
}
pub fn is_prod_email_required(data: &ProdIntent, user_email: String) -> bool {
- let poc_email_check = not_contains_string(&data.poc_email, "juspay");
- let business_website_check = not_contains_string(&data.business_website, "juspay")
- && not_contains_string(&data.business_website, "hyperswitch");
- let user_email_check = not_contains_string(&Some(user_email), "juspay");
+ let poc_email_check = not_contains_string(
+ data.poc_email.as_ref().map(|email| email.peek().as_str()),
+ "juspay",
+ );
+ let business_website_check = not_contains_string(data.business_website.as_deref(), "juspay")
+ && not_contains_string(data.business_website.as_deref(), "hyperswitch");
+ let user_email_check = not_contains_string(Some(&user_email), "juspay");
if (poc_email_check && business_website_check && user_email_check).not() {
logger::info!(prod_intent_email = poc_email_check);
|
2025-01-28T09:34:50Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- (api_models): change the `poc_email` type to `Secret<String>`
- Add some `pii::Email` validation to check for input validity
- (diesel_models): change `data_value` to `Secret<serde_json::Value>`
## Fixes #7128
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
`poc_email` isn't masked for `DashboardMetadata` which leads to it being logged both at API and diesel query level.
Example:
<img width="1114" alt="Image" src="https://github.com/user-attachments/assets/8aa98114-b492-40bf-bddf-68323f86ffc0" />
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Curl to set metadata:
```bash
curl --location 'http://localhost:8080/user/data' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{TOKEN}}' \
--data '
{
"ProdIntent": {
"is_completed": true,
"legal_business_name": "test",
"business_label": "test",
"business_location": "US",
"display_name": "test",
"poc_email": "test@gmail.com",
"business_type": "test",
"business_identifier": "test",
"business_website": "test",
"poc_name": "test",
"poc_contact": "test",
"comments": "test"
}
}
'
```
Result:
<img width="815" alt="Screenshot 2025-01-28 at 3 03 49 PM" src="https://github.com/user-attachments/assets/039d9ee6-88f3-4213-92d6-0f6dba73c010" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
c02cb20b02501eb027e61e4f4a342eeda1fb9b70
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7150
|
Bug: [FEATURE] : [CONNECTOR] Add Multisafepay, Wellsfargo, Worldpay supported payment methods, currencies and countries in feature matrix
### Feature Description
Add Multisafepay, Wellsfargo, Worldpay supported payment methods, currencies and countries in feature matrix
### Possible Implementation
Add Multisafepay, Wellsfargo, Worldpay supported payment methods, currencies and countries in feature matrix
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index aab4829f069..f65f1dba78b 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -204,9 +204,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
@@ -485,11 +485,31 @@ debit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MY
[pm_filters.plaid]
open_banking_pis = {currency = "EUR,GBP"}
+[pm_filters.multisafepay]
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+google_pay = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PHP,PLN,RON,RUB,SEK,SGD,THB,TRY,TWD,UAH,USD,ZAR" }
+paypal = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AUD,BRL,CAD,CHF,CZK,DKK,EUR,GBP,HKD,HRK,HUF,JPY,MXN,MYR,NOK,NZD,PHP,PLN,RUB,SEK,SGD,THB,TRY,TWD,USD" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+klarna = { country = "AT,BE,DK,FI,FR,DE,IT,NL,NO,PT,ES,SE,GB", currency = "DKK,EUR,GBP,NOK,SEK" }
+
+[pm_filters.cashtocode]
+classic = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+evoucher = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+
+[pm_filters.wellsfargo]
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+google_pay = { country = "US", currency = "USD" }
+apple_pay = { country = "US", currency = "USD" }
+ach = { country = "US", currency = "USD" }
+
[pm_filters.worldpay]
debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
-google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
+google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 2040773c6de..b1eed3549af 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -204,9 +204,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
@@ -470,6 +470,26 @@ google_pay = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH
[pm_filters.prophetpay]
card_redirect.currency = "USD"
+[pm_filters.multisafepay]
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+google_pay = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PHP,PLN,RON,RUB,SEK,SGD,THB,TRY,TWD,UAH,USD,ZAR" }
+paypal = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AUD,BRL,CAD,CHF,CZK,DKK,EUR,GBP,HKD,HRK,HUF,JPY,MXN,MYR,NOK,NZD,PHP,PLN,RUB,SEK,SGD,THB,TRY,TWD,USD" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+klarna = { country = "AT,BE,DK,FI,FR,DE,IT,NL,NO,PT,ES,SE,GB", currency = "DKK,EUR,GBP,NOK,SEK" }
+
+[pm_filters.cashtocode]
+classic = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+evoucher = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+
+[pm_filters.wellsfargo]
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+google_pay = { country = "US", currency = "USD" }
+apple_pay = { country = "US", currency = "USD" }
+ach = { country = "US", currency = "USD" }
+
[pm_filters.stax]
ach = { country = "US", currency = "USD" }
@@ -502,8 +522,8 @@ open_banking_pis = {currency = "EUR,GBP"}
[pm_filters.worldpay]
debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
-google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
+google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3fa97db2a02..15efb264ac6 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -204,9 +204,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
@@ -472,6 +472,25 @@ google_pay = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH
[pm_filters.prophetpay]
card_redirect.currency = "USD"
+[pm_filters.multisafepay]
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+google_pay = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PHP,PLN,RON,RUB,SEK,SGD,THB,TRY,TWD,UAH,USD,ZAR" }
+paypal = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AUD,BRL,CAD,CHF,CZK,DKK,EUR,GBP,HKD,HRK,HUF,JPY,MXN,MYR,NOK,NZD,PHP,PLN,RUB,SEK,SGD,THB,TRY,TWD,USD" }
+ideal = { country = "NL", currency = "EUR" }
+klarna = { country = "AT,BE,DK,FI,FR,DE,IT,NL,NO,PT,ES,SE,GB", currency = "DKK,EUR,GBP,NOK,SEK" }
+
+[pm_filters.cashtocode]
+classic = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+evoucher = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+
+[pm_filters.wellsfargo]
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+google_pay = { country = "US", currency = "USD" }
+apple_pay = { country = "US", currency = "USD" }
+ach = { country = "US", currency = "USD" }
+
[pm_filters.stax]
ach = { country = "US", currency = "USD" }
@@ -504,8 +523,8 @@ open_banking_pis = {currency = "EUR,GBP"}
[pm_filters.worldpay]
debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
-google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
+google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
diff --git a/config/development.toml b/config/development.toml
index d40e8db0269..a059466e435 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -656,10 +656,6 @@ eps = { country = "AT", currency = "EUR" }
ideal = { country = "NL", currency = "EUR" }
przelewy24 = { country = "PL", currency = "PLN,EUR" }
-[pm_filters.multisafepay]
-credit = { not_available_flows = { capture_method = "manual" } }
-debit = { not_available_flows = { capture_method = "manual" } }
-
[pm_filters.redsys]
credit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
debit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
@@ -672,6 +668,26 @@ ach = { currency = "USD" }
[pm_filters.prophetpay]
card_redirect = { currency = "USD" }
+[pm_filters.multisafepay]
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR", not_available_flows = { capture_method = "manual" } }
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR", not_available_flows = { capture_method = "manual" } }
+google_pay = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PHP,PLN,RON,RUB,SEK,SGD,THB,TRY,TWD,UAH,USD,ZAR" }
+paypal = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AUD,BRL,CAD,CHF,CZK,DKK,EUR,GBP,HKD,HRK,HUF,JPY,MXN,MYR,NOK,NZD,PHP,PLN,RUB,SEK,SGD,THB,TRY,TWD,USD" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+klarna = { country = "AT,BE,DK,FI,FR,DE,IT,NL,NO,PT,ES,SE,GB", currency = "DKK,EUR,GBP,NOK,SEK" }
+
+[pm_filters.cashtocode]
+classic = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+evoucher = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+
+[pm_filters.wellsfargo]
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+google_pay = { country = "US", currency = "USD" }
+apple_pay = { country = "US", currency = "USD" }
+ach = { country = "US", currency = "USD" }
+
[pm_filters.trustpay]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
@@ -685,8 +701,8 @@ paypal = { currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.worldpay]
debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
-google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
+google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
[file_upload_config]
bucket_name = ""
@@ -833,9 +849,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 45ce79abf56..caf617ef71e 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -615,11 +615,31 @@ credit = { currency = "USD" }
debit = { currency = "USD" }
ach = { currency = "USD" }
+[pm_filters.multisafepay]
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PLN,RON,RUB,SEK,SGD,TRY,TWD,USD,ZAR" }
+google_pay = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AED,AUD,BRL,CAD,CHF,CLP,CNY,COP,CZK,DKK,EUR,GBP,HKD,HRK,HUF,ILS,INR,ISK,JPY,KRW,MXN,MYR,NOK,NZD,PEN,PHP,PLN,RON,RUB,SEK,SGD,THB,TRY,TWD,UAH,USD,ZAR" }
+paypal = { 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,CV,KH,CM,CA,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,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,SZ,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 = "AUD,BRL,CAD,CHF,CZK,DKK,EUR,GBP,HKD,HRK,HUF,JPY,MXN,MYR,NOK,NZD,PHP,PLN,RUB,SEK,SGD,THB,TRY,TWD,USD" }
+giropay = { country = "DE", currency = "EUR" }
+ideal = { country = "NL", currency = "EUR" }
+klarna = { country = "AT,BE,DK,FI,FR,DE,IT,NL,NO,PT,ES,SE,GB", currency = "DKK,EUR,GBP,NOK,SEK" }
+
+[pm_filters.cashtocode]
+classic = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+evoucher = { country = "CA,AU,NZ,ZA,AR,MX,BR,NG,IN,CN,GH,JP,KE,PE,CO,CL,EC,GT,ZM,CM,CI", currency = "CAD,USD,AUD,NZD,EUR,INR,NGN,CNY,GHS,JPY,KES,ZAR,ARS" }
+
+[pm_filters.wellsfargo]
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+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,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,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,US,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "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" }
+google_pay = { country = "US", currency = "USD" }
+apple_pay = { country = "US", currency = "USD" }
+ach = { country = "US", currency = "USD" }
+
[pm_filters.worldpay]
debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
-google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
+google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
[pm_filters.fiuu]
duit_now = { country = "MY", currency = "MYR" }
@@ -708,12 +728,13 @@ bank_redirect.open_banking_uk.connector_list = "adyen"
[mandates.supported_payment_methods]
pay_later.klarna = { connector_list = "adyen" }
-wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotnet,novalnet" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet" }
+wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" }
wallet.samsung_pay = { connector_list = "cybersource" }
wallet.paypal = { connector_list = "adyen,novalnet" }
-card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac" }
-card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac" }
+card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,wellsfargo" }
+card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,wellsfargo" }
+
bank_debit.ach = { connector_list = "gocardless,adyen" }
bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" }
@@ -919,4 +940,4 @@ background_color = "#FFFFFF"
enabled = true
[authentication_providers]
-click_to_pay = {connector_list = "adyen, cybersource"}
\ No newline at end of file
+click_to_pay = {connector_list = "adyen, cybersource"}
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index cd97fb50a3f..be9420b5c36 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -1,4 +1,7 @@
pub mod transformers;
+
+use std::sync::LazyLock;
+
use base64::Engine;
use common_enums::enums;
use common_utils::{
@@ -21,7 +24,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData},
};
use hyperswitch_interfaces::{
@@ -153,24 +159,7 @@ impl ConnectorCommon for Cashtocode {
}
}
-impl ConnectorValidation for Cashtocode {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_supported_error_report(capture_method, self.id()),
- ),
- }
- }
-}
+impl ConnectorValidation for Cashtocode {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Cashtocode {
//TODO: implement sessions flow
@@ -460,4 +449,60 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Cashtocod
// default implementation of build_request method will be executed
}
-impl ConnectorSpecifications for Cashtocode {}
+static CASHTOCODE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let mut cashtocode_supported_payment_methods = SupportedPaymentMethods::new();
+
+ cashtocode_supported_payment_methods.add(
+ enums::PaymentMethod::Reward,
+ enums::PaymentMethodType::ClassicReward,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::NotSupported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ cashtocode_supported_payment_methods.add(
+ enums::PaymentMethod::Reward,
+ enums::PaymentMethodType::Evoucher,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::NotSupported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ cashtocode_supported_payment_methods
+ });
+
+static CASHTOCODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "CashToCode",
+ description:
+ "CashToCode is a payment solution that enables users to convert cash into digital vouchers for online transactions",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+
+static CASHTOCODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
+
+impl ConnectorSpecifications for Cashtocode {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&CASHTOCODE_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*CASHTOCODE_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&CASHTOCODE_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
index a4ff3a3b3ac..725bbbbeb92 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
@@ -1,6 +1,6 @@
pub mod transformers;
-use std::time::SystemTime;
+use std::{sync::LazyLock, time::SystemTime};
use actix_web::http::header::Date;
use base64::Engine;
@@ -48,7 +48,6 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
-use lazy_static::lazy_static;
use masking::{ExposeInterface, Mask, Secret};
use rand::distributions::{Alphanumeric, DistString};
use ring::hmac;
@@ -1003,8 +1002,8 @@ impl webhooks::IncomingWebhook for Deutschebank {
}
}
-lazy_static! {
- static ref DEUTSCHEBANK_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+static DEUTSCHEBANK_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
let supported_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::Manual,
@@ -1021,37 +1020,18 @@ lazy_static! {
deutschebank_supported_payment_methods.add(
enums::PaymentMethod::BankDebit,
enums::PaymentMethodType::Sepa,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::Supported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: None,
- }
+ },
);
deutschebank_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Credit,
- PaymentMethodDetails{
- mandates: enums::FeatureStatus::NotSupported,
- refunds: enums::FeatureStatus::Supported,
- supported_capture_methods: supported_capture_methods.clone(),
- specific_features: Some(
- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
- api_models::feature_matrix::CardSpecificFeatures {
- three_ds: common_enums::FeatureStatus::Supported,
- no_three_ds: common_enums::FeatureStatus::NotSupported,
- supported_card_networks: supported_card_network.clone(),
- }
- }),
- ),
- }
- );
-
- deutschebank_supported_payment_methods.add(
- enums::PaymentMethod::Card,
- enums::PaymentMethodType::Debit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -1064,13 +1044,13 @@ lazy_static! {
}
}),
),
- }
+ },
);
deutschebank_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Debit,
- PaymentMethodDetails{
+ PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
@@ -1083,26 +1063,24 @@ lazy_static! {
}
}),
),
- }
+ },
);
deutschebank_supported_payment_methods
- };
+ });
- static ref DEUTSCHEBANK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
- display_name: "Deutsche Bank",
- description:
- "Deutsche Bank is a German multinational investment bank and financial services company ",
- connector_type: enums::PaymentConnectorCategory::BankAcquirer,
- };
-
- static ref DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+static DEUTSCHEBANK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Deutsche Bank",
+ description:
+ "Deutsche Bank is a German multinational investment bank and financial services company ",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+};
-}
+static DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
impl ConnectorSpecifications for Deutschebank {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
- Some(&*DEUTSCHEBANK_CONNECTOR_INFO)
+ Some(&DEUTSCHEBANK_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
@@ -1110,6 +1088,6 @@ impl ConnectorSpecifications for Deutschebank {
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
- Some(&*DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS)
+ Some(&DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS)
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
index 3403f2213d2..f2fc62d6cbf 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
@@ -1,5 +1,7 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use api_models::webhooks::IncomingWebhookEvent;
use common_enums::{enums, AttemptStatus};
use common_utils::{
@@ -22,7 +24,10 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
RefundsRouterData,
@@ -130,24 +135,6 @@ impl ConnectorCommon for Multisafepay {
}
impl ConnectorValidation for Multisafepay {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::Manual
- | enums::CaptureMethod::ManualMultiple
- | enums::CaptureMethod::Scheduled => Err(errors::ConnectorError::NotImplemented(
- format!("{} for {}", capture_method, self.id()),
- )
- .into()),
- }
- }
-
fn validate_mandate_payment(
&self,
pm_type: Option<enums::PaymentMethodType>,
@@ -570,4 +557,137 @@ impl IncomingWebhook for Multisafepay {
}
}
-impl ConnectorSpecifications for Multisafepay {}
+static MULTISAFEPAY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::Maestro,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ ];
+
+ let mut multisafepay_supported_payment_methods = SupportedPaymentMethods::new();
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::NotSupported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::NotSupported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::Paypal,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::Giropay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::Ideal,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ multisafepay_supported_payment_methods.add(
+ enums::PaymentMethod::PayLater,
+ enums::PaymentMethodType::Klarna,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ multisafepay_supported_payment_methods
+ });
+
+static MULTISAFEPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Multisafepay",
+ description: "MultiSafePay is a payment gateway and PSP enabling secure online transactions",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static MULTISAFEPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Multisafepay {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&MULTISAFEPAY_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*MULTISAFEPAY_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&MULTISAFEPAY_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
index c85e16a9977..4fb3985812e 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
@@ -1,5 +1,7 @@
pub mod transformers;
+use std::sync::LazyLock;
+
use base64::Engine;
use common_enums::enums;
use common_utils::{
@@ -28,7 +30,10 @@ use hyperswitch_domain_models::{
PaymentsIncrementalAuthorizationData, PaymentsSessionData, PaymentsSyncData, RefundsData,
SetupMandateRequestData,
},
- router_response_types::{MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, MandateRevokeResponseData, PaymentMethodDetails, PaymentsResponseData,
+ RefundsResponseData, SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
MandateRevokeRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,
PaymentsCaptureRouterData, PaymentsIncrementalAuthorizationRouterData,
@@ -279,22 +284,6 @@ impl ConnectorCommon for Wellsfargo {
}
impl ConnectorValidation for Wellsfargo {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- utils::construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
fn validate_mandate_payment(
&self,
pm_type: Option<enums::PaymentMethodType>,
@@ -1328,4 +1317,116 @@ impl webhooks::IncomingWebhook for Wellsfargo {
}
}
-impl ConnectorSpecifications for Wellsfargo {}
+static WELLSFARGO_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::Discover,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ ];
+
+ let mut wellsfargo_supported_payment_methods = SupportedPaymentMethods::new();
+
+ wellsfargo_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ wellsfargo_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ wellsfargo_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ wellsfargo_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ wellsfargo_supported_payment_methods.add(
+ enums::PaymentMethod::BankDebit,
+ enums::PaymentMethodType::Ach,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ wellsfargo_supported_payment_methods
+ });
+
+static WELLSFARGO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Wells Fargo",
+ description:
+ "Wells Fargo is a major bank offering retail, commercial, and wealth management services",
+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+};
+
+static WELLSFARGO_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Wellsfargo {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&WELLSFARGO_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*WELLSFARGO_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&WELLSFARGO_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index 645502b267d..009a02f7ef5 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -2,6 +2,8 @@ mod requests;
mod response;
pub mod transformers;
+use std::sync::LazyLock;
+
use api_models::{payments::PaymentIdType, webhooks::IncomingWebhookEvent};
use common_enums::{enums, PaymentAction};
use common_utils::{
@@ -26,7 +28,10 @@ use hyperswitch_domain_models::{
PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
PaymentsSyncData, RefundsData, ResponseId, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundExecuteRouterData,
@@ -60,8 +65,8 @@ use crate::{
constants::headers,
types::ResponseRouterData,
utils::{
- construct_not_implemented_error_report, convert_amount, get_header_key_value,
- is_mandate_supported, ForeignTryFrom, PaymentMethodDataType, RefundsRequestData,
+ convert_amount, get_header_key_value, is_mandate_supported, ForeignTryFrom,
+ PaymentMethodDataType, RefundsRequestData,
},
};
@@ -164,23 +169,6 @@ impl ConnectorCommon for Worldpay {
}
impl ConnectorValidation for Worldpay {
- fn validate_connector_against_payment_request(
- &self,
- capture_method: Option<enums::CaptureMethod>,
- _payment_method: enums::PaymentMethod,
- _pmt: Option<enums::PaymentMethodType>,
- ) -> CustomResult<(), errors::ConnectorError> {
- let capture_method = capture_method.unwrap_or_default();
- match capture_method {
- enums::CaptureMethod::Automatic
- | enums::CaptureMethod::Manual
- | enums::CaptureMethod::SequentialAutomatic => Ok(()),
- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- construct_not_implemented_error_report(capture_method, self.id()),
- ),
- }
- }
-
fn validate_mandate_payment(
&self,
pm_type: Option<enums::PaymentMethodType>,
@@ -1263,4 +1251,107 @@ impl ConnectorRedirectResponse for Worldpay {
}
}
-impl ConnectorSpecifications for Worldpay {}
+static WORLDPAY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::Manual,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::Maestro,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ ];
+
+ let mut worldpay_supported_payment_methods = SupportedPaymentMethods::new();
+
+ worldpay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ worldpay_supported_payment_methods.add(
+ enums::PaymentMethod::Card,
+ enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::Supported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::Supported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ worldpay_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ worldpay_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ worldpay_supported_payment_methods
+ });
+
+static WORLDPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Worldpay",
+ description: "Worldpay is a payment gateway and PSP enabling secure online transactions",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static WORLDPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
+
+impl ConnectorSpecifications for Worldpay {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&WORLDPAY_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*WORLDPAY_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&WORLDPAY_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
|
2025-01-31T06:07:14Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added Feature Matrix supported payment methods, countries and currencies for Multisafepay, Cashtocode, Worldpay and Wellsfargo.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
### MULTISAFEPAY
**Card(Credit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BRLi0eobwJCQvfjdD0MZbuGVAIaX16cvGPAM80Rpdn0j0ixXtlg3jtpzTDnMJUeH' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_bp8hf7Ocmqq7Ep9isDWQ",
"merchant_id": "postman_merchant_GHAction_2c4ad87f-3e25-4085-8b54-825e8d863450",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "cybersource",
"client_secret": "pay_bp8hf7Ocmqq7Ep9isDWQ_secret_mHy67YGHq7j2ToBELWS6",
"created": "2025-05-15T11:48:46.858Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1237",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "421234",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": {
"avs_response": {
"code": "Y",
"codeRaw": "Y"
},
"card_verification": {
"resultCode": "M",
"resultCodeRaw": "M"
}
},
"authentication_data": null
},
"billing": null
},
"payment_token": "token_TNV1WLBwxbIKZgsBtfmY",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747309726,
"expires": 1747313326,
"secret": "epk_58d552108b124ed7aaf601f064052c32"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7473097280976362903813",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_bp8hf7Ocmqq7Ep9isDWQ_1",
"payment_link": null,
"profile_id": "pro_2Rna3YFTyOAA6HVlHE6P",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_yUDi3EIIDvjyE3xfxhVo",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-15T12:03:46.858Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-15T11:48:48.988Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
**Card(Debit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BRLi0eobwJCQvfjdD0MZbuGVAIaX16cvGPAM80Rpdn0j0ixXtlg3jtpzTDnMJUeH' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "debit",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_RGvWZ6NZWFdyEL1oYY9f",
"merchant_id": "postman_merchant_GHAction_2c4ad87f-3e25-4085-8b54-825e8d863450",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "cybersource",
"client_secret": "pay_RGvWZ6NZWFdyEL1oYY9f_secret_9RR3g8s7Ez0Ue8TNYHqL",
"created": "2025-05-15T11:50:43.927Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1237",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "421234",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": {
"avs_response": {
"code": "Y",
"codeRaw": "Y"
},
"card_verification": {
"resultCode": "M",
"resultCodeRaw": "M"
}
},
"authentication_data": null
},
"billing": null
},
"payment_token": "token_9O9B1lEaUrB6NDxdeKL8",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747309843,
"expires": 1747313443,
"secret": "epk_e3cb053fcd8f4983965d69314c193199"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7473098451916632303814",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_RGvWZ6NZWFdyEL1oYY9f_1",
"payment_link": null,
"profile_id": "pro_2Rna3YFTyOAA6HVlHE6P",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_yUDi3EIIDvjyE3xfxhVo",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-15T12:05:43.927Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-15T11:50:46.072Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
### WORLDPAY
**Card(Credit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ALZ6HXV1kpq1Ok1KCdI3B6qxZmg9FBPBnPrcxfafEsRItJZIfgE1LtRGrMwk0TYE' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "4917610000000000",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_LfDj7yDZwdZKE3ne24KO",
"merchant_id": "postman_merchant_GHAction_e8a47dab-c2e9-47ef-8a91-a48635f71ce5",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "worldpay",
"client_secret": "pay_LfDj7yDZwdZKE3ne24KO_secret_P8DHVjLDskQrknede60B",
"created": "2025-05-15T12:36:29.727Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0000",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "491761",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747312589,
"expires": 1747316189,
"secret": "epk_15edccce1ec84678a5b9153ccf6eeb35"
},
"manual_retry_allowed": false,
"connector_transaction_id": "eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLfKkob4xtgyQHOUdu:YUsnot2jFsqX+NMruRZjQY5g0pBMj22Q8mqp+GdNtOOwjHFKehJNZz0urTs8IkF9iA18O1al9kEkFIu2H2OhX:2:zorW66yFNGsWi87tzkRENLR8ix3NBfHPU2KlzlyTrmR0mwasA4zRNlfY:bG7Aaa:GaUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9Ij4FJlJc72BVERP7cifjqijx0JfAcqMmcRJg25WkhfAecgEOJO+Qo7r7FThP081jgS+WwXVvDoxGmrxlJztOw0ZGhpBnafkmtr87KRkF2Hgo",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "61acaebf-c0ca-4b58-b18b-be262abe305f",
"payment_link": null,
"profile_id": "pro_h8hgkqbVCGEK8MyOnVaL",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_wpyfUNuvetffMg1uwbMv",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-15T12:51:29.727Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-15T12:36:30.946Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
**Card(Debit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ALZ6HXV1kpq1Ok1KCdI3B6qxZmg9FBPBnPrcxfafEsRItJZIfgE1LtRGrMwk0TYE' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "debit",
"payment_method_data": {
"card": {
"card_number": "4917610000000000",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_25AHqTxE1luViOJtmCu5",
"merchant_id": "postman_merchant_GHAction_e8a47dab-c2e9-47ef-8a91-a48635f71ce5",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "worldpay",
"client_secret": "pay_25AHqTxE1luViOJtmCu5_secret_s32GKSm4PjQc4zpVPMiX",
"created": "2025-05-15T12:37:58.132Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0000",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "491761",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747312678,
"expires": 1747316278,
"secret": "epk_ec24ac5e66464278803a4c1dde2e9222"
},
"manual_retry_allowed": false,
"connector_transaction_id": "eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HL3:Tpogxng2CfR4suZ0BadXLKtk0Qq+VdxvEKmiG66C1BMj22Q8mqp+GdNtOOwjHFKehJNZz0urTs8IkF9iA18O1al9kEkFIu2H2OhX:2:zorW66yFNGsWi87tzkRENLR8ix3NBfHPU2KlzlyTrmR0mwasA4zRNlfY:bG7Aaa:GaUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9ItPQQ4uEWtdK2eQhGhjXv4:b+hCjRbIf5TaaBZ7lNykV74q79FFmYaJUU5c653i+Zy+WwXVvDoxGmrxlJztOw0ZGhpBnafkmtr87KRkF2Hgo",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "980c0ecd-c852-4c1d-a9a6-360d62603074",
"payment_link": null,
"profile_id": "pro_h8hgkqbVCGEK8MyOnVaL",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_wpyfUNuvetffMg1uwbMv",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-15T12:52:58.132Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-15T12:37:59.805Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
### WELLSFARGO
**Card(Credit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0NOp4TLj6uRWn6OHHIlkjMgmPPPOlqAmaB6ZjeKLFangy25qjRWiWptl5n77kbmV' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "4917610000000000",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_deDEDrQjPUQwzd3IdXzJ",
"merchant_id": "postman_merchant_GHAction_fc8bb43f-52ec-4650-8eff-b9b265bac10e",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "wellsfargo",
"client_secret": "pay_deDEDrQjPUQwzd3IdXzJ_secret_d1oz1MWIXIGtGLESHzqX",
"created": "2025-05-16T05:45:17.431Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0000",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "491761",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": {
"avs_response": {
"code": "Y",
"codeRaw": "Y"
},
"card_verification": {
"resultCode": "M",
"resultCodeRaw": "M"
}
},
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747374317,
"expires": 1747377917,
"secret": "epk_d7f9ccabfdf54b9b8aa3dfe0ba44ce92"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7473743176986359504806",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_deDEDrQjPUQwzd3IdXzJ_1",
"payment_link": null,
"profile_id": "pro_4kYBY5XPiQLdOCQMOoNA",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_PDi685cMHPyFvYTGVPEQ",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-16T06:00:17.431Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-16T05:45:18.676Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
**Card(Debit)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0NOp4TLj6uRWn6OHHIlkjMgmPPPOlqAmaB6ZjeKLFangy25qjRWiWptl5n77kbmV' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcdfe",
"email": "guest@example.com",
"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": "debit",
"payment_method_data": {
"card": {
"card_number": "4917610000000000",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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"
}
}'
```
-Response
```
{
"payment_id": "pay_usd7OiZOJa55V2ze0nYL",
"merchant_id": "postman_merchant_GHAction_fc8bb43f-52ec-4650-8eff-b9b265bac10e",
"status": "succeeded",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 12345,
"connector": "wellsfargo",
"client_secret": "pay_usd7OiZOJa55V2ze0nYL_secret_1miOHzueRY3p9Qd12fPm",
"created": "2025-05-16T05:46:54.074Z",
"currency": "USD",
"customer_id": "abcdfe",
"customer": {
"id": "abcdfe",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0000",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "491761",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": {
"avs_response": {
"code": "Y",
"codeRaw": "Y"
},
"card_verification": {
"resultCode": "M",
"resultCodeRaw": "M"
}
},
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcdfe",
"created_at": 1747374414,
"expires": 1747378014,
"secret": "epk_02d3e13eb4874dd88b59c4b5d8bd6712"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7473744151326397904806",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_usd7OiZOJa55V2ze0nYL_1",
"payment_link": null,
"profile_id": "pro_4kYBY5XPiQLdOCQMOoNA",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_PDi685cMHPyFvYTGVPEQ",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-16T06:01:54.074Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-16T05:46:56.008Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
212ac27057762f9d4cd2073d93c2216f61711cfe
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7119
|
Bug: [BUG] Deserialization Error Due to Error Coming in HTML format from Bluesnap Connector
### Bug Description
The Bluesnap Connector propagates errors received from its cloud service (Cloudflare). Cloudflare returns these errors in HTML format, and Bluesnap forwards them in the same HTML format. When an error is received in HTML format, the backend's deserialization fails because it expects the response to be in JSON format.
### Expected Behavior
The code should ensure any unexpected responses from the connector are appropriately logged and handled, providing meaningful and actionable error information to the caller.
### Actual Behavior
The server returns a 500 Internal Server Error without handling the issue gracefully.
### Steps To Reproduce
Only triggered when Bluesnap propagates error in HTML format. Bluesnap normally generates error in JSON format.
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? No
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution: mac
2. Rust version (output of `rustc --version`): `rustc 1.83.0 (90b35a623 2024-11-26)`
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
index 8fac36424e2..3f319ee74f5 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
@@ -11,7 +11,7 @@ use common_utils::{
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
};
-use error_stack::{report, ResultExt};
+use error_stack::{report, Report, ResultExt};
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
@@ -55,9 +55,9 @@ use crate::{
utils::{
construct_not_supported_error_report, convert_amount,
get_error_code_error_message_based_on_priority, get_header_key_value, get_http_header,
- to_connector_meta_from_secret, to_currency_lower_unit, ConnectorErrorType,
- ConnectorErrorTypeMapping, ForeignTryFrom, PaymentsAuthorizeRequestData,
- RefundsRequestData, RouterData as _,
+ handle_json_response_deserialization_failure, to_connector_meta_from_secret,
+ to_currency_lower_unit, ConnectorErrorType, ConnectorErrorTypeMapping, ForeignTryFrom,
+ PaymentsAuthorizeRequestData, RefundsRequestData, RouterData as _,
},
};
@@ -132,74 +132,84 @@ impl ConnectorCommon for Bluesnap {
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
logger::debug!(bluesnap_error_response=?res);
- let response: bluesnap::BluesnapErrors = res
- .response
- .parse_struct("BluesnapErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- event_builder.map(|i| i.set_error_response_body(&response));
- router_env::logger::info!(connector_response=?response);
+ let response_data: Result<
+ bluesnap::BluesnapErrors,
+ Report<common_utils::errors::ParsingError>,
+ > = res.response.parse_struct("BluesnapErrors");
+
+ match response_data {
+ Ok(response) => {
+ event_builder.map(|i| i.set_error_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
- let response_error_message = match response {
- bluesnap::BluesnapErrors::Payment(error_response) => {
- let error_list = error_response.message.clone();
- let option_error_code_message = get_error_code_error_message_based_on_priority(
- self.clone(),
- error_list.into_iter().map(|errors| errors.into()).collect(),
- );
- let reason = error_response
- .message
- .iter()
- .map(|error| error.description.clone())
- .collect::<Vec<String>>()
- .join(" & ");
- ErrorResponse {
- status_code: res.status_code,
- code: option_error_code_message
- .clone()
- .map(|error_code_message| error_code_message.error_code)
- .unwrap_or(NO_ERROR_CODE.to_string()),
- message: option_error_code_message
- .map(|error_code_message| error_code_message.error_message)
- .unwrap_or(NO_ERROR_MESSAGE.to_string()),
- reason: Some(reason),
- attempt_status: None,
- connector_transaction_id: None,
- }
- }
- bluesnap::BluesnapErrors::Auth(error_res) => ErrorResponse {
- status_code: res.status_code,
- code: error_res.error_code.clone(),
- message: error_res.error_name.clone().unwrap_or(error_res.error_code),
- reason: Some(error_res.error_description),
- attempt_status: None,
- connector_transaction_id: None,
- },
- bluesnap::BluesnapErrors::General(error_response) => {
- let (error_res, attempt_status) = if res.status_code == 403
- && error_response.contains(BLUESNAP_TRANSACTION_NOT_FOUND)
- {
- (
- format!(
- "{} in bluesnap dashboard",
- REQUEST_TIMEOUT_PAYMENT_NOT_FOUND
- ),
- Some(enums::AttemptStatus::Failure), // when bluesnap throws 403 for payment not found, we update the payment status to failure.
- )
- } else {
- (error_response.clone(), None)
+ let response_error_message = match response {
+ bluesnap::BluesnapErrors::Payment(error_response) => {
+ let error_list = error_response.message.clone();
+ let option_error_code_message =
+ get_error_code_error_message_based_on_priority(
+ self.clone(),
+ error_list.into_iter().map(|errors| errors.into()).collect(),
+ );
+ let reason = error_response
+ .message
+ .iter()
+ .map(|error| error.description.clone())
+ .collect::<Vec<String>>()
+ .join(" & ");
+ ErrorResponse {
+ status_code: res.status_code,
+ code: option_error_code_message
+ .clone()
+ .map(|error_code_message| error_code_message.error_code)
+ .unwrap_or(NO_ERROR_CODE.to_string()),
+ message: option_error_code_message
+ .map(|error_code_message| error_code_message.error_message)
+ .unwrap_or(NO_ERROR_MESSAGE.to_string()),
+ reason: Some(reason),
+ attempt_status: None,
+ connector_transaction_id: None,
+ }
+ }
+ bluesnap::BluesnapErrors::Auth(error_res) => ErrorResponse {
+ status_code: res.status_code,
+ code: error_res.error_code.clone(),
+ message: error_res.error_name.clone().unwrap_or(error_res.error_code),
+ reason: Some(error_res.error_description),
+ attempt_status: None,
+ connector_transaction_id: None,
+ },
+ bluesnap::BluesnapErrors::General(error_response) => {
+ let (error_res, attempt_status) = if res.status_code == 403
+ && error_response.contains(BLUESNAP_TRANSACTION_NOT_FOUND)
+ {
+ (
+ format!(
+ "{} in bluesnap dashboard",
+ REQUEST_TIMEOUT_PAYMENT_NOT_FOUND
+ ),
+ Some(enums::AttemptStatus::Failure), // when bluesnap throws 403 for payment not found, we update the payment status to failure.
+ )
+ } else {
+ (error_response.clone(), None)
+ };
+ ErrorResponse {
+ status_code: res.status_code,
+ code: NO_ERROR_CODE.to_string(),
+ message: error_response,
+ reason: Some(error_res),
+ attempt_status,
+ connector_transaction_id: None,
+ }
+ }
};
- ErrorResponse {
- status_code: res.status_code,
- code: NO_ERROR_CODE.to_string(),
- message: error_response,
- reason: Some(error_res),
- attempt_status,
- connector_transaction_id: None,
- }
+ Ok(response_error_message)
+ }
+ Err(error_msg) => {
+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));
+ router_env::logger::error!(deserialization_error =? error_msg);
+ handle_json_response_deserialization_failure(res, "bluesnap")
}
- };
- Ok(response_error_message)
+ }
}
}
|
2025-01-27T11:29:17Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
The code ensures any unexpected responses from the connector are appropriately logged and handled, providing meaningful and actionable error information to the caller.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
The Bluesnap Connector propagates errors received from its cloud service (Cloudflare). Cloudflare returns these errors in HTML format, and Bluesnap forwards them in the same HTML format. When an error is received in HTML format, the backend's deserialization fails because it expects the response to be in JSON format.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Unable to test 5xx error codes
Normal testing done through postman
1. Payment Connector - Create
Request -
```
curl --location 'http://localhost:8080/account/merchant_1737978930/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "payment_processor",
"connector_name": "bluesnap",
"connector_account_details": {
"auth_type": "BodyKey",
"api_key":"Hyperswitch_P4yments",
"key1":"API_16769616681841700433194"
},
"test_mode": false,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard",
"Interac",
"AmericanExpress",
"JCB",
"DinersClub",
"Discover",
"CartesBancaires",
"UnionPay"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "debit",
"card_networks": [
"AmericanExpress",
"Visa",
"Mastercard",
"Discover",
"Interac",
"JCB",
"DinersClub",
"UnionPay",
"RuPay"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
},
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "google_pay",
"payment_experience": "redirect_to_url",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "apple_pay",
"payment_experience": "redirect_to_url",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
},
{
"payment_method": "pay_later",
"payment_method_types": [
{
"payment_method_type": "klarna",
"payment_experience": "redirect_to_url",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "affirm",
"payment_experience": "redirect_to_url",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "afterpay_clearpay",
"payment_experience": "redirect_to_url",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
}
],
"metadata": {
"city": "NY",
"unit": "245"
},
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret"
},
"business_country": "US",
"business_label": "default"
}'
```
Response -
```
{
"connector_type": "payment_processor",
"connector_name": "bluesnap",
"connector_label": "bluesnap_US_default",
"merchant_connector_id": "mca_thvNFxLqnEvxlCuNYHHd",
"profile_id": "pro_y9tlfRoNqyKFoTv0jV7q",
"connector_account_details": {
"auth_type": "BodyKey",
"api_key": "Hy****************ts",
"key1": "AP***********************94"
},
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"payment_experience": null,
"card_networks": [
"Visa",
"Mastercard",
"Interac",
"AmericanExpress",
"JCB",
"DinersClub",
"Discover",
"CartesBancaires",
"UnionPay"
],
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "debit",
"payment_experience": null,
"card_networks": [
"AmericanExpress",
"Visa",
"Mastercard",
"Discover",
"Interac",
"JCB",
"DinersClub",
"UnionPay",
"RuPay"
],
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
},
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "google_pay",
"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
},
{
"payment_method_type": "apple_pay",
"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
}
]
},
{
"payment_method": "pay_later",
"payment_method_types": [
{
"payment_method_type": "klarna",
"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
},
{
"payment_method_type": "affirm",
"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
},
{
"payment_method_type": "afterpay_clearpay",
"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
}
]
}
],
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret",
"additional_secret": null
},
"metadata": {
"city": "NY",
"unit": "245"
},
"test_mode": false,
"disabled": false,
"frm_configs": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null
}
```
2A. Payments - Create (Successful Transaction)
Request -
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_5KAXSZnLdrlEc2TqZsnrEfcnQqo6DfAQssC12bYyQ446NkHIfrF9eS9D5zHGcNQd' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "bluesnapsavecard_123",
"email": "guest@example.com",
"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": "4263982640269299",
"card_exp_month": "4",
"card_exp_year": "26",
"card_holder_name": "joseph Doe",
"card_cvc": "738"
}
},
"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"
}
},
"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"
}
}'
```
Response -
```
{
"payment_id": "pay_GlBb0QHBglMPzrs7KUFH",
"merchant_id": "merchant_1737978930",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "bluesnap",
"client_secret": "pay_GlBb0QHBglMPzrs7KUFH_secret_EjtASO8UyEF7lbwqbBp3",
"created": "2025-01-27T12:14:05.253Z",
"currency": "USD",
"customer_id": "bluesnapsavecard_123",
"customer": {
"id": "bluesnapsavecard_123",
"name": null,
"email": "guest@example.com",
"phone": null,
"phone_country_code": null
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "9299",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "426398",
"card_extended_bin": null,
"card_exp_month": "4",
"card_exp_year": "26",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_Nf1u8P35zmlUmjQeySy1",
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": null
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "bluesnapsavecard_123",
"created_at": 1737980045,
"expires": 1737983645,
"secret": "epk_986f5561194a4f0099af0a64b111798c"
},
"manual_retry_allowed": false,
"connector_transaction_id": "1072270280",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "1072270280",
"payment_link": null,
"profile_id": "pro_y9tlfRoNqyKFoTv0jV7q",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_thvNFxLqnEvxlCuNYHHd",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-27T12:29:05.253Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-27T12:14:09.598Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
2B. Payments - Create (Failed Transaction, producing error)
Request -
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_5KAXSZnLdrlEc2TqZsnrEfcnQqo6DfAQssC12bYyQ446NkHIfrF9eS9D5zHGcNQd' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "bluesnapsavecard_123",
"email": "guest@example.com",
"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": "4347699988887777",
"card_exp_month": "1",
"card_exp_year": "26",
"card_holder_name": "joseph Doe",
"card_cvc": "555"
}
},
"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"
}
},
"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"
}
}'
```
Response -
```
{
"amount": 6540,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "bluesnapsavecard_123",
"email": "guest@example.com",
"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": "4347699988887777",
"card_exp_month": "1",
"card_exp_year": "26",
"card_holder_name": "joseph Doe",
"card_cvc": "555"
}
},
"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"
}
},
"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"
}
}
```
Cypress Test
<img width="842" alt="Screenshot 2025-01-30 at 13 02 43" src="https://github.com/user-attachments/assets/e81ccafb-1f51-44db-9199-d4b97405050d" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3da637e6960f73a3a69aef98b9de2e6de01fcb5e
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7161
|
Bug: Postman Connector Integration Tests Failing
Several Postman integration tests are failing. The issue needs analyzing to determine the reasons of the failures.
### **Observation**
#### **Failed Tests**
- `postman-test-adyen_uk-INTEGRATION`
- `postman-test-cybersource-INTEGRATION`
- `postman-test-nmi-INTEGRATION`
- `postman-test-payme-INTEGRATION`
- `postman-test-paypal-INTEGRATION`
- `postman-test-stripe-INTEGRATION`
- `postman-test-trustpay-INTEGRATION`
#### **Successful Tests**
- `postman-test-bluesnap-INTEGRATION`
- `postman-test-checkout-INTEGRATION`
- `postman-test-users-INTEGRATION`
### **Expected Behavior**
All Postman Connector Integrations should pass successfully if the APIs are functioning correctly.
### **Actual Behavior**
Multiple tests (mentioned above) are failing.
|
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index f1199e53330..3175fdd1dd5 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -40,7 +40,7 @@
"card": {
"card_number": "4242424242424242",
"card_exp_month": "01",
- "card_exp_year": "25",
+ "card_exp_year": "35",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js
index 962c263b0c4..a5befc1b69b 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js
@@ -51,12 +51,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
index 48276c3fd67..c359d358cc3 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
@@ -47,12 +47,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "Succeeded" for "status"
+// Response body should have value "processing" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
@@ -82,12 +82,12 @@ if (jsonData?.amount_received) {
);
}
-// Response body should have value "0" for "amount_capturable"
+// Response body should have value full amount for "amount_capturable"
if (jsonData?.amount) {
pm.test(
"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
function () {
- pm.expect(jsonData.amount_capturable).to.eql(0);
+ pm.expect(jsonData.amount_capturable).to.eql(jsonData.amount);
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js
index b3499d9a0d1..793ef9732aa 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js
@@ -1,6 +1,6 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 2xx", function () {
- pm.response.to.be.success;
+// Validate status 4xx
+pm.test("[POST]::/refunds - Status code is 4xx", function () {
+ pm.response.to.have.status(400);
});
// Validate if response header has matching content-type
@@ -24,6 +24,13 @@ if (jsonData?.refund_id) {
jsonData.refund_id,
);
} else {
+ pm.collectionVariables.set("refund_id", null);
+ pm.test(
+ "[POST]::/refunds - Content check if 'error.message' matches 'This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured'",
+ function () {
+ pm.expect(jsonData.error.message).to.eql("This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured");
+ },
+ );
console.log(
"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
);
@@ -48,8 +55,3 @@ if (jsonData?.status) {
},
);
}
-
-// Validate the connector
-pm.test("[POST]::/payments - connector", function () {
- pm.expect(jsonData.connector).to.eql("cybersource");
-});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js
index cce8d2b8ea9..aa1df1bab97 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js
@@ -1,6 +1,6 @@
-// Validate status 2xx
-pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
+// Validate status 4xx
+pm.test("[POST]::/refunds - Status code is 4xx", function () {
+ pm.response.to.have.status(404);
});
// Validate if response header has matching content-type
@@ -16,19 +16,6 @@ try {
jsonData = pm.response.json();
} catch (e) {}
-// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
// Response body should have value "pending" for "status"
if (jsonData?.status) {
pm.test(
@@ -39,12 +26,19 @@ if (jsonData?.status) {
);
}
-// Response body should have value "6540" for "amount"
-if (jsonData?.status) {
+// Response body should have value "540" for "amount"
+if (jsonData?.status && pm.collectionVariables.get("refund_id") !== null) {
pm.test(
"[POST]::/refunds - Content check if value for 'amount' matches '540'",
function () {
pm.expect(jsonData.amount).to.eql(540);
},
);
+} else {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'error.message' matches 'Refund does not exist in our records.'",
+ function () {
+ pm.expect(jsonData.error.message).to.eql("Refund does not exist in our records.");
+ },
+ );
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json
index dbc19ce0181..1480a1b6c1f 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json
@@ -51,7 +51,7 @@
"card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
- "card_holder_name": "CLBRW1",
+ "card_holder_name": "Juspay Hyperswitch",
"card_cvc": "737"
}
},
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/.meta.json
deleted file mode 100644
index f429c3305a2..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/.meta.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "childrenOrder": [
- "Payments-Create",
- "Incremental Authorization",
- "Payments - Retrieve",
- "Payments - Capture",
- "Refunds - Create",
- "Refunds - Retrieve"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/event.test.js
deleted file mode 100644
index dbf6517a0de..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/event.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'amount' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
-});
-
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'status' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
-});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/request.json
deleted file mode 100644
index 7370c98307d..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/request.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1001
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- "{{payment_id}}",
- "incremental_authorization"
- ]
- }
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/event.test.js
deleted file mode 100644
index 772fa019b9f..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/event.test.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test(
- "[POST]::/payments/:id/capture - Content-Type is application/json",
- function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
- },
-);
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "1001" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
- function () {
- pm.expect(jsonData.amount).to.eql(1001);
- },
- );
-}
-
-// Response body should have value "1001" for "amount_received"
-if (jsonData?.amount_received) {
- pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'",
- function () {
- pm.expect(jsonData.amount_received).to.eql(1001);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/request.json
deleted file mode 100644
index 236b80311e2..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/request.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount_to_capture": 1001,
- "statement_descriptor_name": "Joseph",
- "statement_descriptor_suffix": "JS"
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "capture"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To capture the funds for an uncaptured payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/event.test.js
deleted file mode 100644
index 41883b25ac7..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/event.test.js
+++ /dev/null
@@ -1,35 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/request.json
deleted file mode 100644
index 7a24f361249..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/request.json
+++ /dev/null
@@ -1,130 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- },
- {
- "key": "Authorization",
- "value": "",
- "type": "text",
- "disabled": true
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1000,
- "currency": "USD",
- "confirm": true,
- "capture_method": "manual",
- "customer_id": "{{customer_id}}",
- "email": "p143@example.com",
- "amount_to_capture": 1000,
- "description": "Its my first payment request",
- "capture_on": "2022-09-10T10:11:12Z",
- "return_url": "https://google.com",
- "name": "Preetam",
- "phone": "999999999",
- "phone_country_code": "+65",
- "authentication_type": "no_three_ds",
- "payment_method": "card",
- "payment_method_type": "debit",
- "payment_method_data": {
- "card": {
- "card_number": "4111111111111111",
- "card_exp_month": "09",
- "card_exp_year": "2027",
- "card_holder_name": "",
- "card_cvc": "975"
- }
- },
- "connector_metadata": {
- "noon": {
- "order_category": "pay"
- }
- },
- "browser_info": {
- "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
- "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
- "language": "nl-NL",
- "color_depth": 24,
- "screen_height": 723,
- "screen_width": 1536,
- "time_zone": 0,
- "java_enabled": true,
- "java_script_enabled": true,
- "ip_address": "128.0.0.1"
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "preetam",
- "last_name": "revankar"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "joseph",
- "last_name": "Doe"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "order_details": [
- {
- "product_name": "Apple iphone 15",
- "quantity": 1,
- "amount": 1000,
- "account_name": "transaction_processing"
- }
- ],
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS",
- "request_incremental_authorization": true,
- "metadata": {
- "count_tickets": 1,
- "transaction_number": "5590045"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/event.test.js
deleted file mode 100644
index 8cf4006b877..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/event.test.js
+++ /dev/null
@@ -1,41 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
-
-
-// Response body should have value "requires_capture" for "status"
-if (jsonData?.status) {
-pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
- pm.expect(jsonData.status).to.eql("requires_capture");
-})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/request.json
deleted file mode 100644
index 5b5a18ce870..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "expand_attempts",
- "value": "true"
- },
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/event.test.js
deleted file mode 100644
index 5b54b717e2d..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/refunds - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "pending" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
- function () {
- pm.expect(jsonData.status).to.eql("pending");
- },
- );
-}
-
-// Response body should have value "1001" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
- function () {
- pm.expect(jsonData.amount).to.eql(1001);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/request.json
deleted file mode 100644
index d48ee5a25bc..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/request.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "payment_id": "{{payment_id}}",
- "amount": 1001,
- "reason": "Customer returned product",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds"
- ]
- },
- "description": "To create a refund against an already processed payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/event.test.js
deleted file mode 100644
index 2b906dedf6c..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/refunds/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "pending" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
- function () {
- pm.expect(jsonData.status).to.eql("pending");
- },
- );
-}
-
-// Response body should have value "1001" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '1001'",
- function () {
- pm.expect(jsonData.amount).to.eql(1001);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/request.json
deleted file mode 100644
index 6c28619e856..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/refunds/:id",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
- ]
- },
- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/List payment methods for a Merchant/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Verify PML for mandate/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/.meta.json
deleted file mode 100644
index 522a1196294..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/.meta.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "childrenOrder": [
- "Payments - Create",
- "Incremental Authorization",
- "Payments - Retrieve",
- "Payments - Capture"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/event.test.js
deleted file mode 100644
index dbf6517a0de..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/event.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'amount' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
-});
-
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'status' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
-});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/request.json
deleted file mode 100644
index 7370c98307d..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/request.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1001
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- "{{payment_id}}",
- "incremental_authorization"
- ]
- }
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/event.test.js
deleted file mode 100644
index 772fa019b9f..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/event.test.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test(
- "[POST]::/payments/:id/capture - Content-Type is application/json",
- function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
- },
-);
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "1001" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
- function () {
- pm.expect(jsonData.amount).to.eql(1001);
- },
- );
-}
-
-// Response body should have value "1001" for "amount_received"
-if (jsonData?.amount_received) {
- pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'",
- function () {
- pm.expect(jsonData.amount_received).to.eql(1001);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/request.json
deleted file mode 100644
index 236b80311e2..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/request.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount_to_capture": 1001,
- "statement_descriptor_name": "Joseph",
- "statement_descriptor_suffix": "JS"
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "capture"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To capture the funds for an uncaptured payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/event.test.js
deleted file mode 100644
index 41883b25ac7..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/event.test.js
+++ /dev/null
@@ -1,35 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/request.json
deleted file mode 100644
index 7a24f361249..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/request.json
+++ /dev/null
@@ -1,130 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- },
- {
- "key": "Authorization",
- "value": "",
- "type": "text",
- "disabled": true
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1000,
- "currency": "USD",
- "confirm": true,
- "capture_method": "manual",
- "customer_id": "{{customer_id}}",
- "email": "p143@example.com",
- "amount_to_capture": 1000,
- "description": "Its my first payment request",
- "capture_on": "2022-09-10T10:11:12Z",
- "return_url": "https://google.com",
- "name": "Preetam",
- "phone": "999999999",
- "phone_country_code": "+65",
- "authentication_type": "no_three_ds",
- "payment_method": "card",
- "payment_method_type": "debit",
- "payment_method_data": {
- "card": {
- "card_number": "4111111111111111",
- "card_exp_month": "09",
- "card_exp_year": "2027",
- "card_holder_name": "",
- "card_cvc": "975"
- }
- },
- "connector_metadata": {
- "noon": {
- "order_category": "pay"
- }
- },
- "browser_info": {
- "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
- "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
- "language": "nl-NL",
- "color_depth": 24,
- "screen_height": 723,
- "screen_width": 1536,
- "time_zone": 0,
- "java_enabled": true,
- "java_script_enabled": true,
- "ip_address": "128.0.0.1"
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "preetam",
- "last_name": "revankar"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "joseph",
- "last_name": "Doe"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "order_details": [
- {
- "product_name": "Apple iphone 15",
- "quantity": 1,
- "amount": 1000,
- "account_name": "transaction_processing"
- }
- ],
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS",
- "request_incremental_authorization": true,
- "metadata": {
- "count_tickets": 1,
- "transaction_number": "5590045"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/event.test.js
deleted file mode 100644
index 8cf4006b877..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/event.test.js
+++ /dev/null
@@ -1,41 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
-
-
-// Response body should have value "requires_capture" for "status"
-if (jsonData?.status) {
-pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
- pm.expect(jsonData.status).to.eql("requires_capture");
-})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/request.json
deleted file mode 100644
index 5b5a18ce870..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "expand_attempts",
- "value": "true"
- },
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/List - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Revoke mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/request.json
similarity index 98%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/request.json
index 48692ab2b3e..96fd92bff03 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/request.json
@@ -49,7 +49,7 @@
"card": {
"card_number": "4000000000001000",
"card_exp_month": "01",
- "card_exp_year": "25",
+ "card_exp_year": "35",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Create 3ds payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/.meta.json
deleted file mode 100644
index 784f5e06db4..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/.meta.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "childrenOrder": [
- "Payments - Create",
- "Incremental Authorization",
- "Payments - Retrieve",
- "Payments - Capture",
- "Refunds - Create",
- "Refunds - Retrieve"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/event.test.js
deleted file mode 100644
index dbf6517a0de..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/event.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'amount' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
-});
-
-pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
- // Parse the response JSON
- var jsonData = pm.response.json();
-
- // Check if the 'status' in the response matches the expected value
- pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
-});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/request.json
deleted file mode 100644
index 7370c98307d..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/request.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1001
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- "{{payment_id}}",
- "incremental_authorization"
- ]
- }
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/event.test.js
deleted file mode 100644
index 70312d39fe2..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/event.test.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test(
- "[POST]::/payments/:id/capture - Content-Type is application/json",
- function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
- },
-);
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "partially_captured" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
- function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
- },
- );
-}
-
-// Response body should have value "1001" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
- function () {
- pm.expect(jsonData.amount).to.eql(1001);
- },
- );
-}
-
-// Response body should have value "500" for "amount_received"
-if (jsonData?.amount_received) {
- pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '500'",
- function () {
- pm.expect(jsonData.amount_received).to.eql(500);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/request.json
deleted file mode 100644
index 4f054db2954..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/request.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount_to_capture": 500,
- "statement_descriptor_name": "Joseph",
- "statement_descriptor_suffix": "JS"
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "capture"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To capture the funds for an uncaptured payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/event.test.js
deleted file mode 100644
index 41883b25ac7..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/event.test.js
+++ /dev/null
@@ -1,35 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/request.json
deleted file mode 100644
index 2bb53f5fc53..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/request.json
+++ /dev/null
@@ -1,150 +0,0 @@
-{
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{api_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- },
- {
- "key": "Authorization",
- "value": "",
- "type": "text",
- "disabled": true
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 1000,
- "currency": "USD",
- "confirm": true,
- "capture_method": "manual",
- "customer_id": "{{customer_id}}",
- "email": "p143@example.com",
- "amount_to_capture": 1000,
- "description": "Its my first payment request",
- "capture_on": "2022-09-10T10:11:12Z",
- "return_url": "https://google.com",
- "name": "Preetam",
- "phone": "999999999",
- "phone_country_code": "+65",
- "authentication_type": "no_three_ds",
- "payment_method": "card",
- "payment_method_type": "debit",
- "payment_method_data": {
- "card": {
- "card_number": "4111111111111111",
- "card_exp_month": "09",
- "card_exp_year": "2027",
- "card_holder_name": "",
- "card_cvc": "975"
- }
- },
- "connector_metadata": {
- "noon": {
- "order_category": "pay"
- }
- },
- "browser_info": {
- "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
- "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
- "language": "nl-NL",
- "color_depth": 24,
- "screen_height": 723,
- "screen_width": 1536,
- "time_zone": 0,
- "java_enabled": true,
- "java_script_enabled": true,
- "ip_address": "128.0.0.1"
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "preetam",
- "last_name": "revankar"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "PL",
- "first_name": "joseph",
- "last_name": "Doe"
- },
- "phone": {
- "number": "9123456789",
- "country_code": "+91"
- }
- },
- "order_details": [
- {
- "product_name": "Apple iphone 15",
- "quantity": 1,
- "amount": 1000,
- "account_name": "transaction_processing"
- }
- ],
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS",
- "request_incremental_authorization": true,
- "metadata": {
- "count_tickets": 1,
- "transaction_number": "5590045"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/event.test.js
deleted file mode 100644
index 8cf4006b877..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/event.test.js
+++ /dev/null
@@ -1,41 +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 client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
-} else {
- console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
-};
-
-
-// Response body should have value "requires_capture" for "status"
-if (jsonData?.status) {
-pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
- pm.expect(jsonData.status).to.eql("requires_capture");
-})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/request.json
deleted file mode 100644
index 5b5a18ce870..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "expand_attempts",
- "value": "true"
- },
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/event.test.js
deleted file mode 100644
index 98db0f1b7a5..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/refunds - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "pending" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
- function () {
- pm.expect(jsonData.status).to.eql("pending");
- },
- );
-}
-
-// Response body should have value "500" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '500'",
- function () {
- pm.expect(jsonData.amount).to.eql(500);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/request.json
deleted file mode 100644
index 241a13121e9..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/request.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "payment_id": "{{payment_id}}",
- "amount": 500,
- "reason": "Customer returned product",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds"
- ]
- },
- "description": "To create a refund against an already processed payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/event.test.js
deleted file mode 100644
index 437b5a3c487..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/refunds/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "pending" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
- function () {
- pm.expect(jsonData.status).to.eql("pending");
- },
- );
-}
-
-// Response body should have value "500" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '500'",
- function () {
- pm.expect(jsonData.amount).to.eql(500);
- },
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/request.json
deleted file mode 100644
index 6c28619e856..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/refunds/:id",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
- ]
- },
- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Create 3ds mandate/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Confirm/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
index 44a6caa3e3a..c48127e8cd0 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
@@ -50,12 +50,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status" while capturing a payment manually
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
index f88687240aa..c64b962a3cf 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
@@ -47,12 +47,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status" while capturing a payment manually
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js
index ad7ec549dd5..7ac33d76eae 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js
@@ -50,12 +50,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status" while partially capturing a payment
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js
index 27ce6277ba8..f256a9a417f 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js
@@ -47,12 +47,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status" while partially capturing a payment
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]::/payments - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js
index 44a6caa3e3a..b5c042e78c8 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js
@@ -50,12 +50,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status" in case of Manual capture for recurring payments
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js
index fe8fa706b96..952a7f0bfb4 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js
@@ -48,12 +48,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "Succeeded" for "status"
+// Response body should have value "processing" for "status" while retrieving a payment captured manually
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json
index 03891f4045c..35bf67cdd4e 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -48,6 +48,7 @@
},
"test_mode": false,
"disabled": false,
+ "metadata": {},
"payment_methods_enabled": [
{
"payment_method": "card",
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/event.test.js
similarity index 93%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/event.test.js
index ad7ec549dd5..f8451fe02ef 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/event.test.js
@@ -50,12 +50,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "succeeded" for "status"
+// Response body should have value "processing" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Capture/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/event.test.js
similarity index 91%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/event.test.js
index 550547e3399..678c058ebfd 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/event.test.js
@@ -47,12 +47,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "Succeeded" for "status"
+// Response body should have value "processing" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/event.test.js
similarity index 74%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/event.test.js
index 07721f97af3..6809c1e704c 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/event.test.js
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/event.test.js
@@ -47,12 +47,12 @@ if (jsonData?.error?.type) {
);
}
-// Response body should have value "The refund amount exceeds the amount captured" for "error message"
+// Response body should have value "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured" for "error message"
if (jsonData?.error?.type) {
pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'error.message' matches 'The refund amount exceeds the amount captured'",
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.message' matches 'This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured'",
function () {
- pm.expect(jsonData.error.message).to.eql("The refund amount exceeds the amount captured");
+ pm.expect(jsonData.error.message).to.eql("This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured");
},
);
}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Refunds - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/List - Mandates/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Revoke for revoked mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Recurring payment for revoked mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Revoke - Mandates/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is null for normal payments/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is null for normal payments/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario6-Refund exceeds amount/Refunds - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Capture/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund for unsuccessful payment/Refunds - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Revoke - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Refund exceeds amount captured/Refunds - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Setup_future_usage is off_session for normal payments/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Recurring payment for revoked mandates/Recurring Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Manual multiple capture/Payments - Create/response.json
diff --git a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/event.test.js b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/event.test.js
index b62f99d61fd..b07811aed26 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/event.test.js
+++ b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/event.test.js
@@ -36,7 +36,7 @@ if (jsonData?.error?.message) {
pm.test(
"[POST]::/payments/:id/confirm - Content check if value for 'error.reason' matches ' mandate payment is not supported by nmi'" ,
function () {
- pm.expect(jsonData.error.reason).to.eql(" mandate payment is not supported by nmi");
+ pm.expect(jsonData.error.reason).to.eql("credit mandate payment is not supported by nmi");
},
);
}
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
index 0652a2d92fd..999814916d9 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
@@ -68,4 +68,4 @@ if (jsonData?.status) {
pm.expect(jsonData.status).to.eql("succeeded");
},
);
-}
+}
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.prerequest.js
new file mode 100644
index 00000000000..8b106df67e0
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.prerequest.js
@@ -0,0 +1,4 @@
+// Add a delay of 10 seconds
+setTimeout(function () {
+ console.log("Delay of 10 seconds completed.");
+}, 10000);
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Create/event.test.js
index a6947db94c0..efb9b6ee803 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Create/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Create/event.test.js
@@ -59,3 +59,13 @@ if (jsonData?.client_secret) {
"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");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
index d0a02af7436..58ce99b81da 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
@@ -59,3 +59,13 @@ if (jsonData?.client_secret) {
"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
);
}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.prerequest.js
new file mode 100644
index 00000000000..8b106df67e0
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.prerequest.js
@@ -0,0 +1,4 @@
+// Add a delay of 10 seconds
+setTimeout(function () {
+ console.log("Delay of 10 seconds completed.");
+}, 10000);
\ No newline at end of file
diff --git a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.test.js
index dbc930608cb..05e511d3135 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Create/event.test.js
@@ -28,3 +28,23 @@ if (jsonData?.refund_id) {
"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
);
}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "600" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '600'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(600);
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
index bbd8e544e2c..0b562c615dc 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
@@ -28,3 +28,23 @@ if (jsonData?.refund_id) {
"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
);
}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "600" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '600'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(600);
+ },
+ );
+}
|
2025-01-31T18:42:38Z
|
## Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Motivation and Context
## How did you test it?
### Connector:`adyen_uk`
<img width="1270" alt="image" src="https://github.com/user-attachments/assets/b4886786-5f02-4657-8d74-dee18ee45734" />
_**Note:** The `Sofort` Test Cases are removed in PR #7099 after being deprecated by `adyen` connector._
<img width="500" alt="image" src="https://github.com/user-attachments/assets/20641a84-fdba-440e-bc6b-6ec5f3a248a7" />
### Connector:`bluesnap`
<img width="500" alt="image" src="https://github.com/user-attachments/assets/4ac36593-17a9-430c-84ac-22a2090f58c1" />
### Connector:`cybersource`
_Before_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/897fd331-ae52-46df-b03f-60fa835f7bf6" />
<details>
<summary>Changes</summary>
- Updated `card_exp_year` from `25` to `35` in `postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json` because `01/25` is not a valid expiration anymore.
- Manual Capture in `Cybersource` connector takes upto 24 hours to show `succeeded` or `failed` status. So, it remains in `pending` status.
- And, because the Payment with Manual Capture does not get a status `succeeded` anytime soon, Payments can not be Refunded anytime soon.
- A `Refunds - Retrieve` assertion was failing due to the `refund_id` issue in the `Refunds - Create`. Because it was assigned with the `refund_id` value of `Scenario9-Add card flow/Refunds - Create` which had the amount of `600`, the assertion in this conditional statement was failing expecting it to be `540` according to the request created in `Scenario11-Save card payment with manual capture`.
- However, added an assertion to check the Error Message.
- In `postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json`, adding a string without space between considers it as the first name and throws `Declined - The request is missing one or more fields, detailed_error_information: orderInformation.billTo.lastName : MISSING_FIELD`, So added a space in the `card_holder_name` string making it have a `firstName` and a `lastName`.
- Removed Incremental Auth Flows because you don't have the required credentials to pass the flows.
- Added `"metadata": {}` in `postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json` because without it, `The metadata is invalid` error message is thrown.
</details>
_After_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/7f8cf1a1-38fd-4c6e-8885-b7befa0ad614" />
### Connector:`nmi`
_Before_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/9f2d01b8-b8db-4353-8e31-13c9b0fe1bb5" />
<details>
<summary>Changes</summary>
- An error reason was expected to be `"credit mandate payment is not supported by nmi"` instead of `"mandate payment is not supported by nmi"`.
</details>
_After_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/5e4d596a-7a1b-400c-b0e1-50179392ae10" />
### Connector: `paypal`
<img width="500" alt="image" src="https://github.com/user-attachments/assets/cd3c0a0b-2a73-447d-bb1c-570530bc96fe" />
### Connector: `stripe`
Failing too inconsistently. Different number of test cases are failing. It is not even the same test cases each time it fails.
### Connector: `trustpay`
_Before_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/8807d1fc-d845-4ea3-b8ba-d922bdd63af4" />
<details>
<summary>Changes</summary>
- Added assertions to verify Payments and Refunds status to be succeeded.
- Added assertions to verify the amount in Refunds.
- Added Delay in Payments - Retrieve so that we can initiate Refunds.
</details>
_After_
<img width="500" alt="image" src="https://github.com/user-attachments/assets/7e402564-0758-421b-8e79-6b9d6eb7ee99" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
6e19a9b48af67f39e632f8b94d2b92a59f98e37b
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7112
|
Bug: [FEATURE] Card Testing Guard
### Feature Description
We have implemented three rules for detecting and preventing this card testing attacks:
I) Card <> IP Blocking for Merchant : If there are X number of unsuccessful payment attempts from a single IP Address for a specific merchant, then that combination of Card <> IP will be blocked for that merchant for a particular duration.
II) Card Blocking for Guest Users for Merchant: If there are X number of unsuccessful payment attempts for a single card, then guest user payments will be blocked for that card and that merchant for a particular duration. Logged in customers will still be able to use that card for payment.
III) Customer ID Blocking for Merchant: If there are X number of unsuccessful payment attempts from a single Customer ID, then that customer ID will be blocked from making any payments for a particular duration.
These unsuccessful payment thresholds and duration for blocking is configurable and stored in database.
Whether the merchants want these rules to be enabled/disabled, that is also configurable.
### Possible Implementation
The attacker gets the `client_secret` from the payment intent create call which happens through our SDK, and uses the `client_secret` to hit the /confirm API repeatedly with different sets of card numbers and CVC.
A method validate_request_with_state has been created in the `GetTracker` trait which enforces the three above mentioned rules depending on the `business_profile` config. The `validate_request_with_state` method internally calls `validate_card_ip_blocking_for_business_profile` method, `validate_guest_user_card_blocking_for_business_profile` method and `validate_customer_id_blocking_for_business_profile` method for performing the below validations:
I) Card<>IP Blocking: A fingerprint is generated for the card which is unique to the `business_profile` (by using a hash key which is unique to the profile and stored as `card_testing_secret_key` in `business_profile`). This is done so that the cards are blocked at a profile level. The IP Address is fetched from the payment intent create request, and then for each unsuccessful payment attempt, the value of the redis key CardFingerprint<>IP is increased by 1, and after it reaches a certain threshold, it is blocked.
II) Guest User Card Blocking: A fingerprint is generated for the card which is unique to the `business_profile` (by using a hash key which is unique to the profile and stored as `card_testing_secret_key` in `business_profile`). This is done so that the cards are not blocked at a profile level. For each unsuccessful payment attempt, the value of the redis key CardFingerprint is increased by 1, and after it reaches a certain threshold, it is blocked, but only for guest users. Logged in customers can still make payments with that card.
III) Customer ID Blocking: The `customer_id` is fetched from the payment intent create call request, and then for each unsuccessful payment attempt, the value of redis key CardFingerprint<>Profile is increased by 1, and after it reaches a certain threshold, it is blocked.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index aebc0b38c27..f81eca420a0 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7096,6 +7096,56 @@
}
}
},
+ "CardTestingGuardConfig": {
+ "type": "object",
+ "required": [
+ "card_ip_blocking_status",
+ "card_ip_blocking_threshold",
+ "guest_user_card_blocking_status",
+ "guest_user_card_blocking_threshold",
+ "customer_id_blocking_status",
+ "customer_id_blocking_threshold",
+ "card_testing_guard_expiry"
+ ],
+ "properties": {
+ "card_ip_blocking_status": {
+ "$ref": "#/components/schemas/CardTestingGuardStatus"
+ },
+ "card_ip_blocking_threshold": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Determines the unsuccessful payment threshold for Card IP Blocking for profile"
+ },
+ "guest_user_card_blocking_status": {
+ "$ref": "#/components/schemas/CardTestingGuardStatus"
+ },
+ "guest_user_card_blocking_threshold": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Determines the unsuccessful payment threshold for Guest User Card Blocking for profile"
+ },
+ "customer_id_blocking_status": {
+ "$ref": "#/components/schemas/CardTestingGuardStatus"
+ },
+ "customer_id_blocking_threshold": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Determines the unsuccessful payment threshold for Customer Id Blocking for profile"
+ },
+ "card_testing_guard_expiry": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Determines Redis Expiry for Card Testing Guard for profile"
+ }
+ }
+ },
+ "CardTestingGuardStatus": {
+ "type": "string",
+ "enum": [
+ "enabled",
+ "disabled"
+ ]
+ },
"CardToken": {
"type": "object",
"required": [
@@ -18592,6 +18642,14 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
+ },
+ "card_testing_guard_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CardTestingGuardConfig"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -18816,6 +18874,14 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
+ },
+ "card_testing_guard_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CardTestingGuardConfig"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 77488262c75..be7841fe5e1 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -238,6 +238,31 @@ impl MerchantAccountCreate {
}
}
+#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
+pub struct CardTestingGuardConfig {
+ /// Determines if Card IP Blocking is enabled for profile
+ pub card_ip_blocking_status: CardTestingGuardStatus,
+ /// Determines the unsuccessful payment threshold for Card IP Blocking for profile
+ pub card_ip_blocking_threshold: i32,
+ /// Determines if Guest User Card Blocking is enabled for profile
+ pub guest_user_card_blocking_status: CardTestingGuardStatus,
+ /// Determines the unsuccessful payment threshold for Guest User Card Blocking for profile
+ pub guest_user_card_blocking_threshold: i32,
+ /// Determines if Customer Id Blocking is enabled for profile
+ pub customer_id_blocking_status: CardTestingGuardStatus,
+ /// Determines the unsuccessful payment threshold for Customer Id Blocking for profile
+ pub customer_id_blocking_threshold: i32,
+ /// Determines Redis Expiry for Card Testing Guard for profile
+ pub card_testing_guard_expiry: i32,
+}
+
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum CardTestingGuardStatus {
+ Enabled,
+ Disabled,
+}
+
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct AuthenticationConnectorDetails {
/// List of authentication connectors
@@ -1912,6 +1937,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[nutype::nutype(
@@ -2030,6 +2058,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v1")]
@@ -2171,6 +2202,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v2")]
@@ -2295,6 +2329,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v1")]
@@ -2426,6 +2463,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v2")]
@@ -2538,6 +2578,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+
+ /// Card Testing Guard Configs
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index fdda26cc77c..3ccf39a6068 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -152,3 +152,24 @@ pub const X_REQUEST_ID: &str = "x-request-id";
/// Default Tenant ID for the `Global` tenant
pub const DEFAULT_GLOBAL_TENANT_ID: &str = "global";
+
+/// Default status of Card IP Blocking
+pub const DEFAULT_CARD_IP_BLOCKING_STATUS: bool = false;
+
+/// Default Threshold for Card IP Blocking
+pub const DEFAULT_CARD_IP_BLOCKING_THRESHOLD: i32 = 3;
+
+/// Default status of Guest User Card Blocking
+pub const DEFAULT_GUEST_USER_CARD_BLOCKING_STATUS: bool = false;
+
+/// Default Threshold for Card Blocking for Guest Users
+pub const DEFAULT_GUEST_USER_CARD_BLOCKING_THRESHOLD: i32 = 10;
+
+/// Default status of Customer ID Blocking
+pub const DEFAULT_CUSTOMER_ID_BLOCKING_STATUS: bool = false;
+
+/// Default Threshold for Customer ID Blocking
+pub const DEFAULT_CUSTOMER_ID_BLOCKING_THRESHOLD: i32 = 5;
+
+/// Default Card Testing Guard Redis Expiry in seconds
+pub const DEFAULT_CARD_TESTING_GUARD_EXPIRY_IN_SECS: i32 = 3600;
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 92da1978458..fdded6a3a34 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -61,6 +61,8 @@ pub struct Profile {
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
#[cfg(feature = "v1")]
@@ -107,6 +109,8 @@ pub struct ProfileNew {
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
#[cfg(feature = "v1")]
@@ -151,6 +155,8 @@ pub struct ProfileUpdateInternal {
pub is_click_to_pay_enabled: Option<bool>,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
#[cfg(feature = "v1")]
@@ -193,6 +199,8 @@ impl ProfileUpdateInternal {
always_request_extended_authorization,
is_click_to_pay_enabled,
authentication_product_ids,
+ card_testing_guard_config,
+ card_testing_secret_key,
} = self;
Profile {
profile_id: source.profile_id,
@@ -258,6 +266,9 @@ impl ProfileUpdateInternal {
.unwrap_or(source.is_click_to_pay_enabled),
authentication_product_ids: authentication_product_ids
.or(source.authentication_product_ids),
+ card_testing_guard_config: card_testing_guard_config
+ .or(source.card_testing_guard_config),
+ card_testing_secret_key,
}
}
}
@@ -317,6 +328,8 @@ pub struct Profile {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
impl Profile {
@@ -379,6 +392,8 @@ pub struct ProfileNew {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
#[cfg(feature = "v2")]
@@ -425,6 +440,8 @@ pub struct ProfileUpdateInternal {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: Option<Encryption>,
}
#[cfg(feature = "v2")]
@@ -469,6 +486,8 @@ impl ProfileUpdateInternal {
is_click_to_pay_enabled,
authentication_product_ids,
three_ds_decision_manager_config,
+ card_testing_guard_config,
+ card_testing_secret_key,
} = self;
Profile {
id: source.id,
@@ -540,6 +559,9 @@ impl ProfileUpdateInternal {
.or(source.authentication_product_ids),
three_ds_decision_manager_config: three_ds_decision_manager_config
.or(source.three_ds_decision_manager_config),
+ card_testing_guard_config: card_testing_guard_config
+ .or(source.card_testing_guard_config),
+ card_testing_secret_key: card_testing_secret_key.or(source.card_testing_secret_key),
}
}
}
@@ -553,6 +575,20 @@ pub struct AuthenticationConnectorDetails {
common_utils::impl_to_sql_from_sql_json!(AuthenticationConnectorDetails);
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
+#[diesel(sql_type = diesel::sql_types::Jsonb)]
+pub struct CardTestingGuardConfig {
+ pub is_card_ip_blocking_enabled: bool,
+ pub card_ip_blocking_threshold: i32,
+ pub is_guest_user_card_blocking_enabled: bool,
+ pub guest_user_card_blocking_threshold: i32,
+ pub is_customer_id_blocking_enabled: bool,
+ pub customer_id_blocking_threshold: i32,
+ pub card_testing_guard_expiry: i32,
+}
+
+common_utils::impl_to_sql_from_sql_json!(CardTestingGuardConfig);
+
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Json)]
pub struct WebhookDetails {
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index cfc0f28e4d0..57c43a1955b 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -219,6 +219,8 @@ diesel::table! {
always_request_extended_authorization -> Nullable<Bool>,
is_click_to_pay_enabled -> Bool,
authentication_product_ids -> Nullable<Jsonb>,
+ card_testing_guard_config -> Nullable<Jsonb>,
+ card_testing_secret_key -> Nullable<Bytea>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 69ba37e8df6..2351bdb83c9 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -228,6 +228,8 @@ diesel::table! {
is_click_to_pay_enabled -> Bool,
authentication_product_ids -> Nullable<Jsonb>,
three_ds_decision_manager_config -> Nullable<Jsonb>,
+ card_testing_guard_config -> Nullable<Jsonb>,
+ card_testing_secret_key -> Nullable<Bytea>,
}
}
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 4a6a84124a7..07fd0a9fd90 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1,5 +1,5 @@
use common_utils::{
- crypto::OptionalEncryptableValue,
+ crypto::{OptionalEncryptableName, OptionalEncryptableValue},
date_time,
encryption::Encryption,
errors::{CustomResult, ValidationError},
@@ -8,7 +8,7 @@ use common_utils::{
};
use diesel_models::business_profile::{
AuthenticationConnectorDetails, BusinessPaymentLinkConfig, BusinessPayoutLinkConfig,
- ProfileUpdateInternal, WebhookDetails,
+ CardTestingGuardConfig, ProfileUpdateInternal, WebhookDetails,
};
use error_stack::ResultExt;
use masking::{PeekInterface, Secret};
@@ -62,6 +62,8 @@ pub struct Profile {
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v1")]
@@ -106,6 +108,8 @@ pub struct ProfileSetter {
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v1")]
@@ -156,6 +160,8 @@ impl From<ProfileSetter> for Profile {
always_request_extended_authorization: value.always_request_extended_authorization,
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
+ card_testing_guard_config: value.card_testing_guard_config,
+ card_testing_secret_key: value.card_testing_secret_key,
}
}
}
@@ -208,6 +214,8 @@ pub struct ProfileGeneralUpdate {
pub is_click_to_pay_enabled: Option<bool>,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v1")]
@@ -230,6 +238,9 @@ pub enum ProfileUpdate {
NetworkTokenizationUpdate {
is_network_tokenization_enabled: bool,
},
+ CardTestingSecretKeyUpdate {
+ card_testing_secret_key: OptionalEncryptableName,
+ },
}
#[cfg(feature = "v1")]
@@ -272,6 +283,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
+ card_testing_guard_config,
+ card_testing_secret_key,
} = *update;
Self {
@@ -312,6 +325,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled,
authentication_product_ids,
+ card_testing_guard_config,
+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -354,6 +369,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
@@ -394,6 +411,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -434,6 +453,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -474,6 +495,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -514,6 +537,50 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
always_request_extended_authorization: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
+ },
+ ProfileUpdate::CardTestingSecretKeyUpdate {
+ card_testing_secret_key,
+ } => Self {
+ profile_name: None,
+ modified_at: now,
+ return_url: None,
+ enable_payment_response_hash: None,
+ payment_response_hash_key: None,
+ redirect_to_merchant_with_http_post: None,
+ webhook_details: None,
+ metadata: None,
+ routing_algorithm: None,
+ intent_fulfillment_time: None,
+ frm_routing_algorithm: None,
+ payout_routing_algorithm: None,
+ is_recon_enabled: None,
+ applepay_verified_domains: None,
+ payment_link_config: None,
+ session_expiry: None,
+ authentication_connector_details: None,
+ payout_link_config: None,
+ is_extended_card_info_enabled: None,
+ extended_card_info_config: None,
+ is_connector_agnostic_mit_enabled: None,
+ use_billing_as_payment_method_billing: None,
+ collect_shipping_details_from_wallet_connector: None,
+ collect_billing_details_from_wallet_connector: None,
+ outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
+ tax_connector_id: None,
+ is_tax_connector_enabled: None,
+ dynamic_routing_algorithm: None,
+ is_network_tokenization_enabled: None,
+ is_auto_retries_enabled: None,
+ max_auto_retries_enabled: None,
+ always_request_extended_authorization: None,
+ is_click_to_pay_enabled: None,
+ authentication_product_ids: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
},
}
}
@@ -573,6 +640,8 @@ impl super::behaviour::Conversion for Profile {
always_request_extended_authorization: self.always_request_extended_authorization,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
+ card_testing_guard_config: self.card_testing_guard_config,
+ card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),
})
}
@@ -644,6 +713,21 @@ impl super::behaviour::Conversion for Profile {
always_request_extended_authorization: item.always_request_extended_authorization,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
+ card_testing_guard_config: item.card_testing_guard_config,
+ card_testing_secret_key: item
+ .card_testing_secret_key
+ .async_lift(|inner| async {
+ crypto_operation(
+ state,
+ type_name!(Self::DstType),
+ CryptoOperation::DecryptOptional(inner),
+ key_manager_identifier.clone(),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await?,
})
}
.await
@@ -698,6 +782,8 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: self.max_auto_retries_enabled,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
+ card_testing_guard_config: self.card_testing_guard_config,
+ card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),
})
}
}
@@ -746,6 +832,8 @@ pub struct Profile {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v2")]
@@ -790,6 +878,8 @@ pub struct ProfileSetter {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v2")]
@@ -840,6 +930,8 @@ impl From<ProfileSetter> for Profile {
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
three_ds_decision_manager_config: value.three_ds_decision_manager_config,
+ card_testing_guard_config: value.card_testing_guard_config,
+ card_testing_secret_key: value.card_testing_secret_key,
}
}
}
@@ -894,6 +986,8 @@ pub struct ProfileGeneralUpdate {
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,
+ pub card_testing_secret_key: OptionalEncryptableName,
}
#[cfg(feature = "v2")]
@@ -922,6 +1016,9 @@ pub enum ProfileUpdate {
DecisionManagerRecordUpdate {
three_ds_decision_manager_config: common_types::payments::DecisionManagerRecord,
},
+ CardTestingSecretKeyUpdate {
+ card_testing_secret_key: OptionalEncryptableName,
+ },
}
#[cfg(feature = "v2")]
@@ -958,6 +1055,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled,
authentication_product_ids,
three_ds_decision_manager_config,
+ card_testing_guard_config,
+ card_testing_secret_key,
} = *update;
Self {
profile_name,
@@ -999,6 +1098,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled,
authentication_product_ids,
three_ds_decision_manager_config,
+ card_testing_guard_config,
+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -1043,6 +1144,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -1085,6 +1188,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -1127,6 +1232,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
@@ -1169,6 +1276,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -1211,6 +1320,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
@@ -1253,6 +1364,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
@@ -1295,6 +1408,52 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: Some(three_ds_decision_manager_config),
+ card_testing_guard_config: None,
+ card_testing_secret_key: None,
+ },
+ ProfileUpdate::CardTestingSecretKeyUpdate {
+ card_testing_secret_key,
+ } => Self {
+ profile_name: None,
+ modified_at: now,
+ return_url: None,
+ enable_payment_response_hash: None,
+ payment_response_hash_key: None,
+ redirect_to_merchant_with_http_post: None,
+ webhook_details: None,
+ metadata: None,
+ is_recon_enabled: None,
+ applepay_verified_domains: None,
+ payment_link_config: None,
+ session_expiry: None,
+ authentication_connector_details: None,
+ payout_link_config: None,
+ is_extended_card_info_enabled: None,
+ extended_card_info_config: None,
+ is_connector_agnostic_mit_enabled: None,
+ use_billing_as_payment_method_billing: None,
+ collect_shipping_details_from_wallet_connector: None,
+ collect_billing_details_from_wallet_connector: None,
+ outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
+ routing_algorithm_id: None,
+ payout_routing_algorithm_id: None,
+ order_fulfillment_time: None,
+ order_fulfillment_time_origin: None,
+ frm_routing_algorithm_id: None,
+ default_fallback_routing: None,
+ should_collect_cvv_during_payment: None,
+ tax_connector_id: None,
+ is_tax_connector_enabled: None,
+ is_network_tokenization_enabled: None,
+ is_auto_retries_enabled: None,
+ max_auto_retries_enabled: None,
+ is_click_to_pay_enabled: None,
+ authentication_product_ids: None,
+ three_ds_decision_manager_config: None,
+ card_testing_guard_config: None,
+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
},
}
}
@@ -1358,6 +1517,8 @@ impl super::behaviour::Conversion for Profile {
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
three_ds_decision_manager_config: self.three_ds_decision_manager_config,
+ card_testing_guard_config: self.card_testing_guard_config,
+ card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),
})
}
@@ -1429,6 +1590,21 @@ impl super::behaviour::Conversion for Profile {
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
three_ds_decision_manager_config: item.three_ds_decision_manager_config,
+ card_testing_guard_config: item.card_testing_guard_config,
+ card_testing_secret_key: item
+ .card_testing_secret_key
+ .async_lift(|inner| async {
+ crypto_operation(
+ state,
+ type_name!(Self::DstType),
+ CryptoOperation::DecryptOptional(inner),
+ key_manager_identifier.clone(),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await?,
})
}
.await
@@ -1487,6 +1663,8 @@ impl super::behaviour::Conversion for Profile {
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
three_ds_decision_manager_config: self.three_ds_decision_manager_config,
+ card_testing_guard_config: self.card_testing_guard_config,
+ card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/card_testing_guard_data.rs b/crates/hyperswitch_domain_models/src/card_testing_guard_data.rs
new file mode 100644
index 00000000000..329f89b946b
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/card_testing_guard_data.rs
@@ -0,0 +1,12 @@
+use serde::{self, Deserialize, Serialize};
+
+#[derive(Clone, Serialize, Deserialize, Debug)]
+pub struct CardTestingGuardData {
+ pub is_card_ip_blocking_enabled: bool,
+ pub card_ip_blocking_cache_key: String,
+ pub is_guest_user_card_blocking_enabled: bool,
+ pub guest_user_card_blocking_cache_key: String,
+ pub is_customer_id_blocking_enabled: bool,
+ pub customer_id_blocking_cache_key: String,
+ pub card_testing_guard_expiry: i32,
+}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index ef2cbe064d6..011f9619cdd 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -3,6 +3,7 @@ pub mod api;
pub mod behaviour;
pub mod business_profile;
pub mod callback_mapper;
+pub mod card_testing_guard_data;
pub mod consts;
pub mod customer;
pub mod disputes;
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 1b6f73fb1cd..8d18d1fe59f 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -250,6 +250,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::BusinessGenericLinkConfig,
api_models::admin::BusinessCollectLinkConfig,
api_models::admin::BusinessPayoutLinkConfig,
+ api_models::admin::CardTestingGuardConfig,
+ api_models::admin::CardTestingGuardStatus,
api_models::customers::CustomerRequest,
api_models::customers::CustomerUpdateRequest,
api_models::customers::CustomerDeleteResponse,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index eeb732f81de..ac432fab965 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -286,6 +286,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::UIWidgetFormLayout,
api_models::admin::MerchantConnectorCreate,
api_models::admin::AdditionalMerchantData,
+ api_models::admin::CardTestingGuardConfig,
+ api_models::admin::CardTestingGuardStatus,
api_models::admin::ConnectorWalletDetails,
api_models::admin::MerchantRecipientData,
api_models::admin::MerchantAccountData,
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index dc3c2d532e8..57ec34227b0 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -89,6 +89,12 @@ pub const EMAIL_SUBJECT_APPROVAL_RECON_REQUEST: &str =
pub const ROLE_INFO_CACHE_PREFIX: &str = "CR_INFO_";
+pub const CARD_IP_BLOCKING_CACHE_KEY_PREFIX: &str = "CARD_IP_BLOCKING";
+
+pub const GUEST_USER_CARD_BLOCKING_CACHE_KEY_PREFIX: &str = "GUEST_USER_CARD_BLOCKING";
+
+pub const CUSTOMER_ID_BLOCKING_PREFIX: &str = "CUSTOMER_ID_BLOCKING";
+
#[cfg(feature = "olap")]
pub const VERIFY_CONNECTOR_ID_PREFIX: &str = "conn_verify";
#[cfg(feature = "olap")]
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 18b3ad14358..365cdaf3a12 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -7,6 +7,7 @@ pub mod authentication;
#[cfg(feature = "v1")]
pub mod blocklist;
pub mod cache;
+pub mod card_testing_guard;
pub mod cards_info;
pub mod conditional_config;
pub mod configs;
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 98b55cd9823..bc93b9c53eb 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -12,7 +12,7 @@ use common_utils::{
};
use diesel_models::configs;
#[cfg(all(any(feature = "v1", feature = "v2"), feature = "olap"))]
-use diesel_models::organization::OrganizationBridge;
+use diesel_models::{business_profile::CardTestingGuardConfig, organization::OrganizationBridge};
use error_stack::{report, FutureExt, ResultExt};
use hyperswitch_domain_models::merchant_connector_account::{
FromRequestEncryptableMerchantConnectorAccount, UpdateEncryptableMerchantConnectorAccount,
@@ -3645,6 +3645,35 @@ impl ProfileCreateBridge for api::ProfileCreate {
})
.transpose()?;
+ let key = key_store.key.clone().into_inner();
+ let key_manager_state = state.into();
+
+ let card_testing_secret_key = Some(Secret::new(utils::generate_id(
+ consts::FINGERPRINT_SECRET_LENGTH,
+ "fs",
+ )));
+
+ let card_testing_guard_config = match self.card_testing_guard_config {
+ Some(card_testing_guard_config) => Some(CardTestingGuardConfig::foreign_from(
+ card_testing_guard_config,
+ )),
+ None => Some(CardTestingGuardConfig {
+ is_card_ip_blocking_enabled: common_utils::consts::DEFAULT_CARD_IP_BLOCKING_STATUS,
+ card_ip_blocking_threshold:
+ common_utils::consts::DEFAULT_CARD_IP_BLOCKING_THRESHOLD,
+ is_guest_user_card_blocking_enabled:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_STATUS,
+ guest_user_card_blocking_threshold:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_THRESHOLD,
+ is_customer_id_blocking_enabled:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_STATUS,
+ customer_id_blocking_threshold:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_THRESHOLD,
+ card_testing_guard_expiry:
+ common_utils::consts::DEFAULT_CARD_TESTING_GUARD_EXPIRY_IN_SECS,
+ }),
+ };
+
Ok(domain::Profile::from(domain::ProfileSetter {
profile_id,
merchant_id: merchant_account.get_id().clone(),
@@ -3717,6 +3746,22 @@ impl ProfileCreateBridge for api::ProfileCreate {
always_request_extended_authorization: self.always_request_extended_authorization,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
+ card_testing_guard_config,
+ card_testing_secret_key: card_testing_secret_key
+ .async_lift(|inner| async {
+ domain_types::crypto_operation(
+ &key_manager_state,
+ common_utils::type_name!(domain::Profile),
+ domain_types::CryptoOperation::EncryptOptional(inner),
+ km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("error while generating card testing secret key")?,
}))
}
@@ -3768,6 +3813,35 @@ impl ProfileCreateBridge for api::ProfileCreate {
})
.transpose()?;
+ let key = key_store.key.clone().into_inner();
+ let key_manager_state = state.into();
+
+ let card_testing_secret_key = Some(Secret::new(utils::generate_id(
+ consts::FINGERPRINT_SECRET_LENGTH,
+ "fs",
+ )));
+
+ let card_testing_guard_config = match self.card_testing_guard_config {
+ Some(card_testing_guard_config) => Some(CardTestingGuardConfig::foreign_from(
+ card_testing_guard_config,
+ )),
+ None => Some(CardTestingGuardConfig {
+ is_card_ip_blocking_enabled: common_utils::consts::DEFAULT_CARD_IP_BLOCKING_STATUS,
+ card_ip_blocking_threshold:
+ common_utils::consts::DEFAULT_CARD_IP_BLOCKING_THRESHOLD,
+ is_guest_user_card_blocking_enabled:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_STATUS,
+ guest_user_card_blocking_threshold:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_THRESHOLD,
+ is_customer_id_blocking_enabled:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_STATUS,
+ customer_id_blocking_threshold:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_THRESHOLD,
+ card_testing_guard_expiry:
+ common_utils::consts::DEFAULT_CARD_TESTING_GUARD_EXPIRY_IN_SECS,
+ }),
+ };
+
Ok(domain::Profile::from(domain::ProfileSetter {
id: profile_id,
merchant_id: merchant_id.clone(),
@@ -3827,6 +3901,22 @@ impl ProfileCreateBridge for api::ProfileCreate {
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
three_ds_decision_manager_config: None,
+ card_testing_guard_config,
+ card_testing_secret_key: card_testing_secret_key
+ .async_lift(|inner| async {
+ domain_types::crypto_operation(
+ &key_manager_state,
+ common_utils::type_name!(domain::Profile),
+ domain_types::CryptoOperation::EncryptOptional(inner),
+ km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("error while generating card testing secret key")?,
}))
}
}
@@ -3960,6 +4050,7 @@ trait ProfileUpdateBridge {
self,
state: &SessionState,
key_store: &domain::MerchantKeyStore,
+ business_profile: &domain::Profile,
) -> RouterResult<domain::ProfileUpdate>;
}
@@ -3970,6 +4061,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
self,
state: &SessionState,
key_store: &domain::MerchantKeyStore,
+ business_profile: &domain::Profile,
) -> RouterResult<domain::ProfileUpdate> {
if let Some(session_expiry) = &self.session_expiry {
helpers::validate_session_expiry(session_expiry.to_owned())?;
@@ -4034,6 +4126,35 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
})
.transpose()?;
+ let key = key_store.key.clone().into_inner();
+ let key_manager_state = state.into();
+
+ let card_testing_secret_key = match business_profile.card_testing_secret_key {
+ Some(_) => None,
+ None => {
+ let card_testing_secret_key = Some(Secret::new(utils::generate_id(
+ consts::FINGERPRINT_SECRET_LENGTH,
+ "fs",
+ )));
+
+ card_testing_secret_key
+ .async_lift(|inner| async {
+ domain_types::crypto_operation(
+ &key_manager_state,
+ common_utils::type_name!(domain::Profile),
+ domain_types::CryptoOperation::EncryptOptional(inner),
+ km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("error while generating card testing secret key")?
+ }
+ };
+
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {
profile_name: self.profile_name,
@@ -4078,6 +4199,10 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
max_auto_retries_enabled: self.max_auto_retries_enabled.map(i16::from),
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
+ card_testing_guard_config: self
+ .card_testing_guard_config
+ .map(ForeignInto::foreign_into),
+ card_testing_secret_key,
},
)))
}
@@ -4090,6 +4215,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
self,
state: &SessionState,
key_store: &domain::MerchantKeyStore,
+ business_profile: &domain::Profile,
) -> RouterResult<domain::ProfileUpdate> {
if let Some(session_expiry) = &self.session_expiry {
helpers::validate_session_expiry(session_expiry.to_owned())?;
@@ -4140,6 +4266,35 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
})
.transpose()?;
+ let key = key_store.key.clone().into_inner();
+ let key_manager_state = state.into();
+
+ let card_testing_secret_key = match business_profile.card_testing_secret_key {
+ Some(_) => None,
+ None => {
+ let card_testing_secret_key = Some(Secret::new(utils::generate_id(
+ consts::FINGERPRINT_SECRET_LENGTH,
+ "fs",
+ )));
+
+ card_testing_secret_key
+ .async_lift(|inner| async {
+ domain_types::crypto_operation(
+ &key_manager_state,
+ common_utils::type_name!(domain::Profile),
+ domain_types::CryptoOperation::EncryptOptional(inner),
+ km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("error while generating card testing secret key")?
+ }
+ };
+
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {
profile_name: self.profile_name,
@@ -4177,6 +4332,10 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
three_ds_decision_manager_config: None,
+ card_testing_guard_config: self
+ .card_testing_guard_config
+ .map(ForeignInto::foreign_into),
+ card_testing_secret_key,
},
)))
}
@@ -4200,7 +4359,7 @@ pub async fn update_profile(
})?;
let profile_update = request
- .get_update_profile_object(&state, &key_store)
+ .get_update_profile_object(&state, &key_store, &business_profile)
.await?;
let updated_business_profile = db
diff --git a/crates/router/src/core/card_testing_guard.rs b/crates/router/src/core/card_testing_guard.rs
new file mode 100644
index 00000000000..1b480a9e2ab
--- /dev/null
+++ b/crates/router/src/core/card_testing_guard.rs
@@ -0,0 +1,3 @@
+pub mod utils;
+
+use crate::core::errors;
diff --git a/crates/router/src/core/card_testing_guard/utils.rs b/crates/router/src/core/card_testing_guard/utils.rs
new file mode 100644
index 00000000000..85f949b3b87
--- /dev/null
+++ b/crates/router/src/core/card_testing_guard/utils.rs
@@ -0,0 +1,196 @@
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+ card_testing_guard_data::CardTestingGuardData, router_request_types::BrowserInformation,
+};
+use masking::{PeekInterface, Secret};
+use router_env::logger;
+
+use super::errors;
+use crate::{
+ core::{errors::RouterResult, payments::helpers},
+ routes::SessionState,
+ services,
+ types::{api, domain},
+ utils::crypto::{self, SignMessage},
+};
+
+pub async fn validate_card_testing_guard_checks(
+ state: &SessionState,
+ request: &api::PaymentsRequest,
+ payment_method_data: Option<&api_models::payments::PaymentMethodData>,
+ customer_id: &Option<common_utils::id_type::CustomerId>,
+ business_profile: &domain::Profile,
+) -> RouterResult<Option<CardTestingGuardData>> {
+ match &business_profile.card_testing_guard_config {
+ Some(card_testing_guard_config) => {
+ let fingerprint = generate_fingerprint(payment_method_data, business_profile).await?;
+
+ let card_testing_guard_expiry = card_testing_guard_config.card_testing_guard_expiry;
+
+ let mut card_ip_blocking_cache_key = String::new();
+ let mut guest_user_card_blocking_cache_key = String::new();
+ let mut customer_id_blocking_cache_key = String::new();
+
+ if card_testing_guard_config.is_card_ip_blocking_enabled {
+ if let Some(browser_info) = &request.browser_info {
+ #[cfg(feature = "v1")]
+ {
+ let browser_info =
+ serde_json::from_value::<BrowserInformation>(browser_info.clone())
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("could not parse browser_info")?;
+
+ if let Some(browser_info_ip) = browser_info.ip_address {
+ card_ip_blocking_cache_key =
+ helpers::validate_card_ip_blocking_for_business_profile(
+ state,
+ browser_info_ip,
+ fingerprint.clone(),
+ card_testing_guard_config,
+ )
+ .await?;
+ }
+ }
+
+ #[cfg(feature = "v2")]
+ {
+ if let Some(browser_info_ip) = browser_info.ip_address {
+ card_ip_blocking_cache_key =
+ helpers::validate_card_ip_blocking_for_business_profile(
+ state,
+ browser_info_ip,
+ fingerprint.clone(),
+ card_testing_guard_config,
+ )
+ .await?;
+ }
+ }
+ }
+ }
+
+ if card_testing_guard_config.is_guest_user_card_blocking_enabled {
+ guest_user_card_blocking_cache_key =
+ helpers::validate_guest_user_card_blocking_for_business_profile(
+ state,
+ fingerprint.clone(),
+ customer_id.clone(),
+ card_testing_guard_config,
+ )
+ .await?;
+ }
+
+ if card_testing_guard_config.is_customer_id_blocking_enabled {
+ if let Some(customer_id) = customer_id.clone() {
+ customer_id_blocking_cache_key =
+ helpers::validate_customer_id_blocking_for_business_profile(
+ state,
+ customer_id.clone(),
+ business_profile.get_id(),
+ card_testing_guard_config,
+ )
+ .await?;
+ }
+ }
+
+ Ok(Some(CardTestingGuardData {
+ is_card_ip_blocking_enabled: card_testing_guard_config.is_card_ip_blocking_enabled,
+ card_ip_blocking_cache_key,
+ is_guest_user_card_blocking_enabled: card_testing_guard_config
+ .is_guest_user_card_blocking_enabled,
+ guest_user_card_blocking_cache_key,
+ is_customer_id_blocking_enabled: card_testing_guard_config
+ .is_customer_id_blocking_enabled,
+ customer_id_blocking_cache_key,
+ card_testing_guard_expiry,
+ }))
+ }
+ None => Ok(None),
+ }
+}
+
+pub async fn generate_fingerprint(
+ payment_method_data: Option<&api_models::payments::PaymentMethodData>,
+ business_profile: &domain::Profile,
+) -> RouterResult<Secret<String>> {
+ let card_testing_secret_key = &business_profile.card_testing_secret_key;
+
+ match card_testing_secret_key {
+ Some(card_testing_secret_key) => {
+ let card_number_fingerprint = payment_method_data
+ .as_ref()
+ .and_then(|pm_data| match pm_data {
+ api_models::payments::PaymentMethodData::Card(card) => {
+ crypto::HmacSha512::sign_message(
+ &crypto::HmacSha512,
+ card_testing_secret_key.get_inner().peek().as_bytes(),
+ card.card_number.clone().get_card_no().as_bytes(),
+ )
+ .attach_printable("error in pm fingerprint creation")
+ .map_or_else(
+ |err| {
+ logger::error!(error=?err);
+ None
+ },
+ Some,
+ )
+ }
+ _ => None,
+ })
+ .map(hex::encode);
+
+ card_number_fingerprint.map(Secret::new).ok_or_else(|| {
+ error_stack::report!(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while masking fingerprint")
+ })
+ }
+ None => Err(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("card testing secret key not configured")?,
+ }
+}
+
+pub async fn increment_blocked_count_in_cache(
+ state: &SessionState,
+ card_testing_guard_data: Option<CardTestingGuardData>,
+) -> RouterResult<()> {
+ if let Some(card_testing_guard_data) = card_testing_guard_data.clone() {
+ if card_testing_guard_data.is_card_ip_blocking_enabled
+ && !card_testing_guard_data
+ .card_ip_blocking_cache_key
+ .is_empty()
+ {
+ let _ = services::card_testing_guard::increment_blocked_count_in_cache(
+ state,
+ &card_testing_guard_data.card_ip_blocking_cache_key,
+ card_testing_guard_data.card_testing_guard_expiry.into(),
+ )
+ .await;
+ }
+
+ if card_testing_guard_data.is_guest_user_card_blocking_enabled
+ && !card_testing_guard_data
+ .guest_user_card_blocking_cache_key
+ .is_empty()
+ {
+ let _ = services::card_testing_guard::increment_blocked_count_in_cache(
+ state,
+ &card_testing_guard_data.guest_user_card_blocking_cache_key,
+ card_testing_guard_data.card_testing_guard_expiry.into(),
+ )
+ .await;
+ }
+
+ if card_testing_guard_data.is_customer_id_blocking_enabled
+ && !card_testing_guard_data
+ .customer_id_blocking_cache_key
+ .is_empty()
+ {
+ let _ = services::card_testing_guard::increment_blocked_count_in_cache(
+ state,
+ &card_testing_guard_data.customer_id_blocking_cache_key,
+ card_testing_guard_data.card_testing_guard_expiry.into(),
+ )
+ .await;
+ }
+ }
+ Ok(())
+}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 1898dd40666..17775b83aab 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -301,6 +301,12 @@ where
platform_merchant_account.as_ref(),
)
.await?;
+
+ operation
+ .to_get_tracker()?
+ .validate_request_with_state(state, &req, &mut payment_data, &business_profile)
+ .await?;
+
core_utils::validate_profile_id_from_auth_layer(
profile_id_from_auth_layer,
&payment_data.get_payment_intent().clone(),
@@ -4982,6 +4988,8 @@ where
pub tax_data: Option<TaxData>,
pub session_id: Option<String>,
pub service_details: Option<api_models::payments::CtpServiceDetails>,
+ pub card_testing_guard_data:
+ Option<hyperswitch_domain_models::card_testing_guard_data::CardTestingGuardData>,
}
#[derive(Clone, serde::Serialize, Debug)]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 032262b30aa..ba509221956 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1,4 +1,4 @@
-use std::{borrow::Cow, collections::HashSet, str::FromStr};
+use std::{borrow::Cow, collections::HashSet, net::IpAddr, str::FromStr};
#[cfg(feature = "v2")]
use api_models::ephemeral_key::ClientSecretResponse;
@@ -1478,6 +1478,84 @@ pub fn validate_customer_information(
}
}
+pub async fn validate_card_ip_blocking_for_business_profile(
+ state: &SessionState,
+ ip: IpAddr,
+ fingerprnt: masking::Secret<String>,
+ card_testing_guard_config: &diesel_models::business_profile::CardTestingGuardConfig,
+) -> RouterResult<String> {
+ let cache_key = format!(
+ "{}_{}_{}",
+ consts::CARD_IP_BLOCKING_CACHE_KEY_PREFIX,
+ fingerprnt.peek(),
+ ip
+ );
+
+ let unsuccessful_payment_threshold = card_testing_guard_config.card_ip_blocking_threshold;
+
+ validate_blocking_threshold(state, unsuccessful_payment_threshold, cache_key).await
+}
+
+pub async fn validate_guest_user_card_blocking_for_business_profile(
+ state: &SessionState,
+ fingerprnt: masking::Secret<String>,
+ customer_id: Option<id_type::CustomerId>,
+ card_testing_guard_config: &diesel_models::business_profile::CardTestingGuardConfig,
+) -> RouterResult<String> {
+ let cache_key = format!(
+ "{}_{}",
+ consts::GUEST_USER_CARD_BLOCKING_CACHE_KEY_PREFIX,
+ fingerprnt.peek()
+ );
+
+ let unsuccessful_payment_threshold =
+ card_testing_guard_config.guest_user_card_blocking_threshold;
+
+ if customer_id.is_none() {
+ Ok(validate_blocking_threshold(state, unsuccessful_payment_threshold, cache_key).await?)
+ } else {
+ Ok(cache_key)
+ }
+}
+
+pub async fn validate_customer_id_blocking_for_business_profile(
+ state: &SessionState,
+ customer_id: id_type::CustomerId,
+ profile_id: &id_type::ProfileId,
+ card_testing_guard_config: &diesel_models::business_profile::CardTestingGuardConfig,
+) -> RouterResult<String> {
+ let cache_key = format!(
+ "{}_{}_{}",
+ consts::CUSTOMER_ID_BLOCKING_PREFIX,
+ profile_id.get_string_repr(),
+ customer_id.get_string_repr(),
+ );
+
+ let unsuccessful_payment_threshold = card_testing_guard_config.customer_id_blocking_threshold;
+
+ validate_blocking_threshold(state, unsuccessful_payment_threshold, cache_key).await
+}
+
+pub async fn validate_blocking_threshold(
+ state: &SessionState,
+ unsuccessful_payment_threshold: i32,
+ cache_key: String,
+) -> RouterResult<String> {
+ match services::card_testing_guard::get_blocked_count_from_cache(state, &cache_key).await {
+ Ok(Some(unsuccessful_payment_count)) => {
+ if unsuccessful_payment_count >= unsuccessful_payment_threshold {
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Blocked due to suspicious activity".to_string(),
+ })?
+ } else {
+ Ok(cache_key)
+ }
+ }
+ Ok(None) => Ok(cache_key),
+ Err(error) => Err(errors::ApiErrorResponse::InternalServerError).attach_printable(error)?,
+ }
+}
+
#[cfg(feature = "v1")]
/// Get the customer details from customer field if present
/// or from the individual fields in `PaymentsRequest`
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index b305370f6c1..a1ebaa04152 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -206,6 +206,16 @@ pub trait GetTracker<F: Clone, D, R>: Send {
header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<GetTrackerResponse<D>>;
+
+ async fn validate_request_with_state(
+ &self,
+ _state: &SessionState,
+ _request: &R,
+ _payment_data: &mut D,
+ _business_profile: &domain::Profile,
+ ) -> RouterResult<()> {
+ Ok(())
+ }
}
#[async_trait]
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index bdb0548d6a4..393d08a68d4 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -200,6 +200,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index b41247003bd..d713e7aa567 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -211,6 +211,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 2bb8dd279e5..2a58adb822c 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -260,6 +260,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
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 f1279f394b2..fab2a9144c7 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -354,6 +354,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let customer_details = Some(CustomerDetails {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 43057855467..62f60d938a2 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -33,6 +33,7 @@ use crate::{
core::{
authentication,
blocklist::utils as blocklist_utils,
+ card_testing_guard::utils as card_testing_guard_utils,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
payments::{
@@ -825,6 +826,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: request.ctp_service_details.clone(),
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
@@ -837,6 +839,39 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
Ok(get_trackers_response)
}
+
+ async fn validate_request_with_state(
+ &self,
+ state: &SessionState,
+ request: &api::PaymentsRequest,
+ payment_data: &mut PaymentData<F>,
+ business_profile: &domain::Profile,
+ ) -> RouterResult<()> {
+ let payment_method_data: Option<&api_models::payments::PaymentMethodData> = request
+ .payment_method_data
+ .as_ref()
+ .and_then(|request_payment_method_data| {
+ request_payment_method_data.payment_method_data.as_ref()
+ });
+
+ let customer_id = &payment_data.payment_intent.customer_id;
+
+ match payment_method_data {
+ Some(api_models::payments::PaymentMethodData::Card(_card)) => {
+ payment_data.card_testing_guard_data =
+ card_testing_guard_utils::validate_card_testing_guard_checks(
+ state,
+ request,
+ payment_method_data,
+ customer_id,
+ business_profile,
+ )
+ .await?;
+ Ok(())
+ }
+ _ => Ok(()),
+ }
+ }
}
#[async_trait]
@@ -1870,6 +1905,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
}
}
+#[async_trait]
impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentData<F>>
for PaymentConfirm
{
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 1d3a56162e9..06036c4bc59 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -625,6 +625,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 9f21dbc9981..0a3efc92ccd 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -169,6 +169,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
operation: Box::new(self),
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 1591b1d6a47..91317dbde68 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -198,6 +198,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 25ae8c84c39..f543c9aa1a0 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -30,6 +30,7 @@ use crate::{
connector::utils::PaymentResponseRouterData,
consts,
core::{
+ card_testing_guard::utils as card_testing_guard_utils,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate,
payment_methods::{self, cards::create_encrypted_data},
@@ -2047,6 +2048,14 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
.map(|info| info.status = status)
});
+ if payment_data.payment_attempt.status == enums::AttemptStatus::Failure {
+ let _ = card_testing_guard_utils::increment_blocked_count_in_cache(
+ state,
+ payment_data.card_testing_guard_data.clone(),
+ )
+ .await;
+ }
+
match router_data.integrity_check {
Ok(()) => Ok(payment_data),
Err(err) => {
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index be4f804a8a7..a86ca0be4ef 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -216,6 +216,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 299d7237807..ebae54e1220 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -203,6 +203,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index c458f95ad97..e05eed41419 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -534,6 +534,7 @@ async fn get_tracker_for_sync<
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index ac37513f2b9..89a94552bc2 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -495,6 +495,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
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 95c50f2f17e..8ef656599a7 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -177,6 +177,7 @@ impl<F: Send + Clone + Sync>
tax_data: None,
session_id: None,
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index bcda2af8768..0d31c4d5de1 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -183,6 +183,7 @@ impl<F: Send + Clone + Sync>
tax_data: Some(tax_data),
session_id: request.session_id.clone(),
service_details: None,
+ card_testing_guard_data: None,
};
let get_trackers_response = operations::GetTrackerResponse {
operation: Box::new(self),
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index 18bc1eb41c4..57f9fadcbcd 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -12,6 +12,7 @@ pub mod kafka;
pub mod logger;
pub mod pm_auth;
+pub mod card_testing_guard;
#[cfg(feature = "olap")]
pub mod openidconnect;
diff --git a/crates/router/src/services/card_testing_guard.rs b/crates/router/src/services/card_testing_guard.rs
new file mode 100644
index 00000000000..09c5dbd9504
--- /dev/null
+++ b/crates/router/src/services/card_testing_guard.rs
@@ -0,0 +1,78 @@
+use std::sync::Arc;
+
+use error_stack::ResultExt;
+use redis_interface::RedisConnectionPool;
+
+use crate::{
+ core::errors::{ApiErrorResponse, RouterResult},
+ routes::app::SessionStateInfo,
+};
+
+fn get_redis_connection<A: SessionStateInfo>(state: &A) -> RouterResult<Arc<RedisConnectionPool>> {
+ state
+ .store()
+ .get_redis_conn()
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to get redis connection")
+}
+
+pub async fn set_blocked_count_in_cache<A>(
+ state: &A,
+ cache_key: &str,
+ value: i32,
+ expiry: i64,
+) -> RouterResult<()>
+where
+ A: SessionStateInfo + Sync,
+{
+ let redis_conn = get_redis_connection(state)?;
+
+ redis_conn
+ .set_key_with_expiry(&cache_key.into(), value, expiry)
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+}
+
+pub async fn get_blocked_count_from_cache<A>(
+ state: &A,
+ cache_key: &str,
+) -> RouterResult<Option<i32>>
+where
+ A: SessionStateInfo + Sync,
+{
+ let redis_conn = get_redis_connection(state)?;
+
+ let value: Option<i32> = redis_conn
+ .get_key(&cache_key.into())
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)?;
+
+ Ok(value)
+}
+
+pub async fn increment_blocked_count_in_cache<A>(
+ state: &A,
+ cache_key: &str,
+ expiry: i64,
+) -> RouterResult<()>
+where
+ A: SessionStateInfo + Sync,
+{
+ let redis_conn = get_redis_connection(state)?;
+
+ let value: Option<i32> = redis_conn
+ .get_key(&cache_key.into())
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)?;
+
+ let mut incremented_blocked_count: i32 = 1;
+
+ if let Some(actual_value) = value {
+ incremented_blocked_count = actual_value + 1;
+ }
+
+ redis_conn
+ .set_key_with_expiry(&cache_key.into(), incremented_blocked_count, expiry)
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+}
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 289b56a7800..2852766cdd3 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -15,20 +15,25 @@ pub use api_models::{
OrganizationCreateRequest, OrganizationId, OrganizationResponse, OrganizationUpdateRequest,
},
};
-use common_utils::ext_traits::ValueExt;
+use common_utils::{ext_traits::ValueExt, types::keymanager as km_types};
use diesel_models::organization::OrganizationBridge;
use error_stack::ResultExt;
use hyperswitch_domain_models::merchant_key_store::MerchantKeyStore;
-use masking::{ExposeInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
use crate::{
+ consts,
core::errors,
routes::SessionState,
types::{
- domain,
+ domain::{
+ self,
+ types::{self as domain_types, AsyncLift},
+ },
transformers::{ForeignInto, ForeignTryFrom},
ForeignFrom,
},
+ utils,
};
impl ForeignFrom<diesel_models::organization::Organization> for OrganizationResponse {
@@ -179,6 +184,9 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
always_request_extended_authorization: item.always_request_extended_authorization,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
+ card_testing_guard_config: item
+ .card_testing_guard_config
+ .map(ForeignInto::foreign_into),
})
}
}
@@ -250,6 +258,9 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_network_tokenization_enabled: item.is_network_tokenization_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
+ card_testing_guard_config: item
+ .card_testing_guard_config
+ .map(ForeignInto::foreign_into),
})
}
}
@@ -262,6 +273,7 @@ pub async fn create_profile_from_merchant_account(
key_store: &MerchantKeyStore,
) -> Result<domain::Profile, error_stack::Report<errors::ApiErrorResponse>> {
use common_utils::ext_traits::AsyncExt;
+ use diesel_models::business_profile::CardTestingGuardConfig;
use crate::core;
@@ -306,6 +318,34 @@ pub async fn create_profile_from_merchant_account(
})
.transpose()?;
+ let key = key_store.key.clone().into_inner();
+ let key_manager_state = state.into();
+
+ let card_testing_secret_key = Some(Secret::new(utils::generate_id(
+ consts::FINGERPRINT_SECRET_LENGTH,
+ "fs",
+ )));
+
+ let card_testing_guard_config = match request.card_testing_guard_config {
+ Some(card_testing_guard_config) => Some(CardTestingGuardConfig::foreign_from(
+ card_testing_guard_config,
+ )),
+ None => Some(CardTestingGuardConfig {
+ is_card_ip_blocking_enabled: common_utils::consts::DEFAULT_CARD_IP_BLOCKING_STATUS,
+ card_ip_blocking_threshold: common_utils::consts::DEFAULT_CARD_IP_BLOCKING_THRESHOLD,
+ is_guest_user_card_blocking_enabled:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_STATUS,
+ guest_user_card_blocking_threshold:
+ common_utils::consts::DEFAULT_GUEST_USER_CARD_BLOCKING_THRESHOLD,
+ is_customer_id_blocking_enabled:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_STATUS,
+ customer_id_blocking_threshold:
+ common_utils::consts::DEFAULT_CUSTOMER_ID_BLOCKING_THRESHOLD,
+ card_testing_guard_expiry:
+ common_utils::consts::DEFAULT_CARD_TESTING_GUARD_EXPIRY_IN_SECS,
+ }),
+ };
+
Ok(domain::Profile::from(domain::ProfileSetter {
profile_id,
merchant_id,
@@ -379,5 +419,21 @@ pub async fn create_profile_from_merchant_account(
always_request_extended_authorization: request.always_request_extended_authorization,
is_click_to_pay_enabled: request.is_click_to_pay_enabled,
authentication_product_ids: request.authentication_product_ids,
+ card_testing_guard_config,
+ card_testing_secret_key: card_testing_secret_key
+ .async_lift(|inner| async {
+ domain_types::crypto_operation(
+ &key_manager_state,
+ common_utils::type_name!(domain::Profile),
+ domain_types::CryptoOperation::EncryptOptional(inner),
+ km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_optionaloperation())
+ })
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("error while generating card testing secret key")?,
}))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index aa27e362df2..a05020856b9 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -2019,6 +2019,56 @@ impl ForeignFrom<diesel_models::business_profile::AuthenticationConnectorDetails
}
}
+impl ForeignFrom<api_models::admin::CardTestingGuardConfig>
+ for diesel_models::business_profile::CardTestingGuardConfig
+{
+ fn foreign_from(item: api_models::admin::CardTestingGuardConfig) -> Self {
+ Self {
+ is_card_ip_blocking_enabled: match item.card_ip_blocking_status {
+ api_models::admin::CardTestingGuardStatus::Enabled => true,
+ api_models::admin::CardTestingGuardStatus::Disabled => false,
+ },
+ card_ip_blocking_threshold: item.card_ip_blocking_threshold,
+ is_guest_user_card_blocking_enabled: match item.guest_user_card_blocking_status {
+ api_models::admin::CardTestingGuardStatus::Enabled => true,
+ api_models::admin::CardTestingGuardStatus::Disabled => false,
+ },
+ guest_user_card_blocking_threshold: item.guest_user_card_blocking_threshold,
+ is_customer_id_blocking_enabled: match item.customer_id_blocking_status {
+ api_models::admin::CardTestingGuardStatus::Enabled => true,
+ api_models::admin::CardTestingGuardStatus::Disabled => false,
+ },
+ customer_id_blocking_threshold: item.customer_id_blocking_threshold,
+ card_testing_guard_expiry: item.card_testing_guard_expiry,
+ }
+ }
+}
+
+impl ForeignFrom<diesel_models::business_profile::CardTestingGuardConfig>
+ for api_models::admin::CardTestingGuardConfig
+{
+ fn foreign_from(item: diesel_models::business_profile::CardTestingGuardConfig) -> Self {
+ Self {
+ card_ip_blocking_status: match item.is_card_ip_blocking_enabled {
+ true => api_models::admin::CardTestingGuardStatus::Enabled,
+ false => api_models::admin::CardTestingGuardStatus::Disabled,
+ },
+ card_ip_blocking_threshold: item.card_ip_blocking_threshold,
+ guest_user_card_blocking_status: match item.is_guest_user_card_blocking_enabled {
+ true => api_models::admin::CardTestingGuardStatus::Enabled,
+ false => api_models::admin::CardTestingGuardStatus::Disabled,
+ },
+ guest_user_card_blocking_threshold: item.guest_user_card_blocking_threshold,
+ customer_id_blocking_status: match item.is_customer_id_blocking_enabled {
+ true => api_models::admin::CardTestingGuardStatus::Enabled,
+ false => api_models::admin::CardTestingGuardStatus::Disabled,
+ },
+ customer_id_blocking_threshold: item.customer_id_blocking_threshold,
+ card_testing_guard_expiry: item.card_testing_guard_expiry,
+ }
+ }
+}
+
impl ForeignFrom<api_models::admin::WebhookDetails>
for diesel_models::business_profile::WebhookDetails
{
diff --git a/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/down.sql b/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/down.sql
new file mode 100644
index 00000000000..bd9c5a00505
--- /dev/null
+++ b/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/down.sql
@@ -0,0 +1,7 @@
+-- This file should undo anything in `up.sql`
+
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS card_testing_guard_config;
+
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS card_testing_secret_key;
diff --git a/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/up.sql b/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/up.sql
new file mode 100644
index 00000000000..e933074edff
--- /dev/null
+++ b/migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/up.sql
@@ -0,0 +1,9 @@
+-- Your SQL goes here
+
+ALTER TABLE business_profile
+ADD COLUMN card_testing_guard_config JSONB
+DEFAULT NULL;
+
+ALTER TABLE business_profile
+ADD COLUMN card_testing_secret_key BYTEA
+DEFAULT NULL;
\ No newline at end of file
|
2025-01-27T04:37:24Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
**Problem Statement:**
Card testing attacks involve fraudsters using stolen credit card details to make small transactions on e-commerce sites using different combinations of CVC to verify if the CVC is valid. Successful transactions indicate the card is active and the CVC is valid, while failed ones are discarded. This is done to avoid detection before committing larger fraudulent purchases.
**Solution:**
We have implemented three rules for detecting and preventing this card testing attacks:
I) Card <> IP Blocking for Merchant : If there are X number of unsuccessful payment attempts from a single IP Address for a specific merchant, then that combination of Card <> IP will be blocked for that merchant for a particular duration.
II) Card Blocking for Guest Users for Merchant: If there are X number of unsuccessful payment attempts for a single card, then guest user payments will be blocked for that card and that merchant for a particular duration. Logged in customers will still be able to use that card for payment.
III) Customer ID Blocking for Merchant: If there are X number of unsuccessful payment attempts from a single Customer ID, then that customer ID will be blocked from making any payments for a particular duration.
These unsuccessful payment thresholds and duration for blocking is configurable and stored in database.
Whether the merchants want these rules to be enabled/disabled, that is also configurable.
**Implementation:**
The attacker gets the ```client_secret``` from the payment intent create call which happens through our SDK, and uses the ```client_secret``` to hit the /confirm API repeatedly with different sets of card numbers and CVC.
A method ```validate_request_with_state``` has been created in the ```GetTracker``` trait which enforces the three above mentioned rules depending on the business_profile config. The `validate_request_with_state method` internally calls `validate_card_ip_blocking_for_business_profile` method, `validate_guest_user_card_blocking_for_business_profile` method and `validate_customer_id_blocking_for_business_profile` method for performing the below validations:
I) Card<>IP Blocking: A fingerprint is generated for the card which is unique to the ```business_profile``` (by using a hash key which is unique to the profile and stored as ```card_testing_secret_key``` in ```business_profile```). This is done so that the cards are blocked at a profile level. The IP Address is fetched from the payment intent create request, and then for each unsuccessful payment attempt, the value of the redis key CardFingerprint<>IP is increased by 1, and after it reaches a certain threshold, it is blocked.
II) Guest User Card Blocking: A fingerprint is generated for the card which is unique to the ```business_profile``` (by using a hash key which is unique to the profile and stored as ```card_testing_secret_key``` in ```business_profile```). This is done so that the cards are not blocked at a profile level. For each unsuccessful payment attempt, the value of the redis key CardFingerprint is increased by 1, and after it reaches a certain threshold, it is blocked, but only for guest users. Logged in customers can still make payments with that card.
III) Customer ID Blocking: The ```customer_id``` is fetched from the payment intent create call request, and then for each unsuccessful payment attempt, the value of redis key CardFingerprint<>Profile is increased by 1, and after it reaches a certain threshold, it is blocked.
### Additional Changes
- [x] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
**Postman Tests**
**Step By Step Guide to Test:**
1. Use Adyen Connector to test the curls (because for Adyen, only a specific CVC works for test cards)
2. Update Business Profile to set `card_ip_blocking_status` as `enabled`, `guest_user_card_blocking_status` as `disabled` and `customer_id_blocking_status` as `disabled`
3. Now that card_ip_blocking is enabled, start hitting the endpoints repeatedly with incorrect CVC to make the payments fail (Use curl provided below). After X attempts (determined by `card_ip_blocking_threshold`), the payment attempt will be blocked.
4. Update Business Profile to set `card_ip_blocking_status` as `disabled`, `guest_user_card_blocking_status` as `enabled` and `customer_id_blocking_status` as `disabled`
5. Now that guest_user_card_blocking is enabled, start hitting the endpoints repeatedly with incorrect CVC to make the payments fail (Use curl provided below). After X attempts (determined by `guest_user_card_blocking_threshold`), the payment attempt will be blocked.
6. Update Business Profile to set `card_ip_blocking_status` as `disabled`, `guest_user_card_blocking_status` as `disabled` and `customer_id_blocking_status` as `enabled`
7. Now that customer_id_blocking is enabled, start hitting the endpoints repeatedly with incorrect CVC to make the payments fail (Use curl provided below). After X attempts (determined by `customer_id_blocking_threshold`), the payment attempt will be blocked.
**Update Business Profile (For enabling card_ip_blocking)**
-Request
```
curl --location 'http://localhost:8080/account/postman_merchant_GHAction_20cfc2e0-4fb3-4fde-a322-a5d4412b1596/business_profile/pro_VvEqQhEZBLj6WGrH4efC' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
"profile_name": "Update5",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"metadata": null,
"intent_fulfillment_time": 900,
"frm_routing_algorithm": null,
"payout_routing_algorithm": null,
"applepay_verified_domains": null,
"session_expiry": 900,
"payment_link_config": {
"display_billing_details": true,
"hide_card_nickname_field": true
},
"authentication_connector_details": null,
"use_billing_as_payment_method_billing": true,
"collect_shipping_details_from_wallet_connector": false,
"collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": false,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null,
"card_testing_guard_config": {
"card_ip_blocking_status": "enabled",
"card_ip_blocking_threshold": 3,
"guest_user_card_blocking_status": "disabled",
"guest_user_card_blocking_threshold": 10,
"customer_id_blocking_status": "disabled",
"customer_id_blocking_threshold": 5,
"card_testing_guard_expiry": 3600
}
}'
```
-Response
```
{
"merchant_id": "postman_merchant_GHAction_20cfc2e0-4fb3-4fde-a322-a5d4412b1596",
"profile_id": "pro_VvEqQhEZBLj6WGrH4efC",
"profile_name": "Update5",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "5C72AqxtJV2P2YfLQoIF7L72uuz9srr3H290cKiA8pEaR0H7kPWqmC8fB6Y8Xe4Y",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"metadata": null,
"routing_algorithm": null,
"intent_fulfillment_time": 900,
"frm_routing_algorithm": null,
"payout_routing_algorithm": null,
"applepay_verified_domains": null,
"session_expiry": 900,
"payment_link_config": {
"domain_name": null,
"theme": null,
"logo": null,
"seller_name": null,
"sdk_layout": null,
"display_sdk_only": null,
"enabled_saved_payment_method": null,
"hide_card_nickname_field": true,
"show_card_form_by_default": null,
"transaction_details": null,
"background_image": null,
"details_layout": null,
"payment_button_text": null,
"business_specific_configs": null,
"allowed_domains": null,
"branding_visibility": null
},
"authentication_connector_details": null,
"use_billing_as_payment_method_billing": true,
"extended_card_info_config": null,
"collect_shipping_details_from_wallet_connector": false,
"collect_billing_details_from_wallet_connector": false,
"always_collect_shipping_details_from_wallet_connector": false,
"always_collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": false,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null,
"tax_connector_id": null,
"is_tax_connector_enabled": false,
"is_network_tokenization_enabled": false,
"is_auto_retries_enabled": false,
"max_auto_retries_enabled": null,
"is_click_to_pay_enabled": false,
"authentication_product_ids": null,
"card_testing_guard_config": {
"card_ip_blocking_status": "enabled",
"card_ip_blocking_threshold": 3,
"guest_user_card_blocking_status": "disabled",
"guest_user_card_blocking_threshold": 10,
"customer_id_blocking_status": "disabled",
"customer_id_blocking_threshold": 5,
"card_testing_guard_expiry": 3600
}
}
```
**1. Card <> IP Blocking (Below Threshold)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcd",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"payment_id": "pay_tVK43iCoFLj3giMpq1aR",
"merchant_id": "postman_merchant_GHAction_7522c600-57f2-4a82-b4f4-9df401d240ab",
"status": "failed",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_tVK43iCoFLj3giMpq1aR_secret_slmMPbx0VVLowhjqrwF9",
"created": "2025-01-27T07:16:16.548Z",
"currency": "USD",
"customer_id": "abcd",
"customer": {
"id": "abcd",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1237",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "421234",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": "24",
"error_message": "CVC Declined",
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcd",
"created_at": 1737962176,
"expires": 1737965776,
"secret": "epk_76f0a10b19ad4a91bd597b75680b4afb"
},
"manual_retry_allowed": true,
"connector_transaction_id": "D3W4SJB5J4P8CX65",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_6nc1JRTymtljmHmhnTEt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_wpJDRDrWhfV2oZR77bFX",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-27T07:31:16.548Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.6",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-27T07:16:19.648Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**2. Card <> IP Blocking (After threshold)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcd",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"error": {
"type": "invalid_request",
"message": "Blocked due to suspicious activity",
"code": "IR_16"
}
}
```
**3. Guest User Card Blocking (Below Threshold)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"payment_id": "pay_6FU271N4pLzdJAxJEr49",
"merchant_id": "postman_merchant_GHAction_7522c600-57f2-4a82-b4f4-9df401d240ab",
"status": "failed",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_6FU271N4pLzdJAxJEr49_secret_wvcjDfb9IucJ4G2m9P0O",
"created": "2025-01-27T07:20:24.599Z",
"currency": "USD",
"customer_id": null,
"customer": {
"id": null,
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1237",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "421234",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": "24",
"error_message": "CVC Declined",
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": true,
"connector_transaction_id": "NTQV5DFG3XPPT9V5",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_6nc1JRTymtljmHmhnTEt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_wpJDRDrWhfV2oZR77bFX",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-27T07:35:24.599Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.6",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-27T07:20:26.282Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**4. Guest User Card Blocking (After Threshold & Guest User)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"error": {
"type": "invalid_request",
"message": "Blocked due to suspicious activity",
"code": "IR_16"
}
}
```
**5. Customer ID Blocking (Below Threshold)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcd",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"payment_id": "pay_k631dMCrATBssb71COuI",
"merchant_id": "postman_merchant_GHAction_7522c600-57f2-4a82-b4f4-9df401d240ab",
"status": "failed",
"amount": 12345,
"net_amount": 12345,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "adyen",
"client_secret": "pay_k631dMCrATBssb71COuI_secret_P5VvWWn8owaGR9cONsTA",
"created": "2025-01-27T07:23:44.184Z",
"currency": "USD",
"customer_id": "abcd",
"customer": {
"id": "abcd",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1237",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "421234",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": "24",
"error_message": "CVC Declined",
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "abcd",
"created_at": 1737962624,
"expires": 1737966224,
"secret": "epk_365d150a51ac498a8be408a0e048fe9a"
},
"manual_retry_allowed": true,
"connector_transaction_id": "BMF7X5SNLCWNM9V5",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_6nc1JRTymtljmHmhnTEt",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_wpJDRDrWhfV2oZR77bFX",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-27T07:38:44.184Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.6",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-27T07:23:45.746Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
**6. Customer ID Blocking (After Threshold)**
-Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_DXWmMAIEepKhfTAZd13oawyvbN7eNbPHY16nLqlZynQOAOcqdKRWBstt5cQSS7LO' \
--data-raw '{
"amount": 12345,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 12345,
"customer_id": "abcd",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4212345678901237",
"card_exp_month": "03",
"card_exp_year": "30",
"card_holder_name": "John Smith",
"card_cvc": "739"
}
},
"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",
"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.6"
}
}'
```
-Response
```
{
"error": {
"type": "invalid_request",
"message": "Blocked due to suspicious activity",
"code": "IR_16"
}
}
```
**Cypress Tests**

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
db498c272caa8a8a875da14c51fffd1d17efb4cc
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7103
|
Bug: [CHORE] Bump Cypress to v14
bump cypress version to `v14` from `v13.17.0`. there's a ton of under the hood changes and improvements.
check: [docs.cypress.io/app/references/changelog](https://docs.cypress.io/app/references/changelog)
cypress v14 has significant impact on the way we do the redirection flow. check pr description for detailed information.
|
2025-01-24T10:57:50Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [x] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
closes #7103
- video recording
- video recording gets around the race condition that resulted in parallel tests to fail when a payment failed at the same time
- connector specific recording
- store only failed payment recording
- version bump
- cypress to `v14.0.0` (changelog: https://docs.cypress.io/app/references/changelog)
- this is a major change. explained below*.
- eslint to `v9.19.0`
- fix multiple credential wrongly picking `connector_1` for trustpay resulting in `refund` test to fail. logic is as follows:
- `determineConnectorConfig` is where the problem existed
- we have 2 objects and 5 values
- connector credential takes in 3 values -- either next connector (boolean) or value with or without spec name
- if connector credential is null or it does not exist, default to `connector_1`
- if connector credential has `next connector` boolean set to `true`, check if multiple connector status is `true` and count is greater than `1`. if `true`, return `connector_2`, else default to using `connector_1`
- if connector credential has spec name with value, return value only for that spec name (this will affect config only in that respective `spec`), else, just return value that affects the config in every flow
- add security headers
- cypress v14 specific changes*
- use camelCase in redirection flow
- sub domains will now require us to be passed within `cy.origin()` effectively making it impossible to work with redirection tests without below mentioned changes
- once the url is visited, wait until redirection is completed (wait until domain is changed to connector's domain)
- use `cy.url()` to get redirected url (connector's url), which is a promise and it cannot be accessed outside of that promise, and is then passed to `cy.origin()` that enables us to interact with the ui elements
- in verify url function, wait until redirection is completed and we're back to `hyperswitch.io` website by verifying the host
- once, on the returned url, access the present url (returned url) with `cy.url` which is then passed to `cy.origin()` so that we can access the elements just so that we can verify that there's no errors like `4xx`
- access the url and then verify the terminal payment status
- bug fixes
- fix przelwey24 and eps bank redirect in adyen
- fix upi in adyen
- uncaught exception resulting in abrupt failure in adyen tests (happens only in ui)
```js
__all:1 Uncaught (in promise)
Event {isTrusted: true, Symbol(ERR_PREPARED_FOR_SERIALIZATION): true, type: 'error', target: null, currentTarget: null, …}
isTrusted: true
Symbol(ERR_PREPARED_FOR_SERIALIZATION): true
bubbles: false
cancelBubble: false
cancelable: false
composed: false
currentTarget: null
defaultPrevented: false
eventPhase: 0
returnValue: true
srcElement: null
target: null
timeStamp: 298220.2000000002
type: "error"
```
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
just keeping up-to-date.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
ci should pass. especially the redirections.

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
b5b50036088b72338156e29be23f77a62d673f30
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7104
|
Bug: [FEATURE] [GETNET] Add Connector Template Code
### Feature Description
Add Connector Template Code for Getnet
### Possible Implementation
Add Connector Template Code for Getnet
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 16b5ef6c3a1..15012c92405 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -213,6 +213,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 01e74f36542..bc46dda1fcb 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -59,6 +59,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index e52d1a1f91a..07ca70b9af4 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -63,6 +63,7 @@ fiuu.base_url = "https://pay.merchant.razer.com/"
fiuu.secondary_base_url="https://api.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api.gocardless.com"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 548f4aead63..b044641f881 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -63,6 +63,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
diff --git a/config/development.toml b/config/development.toml
index fc7a9427d8c..e767ed39b5e 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -122,6 +122,7 @@ cards = [
"fiservemea",
"fiuu",
"forte",
+ "getnet",
"globalpay",
"globepay",
"gocardless",
@@ -233,6 +234,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"
fiuu.third_base_url = "https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 060093550e9..cf5d83e4da2 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -145,6 +145,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"
fiuu.third_base_url = "https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
@@ -249,6 +250,7 @@ cards = [
"fiservemea",
"fiuu",
"forte",
+ "getnet",
"globalpay",
"globepay",
"gocardless",
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 2e1fd195b90..61dbfd3f7fa 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -81,6 +81,7 @@ pub enum RoutableConnectors {
Fiservemea,
Fiuu,
Forte,
+ // Getnet,
Globalpay,
Globepay,
Gocardless,
@@ -217,6 +218,7 @@ pub enum Connector {
Fiservemea,
Fiuu,
Forte,
+ // Getnet,
Globalpay,
Globepay,
Gocardless,
@@ -365,6 +367,7 @@ impl Connector {
| Self::Fiservemea
| Self::Fiuu
| Self::Forte
+ // | Self::Getnet
| Self::Globalpay
| Self::Globepay
| Self::Gocardless
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 3175bbde8f2..c24beba0a47 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -191,6 +191,7 @@ pub struct ConnectorConfig {
pub fiservemea: Option<ConnectorTomlConfig>,
pub fiuu: Option<ConnectorTomlConfig>,
pub forte: Option<ConnectorTomlConfig>,
+ // pub getnet: Option<ConnectorTomlConfig>,
pub globalpay: Option<ConnectorTomlConfig>,
pub globepay: Option<ConnectorTomlConfig>,
pub gocardless: Option<ConnectorTomlConfig>,
@@ -353,6 +354,7 @@ impl ConnectorConfig {
Connector::Fiservemea => Ok(connector_data.fiservemea),
Connector::Fiuu => Ok(connector_data.fiuu),
Connector::Forte => Ok(connector_data.forte),
+ // Connector::Getnet => Ok(connector_data.getnet),
Connector::Globalpay => Ok(connector_data.globalpay),
Connector::Globepay => Ok(connector_data.globepay),
Connector::Gocardless => Ok(connector_data.gocardless),
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 58e6d9c7e5d..a236309e88a 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -25,6 +25,7 @@ pub mod fiserv;
pub mod fiservemea;
pub mod fiuu;
pub mod forte;
+pub mod getnet;
pub mod globalpay;
pub mod globepay;
pub mod gocardless;
@@ -73,14 +74,15 @@ pub use self::{
chargebee::Chargebee, coinbase::Coinbase, coingate::Coingate, cryptopay::Cryptopay,
ctp_mastercard::CtpMastercard, cybersource::Cybersource, datatrans::Datatrans,
deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, elavon::Elavon,
- fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, globalpay::Globalpay,
- globepay::Globepay, gocardless::Gocardless, helcim::Helcim, iatapay::Iatapay, inespay::Inespay,
- itaubank::Itaubank, jpmorgan::Jpmorgan, klarna::Klarna, mifinity::Mifinity, mollie::Mollie,
- multisafepay::Multisafepay, nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay,
- novalnet::Novalnet, nuvei::Nuvei, paybox::Paybox, payeezy::Payeezy, payu::Payu,
- placetopay::Placetopay, powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd,
- razorpay::Razorpay, redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar,
- thunes::Thunes, tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService,
- volt::Volt, wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit,
- zen::Zen, zsl::Zsl,
+ fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, getnet::Getnet,
+ globalpay::Globalpay, globepay::Globepay, gocardless::Gocardless, helcim::Helcim,
+ iatapay::Iatapay, inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan, klarna::Klarna,
+ mifinity::Mifinity, mollie::Mollie, multisafepay::Multisafepay, nexinets::Nexinets,
+ nexixpay::Nexixpay, nomupay::Nomupay, novalnet::Novalnet, nuvei::Nuvei, paybox::Paybox,
+ payeezy::Payeezy, payu::Payu, placetopay::Placetopay, powertranz::Powertranz,
+ prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, redsys::Redsys, shift4::Shift4,
+ square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys,
+ unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
+ wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen,
+ zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs
new file mode 100644
index 00000000000..557dfbeaca3
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs
@@ -0,0 +1,568 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as getnet;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Getnet {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Getnet {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Getnet {}
+impl api::PaymentSession for Getnet {}
+impl api::ConnectorAccessToken for Getnet {}
+impl api::MandateSetup for Getnet {}
+impl api::PaymentAuthorize for Getnet {}
+impl api::PaymentSync for Getnet {}
+impl api::PaymentCapture for Getnet {}
+impl api::PaymentVoid for Getnet {}
+impl api::Refund for Getnet {}
+impl api::RefundExecute for Getnet {}
+impl api::RefundSync for Getnet {}
+impl api::PaymentToken for Getnet {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Getnet
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Getnet
+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 Getnet {
+ fn id(&self) -> &'static str {
+ "getnet"
+ }
+
+ 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.getnet.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = getnet::GetnetAuthType::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: getnet::GetnetErrorResponse = res
+ .response
+ .parse_struct("GetnetErrorResponse")
+ .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 Getnet {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Getnet {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Getnet {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Getnet {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Getnet {
+ 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 = getnet::GetnetRouterData::from((amount, req));
+ let connector_req = getnet::GetnetPaymentsRequest::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: getnet::GetnetPaymentsResponse = res
+ .response
+ .parse_struct("Getnet 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 Getnet {
+ 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: getnet::GetnetPaymentsResponse = res
+ .response
+ .parse_struct("getnet 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 Getnet {
+ 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: getnet::GetnetPaymentsResponse = res
+ .response
+ .parse_struct("Getnet 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 Getnet {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Getnet {
+ 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 = getnet::GetnetRouterData::from((refund_amount, req));
+ let connector_req = getnet::GetnetRefundRequest::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: getnet::RefundResponse =
+ res.response
+ .parse_struct("getnet 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 Getnet {
+ 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: getnet::RefundResponse = res
+ .response
+ .parse_struct("getnet 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 Getnet {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl ConnectorSpecifications for Getnet {}
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
new file mode 100644
index 00000000000..a6dd52d83f5
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/getnet/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 GetnetRouterData<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 GetnetRouterData<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 GetnetPaymentsRequest {
+ amount: StringMinorUnit,
+ card: GetnetCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct GetnetCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&GetnetRouterData<&PaymentsAuthorizeRouterData>> for GetnetPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &GetnetRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = GetnetCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct GetnetAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for GetnetAuthType {
+ 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 GetnetPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<GetnetPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: GetnetPaymentStatus) -> Self {
+ match item {
+ GetnetPaymentStatus::Succeeded => Self::Charged,
+ GetnetPaymentStatus::Failed => Self::Failure,
+ GetnetPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct GetnetPaymentsResponse {
+ status: GetnetPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, GetnetPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, GetnetPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct GetnetRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&GetnetRouterData<&RefundsRouterData<F>>> for GetnetRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &GetnetRouterData<&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 GetnetErrorResponse {
+ 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 f34b09e8f35..f2f7e6b441b 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -121,6 +121,7 @@ default_imp_for_authorize_session_token!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -203,6 +204,7 @@ default_imp_for_calculate_tax!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -284,6 +286,7 @@ default_imp_for_session_update!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Forte,
+ connectors::Getnet,
connectors::Helcim,
connectors::Iatapay,
connectors::Inespay,
@@ -369,6 +372,7 @@ default_imp_for_post_session_tokens!(
connectors::Fiserv,
connectors::Fiservemea,
connectors::Forte,
+ connectors::Getnet,
connectors::Helcim,
connectors::Iatapay,
connectors::Inespay,
@@ -449,6 +453,7 @@ default_imp_for_complete_authorize!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globepay,
connectors::Gocardless,
connectors::Helcim,
@@ -524,6 +529,7 @@ default_imp_for_incremental_authorization!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -608,6 +614,7 @@ default_imp_for_create_customer!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Helcim,
@@ -688,6 +695,7 @@ default_imp_for_connector_redirect_response!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globepay,
connectors::Gocardless,
connectors::Helcim,
@@ -763,6 +771,7 @@ default_imp_for_pre_processing_steps!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Helcim,
@@ -844,6 +853,7 @@ default_imp_for_post_processing_steps!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -929,6 +939,7 @@ default_imp_for_approve!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1014,6 +1025,7 @@ default_imp_for_reject!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1099,6 +1111,7 @@ default_imp_for_webhook_source_verification!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1185,6 +1198,7 @@ default_imp_for_accept_dispute!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1270,6 +1284,7 @@ default_imp_for_submit_evidence!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1355,6 +1370,7 @@ default_imp_for_defend_dispute!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1449,6 +1465,7 @@ default_imp_for_file_upload!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1526,6 +1543,7 @@ default_imp_for_payouts!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1612,6 +1630,7 @@ default_imp_for_payouts_create!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1699,6 +1718,7 @@ default_imp_for_payouts_retrieve!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1786,6 +1806,7 @@ default_imp_for_payouts_eligibility!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1872,6 +1893,7 @@ default_imp_for_payouts_fulfill!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1959,6 +1981,7 @@ default_imp_for_payouts_cancel!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2046,6 +2069,7 @@ default_imp_for_payouts_quote!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2133,6 +2157,7 @@ default_imp_for_payouts_recipient!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2220,6 +2245,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2307,6 +2333,7 @@ default_imp_for_frm_sale!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2394,6 +2421,7 @@ default_imp_for_frm_checkout!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2481,6 +2509,7 @@ default_imp_for_frm_transaction!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2568,6 +2597,7 @@ default_imp_for_frm_fulfillment!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2655,6 +2685,7 @@ default_imp_for_frm_record_return!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2738,6 +2769,7 @@ default_imp_for_revoking_mandates!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2823,6 +2855,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2906,6 +2939,7 @@ default_imp_for_uas_post_authentication!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2989,6 +3023,7 @@ default_imp_for_uas_authentication!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index d0241967acb..93623f3d7f0 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -231,6 +231,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -317,6 +318,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -398,6 +400,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -484,6 +487,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -569,6 +573,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -655,6 +660,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -751,6 +757,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -839,6 +846,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -927,6 +935,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1015,6 +1024,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1103,6 +1113,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1191,6 +1202,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1279,6 +1291,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1367,6 +1380,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1455,6 +1469,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1541,6 +1556,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1629,6 +1645,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1717,6 +1734,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1805,6 +1823,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1893,6 +1912,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -1981,6 +2001,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
@@ -2066,6 +2087,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Fiservemea,
connectors::Fiuu,
connectors::Forte,
+ connectors::Getnet,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index ecb3aea102a..8781060eb9e 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -43,6 +43,7 @@ pub struct Connectors {
pub fiservemea: ConnectorParams,
pub fiuu: ConnectorParamsWithThreeUrls,
pub forte: ConnectorParams,
+ pub getnet: ConnectorParams,
pub globalpay: ConnectorParams,
pub globepay: ConnectorParams,
pub gocardless: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index e6767fbb08b..c8ac040ff8b 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -35,8 +35,8 @@ pub use hyperswitch_connectors::connectors::{
datatrans::Datatrans, deutschebank, deutschebank::Deutschebank, digitalvirgo,
digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, elavon, elavon::Elavon, fiserv,
fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte,
- globalpay, globalpay::Globalpay, globepay, globepay::Globepay, gocardless,
- gocardless::Gocardless, helcim, helcim::Helcim, iatapay, iatapay::Iatapay, inespay,
+ getnet, getnet::Getnet, globalpay, globalpay::Globalpay, globepay, globepay::Globepay,
+ gocardless, gocardless::Gocardless, helcim, helcim::Helcim, iatapay, iatapay::Iatapay, inespay,
inespay::Inespay, itaubank, itaubank::Itaubank, jpmorgan, jpmorgan::Jpmorgan, klarna,
klarna::Klarna, mifinity, mifinity::Mifinity, mollie, mollie::Mollie, multisafepay,
multisafepay::Multisafepay, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index a75d16a7300..b3f1eab9d9b 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1370,6 +1370,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
forte::transformers::ForteAuthType::try_from(self.auth_type)?;
Ok(())
}
+ // api_enums::Connector::Getnet => {
+ // getnet::transformers::GetnetAuthType::try_from(self.auth_type)?;
+ // Ok(())
+ // }
api_enums::Connector::Globalpay => {
globalpay::transformers::GlobalpayAuthType::try_from(self.auth_type)?;
Ok(())
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 7a43ec1a189..b9595c1b23d 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1002,6 +1002,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Fiservemea,
connector::Fiuu,
connector::Forte,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gpayments,
@@ -1466,6 +1467,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Fiservemea,
connector::Forte,
connector::Fiuu,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gpayments,
@@ -1839,6 +1841,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Fiservemea,
connector::Forte,
connector::Fiuu,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 6728d51558c..e311c37ffab 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -422,6 +422,7 @@ default_imp_for_connector_request_id!(
connector::Fiservemea,
connector::Fiuu,
connector::Forte,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
@@ -1379,6 +1380,7 @@ default_imp_for_fraud_check!(
connector::Fiservemea,
connector::Fiuu,
connector::Forte,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
@@ -1914,6 +1916,7 @@ default_imp_for_connector_authentication!(
connector::Fiservemea,
connector::Fiuu,
connector::Forte,
+ connector::Getnet,
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index addb34eb973..ab3572d2661 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -430,6 +430,9 @@ impl ConnectorData {
enums::Connector::Forte => {
Ok(ConnectorEnum::Old(Box::new(connector::Forte::new())))
}
+ // enums::Connector::Getnet => {
+ // Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new())))
+ // }
enums::Connector::Globalpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Globalpay::new())))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index a945f8ebfb4..40d07490b83 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -246,6 +246,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Fiservemea => Self::Fiservemea,
api_enums::Connector::Fiuu => Self::Fiuu,
api_enums::Connector::Forte => Self::Forte,
+ // api_enums::Connector::Getnet => Self::Getnet,
api_enums::Connector::Globalpay => Self::Globalpay,
api_enums::Connector::Globepay => Self::Globepay,
api_enums::Connector::Gocardless => Self::Gocardless,
diff --git a/crates/router/tests/connectors/getnet.rs b/crates/router/tests/connectors/getnet.rs
new file mode 100644
index 00000000000..d8441df440b
--- /dev/null
+++ b/crates/router/tests/connectors/getnet.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct GetnetTest;
+impl ConnectorActions for GetnetTest {}
+impl utils::Connector for GetnetTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Getnet;
+ utils::construct_connector_data_old(
+ Box::new(Getnet::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .getnet
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "getnet".to_string()
+ }
+}
+
+static CONNECTOR: GetnetTest = GetnetTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 19f0b9f9b2c..7e9e49c06a0 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -38,6 +38,7 @@ mod fiserv;
mod fiservemea;
mod fiuu;
mod forte;
+mod getnet;
mod globalpay;
mod globepay;
mod gocardless;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 44c178f3a3b..bf8b35d2fe0 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -290,6 +290,9 @@ api_secret = "Client Key"
[thunes]
api_key="API Key"
+[getnet]
+api_key="API Key"
+
[inespay]
api_key="API Key"
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 0a3aa4bcff0..8e733330517 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -45,6 +45,7 @@ pub struct ConnectorAuthentication {
pub fiservemea: Option<HeaderKey>,
pub fiuu: Option<HeaderKey>,
pub forte: Option<MultiAuthKey>,
+ pub getnet: Option<HeaderKey>,
pub globalpay: Option<BodyKey>,
pub globepay: Option<BodyKey>,
pub gocardless: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index f0f44fc207d..c2cc8833f87 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -111,6 +111,7 @@ fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
+getnet.base_url = "https://api-test.getneteurope.com/engine/rest"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
@@ -215,6 +216,7 @@ cards = [
"fiservemea",
"fiuu",
"forte",
+ "getnet",
"globalpay",
"globepay",
"gocardless",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 8dee6cd21f9..049b4db3f8f 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase coingate cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
2025-01-24T17:12:47Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Template code added for connector Getnet
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch-cloud/issues/8209
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Only template PR, hence no testing required.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
b616bd130b19b259a3b05377bdbae37834f8647d
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7098
|
Bug: [REFACTOR] : remove deprecated PMTs from Adyen (Giropay and Sofort)
Remove deprecated PMTs from Adyen (Giropay and Sofort)
|
diff --git a/config/config.example.toml b/config/config.example.toml
index e982a01eb11..7a810414b4d 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -458,11 +458,11 @@ bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" } # Mandate supported payment method type and connector for bank_debit
bank_debit.sepa = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
-bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
+bank_redirect.sofort = { connector_list = "stripe,globalpay" }
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
wallet.samsung_pay = { connector_list = "cybersource" }
wallet.google_pay = { connector_list = "bankofamerica" }
-bank_redirect.giropay = { connector_list = "adyen,globalpay" }
+bank_redirect.giropay = { connector_list = "globalpay" }
[mandates.update_mandate_supported]
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 5791c6aa83e..04cec1da4d9 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -181,8 +181,8 @@ wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
-bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
bank_redirect.bancontact_card.connector_list="adyen,stripe"
bank_redirect.trustly.connector_list="adyen"
bank_redirect.open_banking_uk.connector_list="adyen"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 78590f05f1b..3c63825da87 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -181,8 +181,8 @@ wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
-bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
bank_redirect.bancontact_card.connector_list="adyen,stripe"
bank_redirect.trustly.connector_list="adyen"
bank_redirect.open_banking_uk.connector_list="adyen"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 4127a694fcb..f5782fc563b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -181,8 +181,8 @@ wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
-bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
bank_redirect.bancontact_card.connector_list="adyen,stripe"
bank_redirect.trustly.connector_list="adyen"
bank_redirect.open_banking_uk.connector_list="adyen"
diff --git a/config/development.toml b/config/development.toml
index 473c453d1c8..40d55207584 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -643,8 +643,8 @@ wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
-bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
bank_redirect.bancontact_card.connector_list = "adyen,stripe"
bank_redirect.trustly.connector_list = "adyen"
bank_redirect.open_banking_uk.connector_list = "adyen"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 12b8df6683c..15fb3ec4423 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -534,8 +534,8 @@ bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" }
bank_debit.sepa = { connector_list = "gocardless,adyen" }
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" }
-bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
-bank_redirect.giropay = { connector_list = "adyen,globalpay" }
+bank_redirect.sofort = { connector_list = "stripe,globalpay" }
+bank_redirect.giropay = { connector_list = "globalpay" }
[mandates.update_mandate_supported]
card.credit = { connector_list = "cybersource" }
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 2b04ea8d1c2..d8e5a0651ee 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -119,10 +119,6 @@ merchant_secret="Source verification key"
payment_method_type = "sepa"
[[adyen.bank_redirect]]
payment_method_type = "ideal"
-[[adyen.bank_redirect]]
- payment_method_type = "giropay"
-[[adyen.bank_redirect]]
- payment_method_type = "sofort"
[[adyen.bank_redirect]]
payment_method_type = "eps"
[[adyen.bank_redirect]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index b7108c63477..4dceada37d9 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -106,10 +106,6 @@ merchant_secret="Source verification key"
payment_method_type = "bacs"
[[adyen.bank_redirect]]
payment_method_type = "ideal"
-[[adyen.bank_redirect]]
- payment_method_type = "giropay"
-[[adyen.bank_redirect]]
- payment_method_type = "sofort"
[[adyen.bank_redirect]]
payment_method_type = "eps"
[[adyen.wallet]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index b886e7410a9..489fd858350 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -119,10 +119,6 @@ merchant_secret="Source verification key"
payment_method_type = "sepa"
[[adyen.bank_redirect]]
payment_method_type = "ideal"
-[[adyen.bank_redirect]]
- payment_method_type = "giropay"
-[[adyen.bank_redirect]]
- payment_method_type = "sofort"
[[adyen.bank_redirect]]
payment_method_type = "eps"
[[adyen.bank_redirect]]
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 91e65759573..7067592771f 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -192,8 +192,6 @@ impl ConnectorValidation for Adyen {
| PaymentMethodType::Alfamart
| PaymentMethodType::Indomaret
| PaymentMethodType::FamilyMart
- | PaymentMethodType::Sofort
- | PaymentMethodType::Giropay
| PaymentMethodType::Seicomart
| PaymentMethodType::PayEasy
| PaymentMethodType::MiniStop
@@ -228,10 +226,12 @@ impl ConnectorValidation for Adyen {
| PaymentMethodType::Pse
| PaymentMethodType::LocalBankTransfer
| PaymentMethodType::Efecty
+ | PaymentMethodType::Giropay
| PaymentMethodType::PagoEfectivo
| PaymentMethodType::PromptPay
| PaymentMethodType::RedCompra
| PaymentMethodType::RedPagos
+ | PaymentMethodType::Sofort
| PaymentMethodType::CryptoCurrency
| PaymentMethodType::Evoucher
| PaymentMethodType::Cashapp
@@ -274,9 +274,7 @@ impl ConnectorValidation for Adyen {
PaymentMethodDataType::VippsRedirect,
PaymentMethodDataType::KlarnaRedirect,
PaymentMethodDataType::Ideal,
- PaymentMethodDataType::Sofort,
PaymentMethodDataType::OpenBankingUk,
- PaymentMethodDataType::Giropay,
PaymentMethodDataType::Trustly,
PaymentMethodDataType::BancontactCard,
PaymentMethodDataType::AchBankDebit,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index adb1a795f70..a20891d0c16 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -530,7 +530,6 @@ pub enum AdyenPaymentMethod<'a> {
Eps(Box<BankRedirectionWithIssuer<'a>>),
#[serde(rename = "gcash")]
Gcash(Box<GcashData>),
- Giropay(Box<PmdForPaymentType>),
Gpay(Box<AdyenGPay>),
#[serde(rename = "gopay_wallet")]
GoPay(Box<GoPayData>),
@@ -564,8 +563,6 @@ pub enum AdyenPaymentMethod<'a> {
PayBright,
#[serde(rename = "doku_permata_lite_atm")]
PermataBankTransfer(Box<DokuBankData>),
- #[serde(rename = "directEbanking")]
- Sofort,
#[serde(rename = "trustly")]
Trustly,
#[serde(rename = "walley")]
@@ -1287,7 +1284,6 @@ pub enum PaymentType {
Dana,
Eps,
Gcash,
- Giropay,
Googlepay,
#[serde(rename = "gopay_wallet")]
GoPay,
@@ -1323,8 +1319,6 @@ pub enum PaymentType {
PayBright,
Paypal,
Scheme,
- #[serde(rename = "directEbanking")]
- Sofort,
#[serde(rename = "networkToken")]
NetworkToken,
Trustly,
@@ -2052,13 +2046,11 @@ impl TryFrom<&storage_enums::PaymentMethodType> for PaymentType {
| storage_enums::PaymentMethodType::BancontactCard
| storage_enums::PaymentMethodType::Blik
| storage_enums::PaymentMethodType::Eps
- | storage_enums::PaymentMethodType::Giropay
| storage_enums::PaymentMethodType::Ideal
| storage_enums::PaymentMethodType::OnlineBankingCzechRepublic
| storage_enums::PaymentMethodType::OnlineBankingFinland
| storage_enums::PaymentMethodType::OnlineBankingPoland
| storage_enums::PaymentMethodType::OnlineBankingSlovakia
- | storage_enums::PaymentMethodType::Sofort
| storage_enums::PaymentMethodType::Trustly
| storage_enums::PaymentMethodType::GooglePay
| storage_enums::PaymentMethodType::AliPay
@@ -2436,11 +2428,6 @@ impl
),
}),
)),
- domain::BankRedirectData::Giropay { .. } => {
- Ok(AdyenPaymentMethod::Giropay(Box::new(PmdForPaymentType {
- payment_type: PaymentType::Giropay,
- })))
- }
domain::BankRedirectData::Ideal { bank_name, .. } => {
let issuer = if test_mode.unwrap_or(true) {
Some(
@@ -2511,11 +2498,12 @@ impl
},
})),
),
- domain::BankRedirectData::Sofort { .. } => Ok(AdyenPaymentMethod::Sofort),
domain::BankRedirectData::Trustly { .. } => Ok(AdyenPaymentMethod::Trustly),
- domain::BankRedirectData::Interac { .. }
+ domain::BankRedirectData::Giropay { .. }
+ | domain::BankRedirectData::Interac { .. }
| domain::BankRedirectData::LocalBankRedirect {}
- | domain::BankRedirectData::Przelewy24 { .. } => {
+ | domain::BankRedirectData::Przelewy24 { .. }
+ | domain::BankRedirectData::Sofort { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
@@ -3139,20 +3127,13 @@ fn get_redirect_extra_details(
) -> errors::CustomResult<(Option<String>, Option<api_enums::CountryAlpha2>), errors::ConnectorError>
{
match item.request.payment_method_data {
- domain::PaymentMethodData::BankRedirect(ref redirect_data) => match redirect_data {
- domain::BankRedirectData::Sofort {
- preferred_language, ..
- } => {
- let country = item.get_optional_billing_country();
- Ok((preferred_language.clone(), country))
- }
+ domain::PaymentMethodData::BankRedirect(
domain::BankRedirectData::Trustly { .. }
- | domain::BankRedirectData::OpenBankingUk { .. } => {
- let country = item.get_optional_billing_country();
- Ok((None, country))
- }
- _ => Ok((None, None)),
- },
+ | domain::BankRedirectData::OpenBankingUk { .. },
+ ) => {
+ let country = item.get_optional_billing_country();
+ Ok((None, country))
+ }
_ => Ok((None, None)),
}
}
@@ -3920,7 +3901,6 @@ pub fn get_wait_screen_metadata(
| PaymentType::Dana
| PaymentType::Eps
| PaymentType::Gcash
- | PaymentType::Giropay
| PaymentType::Googlepay
| PaymentType::GoPay
| PaymentType::Ideal
@@ -3940,7 +3920,6 @@ pub fn get_wait_screen_metadata(
| PaymentType::PayBright
| PaymentType::Paypal
| PaymentType::Scheme
- | PaymentType::Sofort
| PaymentType::NetworkToken
| PaymentType::Trustly
| PaymentType::TouchNGo
@@ -4037,7 +4016,6 @@ pub fn get_present_to_shopper_metadata(
| PaymentType::Dana
| PaymentType::Eps
| PaymentType::Gcash
- | PaymentType::Giropay
| PaymentType::Googlepay
| PaymentType::GoPay
| PaymentType::Ideal
@@ -4059,7 +4037,6 @@ pub fn get_present_to_shopper_metadata(
| PaymentType::PayBright
| PaymentType::Paypal
| PaymentType::Scheme
- | PaymentType::Sofort
| PaymentType::NetworkToken
| PaymentType::Trustly
| PaymentType::TouchNGo
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 4d9c686f23b..8a0c18152fc 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -350,8 +350,8 @@ wallet.twint.connector_list = "adyen"
wallet.vipps.connector_list = "adyen"
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets"
-bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
-bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets"
+bank_redirect.sofort.connector_list = "stripe,globalpay"
+bank_redirect.giropay.connector_list = "globalpay,multisafepay,nexinets"
bank_redirect.bancontact_card.connector_list="adyen,stripe"
bank_redirect.trustly.connector_list="adyen"
bank_redirect.open_banking_uk.connector_list="adyen"
|
2025-01-24T10:22:32Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Removed deprecated PMTs from Ayden: https://www.adyen.com/payment-methods
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch-cloud/issues/8202
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Removed the deprecated payment methods, so no testing required.
Reference that the payment methods are actually no longer available: https://www.adyen.com/payment-methods
No-3DS auto capture
<img width="1720" alt="Screenshot 2025-02-10 at 5 25 26 PM" src="https://github.com/user-attachments/assets/0ca86a25-1c0c-41cf-9348-9676b1254cf7" />
3DS auto capture
<img width="1715" alt="Screenshot 2025-02-10 at 5 25 46 PM" src="https://github.com/user-attachments/assets/fb4f99ae-2d89-4833-8e1c-f918c303020d" />
No-3DS manual capture
<img width="1724" alt="Screenshot 2025-02-10 at 5 26 06 PM" src="https://github.com/user-attachments/assets/407799ef-67de-4f26-b458-a5a4329303f4" />
3DS manual capture
<img width="1727" alt="Screenshot 2025-02-10 at 5 26 54 PM" src="https://github.com/user-attachments/assets/6dcf53b9-4c2e-45c9-a521-8985090032f8" />
Bank Redirect -- All test cases in bank redirect is passed, other than `ideal`. Ideal's payment is failing currently and I will be fixing that in other PR.
<img width="1722" alt="Screenshot 2025-02-10 at 5 36 47 PM" src="https://github.com/user-attachments/assets/a823e7cb-744a-455f-b004-63b6834fb63c" />
<img width="1725" alt="Screenshot 2025-02-10 at 5 36 56 PM" src="https://github.com/user-attachments/assets/ab0369c1-d49c-4606-9830-63992c701040" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3da637e6960f73a3a69aef98b9de2e6de01fcb5e
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7093
|
Bug: [BUG] hyperswitch.io website has some uncaught exceptions resulting in cypress ci checks to fail
ignore uncaught errors
|
2025-01-23T09:34:12Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
the return url i.e., `hyperswitch.io` is throwing uncaught exceptions. the issue has been escalated to the team managing the website. and for now, we're ignoring any uncaught exceptions thrown by it.
additionally, have bumped the package versions except for cypress since it is a major upgrade and breaks redirection tests left right and center.
this pr also removes redundant code from redirection handler
closes https://github.com/juspay/hyperswitch/issues/7093
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
ci
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
ci checks should pass, but works in local:
payouts: wise

payments: adyen

payments: bankofamerica

payments: bluesnap

payments: cybersource

payments: nmi

payments: paypal

payments: stripe

payments: trustpay

payment method list

routing

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
a9a1ded77e2ba0cc7fa9763ce2da4bb0852d82af
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7082
|
Bug: prioritise connector_mandate_id over network_transaction_id during MITs
During the MIT if the decided connector is same as the connector with which the mandate is created then the MIT should be processed with the connector mandate _id.
|
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index ceeb384ed21..c88cc161287 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5799,26 +5799,7 @@ where
.as_ref()
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to find the merchant connector id")?;
- if is_network_transaction_id_flow(
- state,
- is_connector_agnostic_mit_enabled,
- connector_data.connector_name,
- payment_method_info,
- ) {
- logger::info!("using network_transaction_id for MIT flow");
- let network_transaction_id = payment_method_info
- .network_transaction_id
- .as_ref()
- .ok_or(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to fetch the network transaction id")?;
-
- let mandate_reference_id = Some(payments_api::MandateReferenceId::NetworkMandateId(
- network_transaction_id.to_string(),
- ));
-
- connector_choice = Some((connector_data, mandate_reference_id.clone()));
- break;
- } else if connector_mandate_details
+ if connector_mandate_details
.clone()
.map(|connector_mandate_details| {
connector_mandate_details.contains_key(merchant_connector_id)
@@ -5868,6 +5849,25 @@ where
break;
}
}
+ } else if is_network_transaction_id_flow(
+ state,
+ is_connector_agnostic_mit_enabled,
+ connector_data.connector_name,
+ payment_method_info,
+ ) {
+ logger::info!("using network_transaction_id for MIT flow");
+ let network_transaction_id = payment_method_info
+ .network_transaction_id
+ .as_ref()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to fetch the network transaction id")?;
+
+ let mandate_reference_id = Some(payments_api::MandateReferenceId::NetworkMandateId(
+ network_transaction_id.to_string(),
+ ));
+
+ connector_choice = Some((connector_data, mandate_reference_id.clone()));
+ break;
} else {
continue;
}
|
2025-01-21T07:40:34Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
During the MIT if the decided connector is same as the connector with which the mandate is created then the MIT should be processed with the connector mandate _id.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Connector mandate id based payments have better auth rates than the card details with network transaction id.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a business profile and enable connector agnostic mandate feature
```
curl --location 'http://localhost:8080/account/merchant_1737444280/business_profile/pro_h1bdGYYiQic3IHdVU1Mm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"is_connector_agnostic_mit_enabled": true
}'
```
```
{
"merchant_id": "merchant_1737444280",
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"profile_name": "US_default",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "g9sOqQ4SnAvNAjupw2CYjfkOlasfwYVIILUieujxrvuklwkPFAUjaPR6k48uxLd0",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": null,
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"metadata": null,
"routing_algorithm": null,
"intent_fulfillment_time": 900,
"frm_routing_algorithm": null,
"payout_routing_algorithm": null,
"applepay_verified_domains": null,
"session_expiry": 900,
"payment_link_config": null,
"authentication_connector_details": null,
"use_billing_as_payment_method_billing": true,
"extended_card_info_config": null,
"collect_shipping_details_from_wallet_connector": false,
"collect_billing_details_from_wallet_connector": false,
"always_collect_shipping_details_from_wallet_connector": false,
"always_collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": true,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null,
"tax_connector_id": null,
"is_tax_connector_enabled": false,
"is_network_tokenization_enabled": false,
"is_auto_retries_enabled": false,
"max_auto_retries_enabled": null,
"is_click_to_pay_enabled": false,
"authentication_product_ids": null
}
```
#### Create a off session payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 500,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "cu_1737444547",
"email": "guest@example.com",
"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",
"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": "name name",
"card_cvc": "737"
}
},
"setup_future_usage": "off_session",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"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",
"last_name": "ss"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"browser_info": {
"user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
"accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "125.0.0.1"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {},
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 0,
"account_name": "transaction_processing"
}
]
}'
```
```
{
"payment_id": "pay_KqygCo0YGgtq5kwRg7ya",
"merchant_id": "merchant_1737444280",
"status": "succeeded",
"amount": 500,
"net_amount": 500,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 500,
"connector": "stripe",
"client_secret": "pay_KqygCo0YGgtq5kwRg7ya_secret_Dem5r9Q8FYZom1eRjrt0",
"created": "2025-01-21T07:28:13.410Z",
"currency": "USD",
"customer_id": "cu_1737444493",
"customer": {
"id": "cu_1737444493",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": {
"cvc_check": "pass",
"address_line1_check": "pass",
"address_postal_code_check": "pass"
},
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": "ss"
},
"phone": null,
"email": null
},
"order_details": [
{
"brand": null,
"amount": 0,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737444493",
"created_at": 1737444493,
"expires": 1737448093,
"secret": "epk_5565c9134045451ab40c5712bfa952b2"
},
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3QjbsgEOqOywnAIx1CT15pu2",
"frm_message": null,
"metadata": {},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QjbsgEOqOywnAIx1CT15pu2",
"payment_link": null,
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_yzI9tnLJezjQey1LjoCo",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-21T07:43:13.410Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_LR6jCdVNR85W6L1jYIeX",
"payment_method_status": "active",
"updated": "2025-01-21T07:28:15.652Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "pm_1QjbsgEOqOywnAIxpfltM04Z"
}
```
-> Image showing `network_transaction_id` shored in db

#### Recurring payment with same connector
-> Create a payment for the same customer with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "USD",
"capture_method": "automatic",
"authentication_type": "three_ds",
"confirm": false,
"customer_id": "cu_1737444493"
}'
```
```
{
"payment_id": "pay_pG0kiVb7LLFH8zL2MwFk",
"merchant_id": "merchant_1737444280",
"status": "requires_payment_method",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_pG0kiVb7LLFH8zL2MwFk_secret_ArZFjbGaLgfS9Xz75hcM",
"created": "2025-01-21T07:31:42.526Z",
"currency": "USD",
"customer_id": "cu_1737444493",
"customer": {
"id": "cu_1737444493",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737444493",
"created_at": 1737444702,
"expires": 1737448302,
"secret": "epk_eb66ffa2b7be44958a581a9774279fef"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-21T07:46:42.526Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-21T07:31:42.545Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> List customer payment methods with the `client_secret`
```
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_pG0kiVb7LLFH8zL2MwFk_secret_ArZFjbGaLgfS9Xz75hcM' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_b40ef36c556f4da5b6d4682fe66bceeb'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_sBwkrgItKqpd07yTPDVG",
"payment_method_id": "pm_LR6jCdVNR85W6L1jYIeX",
"customer_id": "cu_1737444493",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": true,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": {
"scheme": null,
"issuer_country": null,
"last4_digits": "1111",
"expiry_month": "03",
"expiry_year": "2030",
"card_token": null,
"card_holder_name": "name name",
"card_fingerprint": null,
"nick_name": null,
"card_network": null,
"card_isin": "411111",
"card_issuer": null,
"card_type": null,
"saved_to_locker": true
},
"metadata": null,
"created": "2025-01-21T07:28:15.607Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-01-21T07:28:15.607Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "name",
"last_name": "name"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": false
}
```
-> Confirm the payment with the above listed token and the `client_secret`
```
curl --location 'http://localhost:8080/payments/pay_pG0kiVb7LLFH8zL2MwFk/confirm' \
--header 'api-key: pk_dev_b40ef36c556f4da5b6d4682fe66bceeb' \
--header 'Content-Type: application/json' \
--data-raw '{
"payment_token": "token_sBwkrgItKqpd07yTPDVG",
"payment_method_type": "credit",
"payment_method": "card",
"setup_future_usage": "off_session",
"client_secret": "pay_pG0kiVb7LLFH8zL2MwFk_secret_ArZFjbGaLgfS9Xz75hcM",
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
}
}'
```
```
{
"payment_id": "pay_pG0kiVb7LLFH8zL2MwFk",
"merchant_id": "merchant_1737444280",
"status": "succeeded",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 10000,
"connector": "stripe",
"client_secret": "pay_pG0kiVb7LLFH8zL2MwFk_secret_ArZFjbGaLgfS9Xz75hcM",
"created": "2025-01-21T07:31:42.526Z",
"currency": "USD",
"customer_id": "cu_1737444493",
"customer": {
"id": "cu_1737444493",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_sBwkrgItKqpd07yTPDVG",
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3Qjbx2EOqOywnAIx0fDT7TiV",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3Qjbx2EOqOywnAIx0fDT7TiV",
"payment_link": null,
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_yzI9tnLJezjQey1LjoCo",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-21T07:46:42.526Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": null,
"time_zone": null,
"ip_address": "::1",
"os_version": null,
"user_agent": null,
"color_depth": null,
"device_model": null,
"java_enabled": null,
"screen_width": null,
"accept_header": null,
"screen_height": null,
"java_script_enabled": null
},
"payment_method_id": "pm_LR6jCdVNR85W6L1jYIeX",
"payment_method_status": "active",
"updated": "2025-01-21T07:32:45.176Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "pm_1QjbsgEOqOywnAIxpfltM04Z"
}
```
-> Logs indicating `connector_mandate_id` was used to make MIT

#### Recurring payment with different connector
Since the initial CIT was processed using the Stripe payment method, the table will only contain the connector mandate ID for Stripe. Now that Cybersource has been chosen for the MIT, the payment should be processed through Cybersource using the network_transaction_id, and it should succeed.
-> Configure another connector (stripe, adyen, or cybersource), other than the one used in CIT
-> Create a payment for same customer with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "USD",
"capture_method": "automatic",
"authentication_type": "three_ds",
"confirm": false,
"customer_id": "cu_1737444493"
}'
```
```
{
"payment_id": "pay_HEjhNaSLzmzi9i7hNQAf",
"merchant_id": "merchant_1737444280",
"status": "requires_payment_method",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_HEjhNaSLzmzi9i7hNQAf_secret_HukTuQYWnuiDSV6cHmz9",
"created": "2025-01-21T07:43:14.695Z",
"currency": "USD",
"customer_id": "cu_1737444493",
"customer": {
"id": "cu_1737444493",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737444493",
"created_at": 1737445394,
"expires": 1737448994,
"secret": "epk_e470828aef5346b78806253351aa5283"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-21T07:58:14.695Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-21T07:43:14.712Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> List customer payment methods using the `client_secret`
```
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_HEjhNaSLzmzi9i7hNQAf_secret_HukTuQYWnuiDSV6cHmz9' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_b40ef36c556f4da5b6d4682fe66bceeb'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_NG5a2aePYBabkiDr0WTP",
"payment_method_id": "pm_LR6jCdVNR85W6L1jYIeX",
"customer_id": "cu_1737444493",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": true,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": {
"scheme": null,
"issuer_country": null,
"last4_digits": "1111",
"expiry_month": "03",
"expiry_year": "2030",
"card_token": null,
"card_holder_name": "name name",
"card_fingerprint": null,
"nick_name": null,
"card_network": null,
"card_isin": "411111",
"card_issuer": null,
"card_type": null,
"saved_to_locker": true
},
"metadata": null,
"created": "2025-01-21T07:28:15.607Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-01-21T07:32:45.157Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "name",
"last_name": "name"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": false
}
```
-> Since the initial CIT was processed using the Stripe payment method, the table will only contain the connector mandate ID for Stripe. Now that Cybersource has been chosen for the MIT, the payment should be processed through Cybersource using the network_transaction_id, and it should succeed.
```
curl --location 'http://localhost:8080/payments/pay_HEjhNaSLzmzi9i7hNQAf/confirm' \
--header 'api-key: pk_dev_b40ef36c556f4da5b6d4682fe66bceeb' \
--header 'Content-Type: application/json' \
--data-raw '{
"payment_token": "token_NG5a2aePYBabkiDr0WTP",
"payment_method_type": "credit",
"payment_method": "card",
"setup_future_usage": "off_session",
"client_secret": "pay_HEjhNaSLzmzi9i7hNQAf_secret_HukTuQYWnuiDSV6cHmz9",
"routing": {
"type": "single",
"data": {
"connector": "cybersource",
"merchant_connector_id": "mca_Nz1gr4IIjucxP22LHe1C"
}
},
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
}
}'
```
```
{
"payment_id": "pay_HEjhNaSLzmzi9i7hNQAf",
"merchant_id": "merchant_1737444280",
"status": "succeeded",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 10000,
"connector": "cybersource",
"client_secret": "pay_HEjhNaSLzmzi9i7hNQAf_secret_HukTuQYWnuiDSV6cHmz9",
"created": "2025-01-21T07:43:14.695Z",
"currency": "USD",
"customer_id": "cu_1737444493",
"customer": {
"id": "cu_1737444493",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_NG5a2aePYBabkiDr0WTP",
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "7374456386026828504805",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_HEjhNaSLzmzi9i7hNQAf_1",
"payment_link": null,
"profile_id": "pro_h1bdGYYiQic3IHdVU1Mm",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_Nz1gr4IIjucxP22LHe1C",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-21T07:58:14.695Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": null,
"time_zone": null,
"ip_address": "::1",
"os_version": null,
"user_agent": null,
"color_depth": null,
"device_model": null,
"java_enabled": null,
"screen_width": null,
"accept_header": null,
"screen_height": null,
"java_script_enabled": null
},
"payment_method_id": "pm_LR6jCdVNR85W6L1jYIeX",
"payment_method_status": "active",
"updated": "2025-01-21T07:47:19.698Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> Logs indicating `network_transaction_id` was used to make MIT

## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
90c932a6d798453f7e828c55a7668c5c64c933a5
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7091
|
Bug: add dynamic fields support for samsung_pay
add dynamic fields support for samsung_pay so that it samsung pay button will be displayed in the merchant pml call
|
diff --git a/config/config.example.toml b/config/config.example.toml
index c860420da38..f507df58a77 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -462,6 +462,7 @@ bank_debit.sepa = { connector_list = "gocardless,adyen" }
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
+wallet.samsung_pay = { connector_list = "cybersource" }
wallet.google_pay = { connector_list = "bankofamerica" }
bank_redirect.giropay = { connector_list = "adyen,globalpay" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index b6e487e5a3b..9ce9e104023 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -168,6 +168,7 @@ card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.samsung_pay.connector_list = "cybersource"
wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 3537834fd07..56f7855e22f 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -168,6 +168,7 @@ card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.samsung_pay.connector_list = "cybersource"
wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 7242f263672..5c0558b4c0b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -168,6 +168,7 @@ card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.samsung_pay.connector_list = "cybersource"
wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
diff --git a/config/development.toml b/config/development.toml
index a32102aeebf..dc31ff4f2c8 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -630,6 +630,7 @@ card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.samsung_pay.connector_list = "cybersource"
wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 4296a5931dc..d0894923ae2 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -524,6 +524,7 @@ adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,hal
pay_later.klarna = { connector_list = "adyen" }
wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica" }
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
+wallet.samsung_pay = { connector_list = "cybersource" }
wallet.paypal = { connector_list = "adyen" }
card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" }
card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" }
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 d957109bcef..2ef89f440ad 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -53,6 +53,12 @@ impl Default for Mandates {
]),
},
),
+ (
+ enums::PaymentMethodType::SamsungPay,
+ SupportedConnectorsForMandate {
+ connector_list: HashSet::from([enums::Connector::Cybersource]),
+ },
+ ),
])),
),
(
@@ -8889,6 +8895,21 @@ impl Default for settings::RequiredFields {
]),
},
),
+ (
+ enums::PaymentMethodType::SamsungPay,
+ ConnectorFields {
+ fields: HashMap::from([
+ (
+ enums::Connector::Cybersource,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ ]),
+ },
+ ),
(
enums::PaymentMethodType::GooglePay,
ConnectorFields {
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index e90eb16ab61..87985a414f5 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -340,6 +340,7 @@ card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal"
pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet"
+wallet.samsung_pay.connector_list = "cybersource"
wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet"
wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal"
wallet.momo.connector_list = "adyen"
|
2025-01-23T07:09:51Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
add dynamic fields support for samsung_pay
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
add dynamic fields support for samsung_pay so that it samsung pay button will be displayed in the merchant pml call
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a merchant connector account with samsung pay enabled
-> Create a payment with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ,api-key.' \
--data-raw '{
"amount": 6100,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"amount_to_capture": 6100,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "something@gmail.com",
"setup_future_usage": "off_session",
"name": "Joseph Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"customer_id": "1737615520",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
}
}'
```
```
{
"payment_id": "pay_6VymzRBxbxuYxHIxg6Je",
"merchant_id": "merchant_1737542123",
"status": "requires_payment_method",
"amount": 6100,
"net_amount": 6100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_6VymzRBxbxuYxHIxg6Je_secret_zASufbgnXLVB5t4nNz6M",
"created": "2025-01-23T06:58:30.268Z",
"currency": "USD",
"customer_id": "1737615510",
"customer": {
"id": "1737615510",
"name": "Joseph Doe",
"email": "something@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "something@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": null,
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "1737615510",
"created_at": 1737615510,
"expires": 1737619110,
"secret": "epk_2026cd6080c54699a02f5e24aabe42c0"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_ufywYBbtUhSFzOf1cGEM",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-23T07:13:30.268Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-23T06:58:30.324Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> Merchant payment methods list with the above client secret. It should contain samsung pay
```
curl --location 'http://localhost:8080/account/payment_methods?client_secret=pay_6VymzRBxbxuYxHIxg6Je_secret_zASufbgnXLVB5t4nNz6M' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>'
```
```
{
"redirect_url": "https://google.com/success",
"currency": "USD",
"payment_methods": [
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "samsung_pay",
"payment_experience": [
{
"payment_experience_type": "invoke_sdk_client",
"eligible_connectors": [
"cybersource"
]
}
],
"card_networks": null,
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {},
"surcharge_details": null,
"pm_auth_connector": null
},
{
"payment_method_type": "apple_pay",
"payment_experience": [
{
"payment_experience_type": "invoke_sdk_client",
"eligible_connectors": [
"cybersource"
]
}
],
"card_networks": null,
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {
"billing.address.first_name": {
"required_field": "payment_method_data.billing.address.first_name",
"display_name": "billing_first_name",
"field_type": "user_billing_name",
"value": "joseph"
},
"billing.address.country": {
"required_field": "payment_method_data.billing.address.country",
"display_name": "country",
"field_type": {
"user_address_country": {
"options": [
"ALL"
]
}
},
"value": "US"
},
"billing.address.line1": {
"required_field": "payment_method_data.billing.address.line1",
"display_name": "line1",
"field_type": "user_address_line1",
"value": "1467"
},
"billing.address.state": {
"required_field": "payment_method_data.billing.address.state",
"display_name": "state",
"field_type": "user_address_state",
"value": "California"
},
"billing.address.zip": {
"required_field": "payment_method_data.billing.address.zip",
"display_name": "zip",
"field_type": "user_address_pincode",
"value": "94122"
},
"billing.email": {
"required_field": "payment_method_data.billing.email",
"display_name": "email",
"field_type": "user_email_address",
"value": "something@gmail.com"
},
"billing.address.last_name": {
"required_field": "payment_method_data.billing.address.last_name",
"display_name": "billing_last_name",
"field_type": "user_billing_name",
"value": "Doe"
},
"billing.address.city": {
"required_field": "payment_method_data.billing.address.city",
"display_name": "city",
"field_type": "user_address_city",
"value": "San Fransico"
}
},
"surcharge_details": null,
"pm_auth_connector": null
},
{
"payment_method_type": "google_pay",
"payment_experience": [
{
"payment_experience_type": "invoke_sdk_client",
"eligible_connectors": [
"cybersource"
]
}
],
"card_networks": null,
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {
"billing.address.zip": {
"required_field": "payment_method_data.billing.address.zip",
"display_name": "zip",
"field_type": "user_address_pincode",
"value": "94122"
},
"billing.address.last_name": {
"required_field": "payment_method_data.billing.address.last_name",
"display_name": "billing_last_name",
"field_type": "user_billing_name",
"value": "Doe"
},
"billing.email": {
"required_field": "payment_method_data.billing.email",
"display_name": "email",
"field_type": "user_email_address",
"value": "something@gmail.com"
},
"billing.address.first_name": {
"required_field": "payment_method_data.billing.address.first_name",
"display_name": "billing_first_name",
"field_type": "user_billing_name",
"value": "joseph"
},
"billing.address.city": {
"required_field": "payment_method_data.billing.address.city",
"display_name": "city",
"field_type": "user_address_city",
"value": "San Fransico"
},
"billing.address.state": {
"required_field": "payment_method_data.billing.address.state",
"display_name": "state",
"field_type": "user_address_state",
"value": "California"
},
"billing.address.country": {
"required_field": "payment_method_data.billing.address.country",
"display_name": "country",
"field_type": {
"user_address_country": {
"options": [
"ALL"
]
}
},
"value": "US"
},
"billing.address.line1": {
"required_field": "payment_method_data.billing.address.line1",
"display_name": "line1",
"field_type": "user_address_line1",
"value": "1467"
}
},
"surcharge_details": null,
"pm_auth_connector": null
}
]
},
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"payment_experience": null,
"card_networks": [
{
"card_network": "Discover",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
},
{
"card_network": "DinersClub",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
},
{
"card_network": "Visa",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
},
{
"card_network": "Mastercard",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
}
],
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {
"payment_method_data.card.card_number": {
"required_field": "payment_method_data.card.card_number",
"display_name": "card_number",
"field_type": "user_card_number",
"value": null
},
"billing.address.state": {
"required_field": "payment_method_data.billing.address.state",
"display_name": "state",
"field_type": "user_address_state",
"value": "California"
},
"billing.address.zip": {
"required_field": "payment_method_data.billing.address.zip",
"display_name": "zip",
"field_type": "user_address_pincode",
"value": "94122"
},
"billing.email": {
"required_field": "payment_method_data.billing.email",
"display_name": "email",
"field_type": "user_email_address",
"value": "something@gmail.com"
},
"payment_method_data.card.card_exp_month": {
"required_field": "payment_method_data.card.card_exp_month",
"display_name": "card_exp_month",
"field_type": "user_card_expiry_month",
"value": null
},
"billing.address.first_name": {
"required_field": "payment_method_data.billing.address.first_name",
"display_name": "card_holder_name",
"field_type": "user_full_name",
"value": "joseph"
},
"billing.address.line1": {
"required_field": "payment_method_data.billing.address.line1",
"display_name": "line1",
"field_type": "user_address_line1",
"value": "1467"
},
"payment_method_data.card.card_cvc": {
"required_field": "payment_method_data.card.card_cvc",
"display_name": "card_cvc",
"field_type": "user_card_cvc",
"value": null
},
"billing.address.city": {
"required_field": "payment_method_data.billing.address.city",
"display_name": "city",
"field_type": "user_address_city",
"value": "San Fransico"
},
"payment_method_data.card.card_exp_year": {
"required_field": "payment_method_data.card.card_exp_year",
"display_name": "card_exp_year",
"field_type": "user_card_expiry_year",
"value": null
},
"billing.address.country": {
"required_field": "payment_method_data.billing.address.country",
"display_name": "country",
"field_type": {
"user_address_country": {
"options": [
"ALL"
]
}
},
"value": "US"
},
"billing.address.last_name": {
"required_field": "payment_method_data.billing.address.last_name",
"display_name": "card_holder_name",
"field_type": "user_full_name",
"value": "Doe"
}
},
"surcharge_details": null,
"pm_auth_connector": null
},
{
"payment_method_type": "debit",
"payment_experience": null,
"card_networks": [
{
"card_network": "Mastercard",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
},
{
"card_network": "Visa",
"surcharge_details": null,
"eligible_connectors": [
"cybersource"
]
}
],
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {
"billing.address.zip": {
"required_field": "payment_method_data.billing.address.zip",
"display_name": "zip",
"field_type": "user_address_pincode",
"value": "94122"
},
"billing.address.country": {
"required_field": "payment_method_data.billing.address.country",
"display_name": "country",
"field_type": {
"user_address_country": {
"options": [
"ALL"
]
}
},
"value": "US"
},
"billing.address.city": {
"required_field": "payment_method_data.billing.address.city",
"display_name": "city",
"field_type": "user_address_city",
"value": "San Fransico"
},
"payment_method_data.card.card_cvc": {
"required_field": "payment_method_data.card.card_cvc",
"display_name": "card_cvc",
"field_type": "user_card_cvc",
"value": null
},
"billing.email": {
"required_field": "payment_method_data.billing.email",
"display_name": "email",
"field_type": "user_email_address",
"value": "something@gmail.com"
},
"billing.address.last_name": {
"required_field": "payment_method_data.billing.address.last_name",
"display_name": "card_holder_name",
"field_type": "user_full_name",
"value": "Doe"
},
"payment_method_data.card.card_exp_year": {
"required_field": "payment_method_data.card.card_exp_year",
"display_name": "card_exp_year",
"field_type": "user_card_expiry_year",
"value": null
},
"billing.address.first_name": {
"required_field": "payment_method_data.billing.address.first_name",
"display_name": "card_holder_name",
"field_type": "user_full_name",
"value": "joseph"
},
"billing.address.state": {
"required_field": "payment_method_data.billing.address.state",
"display_name": "state",
"field_type": "user_address_state",
"value": "California"
},
"payment_method_data.card.card_exp_month": {
"required_field": "payment_method_data.card.card_exp_month",
"display_name": "card_exp_month",
"field_type": "user_card_expiry_month",
"value": null
},
"payment_method_data.card.card_number": {
"required_field": "payment_method_data.card.card_number",
"display_name": "card_number",
"field_type": "user_card_number",
"value": null
},
"billing.address.line1": {
"required_field": "payment_method_data.billing.address.line1",
"display_name": "line1",
"field_type": "user_address_line1",
"value": "1467"
}
},
"surcharge_details": null,
"pm_auth_connector": null
}
]
}
],
"mandate_payment": null,
"merchant_name": "NewAge Retailer",
"show_surcharge_breakup_screen": false,
"payment_type": "new_mandate",
"request_external_three_ds_authentication": false,
"collect_shipping_details_from_wallets": false,
"collect_billing_details_from_wallets": false,
"is_tax_calculation_enabled": false
}
```
-> Session token call. This should contain samsung pay token
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_62e8ef44460c457fb253bff92ab3a5ae' \
--data '{
"payment_id": "pay_6VymzRBxbxuYxHIxg6Je",
"wallets": [],
"client_secret": "pay_6VymzRBxbxuYxHIxg6Je_secret_zASufbgnXLVB5t4nNz6M"
}'
```
```
{
"payment_id": "pay_6VymzRBxbxuYxHIxg6Je",
"client_secret": "pay_6VymzRBxbxuYxHIxg6Je_secret_zASufbgnXLVB5t4nNz6M",
"session_token": [
{
"wallet_name": "google_pay",
"merchant_info": {
"merchant_name": "Stripe"
},
"shipping_address_required": false,
"email_required": false,
"shipping_address_parameters": {
"phone_number_required": false
},
"allowed_payment_methods": [
{
"type": "CARD",
"parameters": {
"allowed_auth_methods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"allowed_card_networks": [
"AMEX",
"DISCOVER",
"INTERAC",
"JCB",
"MASTERCARD",
"VISA"
],
"billing_address_required": false
},
"tokenization_specification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2018-10-31",
"stripe:publishableKey": "pk_test_51Msk2GAGHc77EJXX78h549SX2uaOnEkUYqBfjcoD05PIpAnDkYxMn8nQ4d19im85NQuX4Z6WDyHaUw2fFTPBWsIY00Wa7oNerO"
}
}
}
],
"transaction_info": {
"country_code": "US",
"currency_code": "USD",
"total_price_status": "Final",
"total_price": "61.00"
},
"delayed_session_token": false,
"connector": "cybersource",
"sdk_next_action": {
"next_action": "confirm"
},
"secrets": null
},
{
"wallet_name": "samsung_pay",
"version": "2",
"service_id": "49400558c67f4a97b3925f",
"order_number": "pay-6VymzRBxbxuYxHIxg6Je",
"merchant": {
"name": "Hyperswitch",
"url": null,
"country_code": "IN"
},
"amount": {
"option": "FORMAT_TOTAL_PRICE_ONLY",
"currency_code": "USD",
"total": "61.00"
},
"protocol": "PROTOCOL3DS",
"allowed_brands": [
"visa",
"masterCard",
"amex",
"discover"
]
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
cf82861e855bbd055fcbfc2367b23eaa58d8f842
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7080
|
Bug: [BUG] Deployed on a cloud server using Docker Compose, sign up keeps prompting 'Register failed, Try again'
### Bug Description

### Expected Behavior
None
### Actual Behavior
None
### Steps To Reproduce
1. git clone https://github.com/juspay/hyperswitch
2. cd hyperswitch
3. docker compose up -d
I did such operations on my cloud machine which has a public ip.
I referred this doc https://github.com/juspay/hyperswitch?tab=readme-ov-file#try-hyperswitch
### Context For The Bug
I found a similar issue, but the solution of the issue is not worked for me.
https://github.com/juspay/hyperswitch/issues/6915
### Environment
linux version:
NAME="Alibaba Cloud Linux"
VERSION="3 (OpenAnolis Edition)"
ID="alinux"
ID_LIKE="rhel fedora centos anolis"
VERSION_ID="3"
VARIANT="OpenAnolis Edition"
VARIANT_ID="openanolis"
ALINUX_MINOR_ID="2104"
ALINUX_UPDATE_ID="10"
PLATFORM_ID="platform:al8"
PRETTY_NAME="Alibaba Cloud Linux 3.2104 U10 (OpenAnolis Edition)"
ANSI_COLOR="0;31"
HOME_URL="https://www.aliyun.com/"
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None
|
diff --git a/docker-compose-development.yml b/docker-compose-development.yml
index d7a0e365c36..416646f013c 100644
--- a/docker-compose-development.yml
+++ b/docker-compose-development.yml
@@ -64,7 +64,7 @@ services:
FROM rust:latest
RUN apt-get update && \
apt-get install -y protobuf-compiler
- RUN rustup component add rustfmt clippy
+ RUN rustup component add rustfmt clippy
command: cargo run --bin router -- -f ./config/docker_compose.toml
working_dir: /app
ports:
@@ -332,7 +332,7 @@ services:
FROM node:lts
RUN git clone https://github.com/juspay/hyperswitch-web.git --depth 1
WORKDIR hyperswitch-web
- RUN npm i --force
+ RUN npm i --ignore-scripts
command: bash -c 'npm run re:build && npx run webpack serve --config webpack.dev.js --host 0.0.0.0'
ports:
- "9050:9050"
diff --git a/docker-compose.yml b/docker-compose.yml
index 4bc08b09f63..b584beca560 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -51,7 +51,7 @@ services:
environment:
# format -> postgresql://DB_USER:DB_PASSWORD@HOST:PORT/DATABASE_NAME
- DATABASE_URL=postgresql://db_user:db_pass@pg:5432/hyperswitch_db
-
+
mailhog:
image: mailhog/mailhog
networks:
@@ -149,15 +149,13 @@ services:
### Web Client
hyperswitch-web:
+ image: juspaydotin/hyperswitch-web:latest
ports:
- "9050:9050"
- "9060:9060"
- "5252:5252"
networks:
- router_net
- build:
- context: ./docker
- dockerfile: web.Dockerfile
depends_on:
hyperswitch-server:
condition: service_healthy
diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile
index 532ce28fb7c..0ff02e08e4b 100644
--- a/docker/web.Dockerfile
+++ b/docker/web.Dockerfile
@@ -12,4 +12,4 @@ EXPOSE 9050
EXPOSE 5252
EXPOSE 9060
-CMD concurrently "npm run re:build && npm run start" "npm run start:playground"
\ No newline at end of file
+CMD bash -c "npm run re:build && npm run start && npm run start:playground"
\ No newline at end of file
|
2025-01-29T05:02:03Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Playground is not running properly and throwing errors as it is not able to find HyperLoader file.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
https://github.com/juspay/hyperswitch/issues/7080
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
c3333894ce64b1bc694f8c1eb09a8744aa850443
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7084
|
Bug: store `network_transaction_id` for `off_session` payments irrespective of the `is_connector_agnostic_mit_enabled` config
Currently, we store the `network_transaction_id` for the setup_mandate/off_session payments only if the `is_connector_agnostic_mit_enabled` config is enabled. During the MITs, we refer to this flag to decide whether to use the `connector_mandate_id` or the `network_transaction_id` for the MIT.
Instead of using the flag for multiple purposes, it should be used solely to determine whether to use the `connector_mandate_id` or the `network_transaction_id` for the MIT. Therefore, this change will ensure that the `network_transaction_id` is always stored for off-session payments if it is present in the connector response.
|
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 9692b1ca8a5..1cc0975af47 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -576,7 +576,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: &domain::Profile,
+ _business_profile: &domain::Profile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
@@ -617,7 +617,6 @@ 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(())
@@ -1201,7 +1200,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: &domain::Profile,
+ _business_profile: &domain::Profile,
) -> CustomResult<(), errors::ApiErrorResponse>
where
F: 'b + Clone + Send + Sync,
@@ -1241,7 +1240,6 @@ 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(())
@@ -2079,7 +2077,6 @@ 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<()> {
todo!()
}
@@ -2095,7 +2092,6 @@ 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 the payment_method is deleted then ignore the error related to retrieving payment method
// This should be handled when the payment method is soft deleted
@@ -2130,20 +2126,18 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
})
.ok()
.flatten();
- let network_transaction_id =
- if let Some(network_transaction_id) = pm_resp_network_transaction_id {
- if is_connector_agnostic_mit_enabled == Some(true)
- && payment_data.payment_intent.setup_future_usage
- == Some(diesel_models::enums::FutureUsage::OffSession)
- {
- Some(network_transaction_id)
- } else {
- logger::info!("Skip storing network transaction id");
- None
- }
+ let network_transaction_id = if payment_data.payment_intent.setup_future_usage
+ == Some(diesel_models::enums::FutureUsage::OffSession)
+ {
+ if pm_resp_network_transaction_id.is_some() {
+ pm_resp_network_transaction_id
} else {
+ logger::info!("Skip storing network transaction id");
None
- };
+ }
+ } else {
+ None
+ };
let pm_update = if payment_method.status != common_enums::PaymentMethodStatus::Active
&& payment_method.status != attempt_status.into()
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 84f848ef0ab..6ca4fa2ee72 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -108,12 +108,11 @@ where
};
let network_transaction_id =
- if let Some(network_transaction_id) = network_transaction_id {
- if business_profile.is_connector_agnostic_mit_enabled == Some(true)
- && save_payment_method_data.request.get_setup_future_usage()
- == Some(storage_enums::FutureUsage::OffSession)
- {
- Some(network_transaction_id)
+ if save_payment_method_data.request.get_setup_future_usage()
+ == Some(storage_enums::FutureUsage::OffSession)
+ {
+ if network_transaction_id.is_some() {
+ network_transaction_id
} else {
logger::info!("Skip storing network transaction id");
None
|
2025-01-22T05:52:16Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Currently, we store the `network_transaction_id` for the setup_mandate/off_session payments only if the `is_connector_agnostic_mit_enabled` config is enabled. During the MITs, we refer to this flag to decide whether to use the `connector_mandate_id` or the `network_transaction_id` for the MIT.
Instead of using the flag for multiple purposes, it should be used solely to determine whether to use the `connector_mandate_id` or the `network_transaction_id` for the MIT. Therefore, this change will ensure that the `network_transaction_id` is always stored for off-session payments if it is present in the connector response.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Instead of using the `is_connector_agnostic_mit_enabled` flag for multiple purposes, it should be used solely to determine whether to use the `connector_mandate_id` or the `network_transaction_id` for the MIT. And is the connector is returning the `network_transaction_id` for the `off_session` payment it should always be stored.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a business profile and `is_connector_agnostic_mit_enabled` disabled.
#### Initial CIT
-> Make an off_session payment. Even though the `is_connector_agnostic_mit_enabled` is false `network_transaction_id` should be stored in the payment methods table.
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 500,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "cu_1737523971",
"email": "guest@example.com",
"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",
"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": "name name",
"card_cvc": "737"
}
},
"setup_future_usage": "off_session",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"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",
"last_name": "ss"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"browser_info": {
"user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
"accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "125.0.0.1"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {},
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 0,
"account_name": "transaction_processing"
}
]
}'
```
```
{
"payment_id": "pay_WdSrWb2Xf2kDegvEULPM",
"merchant_id": "merchant_1737523864",
"status": "succeeded",
"amount": 500,
"net_amount": 500,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 500,
"connector": "stripe",
"client_secret": "pay_WdSrWb2Xf2kDegvEULPM_secret_VpuAJ51okhFJZG8TmQ0c",
"created": "2025-01-22T05:32:47.192Z",
"currency": "USD",
"customer_id": "cu_1737523967",
"customer": {
"id": "cu_1737523967",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": {
"cvc_check": "pass",
"address_line1_check": "pass",
"address_postal_code_check": "pass"
},
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": "ss"
},
"phone": null,
"email": null
},
"order_details": [
{
"brand": null,
"amount": 0,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737523967",
"created_at": 1737523967,
"expires": 1737527567,
"secret": "epk_e06fef83ccd64ff8b38d5c9955b09a25"
},
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3QjwYWEOqOywnAIx0lOiWYTn",
"frm_message": null,
"metadata": {},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QjwYWEOqOywnAIx0lOiWYTn",
"payment_link": null,
"profile_id": "pro_L5I6p61FJYPyguLsk4W7",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_OrorUGWr12wrEyKfTPBT",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-22T05:47:47.192Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": "pm_MtvoUeVqyzRigXnRA3B8",
"payment_method_status": "active",
"updated": "2025-01-22T05:32:49.202Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "pm_1QjwYWEOqOywnAIx6kk4d3Cf"
}
```
-> Db screenshot shown `network_transaction_id` being stored in the payment methods table.
<img width="1259" alt="image" src="https://github.com/user-attachments/assets/a108e721-41ce-46e5-a0dc-0a327a812742" />
#### Recurring MIT
-> Create a payment for the same customer with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "USD",
"capture_method": "automatic",
"authentication_type": "three_ds",
"confirm": false,
"customer_id": "cu_1737523967"
}'
```
```
{
"payment_id": "pay_i04r0cC5OTVNrNBbWHLk",
"merchant_id": "merchant_1737523864",
"status": "requires_payment_method",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_i04r0cC5OTVNrNBbWHLk_secret_WsYRWkHY7vxbD2AOt1tL",
"created": "2025-01-22T05:37:20.683Z",
"currency": "USD",
"customer_id": "cu_1737523967",
"customer": {
"id": "cu_1737523967",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737523967",
"created_at": 1737524240,
"expires": 1737527840,
"secret": "epk_5036d7ff60ff4b76a31e2a12bf758273"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_L5I6p61FJYPyguLsk4W7",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-22T05:52:20.683Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-22T05:37:20.704Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> List payment methods using the above client_secret
```
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_i04r0cC5OTVNrNBbWHLk_secret_WsYRWkHY7vxbD2AOt1tL' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_2075ddba1e634912bd68c04d912b9da4'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_4LrYcGKdvscFoqp6OzWZ",
"payment_method_id": "pm_MtvoUeVqyzRigXnRA3B8",
"customer_id": "cu_1737523967",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": true,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": {
"scheme": null,
"issuer_country": null,
"last4_digits": "1111",
"expiry_month": "03",
"expiry_year": "2030",
"card_token": null,
"card_holder_name": "name name",
"card_fingerprint": null,
"nick_name": null,
"card_network": null,
"card_isin": "411111",
"card_issuer": null,
"card_type": null,
"saved_to_locker": true
},
"metadata": null,
"created": "2025-01-22T05:32:49.170Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-01-22T05:32:49.170Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "name",
"last_name": "name"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": false
}
```
-> Confirm the payment with the above listed token. Even though `network_transaction_id` is present, as the `is_connector_agnostic_mit_enabled` is false the MIT should be processed by using `connector_mandate_id`.
```
curl --location 'http://localhost:8080/payments/pay_i04r0cC5OTVNrNBbWHLk/confirm' \
--header 'api-key: pk_dev_2075ddba1e634912bd68c04d912b9da4' \
--header 'Content-Type: application/json' \
--data-raw '{
"payment_token": "token_4LrYcGKdvscFoqp6OzWZ",
"payment_method_type": "credit",
"payment_method": "card",
"setup_future_usage": "off_session",
"client_secret": "pay_i04r0cC5OTVNrNBbWHLk_secret_WsYRWkHY7vxbD2AOt1tL",
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
}
}'
```
```
{
"payment_id": "pay_i04r0cC5OTVNrNBbWHLk",
"merchant_id": "merchant_1737523864",
"status": "succeeded",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 10000,
"connector": "stripe",
"client_secret": "pay_i04r0cC5OTVNrNBbWHLk_secret_WsYRWkHY7vxbD2AOt1tL",
"created": "2025-01-22T05:37:20.683Z",
"currency": "USD",
"customer_id": "cu_1737523967",
"customer": {
"id": "cu_1737523967",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_4LrYcGKdvscFoqp6OzWZ",
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3QjwfBEOqOywnAIx0lXPFXLq",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QjwfBEOqOywnAIx0lXPFXLq",
"payment_link": null,
"profile_id": "pro_L5I6p61FJYPyguLsk4W7",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_OrorUGWr12wrEyKfTPBT",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-22T05:52:20.683Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": null,
"time_zone": null,
"ip_address": "::1",
"os_version": null,
"user_agent": null,
"color_depth": null,
"device_model": null,
"java_enabled": null,
"screen_width": null,
"accept_header": null,
"screen_height": null,
"java_script_enabled": null
},
"payment_method_id": "pm_MtvoUeVqyzRigXnRA3B8",
"payment_method_status": "active",
"updated": "2025-01-22T05:39:42.150Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "pm_1QjwYWEOqOywnAIx6kk4d3Cf"
}
```
-> Logs showing `connector_mandate_id` is used for the MIT
<img width="1426" alt="image" src="https://github.com/user-attachments/assets/7ec05d70-a8a7-416f-9792-f875c0c689eb" />
#### Recurring MIT by passing different connector in the routing.
-> Create a `network_transaction_id` support connector (stripe, adyen or cybersource)
-> Create a payment for the same customer
```
curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "USD",
"capture_method": "automatic",
"authentication_type": "three_ds",
"confirm": false,
"customer_id": "cu_1737523967"
}'
```
```
{
"payment_id": "pay_Bi0rNupobukz2roRumXE",
"merchant_id": "merchant_1737523864",
"status": "requires_payment_method",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_Bi0rNupobukz2roRumXE_secret_5p8bU6yvNJeims5isKKM",
"created": "2025-01-22T05:43:24.656Z",
"currency": "USD",
"customer_id": "cu_1737523967",
"customer": {
"id": "cu_1737523967",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737523967",
"created_at": 1737524604,
"expires": 1737528204,
"secret": "epk_b8b07628bfa247d395517dbdc54c26b1"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_L5I6p61FJYPyguLsk4W7",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-22T05:58:24.656Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-22T05:43:24.666Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> List payment methods using the above client_secret
```
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_Bi0rNupobukz2roRumXE_secret_5p8bU6yvNJeims5isKKM' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_2075ddba1e634912bd68c04d912b9da4'
```
```
{
"customer_payment_methods": [
{
"payment_token": "token_1nBgsEHUEWZbafeYF91S",
"payment_method_id": "pm_MtvoUeVqyzRigXnRA3B8",
"customer_id": "cu_1737523967",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_issuer": null,
"payment_method_issuer_code": null,
"recurring_enabled": true,
"installment_payment_enabled": false,
"payment_experience": [
"redirect_to_url"
],
"card": {
"scheme": null,
"issuer_country": null,
"last4_digits": "1111",
"expiry_month": "03",
"expiry_year": "2030",
"card_token": null,
"card_holder_name": "name name",
"card_fingerprint": null,
"nick_name": null,
"card_network": null,
"card_isin": "411111",
"card_issuer": null,
"card_type": null,
"saved_to_locker": true
},
"metadata": null,
"created": "2025-01-22T05:32:49.170Z",
"bank": null,
"surcharge_details": null,
"requires_cvv": true,
"last_used_at": "2025-01-22T05:39:42.140Z",
"default_payment_method_set": true,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "name",
"last_name": "name"
},
"phone": null,
"email": null
}
}
],
"is_guest_customer": false
}
```
-> Confirm the payment by pass the newly configured connector (the connector that was not used in the initially CIT). Even though cybersource was sent in the routing input, the payment was processed with stripe as the `is_connector_agnostic_mit_enabled` is false and `connector_mandate_id` that is present is of stripe.
```
curl --location 'http://localhost:8080/payments/pay_Bi0rNupobukz2roRumXE/confirm' \
--header 'api-key: pk_dev_2075ddba1e634912bd68c04d912b9da4' \
--header 'Content-Type: application/json' \
--data-raw '{
"payment_token": "token_1nBgsEHUEWZbafeYF91S",
"payment_method_type": "credit",
"payment_method": "card",
"setup_future_usage": "off_session",
"client_secret": "pay_Bi0rNupobukz2roRumXE_secret_5p8bU6yvNJeims5isKKM",
"routing": {
"type": "single",
"data": {
"connector": "cybersource",
"merchant_connector_id": "mca_Z8Jdk0UIzjgZHVlOHjuX"
}
},
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
}
}'
```
```
{
"payment_id": "pay_Bi0rNupobukz2roRumXE",
"merchant_id": "merchant_1737523864",
"status": "succeeded",
"amount": 10000,
"net_amount": 10000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 10000,
"connector": "stripe",
"client_secret": "pay_Bi0rNupobukz2roRumXE_secret_5p8bU6yvNJeims5isKKM",
"created": "2025-01-22T05:43:24.656Z",
"currency": "USD",
"customer_id": "cu_1737523967",
"customer": {
"id": "cu_1737523967",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "name name",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_1nBgsEHUEWZbafeYF91S",
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "guest@example.com"
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3QjwjAEOqOywnAIx1JaY1wKs",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QjwjAEOqOywnAIx1JaY1wKs",
"payment_link": null,
"profile_id": "pro_L5I6p61FJYPyguLsk4W7",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_OrorUGWr12wrEyKfTPBT",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-22T05:58:24.656Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": null,
"time_zone": null,
"ip_address": "::1",
"os_version": null,
"user_agent": null,
"color_depth": null,
"device_model": null,
"java_enabled": null,
"screen_width": null,
"accept_header": null,
"screen_height": null,
"java_script_enabled": null
},
"payment_method_id": "pm_MtvoUeVqyzRigXnRA3B8",
"payment_method_status": "active",
"updated": "2025-01-22T05:43:49.519Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "pm_1QjwYWEOqOywnAIx6kk4d3Cf"
}
```
-> Log showing routing order is `[Cybersource, Stripe]` and `connector_mandate_id` was used to process the MIT
<img width="1427" alt="image" src="https://github.com/user-attachments/assets/e4fdde89-891c-4c15-83fd-d428e029bb29" />
NTID cypress test for stripe
<img width="1436" alt="image" src="https://github.com/user-attachments/assets/30ada514-d65a-4302-9c79-df0426e48622" />
<img width="816" alt="image" src="https://github.com/user-attachments/assets/ed17de24-643c-44d7-b6de-6e2ae6e09ed0" />
NTID cypress test for cybersource
<img width="1436" alt="image" src="https://github.com/user-attachments/assets/f36d444a-8123-4577-a0e8-df9dc7762c89" />
<img width="816" alt="image" src="https://github.com/user-attachments/assets/51568fcd-ccb3-424d-b11f-9d4db468bb39" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
5247a3c6512d39d5468188419cf22d362118ee7b
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7094
|
Bug: populate `payment_method_data` in the samsung pay payment response
populate `payment_method_data` in the samsung pay payment response
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 892931256bc..df71a0249b5 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -21469,8 +21469,7 @@
"type": "object",
"required": [
"last4",
- "card_network",
- "type"
+ "card_network"
],
"properties": {
"last4": {
@@ -21483,7 +21482,8 @@
},
"type": {
"type": "string",
- "description": "The type of payment method"
+ "description": "The type of payment method",
+ "nullable": true
}
}
},
@@ -21840,6 +21840,17 @@
"$ref": "#/components/schemas/WalletAdditionalDataForCard"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "samsung_pay"
+ ],
+ "properties": {
+ "samsung_pay": {
+ "$ref": "#/components/schemas/WalletAdditionalDataForCard"
+ }
+ }
}
],
"description": "Hyperswitch supports SDK integration with Apple Pay and Google Pay wallets. For other wallets, we integrate with their respective connectors, redirecting the customer to the connector for wallet payments. As a result, we don’t receive any payment method data in the confirm call for payments made through other wallets."
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 82a7abc6ef1..12bb97d9b7d 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -829,7 +829,7 @@ pub struct PaymentMethodDataWalletInfo {
pub card_network: String,
/// The type of payment method
#[serde(rename = "type")]
- pub card_type: String,
+ pub card_type: Option<String>,
}
impl From<payments::additional_info::WalletAdditionalDataForCard> for PaymentMethodDataWalletInfo {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index b6152cc9787..1851a549375 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2601,6 +2601,7 @@ pub enum AdditionalPaymentData {
Wallet {
apple_pay: Option<ApplepayPaymentMethod>,
google_pay: Option<additional_info::WalletAdditionalDataForCard>,
+ samsung_pay: Option<additional_info::WalletAdditionalDataForCard>,
},
PayLater {
klarna_sdk: Option<KlarnaSdkPaymentMethod>,
@@ -3874,6 +3875,8 @@ pub enum WalletResponseData {
ApplePay(Box<additional_info::WalletAdditionalDataForCard>),
#[schema(value_type = WalletAdditionalDataForCard)]
GooglePay(Box<additional_info::WalletAdditionalDataForCard>),
+ #[schema(value_type = WalletAdditionalDataForCard)]
+ SamsungPay(Box<additional_info::WalletAdditionalDataForCard>),
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -5410,8 +5413,9 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
AdditionalPaymentData::Wallet {
apple_pay,
google_pay,
- } => match (apple_pay, google_pay) {
- (Some(apple_pay_pm), _) => Self::Wallet(Box::new(WalletResponse {
+ samsung_pay,
+ } => match (apple_pay, google_pay, samsung_pay) {
+ (Some(apple_pay_pm), _, _) => Self::Wallet(Box::new(WalletResponse {
details: Some(WalletResponseData::ApplePay(Box::new(
additional_info::WalletAdditionalDataForCard {
last4: apple_pay_pm
@@ -5425,13 +5429,16 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
.rev()
.collect::<String>(),
card_network: apple_pay_pm.network.clone(),
- card_type: apple_pay_pm.pm_type.clone(),
+ card_type: Some(apple_pay_pm.pm_type.clone()),
},
))),
})),
- (_, Some(google_pay_pm)) => Self::Wallet(Box::new(WalletResponse {
+ (_, Some(google_pay_pm), _) => Self::Wallet(Box::new(WalletResponse {
details: Some(WalletResponseData::GooglePay(Box::new(google_pay_pm))),
})),
+ (_, _, Some(samsung_pay_pm)) => Self::Wallet(Box::new(WalletResponse {
+ details: Some(WalletResponseData::SamsungPay(Box::new(samsung_pay_pm))),
+ })),
_ => Self::Wallet(Box::new(WalletResponse { details: None })),
},
AdditionalPaymentData::BankRedirect { bank_name, details } => {
diff --git a/crates/api_models/src/payments/additional_info.rs b/crates/api_models/src/payments/additional_info.rs
index 9e8c910cba7..769e98214fa 100644
--- a/crates/api_models/src/payments/additional_info.rs
+++ b/crates/api_models/src/payments/additional_info.rs
@@ -219,5 +219,5 @@ pub struct WalletAdditionalDataForCard {
pub card_network: String,
/// The type of payment method
#[serde(rename = "type")]
- pub card_type: String,
+ pub card_type: Option<String>,
}
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 8c19a20ef32..dcf46964170 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -1718,7 +1718,7 @@ impl From<GooglePayWalletData> for payment_methods::PaymentMethodDataWalletInfo
Self {
last4: item.info.card_details,
card_network: item.info.card_network,
- card_type: item.pm_type,
+ card_type: Some(item.pm_type),
}
}
}
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
index 59a703d2b3c..da93a14dc94 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
@@ -239,7 +239,7 @@ where
connector: router_data.connector,
payment_id: router_data.payment_id.clone(),
attempt_id: router_data.attempt_id,
- request: FrmRequest::Checkout(FraudCheckCheckoutData {
+ request: FrmRequest::Checkout(Box::new(FraudCheckCheckoutData {
amount: router_data.request.amount,
order_details: router_data.request.order_details,
currency: router_data.request.currency,
@@ -247,7 +247,7 @@ where
payment_method_data: router_data.request.payment_method_data,
email: router_data.request.email,
gateway: router_data.request.gateway,
- }),
+ })),
response: FrmResponse::Checkout(router_data.response),
})
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 93769c71e6c..be88ecd371e 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4671,6 +4671,7 @@ pub async fn get_additional_payment_data(
pm_type: apple_pay_wallet_data.payment_method.pm_type.clone(),
}),
google_pay: None,
+ samsung_pay: None,
}))
}
domain::WalletData::GooglePay(google_pay_pm_data) => {
@@ -4679,13 +4680,32 @@ pub async fn get_additional_payment_data(
google_pay: Some(payment_additional_types::WalletAdditionalDataForCard {
last4: google_pay_pm_data.info.card_details.clone(),
card_network: google_pay_pm_data.info.card_network.clone(),
- card_type: google_pay_pm_data.pm_type.clone(),
+ card_type: Some(google_pay_pm_data.pm_type.clone()),
+ }),
+ samsung_pay: None,
+ }))
+ }
+ domain::WalletData::SamsungPay(samsung_pay_pm_data) => {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
+ apple_pay: None,
+ google_pay: None,
+ samsung_pay: Some(payment_additional_types::WalletAdditionalDataForCard {
+ last4: samsung_pay_pm_data
+ .payment_credential
+ .card_last_four_digits
+ .clone(),
+ card_network: samsung_pay_pm_data
+ .payment_credential
+ .card_brand
+ .to_string(),
+ card_type: None,
}),
}))
}
_ => Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: None,
+ samsung_pay: None,
})),
},
domain::PaymentMethodData::PayLater(_) => Ok(Some(
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 2bb751d4e14..ed5c93489cd 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1178,6 +1178,14 @@ impl PaymentCreate {
Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: Some(wallet.into()),
+ samsung_pay: None,
+ })
+ }
+ Some(enums::PaymentMethodType::SamsungPay) => {
+ Some(api_models::payments::AdditionalPaymentData::Wallet {
+ apple_pay: None,
+ google_pay: None,
+ samsung_pay: Some(wallet.into()),
})
}
_ => None,
diff --git a/crates/router/src/types/fraud_check.rs b/crates/router/src/types/fraud_check.rs
index a861aca67db..386c8a9cd90 100644
--- a/crates/router/src/types/fraud_check.rs
+++ b/crates/router/src/types/fraud_check.rs
@@ -29,7 +29,7 @@ pub struct FrmRouterData {
#[derive(Debug, Clone)]
pub enum FrmRequest {
Sale(FraudCheckSaleData),
- Checkout(FraudCheckCheckoutData),
+ Checkout(Box<FraudCheckCheckoutData>),
Transaction(FraudCheckTransactionData),
Fulfillment(FraudCheckFulfillmentData),
RecordReturn(FraudCheckRecordReturnData),
|
2025-01-23T10:29:42Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pr contains the changes to populate `payment_method_data` in the samsung pay payment response. As part of this card_type is made a optional for wallet payment_method_data as samsung pay does not send credit or debit in the samsung pay token.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Having `payment_method_data` for Samsung Pay would be helpful in identifying the customer's card, as it contains the last four digits during a wallet payment.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a connector with samsung pay enabled
-> Make a samsung pay payment, payment_method_data would be populated in the resposne.
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--data-raw '{
"amount": 1,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"amount_to_capture": 1,
"customer_id": "cu_1737628105",
"setup_future_usage": "off_session",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"return_url": "https://google.com",
"email": "samsungpay@gmail.com",
"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": "wallet",
"payment_method_type": "samsung_pay",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"payment_method_data": {
"wallet": {
"samsung_pay": {
"payment_credential": {
"3_d_s": {
"type": "S",
"version": "100",
"data": ""
},
"payment_card_brand": "VI",
"payment_currency_type": "USD",
"payment_last4_fpan": "1661",
"method": "3DS",
"recurring_payment": false
}
}
}
}
}
'
```
```
{
"payment_id": "pay_JfvIOAfcN2hhbntSD4Wl",
"merchant_id": "merchant_1737542123",
"status": "processing",
"amount": 1,
"net_amount": 1,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "cybersource",
"client_secret": "pay_JfvIOAfcN2hhbntSD4Wl_secret_XQLmNkq4plkpVOnRJ4Tj",
"created": "2025-01-23T08:14:47.701Z",
"currency": "USD",
"customer_id": "cu_1737620088",
"customer": {
"id": "cu_1737620088",
"name": "Joseph Doe",
"email": "samsungpay@gmail.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"samsung_pay": {
"last4": "1661",
"card_network": "Visa",
"type": null
}
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "samsungpay@gmail.com",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "Juspay",
"statement_descriptor_suffix": "Router",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "samsung_pay",
"connector_label": "cybersource_US_default_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737620088",
"created_at": 1737620087,
"expires": 1737623687,
"secret": "epk_7b4a3abd8dd549c9a62694843d1f34b4"
},
"manual_retry_allowed": false,
"connector_transaction_id": "7376200888906816004807",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "7376200888906816004807",
"payment_link": null,
"profile_id": "pro_ufywYBbtUhSFzOf1cGEM",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_27p7IwQqrL6FogXi41pr",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-23T08:29:47.701Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-23T08:14:49.229Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
cf82861e855bbd055fcbfc2367b23eaa58d8f842
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7075
|
Bug: feat(opensearch): add amount and customer_id as filters and handle name for different indexes
Add amount as a filter / category for global search.
Also, add customer_id as a filter for searching based on customer_id on Customers page.
|
diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs
index e85340e49d2..f12198d0054 100644
--- a/crates/analytics/src/opensearch.rs
+++ b/crates/analytics/src/opensearch.rs
@@ -456,7 +456,7 @@ pub struct OpenSearchQueryBuilder {
pub query: String,
pub offset: Option<i64>,
pub count: Option<i64>,
- pub filters: Vec<(String, Vec<String>)>,
+ pub filters: Vec<(String, Vec<Value>)>,
pub time_range: Option<OpensearchTimeRange>,
search_params: Vec<AuthInfo>,
case_sensitive_fields: HashSet<&'static str>,
@@ -477,6 +477,8 @@ impl OpenSearchQueryBuilder {
"search_tags.keyword",
"card_last_4.keyword",
"payment_id.keyword",
+ "amount",
+ "customer_id.keyword",
]),
}
}
@@ -492,7 +494,7 @@ impl OpenSearchQueryBuilder {
Ok(())
}
- pub fn add_filter_clause(&mut self, lhs: String, rhs: Vec<String>) -> QueryResult<()> {
+ pub fn add_filter_clause(&mut self, lhs: String, rhs: Vec<Value>) -> QueryResult<()> {
self.filters.push((lhs, rhs));
Ok(())
}
@@ -505,9 +507,18 @@ impl OpenSearchQueryBuilder {
}
}
+ pub fn get_amount_field(&self, index: SearchIndex) -> &str {
+ match index {
+ SearchIndex::Refunds | SearchIndex::SessionizerRefunds => "refund_amount",
+ SearchIndex::Disputes | SearchIndex::SessionizerDisputes => "dispute_amount",
+ _ => "amount",
+ }
+ }
+
pub fn build_filter_array(
&self,
- case_sensitive_filters: Vec<&(String, Vec<String>)>,
+ case_sensitive_filters: Vec<&(String, Vec<Value>)>,
+ index: SearchIndex,
) -> Vec<Value> {
let mut filter_array = Vec::new();
if !self.query.is_empty() {
@@ -522,7 +533,14 @@ impl OpenSearchQueryBuilder {
let case_sensitive_json_filters = case_sensitive_filters
.into_iter()
- .map(|(k, v)| json!({"terms": {k: v}}))
+ .map(|(k, v)| {
+ let key = if *k == "amount" {
+ self.get_amount_field(index).to_string()
+ } else {
+ k.clone()
+ };
+ json!({"terms": {key: v}})
+ })
.collect::<Vec<Value>>();
filter_array.extend(case_sensitive_json_filters);
@@ -542,7 +560,7 @@ impl OpenSearchQueryBuilder {
pub fn build_case_insensitive_filters(
&self,
mut payload: Value,
- case_insensitive_filters: &[&(String, Vec<String>)],
+ case_insensitive_filters: &[&(String, Vec<Value>)],
auth_array: Vec<Value>,
index: SearchIndex,
) -> Value {
@@ -690,22 +708,16 @@ impl OpenSearchQueryBuilder {
/// Ensure that the input data and the structure of the query are valid and correctly handled.
pub fn construct_payload(&self, indexes: &[SearchIndex]) -> QueryResult<Vec<Value>> {
let mut query_obj = Map::new();
- let mut bool_obj = Map::new();
+ let bool_obj = Map::new();
let (case_sensitive_filters, case_insensitive_filters): (Vec<_>, Vec<_>) = self
.filters
.iter()
.partition(|(k, _)| self.case_sensitive_fields.contains(k.as_str()));
- let filter_array = self.build_filter_array(case_sensitive_filters);
-
- if !filter_array.is_empty() {
- bool_obj.insert("filter".to_string(), Value::Array(filter_array));
- }
-
let should_array = self.build_auth_array();
- query_obj.insert("bool".to_string(), Value::Object(bool_obj));
+ query_obj.insert("bool".to_string(), Value::Object(bool_obj.clone()));
let mut sort_obj = Map::new();
sort_obj.insert(
@@ -724,6 +736,16 @@ impl OpenSearchQueryBuilder {
Value::Object(sort_obj.clone())
]
});
+ let filter_array = self.build_filter_array(case_sensitive_filters.clone(), *index);
+ if !filter_array.is_empty() {
+ payload
+ .get_mut("query")
+ .and_then(|query| query.get_mut("bool"))
+ .and_then(|bool_obj| bool_obj.as_object_mut())
+ .map(|bool_map| {
+ bool_map.insert("filter".to_string(), Value::Array(filter_array));
+ });
+ }
payload = self.build_case_insensitive_filters(
payload,
&case_insensitive_filters,
diff --git a/crates/analytics/src/search.rs b/crates/analytics/src/search.rs
index 9be0200030d..f3bda521c5b 100644
--- a/crates/analytics/src/search.rs
+++ b/crates/analytics/src/search.rs
@@ -5,12 +5,17 @@ use api_models::analytics::search::{
use common_utils::errors::{CustomResult, ReportSwitchExt};
use error_stack::ResultExt;
use router_env::tracing;
+use serde_json::Value;
use crate::{
enums::AuthInfo,
opensearch::{OpenSearchClient, OpenSearchError, OpenSearchQuery, OpenSearchQueryBuilder},
};
+pub fn convert_to_value<T: Into<Value>>(items: Vec<T>) -> Vec<Value> {
+ items.into_iter().map(|item| item.into()).collect()
+}
+
pub async fn msearch_results(
client: &OpenSearchClient,
req: GetGlobalSearchRequest,
@@ -38,21 +43,24 @@ pub async fn msearch_results(
if let Some(currency) = filters.currency {
if !currency.is_empty() {
query_builder
- .add_filter_clause("currency.keyword".to_string(), currency.clone())
+ .add_filter_clause("currency.keyword".to_string(), convert_to_value(currency))
.switch()?;
}
};
if let Some(status) = filters.status {
if !status.is_empty() {
query_builder
- .add_filter_clause("status.keyword".to_string(), status.clone())
+ .add_filter_clause("status.keyword".to_string(), convert_to_value(status))
.switch()?;
}
};
if let Some(payment_method) = filters.payment_method {
if !payment_method.is_empty() {
query_builder
- .add_filter_clause("payment_method.keyword".to_string(), payment_method.clone())
+ .add_filter_clause(
+ "payment_method.keyword".to_string(),
+ convert_to_value(payment_method),
+ )
.switch()?;
}
};
@@ -61,15 +69,17 @@ pub async fn msearch_results(
query_builder
.add_filter_clause(
"customer_email.keyword".to_string(),
- customer_email
- .iter()
- .filter_map(|email| {
- // TODO: Add trait based inputs instead of converting this to strings
- serde_json::to_value(email)
- .ok()
- .and_then(|a| a.as_str().map(|a| a.to_string()))
- })
- .collect(),
+ convert_to_value(
+ customer_email
+ .iter()
+ .filter_map(|email| {
+ // TODO: Add trait based inputs instead of converting this to strings
+ serde_json::to_value(email)
+ .ok()
+ .and_then(|a| a.as_str().map(|a| a.to_string()))
+ })
+ .collect(),
+ ),
)
.switch()?;
}
@@ -79,15 +89,17 @@ pub async fn msearch_results(
query_builder
.add_filter_clause(
"feature_metadata.search_tags.keyword".to_string(),
- search_tags
- .iter()
- .filter_map(|search_tag| {
- // TODO: Add trait based inputs instead of converting this to strings
- serde_json::to_value(search_tag)
- .ok()
- .and_then(|a| a.as_str().map(|a| a.to_string()))
- })
- .collect(),
+ convert_to_value(
+ search_tags
+ .iter()
+ .filter_map(|search_tag| {
+ // TODO: Add trait based inputs instead of converting this to strings
+ serde_json::to_value(search_tag)
+ .ok()
+ .and_then(|a| a.as_str().map(|a| a.to_string()))
+ })
+ .collect(),
+ ),
)
.switch()?;
}
@@ -95,7 +107,7 @@ pub async fn msearch_results(
if let Some(connector) = filters.connector {
if !connector.is_empty() {
query_builder
- .add_filter_clause("connector.keyword".to_string(), connector.clone())
+ .add_filter_clause("connector.keyword".to_string(), convert_to_value(connector))
.switch()?;
}
};
@@ -104,7 +116,7 @@ pub async fn msearch_results(
query_builder
.add_filter_clause(
"payment_method_type.keyword".to_string(),
- payment_method_type.clone(),
+ convert_to_value(payment_method_type),
)
.switch()?;
}
@@ -112,21 +124,47 @@ pub async fn msearch_results(
if let Some(card_network) = filters.card_network {
if !card_network.is_empty() {
query_builder
- .add_filter_clause("card_network.keyword".to_string(), card_network.clone())
+ .add_filter_clause(
+ "card_network.keyword".to_string(),
+ convert_to_value(card_network),
+ )
.switch()?;
}
};
if let Some(card_last_4) = filters.card_last_4 {
if !card_last_4.is_empty() {
query_builder
- .add_filter_clause("card_last_4.keyword".to_string(), card_last_4.clone())
+ .add_filter_clause(
+ "card_last_4.keyword".to_string(),
+ convert_to_value(card_last_4),
+ )
.switch()?;
}
};
if let Some(payment_id) = filters.payment_id {
if !payment_id.is_empty() {
query_builder
- .add_filter_clause("payment_id.keyword".to_string(), payment_id.clone())
+ .add_filter_clause(
+ "payment_id.keyword".to_string(),
+ convert_to_value(payment_id),
+ )
+ .switch()?;
+ }
+ };
+ if let Some(amount) = filters.amount {
+ if !amount.is_empty() {
+ query_builder
+ .add_filter_clause("amount".to_string(), convert_to_value(amount))
+ .switch()?;
+ }
+ };
+ if let Some(customer_id) = filters.customer_id {
+ if !customer_id.is_empty() {
+ query_builder
+ .add_filter_clause(
+ "customer_id.keyword".to_string(),
+ convert_to_value(customer_id),
+ )
.switch()?;
}
};
@@ -211,21 +249,24 @@ pub async fn search_results(
if let Some(currency) = filters.currency {
if !currency.is_empty() {
query_builder
- .add_filter_clause("currency.keyword".to_string(), currency.clone())
+ .add_filter_clause("currency.keyword".to_string(), convert_to_value(currency))
.switch()?;
}
};
if let Some(status) = filters.status {
if !status.is_empty() {
query_builder
- .add_filter_clause("status.keyword".to_string(), status.clone())
+ .add_filter_clause("status.keyword".to_string(), convert_to_value(status))
.switch()?;
}
};
if let Some(payment_method) = filters.payment_method {
if !payment_method.is_empty() {
query_builder
- .add_filter_clause("payment_method.keyword".to_string(), payment_method.clone())
+ .add_filter_clause(
+ "payment_method.keyword".to_string(),
+ convert_to_value(payment_method),
+ )
.switch()?;
}
};
@@ -234,15 +275,17 @@ pub async fn search_results(
query_builder
.add_filter_clause(
"customer_email.keyword".to_string(),
- customer_email
- .iter()
- .filter_map(|email| {
- // TODO: Add trait based inputs instead of converting this to strings
- serde_json::to_value(email)
- .ok()
- .and_then(|a| a.as_str().map(|a| a.to_string()))
- })
- .collect(),
+ convert_to_value(
+ customer_email
+ .iter()
+ .filter_map(|email| {
+ // TODO: Add trait based inputs instead of converting this to strings
+ serde_json::to_value(email)
+ .ok()
+ .and_then(|a| a.as_str().map(|a| a.to_string()))
+ })
+ .collect(),
+ ),
)
.switch()?;
}
@@ -252,15 +295,17 @@ pub async fn search_results(
query_builder
.add_filter_clause(
"feature_metadata.search_tags.keyword".to_string(),
- search_tags
- .iter()
- .filter_map(|search_tag| {
- // TODO: Add trait based inputs instead of converting this to strings
- serde_json::to_value(search_tag)
- .ok()
- .and_then(|a| a.as_str().map(|a| a.to_string()))
- })
- .collect(),
+ convert_to_value(
+ search_tags
+ .iter()
+ .filter_map(|search_tag| {
+ // TODO: Add trait based inputs instead of converting this to strings
+ serde_json::to_value(search_tag)
+ .ok()
+ .and_then(|a| a.as_str().map(|a| a.to_string()))
+ })
+ .collect(),
+ ),
)
.switch()?;
}
@@ -268,7 +313,7 @@ pub async fn search_results(
if let Some(connector) = filters.connector {
if !connector.is_empty() {
query_builder
- .add_filter_clause("connector.keyword".to_string(), connector.clone())
+ .add_filter_clause("connector.keyword".to_string(), convert_to_value(connector))
.switch()?;
}
};
@@ -277,7 +322,7 @@ pub async fn search_results(
query_builder
.add_filter_clause(
"payment_method_type.keyword".to_string(),
- payment_method_type.clone(),
+ convert_to_value(payment_method_type),
)
.switch()?;
}
@@ -285,21 +330,47 @@ pub async fn search_results(
if let Some(card_network) = filters.card_network {
if !card_network.is_empty() {
query_builder
- .add_filter_clause("card_network.keyword".to_string(), card_network.clone())
+ .add_filter_clause(
+ "card_network.keyword".to_string(),
+ convert_to_value(card_network),
+ )
.switch()?;
}
};
if let Some(card_last_4) = filters.card_last_4 {
if !card_last_4.is_empty() {
query_builder
- .add_filter_clause("card_last_4.keyword".to_string(), card_last_4.clone())
+ .add_filter_clause(
+ "card_last_4.keyword".to_string(),
+ convert_to_value(card_last_4),
+ )
.switch()?;
}
};
if let Some(payment_id) = filters.payment_id {
if !payment_id.is_empty() {
query_builder
- .add_filter_clause("payment_id.keyword".to_string(), payment_id.clone())
+ .add_filter_clause(
+ "payment_id.keyword".to_string(),
+ convert_to_value(payment_id),
+ )
+ .switch()?;
+ }
+ };
+ if let Some(amount) = filters.amount {
+ if !amount.is_empty() {
+ query_builder
+ .add_filter_clause("amount".to_string(), convert_to_value(amount))
+ .switch()?;
+ }
+ };
+ if let Some(customer_id) = filters.customer_id {
+ if !customer_id.is_empty() {
+ query_builder
+ .add_filter_clause(
+ "customer_id.keyword".to_string(),
+ convert_to_value(customer_id),
+ )
.switch()?;
}
};
diff --git a/crates/api_models/src/analytics/search.rs b/crates/api_models/src/analytics/search.rs
index a33dd100c79..06426efde6c 100644
--- a/crates/api_models/src/analytics/search.rs
+++ b/crates/api_models/src/analytics/search.rs
@@ -14,6 +14,8 @@ pub struct SearchFilters {
pub card_network: Option<Vec<String>>,
pub card_last_4: Option<Vec<String>>,
pub payment_id: Option<Vec<String>>,
+ pub amount: Option<Vec<u64>>,
+ pub customer_id: Option<Vec<String>>,
}
impl SearchFilters {
pub fn is_all_none(&self) -> bool {
@@ -27,6 +29,8 @@ impl SearchFilters {
&& self.card_network.is_none()
&& self.card_last_4.is_none()
&& self.payment_id.is_none()
+ && self.amount.is_none()
+ && self.customer_id.is_none()
}
}
|
2025-01-20T10:18:22Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
### `amount` filter
- Added `amount` as a filter / category for global search.
- Payments / Refunds / Disputes can now be searched in a better manner by applying an amount filter in the following - format:
```bash
amount:100
```
- Handling of the field name while building the opensearch query is done.
- PaymentAttempts / SessionizerPaymentAttempts / PaymentIntents / SessionizerPaymentIntents - amount
- Refunds / SessionizerRefunds - refund_amount
- Disputes / SessionizerDisputes - dispute_amount
### `customer_id` filter
- Also added `customer_id` as a filter.
- This will enable searching and filtering customers based on the `customer_id` filter on the `Customers` page, which uses global search.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
For better search experience based on filters using global search and also on the Customers page.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
`amount` filter:
- Hit the curl:
```bash
curl --location 'http://localhost:8080/analytics/v1/search' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNmNkZTA0NzYtMTFlMi00NGE5LTlkMjUtOTA5M2QzNDQwZjhlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzM1MDQxMjkzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczNzUzMjA3OSwib3JnX2lkIjoib3JnX2pwanI5TkFEWlhqSENNYTU5MmF3IiwicHJvZmlsZV9pZCI6InByb19QRHUydVA3aWNuM2lXY0I3V0VVSSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.1DAbjUFNOCjpZM_K_NlKj6hOvzP28xLvl01XACE4jPg' \
--header 'Referer: http://localhost:9000/' \
--header 'sec-ch-ua: "Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'api-key: dev_ssyiqBXK7Ou1HUQuH0Z80BsHuV5pojc0uWli4QbNXGM1f4pn7jCIyb9VFiHlyATQ' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json' \
--data '{
"query": "usd",
"filters": {
"amount": [
600
]
}
}'
```
- You can see the amount filter getting applied, and should get results after the amount filter is applied.
- Sample opensearch query structure:
- Sessionizer Payment Intents Index: (Notice the `amount` field in the payload)
```bash
Index: SessionizerPaymentIntents
Payload: {
"query": {
"bool": {
"filter": [
{
"multi_match": {
"type": "phrase",
"query": "usd",
"lenient": true
}
},
{
"terms": {
"amount": [
600
]
}
}
],
"must": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"organization_id.keyword": {
"value": "org_jpjr9NADZXjHCMa592aw"
}
}
}
]
}
}
],
"minimum_should_match": 1
}
}
]
}
}
]
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
```
- Sessionizer Refunds Index: (Notice the `refund_amount` being used here)
```bash
Index: SessionizerRefunds
Payload: {
"query": {
"bool": {
"filter": [
{
"multi_match": {
"type": "phrase",
"query": "usd",
"lenient": true
}
},
{
"terms": {
"refund_amount": [
600
]
}
}
],
"must": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"organization_id.keyword": {
"value": "org_jpjr9NADZXjHCMa592aw"
}
}
}
]
}
}
],
"minimum_should_match": 1
}
}
]
}
}
]
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
```
- Sample response:
```json
[
{
"count": 0,
"index": "payment_attempts",
"hits": [],
"status": "Success"
},
{
"count": 0,
"index": "payment_intents",
"hits": [],
"status": "Success"
},
{
"count": 1,
"index": "refunds",
"hits": [
{
"@timestamp": "2025-01-20T13:02:17Z",
"attempt_id": "pay_ND5OdiSMSt6lhWovQup1_1",
"connector": "stripe_test",
"connector_refund_id": "dummy_ref_isNEfXmc0SW2r0cvaHvc",
"connector_transaction_id": "pay_dWLQFQ9O5CcNP73haAqF",
"created_at": 1737378137,
"currency": "USD",
"description": "Customer returned product",
"external_reference_id": "ref_VIVDwLPl0zwwrRSJtnMP",
"headers": {},
"internal_reference_id": "refid_EqKX3XCwLUAw9vd8bk9Z",
"merchant_id": "merchant_1735041293",
"modified_at": 1737378138,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_id": "pay_ND5OdiSMSt6lhWovQup1",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"refund_amount": 600,
"refund_arn": "",
"refund_error_code": null,
"refund_error_message": null,
"refund_id": "ref_VIVDwLPl0zwwrRSJtnMP",
"refund_reason": "Customer returned product",
"refund_status": "success",
"refund_type": "instant_refund",
"sent_to_gateway": true,
"source_type": "kafka",
"tenant_id": "public",
"timestamp": "2025-01-20T13:02:17Z",
"total_amount": 10000
}
],
"status": "Success"
},
{
"count": 0,
"index": "disputes",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_payment_attempts",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_payment_intents",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_refunds",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_disputes",
"hits": [],
"status": "Failure"
}
]
```
`customer_id` filter:
- Hit the curl:
```bash
curl --location 'http://localhost:8080/analytics/v1/search' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNmNkZTA0NzYtMTFlMi00NGE5LTlkMjUtOTA5M2QzNDQwZjhlIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzM1MDQxMjkzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczODg0MDA2MCwib3JnX2lkIjoib3JnX2pwanI5TkFEWlhqSENNYTU5MmF3IiwicHJvZmlsZV9pZCI6InByb19QRHUydVA3aWNuM2lXY0I3V0VVSSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.frlVM-TVh88J4dxfJgsMoQv5DdLnD6b-qTTr_DIU90s' \
--header 'Referer: http://localhost:9000/' \
--header 'sec-ch-ua: "Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'api-key: dev_ssyiqBXK7Ou1HUQuH0Z80BsHuV5pojc0uWli4QbNXGM1f4pn7jCIyb9VFiHlyATQ' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json' \
--data '{
"query": "usd",
"filters": {
"customer_id": [
"StripeCustomer"
]
}
}'
```
- Sample Resposne:
```json
[
{
"count": 0,
"index": "payment_attempts",
"hits": [],
"status": "Success"
},
{
"count": 6,
"index": "payment_intents",
"hits": [
{
"@timestamp": "2025-01-20T13:01:37Z",
"active_attempt_id": "pay_ND5OdiSMSt6lhWovQup1_1",
"amount": 10000,
"amount_captured": 10000,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_ND5OdiSMSt6lhWovQup1_secret_TWKqD8yqhgbyEXowOSe3",
"connector_id": null,
"created_at": 1737378097,
"currency": "USD",
"customer_email": "f6cd0753a831880835a0e0d23136ef66318d8303605bd37fa80b4ecf248bd303",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": {
"apple_pay_recurring_details": null,
"redirect_response": null,
"search_tags": [
"1259195bb05bb44ea78ab60b26a54065183f91b3c5b3c2c074cadcf521305a79",
"9bff7b14d0a57a00d98f5eb742418a50b3bdfe5993f16b4219bfa31989bdf80f"
]
},
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"data2\":\"camel\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1737378099,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_ND5OdiSMSt6lhWovQup1",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2025-01-20T13:01:37Z"
},
{
"@timestamp": "2025-01-20T09:56:07Z",
"active_attempt_id": "pay_bWGMDT130V4mrDskx9Lt_1",
"amount": 6540,
"amount_captured": 6540,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_bWGMDT130V4mrDskx9Lt_secret_VnTfCd82o07H59gQOmdA",
"connector_id": null,
"created_at": 1737366967,
"currency": "USD",
"customer_email": "6ede5d9641558aef42ea1cff12554f6d6f56081319465af002f0842aec34c763",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": null,
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"udf1\":\"value1\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1737366971,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_bWGMDT130V4mrDskx9Lt",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2025-01-20T09:56:07Z"
},
{
"@timestamp": "2025-01-20T09:50:20Z",
"active_attempt_id": "pay_OEYLy5ZKarSVBVOyhsON_1",
"amount": 6540,
"amount_captured": 6540,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_OEYLy5ZKarSVBVOyhsON_secret_EmNPjhoI9FK8aVO30Ss4",
"connector_id": null,
"created_at": 1737366620,
"currency": "USD",
"customer_email": "6ede5d9641558aef42ea1cff12554f6d6f56081319465af002f0842aec34c763",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": null,
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"udf1\":\"value1\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1737366627,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_OEYLy5ZKarSVBVOyhsON",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2025-01-20T09:50:20Z"
},
{
"@timestamp": "2025-01-20T09:41:41Z",
"active_attempt_id": "pay_lJJCj6jGDPPOtwb3YucZ_1",
"amount": 10000,
"amount_captured": 10000,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_lJJCj6jGDPPOtwb3YucZ_secret_xDqPGN0uREz1mSDLeQv9",
"connector_id": null,
"created_at": 1737366101,
"currency": "USD",
"customer_email": "f6cd0753a831880835a0e0d23136ef66318d8303605bd37fa80b4ecf248bd303",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": {
"apple_pay_recurring_details": null,
"redirect_response": null,
"search_tags": [
"1259195bb05bb44ea78ab60b26a54065183f91b3c5b3c2c074cadcf521305a79",
"9bff7b14d0a57a00d98f5eb742418a50b3bdfe5993f16b4219bfa31989bdf80f"
]
},
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"data2\":\"camel\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1737366102,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_lJJCj6jGDPPOtwb3YucZ",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2025-01-20T09:41:41Z"
},
{
"@timestamp": "2025-01-20T08:13:08Z",
"active_attempt_id": "pay_A3dPrR94eHFTlvT7CSXT_1",
"amount": 10000,
"amount_captured": 10000,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_A3dPrR94eHFTlvT7CSXT_secret_3FUMXfThPXlRp0kZyvPc",
"connector_id": null,
"created_at": 1737360788,
"currency": "USD",
"customer_email": "f6cd0753a831880835a0e0d23136ef66318d8303605bd37fa80b4ecf248bd303",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": {
"apple_pay_recurring_details": null,
"redirect_response": null,
"search_tags": [
"1259195bb05bb44ea78ab60b26a54065183f91b3c5b3c2c074cadcf521305a79",
"9bff7b14d0a57a00d98f5eb742418a50b3bdfe5993f16b4219bfa31989bdf80f"
]
},
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"data2\":\"camel\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1737360790,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_A3dPrR94eHFTlvT7CSXT",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2025-01-20T08:13:08Z"
},
{
"@timestamp": "2024-12-24T11:56:12Z",
"active_attempt_id": "pay_5cvsiaRXZRzRg6VNvJ5e_1",
"amount": 10000,
"amount_captured": 10000,
"attempt_count": 1,
"billing_details": null,
"business_country": null,
"business_label": "default",
"client_secret": "pay_5cvsiaRXZRzRg6VNvJ5e_secret_XRpkHJHWahWqIaYKiovr",
"connector_id": null,
"created_at": 1735041372,
"currency": "USD",
"customer_email": "f6cd0753a831880835a0e0d23136ef66318d8303605bd37fa80b4ecf248bd303",
"customer_id": "StripeCustomer",
"description": "Its my first payment request",
"feature_metadata": {
"redirect_response": null,
"search_tags": [
"1259195bb05bb44ea78ab60b26a54065183f91b3c5b3c2c074cadcf521305a79",
"9bff7b14d0a57a00d98f5eb742418a50b3bdfe5993f16b4219bfa31989bdf80f"
]
},
"headers": {},
"merchant_id": "merchant_1735041293",
"merchant_order_reference_id": null,
"metadata": "{\"data2\":\"camel\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"}",
"modified_at": 1735041373,
"off_session": null,
"organization_id": "org_jpjr9NADZXjHCMa592aw",
"payment_confirm_source": null,
"payment_id": "pay_5cvsiaRXZRzRg6VNvJ5e",
"profile_id": "pro_PDu2uP7icn3iWcB7WEUI",
"return_url": "https://google.com/",
"setup_future_usage": null,
"shipping_details": null,
"source_type": "kafka",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"status": "succeeded",
"tenant_id": "public",
"timestamp": "2024-12-24T11:56:12Z"
}
],
"status": "Success"
},
{
"count": 0,
"index": "refunds",
"hits": [],
"status": "Success"
},
{
"count": 0,
"index": "disputes",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_payment_attempts",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_payment_intents",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_refunds",
"hits": [],
"status": "Failure"
},
{
"count": 0,
"index": "sessionizer_disputes",
"hits": [],
"status": "Failure"
}
]
```
- `customer_id` filter getting applied when building the opensearch query:
```bash
Index: PaymentIntents
Payload: {
"query": {
"bool": {
"filter": [
{
"multi_match": {
"type": "phrase",
"query": "usd",
"lenient": true
}
},
{
"terms": {
"customer_id.keyword": [
"StripeCustomer"
]
}
}
],
"must": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"organization_id.keyword": {
"value": "org_jpjr9NADZXjHCMa592aw"
}
}
}
]
}
}
],
"minimum_should_match": 1
}
}
]
}
}
]
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
22072fd750940ac7fec6ea971737409518600891
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7070
|
Bug: [INTEGRATION] Worldpay Integration
This issue is a continuation of #6316 for tagging the relevant development work in PRs.
|
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index cd028e81ef1..6ae507790dd 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -26,7 +26,7 @@ use super::{requests::*, response::*};
use crate::{
types::ResponseRouterData,
utils::{
- self, AddressData, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData,
+ self, AddressData, ApplePay, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData,
PaymentsSetupMandateRequestData, RouterData as RouterDataTrait,
},
};
@@ -150,7 +150,7 @@ fn fetch_payment_instrument(
})),
WalletData::ApplePay(data) => Ok(PaymentInstrument::Applepay(WalletPayment {
payment_type: PaymentType::Encrypted,
- wallet_token: Secret::new(data.payment_data),
+ wallet_token: data.get_applepay_decoded_payment_data()?,
..WalletPayment::default()
})),
WalletData::AliPayQr(_)
|
2025-01-20T08:50:04Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR fixes the ApplePay integration with WorldPay.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
This PR enables processing ApplePay txns through WorldPay.
## How did you test it?
Tested locally by setting up ApplePay with Worldpay connector
<details>
<summary>Process an ApplePay txn through WP</summary>
- Create a payment link
cURL
curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_roIAheQpBhdk54rvqzIWVex9ffGGpoTEDrpqhygbxtyZgsuGlPeOb6sHs5gRwP65' \
--data-raw '{"authentication_type":"three_ds","customer_id":"cus_G6gAIQuPgLJqht6Ny27k","profile_id":"pro_QSzisIfNqLE7FdEU3Wmr","amount":100,"currency":"USD","payment_link":true,"description":"This is my description of why this payment was requested.","capture_method":"automatic","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":"8056594427","country_code":"+91"}},"email":"john.doe@example.co.in","session_expiry":100000,"return_url":"https://example.com","payment_link_config":{"theme":"#0E103D","logo":"https://hyperswitch.io/favicon.ico","seller_name":"Hyperswitch Inc.","enabled_saved_payment_method":true,"hide_card_nickname_field":true,"show_card_form_by_default":true,"transaction_details":[{"key":"Policy Number","value":"938478327648","ui_configuration":{"is_key_bold":false,"is_value_bold":false,"position":2}},{"key":"Business Country","value":"Germany","ui_configuration":{"is_key_bold":false,"is_value_bold":false,"position":1}},{"key":"Product Name","value":"Life Insurance Elite","ui_configuration":{"is_key_bold":false,"is_value_bold":false,"position":3}}]}}'
Response
{"payment_id":"pay_i5hWlAfZJt989EoU0Qzn","merchant_id":"merchant_1737359846","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":null,"client_secret":"pay_i5hWlAfZJt989EoU0Qzn_secret_WSq9QS2DQqybQHc2FrIO","created":"2025-01-20T08:43:12.479Z","currency":"USD","customer_id":"cus_G6gAIQuPgLJqht6Ny27k","customer":{"id":"cus_G6gAIQuPgLJqht6Ny27k","name":"John Nether","email":"john.doe@example.co.in","phone":"6168205362","phone_country_code":"+1"},"description":"This is my description of why this payment was requested.","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"order_details":null,"email":"john.doe@example.co.in","name":"John Nether","phone":"6168205362","return_url":"https://example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_G6gAIQuPgLJqht6Ny27k","created_at":1737362592,"expires":1737366192,"secret":"epk_522026e973534fa0b6e85fc425de48ec"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"https://onemore.tame-bird-39.telebit.io/payment_link/merchant_1737359846/pay_i5hWlAfZJt989EoU0Qzn?locale=en","secure_link":null,"payment_link_id":"plink_3VVma7RRENT8hvLlfCko"},"profile_id":"pro_QSzisIfNqLE7FdEU3Wmr","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-21T12:29:52.477Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-01-20T08:43:12.492Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
- Open payment link and complete txn
- Retrieve payment
cURL
curl --location --request GET 'http://localhost:8080/payments/pay_i5hWlAfZJt989EoU0Qzn?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_roIAheQpBhdk54rvqzIWVex9ffGGpoTEDrpqhygbxtyZgsuGlPeOb6sHs5gRwP65'
Response
{"payment_id":"pay_i5hWlAfZJt989EoU0Qzn","merchant_id":"merchant_1737359846","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpay","client_secret":"pay_i5hWlAfZJt989EoU0Qzn_secret_WSq9QS2DQqybQHc2FrIO","created":"2025-01-20T08:43:12.479Z","currency":"USD","customer_id":"cus_G6gAIQuPgLJqht6Ny27k","customer":{"id":"cus_G6gAIQuPgLJqht6Ny27k","name":"John Nether","email":"john.doe@example.co.in","phone":"6168205362","phone_country_code":"+1"},"description":"This is my description of why this payment was requested.","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"apple_pay":{"last4":"0492","card_network":"Visa","type":"debit"}},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"order_details":null,"email":"john.doe@example.co.in","name":"John Nether","phone":"6168205362","return_url":"https://example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"apple_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLg2sGkO:vYpWC37Db6JbhdEll9fIyaH2kwt88eyzXjPICpZY8cZeCeMgt1ol:GABqQG6u+T:u3sfHv3ezSOJxioRTixsThPEhzFW4ZZ6mObj3CK0rnFndcM0swvZMqgQwSEj5tBsydfzM4XKX20O6Nme96ha9twqxTSQIfr1rtl9V3q7fw3w5O9UZT4vQi9BMyCcaHkWSD:RbCWCcmiQqa68XlOgjFizTujqaSOCiqD3rKLoKWRGY+zDciMqs+3KEOGqQBtmdOWzHeNbZ7Y2C6t+hQ9RR:Z491q0vLPK+etGkmyVNB6HsgNKLVR8BWjehM+WuX0NAJU:Z4P8Bpdq0Is5ExjJf8mIzQPCvm4AC2kHDz9uIAwzPK7A7AtWsm1vb","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"1e5bf75c-944c-4446-9cf0-f3720ee9c894","payment_link":null,"profile_id":"pro_QSzisIfNqLE7FdEU3Wmr","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_GHrUdffckdzZorvJydsF","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-21T12:29:52.477Z","fingerprint":null,"browser_info":{"os_type":"macOS","language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","os_version":"10.15.7","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15","color_depth":24,"device_model":"Macintosh","java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-01-20T08:44:49.142Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
a9a1ded77e2ba0cc7fa9763ce2da4bb0852d82af
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7067
|
Bug: [BUG] previous rules are being considered for surcharge calculation even after updating surcharge rules in database
### Bug Description
When I updated surcharge rules using the `PUT /routing/decision/surcharge` endpoint, the surcharge rules are being updated in DB but when I do merchant payment method list(PML), previous rules are being applied.
### Expected Behavior
After update, the new rules must be applied during surcharge calculation during PML
### Actual Behavior
After update, old rules are applied during surcharge calculation during PML
### Steps To Reproduce
1. Update surcharge rules
2. Do Merchant Payment Method List.
### Context For The Bug
this is probably caused because the in memory cache is not being invalidated probably during Update.
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR!
|
diff --git a/crates/router/src/core/surcharge_decision_config.rs b/crates/router/src/core/surcharge_decision_config.rs
index 0ff5f3fb373..2d817fd1afe 100644
--- a/crates/router/src/core/surcharge_decision_config.rs
+++ b/crates/router/src/core/surcharge_decision_config.rs
@@ -56,7 +56,7 @@ pub async fn upsert_surcharge_decision_config(
message: "Invalid Request Data".to_string(),
})
.attach_printable("The Request has an Invalid Comparison")?;
-
+ let surcharge_cache_key = merchant_account.get_id().get_surcharge_dsk_key();
match read_config_key {
Ok(config) => {
let previous_record: SurchargeDecisionManagerRecord = config
@@ -88,7 +88,7 @@ pub async fn upsert_surcharge_decision_config(
.attach_printable("Error serializing the config")?;
algo_id.update_surcharge_config_id(key.clone());
- let config_key = cache::CacheKind::Surcharge(key.into());
+ let config_key = cache::CacheKind::Surcharge(surcharge_cache_key.into());
update_merchant_active_algorithm_ref(&state, &key_store, config_key, algo_id)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -125,7 +125,7 @@ pub async fn upsert_surcharge_decision_config(
.attach_printable("Error fetching the config")?;
algo_id.update_surcharge_config_id(key.clone());
- let config_key = cache::CacheKind::Surcharge(key.clone().into());
+ let config_key = cache::CacheKind::Surcharge(surcharge_cache_key.into());
update_merchant_active_algorithm_ref(&state, &key_store, config_key, algo_id)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -173,7 +173,8 @@ pub async fn delete_surcharge_decision_config(
.attach_printable("Could not decode the surcharge conditional_config algorithm")?
.unwrap_or_default();
algo_id.surcharge_config_algo_id = None;
- let config_key = cache::CacheKind::Surcharge(key.clone().into());
+ let surcharge_cache_key = merchant_account.get_id().get_surcharge_dsk_key();
+ let config_key = cache::CacheKind::Surcharge(surcharge_cache_key.into());
update_merchant_active_algorithm_ref(&state, &key_store, config_key, algo_id)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
|
2024-12-20T09:07:57Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
When surcharge rules where updated or deleted, the in memory cache was being invalidated using the wrong key. Fixed that issue in this PR.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. upsert surcharge rules. If amount >500 and <1000 add a surcharge of 40%.
```
curl --location --request PUT 'http://localhost:8080/routing/decision/surcharge' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_bLGFEtyJtHdvJqXtbnwOcnxpBuNk9lcGIHewiAgCcQQKXYdyoHw8SyAz5JcfikMl' \
--data '{
"name": "Surcharge Conditional config",
"algorithm": {
"defaultSelection": {
"surcharge_details": null
},
"rules": [
{
"name": "rule_1",
"routingOutput": {
"surcharge_details": {
"surcharge": {
"type": "rate",
"value": {
"percentage": 40
}
},
"tax_on_surcharge": {
"percentage": 40
}
}
},
"statements": [
{
"condition": [
{
"lhs": "amount",
"comparison": "greater_than",
"value": {
"type": "number",
"value": 500
},
"metadata": {}
},
{
"lhs": "amount",
"comparison": "less_than",
"value": {
"type": "number",
"value": 1000
},
"metadata": {}
}
],
"nested": null
}
]
}
],
"metadata": {}
},
"merchant_surcharge_configs": {
"show_surcharge_breakup_screen": true
}
}'
```
should get status code 200 response.
2. Create payment of 540
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_bLGFEtyJtHdvJqXtbnwOcnxpBuNk9lcGIHewiAgCcQQKXYdyoHw8SyAz5JcfikMl' \
--data-raw '{
"amount": 540,
"currency": "USD",
"confirm": false,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 540,
"customer_id": "StripeCustomer",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "PiX"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "PiX"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
3. Do payment method list.
```
curl --location 'http://localhost:8080/account/payment_methods?client_secret=pay_rKiEoW6t1eHHzS8WukOx_secret_QvEuTgyhWcGmNhzqHrTc' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_8ea5f5ea888f43e199ae05a22b7aaae8'
```
Appropriate surcharge must be applied to each of the payment method.
```
"surcharge_details": {
"surcharge": {
"type": "rate",
"value": {
"percentage": 40.0
}
},
"tax_on_surcharge": {
"percentage": 40.0
},
"display_surcharge_amount": 2.16,
"display_tax_on_surcharge_amount": 0.87,
"display_total_surcharge_amount": 3.03
},
```
4. Now update the surcharge rule. If amount >500 and <1000 add a surcharge of 10%.
```
curl --location --request PUT 'http://localhost:8080/routing/decision/surcharge' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_bLGFEtyJtHdvJqXtbnwOcnxpBuNk9lcGIHewiAgCcQQKXYdyoHw8SyAz5JcfikMl' \
--data '{
"name": "Surcharge Conditional config",
"algorithm": {
"defaultSelection": {
"surcharge_details": null
},
"rules": [
{
"name": "rule_1",
"routingOutput": {
"surcharge_details": {
"surcharge": {
"type": "rate",
"value": {
"percentage": 10
}
},
"tax_on_surcharge": {
"percentage": 10
}
}
},
"statements": [
{
"condition": [
{
"lhs": "amount",
"comparison": "greater_than",
"value": {
"type": "number",
"value": 500
},
"metadata": {}
},
{
"lhs": "amount",
"comparison": "less_than",
"value": {
"type": "number",
"value": 1000
},
"metadata": {}
}
],
"nested": null
}
]
}
],
"metadata": {}
},
"merchant_surcharge_configs": {
"show_surcharge_breakup_screen": true
}
}'
```
5. Do payment method list again.
```
curl --location 'http://localhost:8080/account/payment_methods?client_secret=pay_rKiEoW6t1eHHzS8WukOx_secret_QvEuTgyhWcGmNhzqHrTc' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_8ea5f5ea888f43e199ae05a22b7aaae8'
```
Appropriate surcharge must be applied to each of the payment method.
```
"surcharge_details": {
"surcharge": {
"type": "rate",
"value": {
"percentage": 10.0
}
},
"tax_on_surcharge": {
"percentage": 10.0
},
"display_surcharge_amount": 0.54,
"display_tax_on_surcharge_amount": 0.06,
"display_total_surcharge_amount": 0.6
},
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
3fdc41e6c946609461db6b5459e10e6351694d4c
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7101
|
Bug: [REFACTOR] Remove Deprecated Adyen PMTs Sofort and Trustly Test Cases
This issue addresses the cleanup of deprecated payment methods (PMTs) in the Adyen connector (i.e., Sofort and Trustly) and updates test cases to ensure compatibility with current configurations.
### Details
1. Postman Test Cases Update:
Remove test cases for Sofort and Trustly from the Adyen connector in the Postman collection, as these payment methods are no longer supported by Adyen.
2. Cypress Test Cases Update:
Add a conditional assertion in the Cypress tests for the Sofort redirect flow.
### Testing Details
- Verify changes in the Postman collection for the absence of deprecated test cases.
- Confirm Cypress tests handle assertions for the Adyen-specific error message.
|
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 8bfdb580671..6980f1fe85e 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
@@ -10,15 +10,14 @@
"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"
+ "Scenario11-Bank Redirect-eps",
+ "Scenario12-Refund recurring payment",
+ "Scenario13-Bank debit-ach",
+ "Scenario14-Bank debit-Bacs",
+ "Scenario15-Bank Redirect-Trustly",
+ "Scenario16-Add card flow",
+ "Scenario17-Pass Invalid CVV for save card flow and verify failed payment",
+ "Scenario18-Don't Pass CVV for save card flow and verify failed payment Copy",
+ "Scenario19-Create Gift Card payment"
]
}
\ No newline at end of file
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-eps/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-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
deleted file mode 100644
index d4b9fbead7e..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/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 "sofort" for "payment_method_type"
-if (jsonData?.payment_method_type) {
- pm.test(
- "[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'sofort'",
- function () {
- pm.expect(jsonData.payment_method_type).to.eql("sofort");
- },
- );
-}
-
-// 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/Scenario11-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
deleted file mode 100644
index 001749a500f..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/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": "sofort",
- "payment_method_data": {
- "bank_redirect": {
- "sofort": {
- "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/Scenario11-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
deleted file mode 100644
index 0b0c56d2660..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-sofort/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": "abcdef123@gmail.com",
- "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": "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"
-}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-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-eps/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-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-eps/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Create Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Refund recurring payment/Refunds - Retrieve Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Recurring Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Create Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Refund recurring payment/Refunds - Retrieve Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario13-Bank debit-ach/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-ach/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Bank debit-Bacs/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario12-Bank Redirect-eps/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank debit-Bacs/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Trustly/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario17-Add card flow/List payment methods for a Customer/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/List payment methods for a Customer/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario17-Add card flow/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/List payment methods for a Customer/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario17-Add card flow/List payment methods for a Customer/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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 Redirect-Trustly/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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 Redirect-Trustly/Payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/List payment methods for a Customer/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Payments - Retrieve Copy/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/List payment methods for a Customer/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Payments - Retrieve Copy/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Confirm/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Refunds - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Add card flow/Save card payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/.meta.json
deleted file mode 100644
index 57d3f8e2bc7..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario16-Bank Redirect-Trustly/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario16-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/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/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/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-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/Scenario16-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/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-Pass Invalid CVV for save card flow and verify failed payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario17-Add card flow/Refunds - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario17-Add card flow/Refunds - Retrieve/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Add card flow/Save card payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario17-Add card flow/Save card payments - Confirm/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario17-Add card flow/Save card payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario17-Add card flow/Save card payments - Create/response.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Pass Invalid CVV for save card flow and verify failed payment/Save card payments - Confirm/request.json
diff --git a/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 b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario18-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/Scenario17-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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-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/Scenario18-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
diff --git a/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 b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-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/Scenario18-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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-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-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-Don't Pass CVV for save card flow and verify failed payment Copy/Save card payments - Confirm/request.json
diff --git a/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 b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario19-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/Scenario18-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/Scenario20-Create Gift Card payment/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-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 Redirect-Trustly/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/request.json
diff --git a/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 b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/response.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Create/response.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Create/.event.meta.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-Trustly/Payments - Retrieve/request.json
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/request.json
diff --git a/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 b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/response.json
similarity index 100%
rename from 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
rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Create Gift Card payment/Payments - Retrieve/response.json
diff --git a/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 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
deleted file mode 100644
index fe51488c706..00000000000
--- a/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
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - 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/Scenario20-Create Gift Card payment/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card 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/Scenario20-Create Gift Card payment/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card 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/Scenario20-Create Gift Card payment/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Create Gift Card payment/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-json/adyen_uk.postman_collection.json b/postman/collection-json/adyen_uk.postman_collection.json
index 512f84c6a4b..ebf353bb88d 100644
--- a/postman/collection-json/adyen_uk.postman_collection.json
+++ b/postman/collection-json/adyen_uk.postman_collection.json
@@ -14375,4 +14375,4 @@
"type": "string"
}
]
-}
+}
\ No newline at end of file
|
2025-01-24T09:47:40Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
**Postman Collection Update**: Removed the Sofort test cases from the Adyen connector in the Postman collection because these payment methods are deprecated by Adyen Connector.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
- The **Postman** test cases for Sofort are no longer valid for the Adyen connector, as Adyen has deprecated these PMTs.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
_**Before**_
<img width="1279" alt="image" src="https://github.com/user-attachments/assets/91073ae0-a62c-40d7-863b-ddda5e2620a8" />
_**After**_
<img width="1093" alt="image" src="https://github.com/user-attachments/assets/f45d07f3-47eb-4331-90d9-b7a2fedf4d2f" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
ed8ef2466b7f059ed0f534aa1f3fca9b5ecbeefd
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7053
|
Bug: [CHORE] update Cypress creds
update cypress creds.
wise failing
|
2025-01-17T08:17:42Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
updates wise creds
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
closes #7053
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
ci should pass
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
da5443cbca323ec7e1166b77c635b6076f291157
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7058
|
Bug: fix cybersource cypress redirection
address ci inconsistency.
cybersource cypress test in github has been failing randomly left right and center for no good reason.
|
2025-01-17T11:02:32Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
- enabled video recording for tests that fail
- cybersource connector in github ci, randomly goes through `frictionless` flow without challenge which results in certain expected elements to go missing resulting in respective tests to fail
- this pr forces cybersource to use `frictionless` card for 3ds
- remove `adyenplatform` connector from running in github ci
closes #7058
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
ci checks
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
this issue is not reproducible in local but only in github ci. so, the ci check should never fail!
<img width="465" alt="image" src="https://github.com/user-attachments/assets/bb724420-251d-45dd-96bd-9be307bdc99c" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `npm run format`
- [x] I addressed lints thrown by `npm run lint`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
776ed9a2eb0e5ad8125112fe01bb3ea4b34195bc
|
||
juspay/hyperswitch
|
juspay__hyperswitch-7049
|
Bug: refactor(euclid): update proto file for elimination routing
|
diff --git a/proto/elimination_rate.proto b/proto/elimination_rate.proto
index c5f10597ade..d585dd2494b 100644
--- a/proto/elimination_rate.proto
+++ b/proto/elimination_rate.proto
@@ -28,8 +28,17 @@ message EliminationResponse {
message LabelWithStatus {
string label = 1;
- bool is_eliminated = 2;
- string bucket_name = 3;
+ EliminationInformation elimination_information = 2;
+}
+
+message EliminationInformation {
+ BucketInformation entity = 1;
+ BucketInformation global = 2;
+}
+
+message BucketInformation {
+ bool is_eliminated = 1;
+ repeated string bucket_name = 2;
}
// API-2 types
@@ -64,4 +73,4 @@ message InvalidateBucketResponse {
BUCKET_INVALIDATION_FAILED = 1;
}
InvalidationStatus status = 1;
-}
\ No newline at end of file
+}
|
2025-01-13T08:39:40Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This will update the proto file for elimination routing to include the global rates. This is basically done in order to keep the proto file upto-date with dynamic routing service.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Testing isn't required as this is only env change
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
7fd3551afd7122ed28fe5532639e4a256863de6b
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7048
|
Bug: populate connector metadata in the relay refunds flow
Some connector requires connector metadata in the refund flow.
Example adyen requires endpoint_prefix. Hence this change is to populate the connector metadata in the relay refunds flow.
|
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index 78e42039e02..0f28db0f0e4 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -86,7 +86,7 @@ pub async fn construct_relay_refund_router_data<F>(
description: None,
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: common_enums::AuthenticationType::default(),
- connector_meta_data: None,
+ connector_meta_data: connector_account.metadata.clone(),
connector_wallets_details: None,
amount_captured: None,
payment_method_status: None,
|
2025-01-16T11:41:24Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Some connector requires connector metadata in the refund flow.
Example adyen requires `endpoint_prefix`. Hence this change is to populate the connector metadata in the relay refunds flow.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Some connector like adyen requires the connector metadata in order to perform the refund.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Create a adyen merchant connector account with `endpoint_prefix` in the metadata
-> Create a payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-tenant-id: hyperswitch' \
--header 'api-key: ' \
--data-raw '{
"amount": 100,
"amount_to_capture": 100,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"customer_id": "cu_1737027612",
"return_url": "http://127.0.0.1:4040",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "in sit",
"user_agent": "amet irure esse"
}
},
"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",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "PiX",
"last_name": "ss"
},
"email": "raj@gmail.com"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "PiX"
}
},
"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"
},
"routing": {
"type": "single",
"data": {
"connector": "cybersource",
"merchant_connector_id": "mca_8W0CQfwE89J1BJBbpcnt"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
```
{
"payment_id": "pay_8jnUUY21QbQQUYZw3oXp",
"merchant_id": "merchant_1737026210",
"status": "succeeded",
"amount": 100,
"net_amount": 100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 100,
"connector": "adyen",
"client_secret": "pay_8jnUUY21QbQQUYZw3oXp_secret_gCitDmBCSL1rf57aWz2x",
"created": "2025-01-16T11:17:06.935Z",
"currency": "USD",
"customer_id": "cu_1737026227",
"customer": {
"id": "cu_1737026227",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": null
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "PiX",
"last_name": "ss"
},
"phone": null,
"email": "raj@gmail.com"
},
"order_details": null,
"email": "guest@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "http://127.0.0.1:4040/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cu_1737026227",
"created_at": 1737026226,
"expires": 1737029826,
"secret": "epk_60cc9662baa0498baf38418e6012aec4"
},
"manual_retry_allowed": false,
"connector_transaction_id": "JTP7LKV93245FNV5",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_8jnUUY21QbQQUYZw3oXp_1",
"payment_link": null,
"profile_id": "pro_G34dqlGIBvt43dRfzHqg",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_ElpENwTfGeuTBYpCz0mq",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-16T11:32:06.935Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "125.0.0.1",
"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",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-16T11:17:08.458Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
-> With the above connector reference id perform the relay refund
```
curl --location 'http://localhost:8080/relay' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_G34dqlGIBvt43dRfzHqg' \
--header 'api-key:' \
--data '{
"connector_id": "mca_ElpENwTfGeuTBYpCz0mq",
"connector_resource_id": "JTP7LKV93245FNV5",
"data": {
"refund": {
"amount": 1,
"currency": "USD"
}
},
"type": "refund"
}'
```
```
{
"id": "relay_IzveULiShYKchIM8AL8Q",
"status": "pending",
"connector_resource_id": "JTP7LKV93245FNV5",
"error": null,
"connector_reference_id": "STZLZN7FSHSXRCV5",
"connector_id": "mca_ElpENwTfGeuTBYpCz0mq",
"profile_id": "pro_G34dqlGIBvt43dRfzHqg",
"type": "refund",
"data": {
"refund": {
"amount": 1,
"currency": "USD",
"reason": null
}
}
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
aa8e2e73ebda3d7764c03067fe5bc9b086683dc7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7040
|
Bug: chore: Update readme with juspay's vision, product offering, architecture diagram, setup steps and output
|
diff --git a/README.md b/README.md
index 10fdb6afc76..c09176b172a 100644
--- a/README.md
+++ b/README.md
@@ -3,22 +3,11 @@
<img src="./docs/imgs/hyperswitch-logo-light.svg#gh-light-mode-only" alt="Hyperswitch-Logo" width="40%" />
</p>
-<h1 align="center">The open-source payments switch</h1>
+<h1 align="center">Open-Source Payments Orchestration</h1>
<div align="center" >
-The single API to access payment ecosystems across 130+ countries</div>
-
-<p align="center">
- <a href="#try-a-payment">Try a Payment</a> •
- <a href="#quick-setup">Quick Setup</a> •
- <a href="/docs/try_local_system.md">Local Setup Guide (Hyperswitch App Server)</a> •
- <a href="https://api-reference.hyperswitch.io/introduction"> API Docs </a>
- <br>
- <a href="#community-contributions">Community and Contributions</a> •
- <a href="#bugs-and-feature-requests">Bugs and feature requests</a> •
- <a href="#versioning">Versioning</a> •
- <a href="#copyright-and-license">Copyright and License</a>
-</p>
+Single API to access the payments ecosystem and its features
+</div>
<p align="center">
<a href="https://github.com/juspay/hyperswitch/actions?query=workflow%3ACI+branch%3Amain">
@@ -45,28 +34,46 @@ The single API to access payment ecosystems across 130+ countries</div>
<hr>
-Hyperswitch is a community-led, open payments switch designed to empower digital businesses by providing fast, reliable, and affordable access to the best payments infrastructure.
+## Table of Contents
-Here are the components of Hyperswitch that deliver the whole solution:
+1. [Introduction](#introduction)
+2. [Architectural Overview](#architectural-overview)
+3. [Try Hyperswitch](#try-hyperswitch)
+4. [Support, Feature requests & Bugs](#support-feature-requests)
+5. [Our Vision](#our-vision)
+6. [Versioning](#versioning)
+7. [Copyright and License](#copyright-and-license)
-* [Hyperswitch Backend](https://github.com/juspay/hyperswitch): Powering Payment Processing
+<a href="#introduction">
+ <h2 id="introduction">Introduction</h2>
+</a>
+Juspay, founded in 2012, is a global leader in payment orchestration and checkout solutions, trusted by 400+ leading enterprises and brands worldwide. Hyperswitch is Juspay's new generation of composable, commercial open-source payments platform for merchant and brands. It is an enterprise-grade, transparent and modular payments platform designed to provide digital businesses access to the best payments infrastructure.
-* [SDK (Frontend)](https://github.com/juspay/hyperswitch-web): Simplifying Integration and Powering the UI
+Here are the key components of Hyperswitch that deliver the whole solution:
-* [Control Centre](https://github.com/juspay/hyperswitch-control-center): Managing Operations with Ease
+* [Hyperswitch Backend](https://github.com/juspay/hyperswitch): Hyperswitch backend enables seamless payment processing with comprehensive support for various payment flows - authorization, authentication, void and capture workflows along with robust management of post-payment processes like refunds and chargeback handling. Additionally, Hyperswitch supports non-payment use cases by enabling connections with external FRM or authentication providers as part of the payment flow. The backend optimizes payment routing with customizable workflows, including success rate-based routing, rule-based routing, volume distribution, fallback handling, and intelligent retry mechanisms for failed payments based on specific error codes.
-Jump in and contribute to these repositories to help improve and expand Hyperswitch!
+* [SDK (Frontend)](https://github.com/juspay/hyperswitch-web): The SDK, available for web, [Android, and iOS](https://github.com/juspay/hyperswitch-client-core), unifies the payment experience across various methods such as cards, wallets, BNPL, bank transfers, and more, while supporting the diverse payment flows of underlying PSPs. When paired with the locker, it surfaces the user's saved payment methods.
-<img src="./docs/imgs/switch.png" />
+* [Control Center](https://github.com/juspay/hyperswitch-control-center): The Control Center enables users to manage the entire payments stack without any coding. It allows the creation of workflows for routing, payment retries, and defining conditions to invoke 3DS, fraud risk management (FRM), and surcharge modules. The Control Center provides access to transaction, refund, and chargeback operations across all integrated PSPs, transaction-level logs for initial debugging, and detailed analytics and insights into payment performance.
+
+Read more at [Hyperswitch docs](https://docs.hyperswitch.io/).
+
+<a href="#architectural-overview">
+ <h2 id="architectural-overview">Architectural Overview</h2>
+</a>
+<img src="./docs/imgs/features.png" />
+<img src="./docs/imgs/non-functional-features.png" />
+<img src="./docs/imgs/hyperswitch-architecture-v1.png" />
-<a href="#Quick Setup">
- <h2 id="quick-setup">⚡️ Quick Setup</h2>
+<a href="#try-hyperswitch">
+ <h2 id="try-hyperswitch">Try Hyperswitch</h2>
</a>
-### Docker Compose
+### 1. Local Setup
-You can run Hyperswitch on your system using Docker Compose after cloning this repository:
+You can run Hyperswitch on your system using Docker compose after cloning this repository.
```shell
git clone --depth 1 --branch latest https://github.com/juspay/hyperswitch
@@ -74,23 +81,49 @@ cd hyperswitch
docker compose up -d
```
-This will start the app server, web client/SDK and control center.
-
-Check out the [local setup guide][local-setup-guide] for a more comprehensive
-setup, which includes the [scheduler and monitoring services][docker-compose-scheduler-monitoring].
+Check out the [local setup guide][local-setup-guide] for a more details on setting up the entire stack or component wise. This takes 15-mins and gives the following output
+```shell
+[+] Running 2/2
+✔ hyperswitch-control-center Pulled 2.9s
+✔ hyperswitch-server Pulled 3.0s
+[+] Running 6/0
+
+✔ Container hyperswitch-pg-1 Created 0.0s
+✔ Container hyperswitch-redis-standalone-1 Created 0.0s
+✔ Container hyperswitch-migration_runner-1 Created 0.0s
+✔ Container hyperswitch-hyperswitch-server-1 Created 0.0s
+✔ Container hyperswitch-hyperswitch-web-1 Created 0.0s
+✔ Container hyperswitch-hyperswitch-control-center-1 Created 0.0s
+
+Attaching to hyperswitch-control-center-1, hyperswitch-server-1, hyperswitch-web-1, migration_runner-1, pg-1, redis-standalone-1
+```
-### One-click deployment on AWS cloud
+### 2. Deployment on cloud
-The fastest and easiest way to try Hyperswitch is via our CDK scripts
+The fastest and easiest way to try Hyperswitch on AWS is via our CDK scripts
1. Click on the following button for a quick standalone deployment on AWS, suitable for prototyping.
No code or setup is required in your system and the deployment is covered within the AWS free-tier setup.
- <a href="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=HyperswitchBootstarp&templateURL=https://hyperswitch-synth.s3.eu-central-1.amazonaws.com/hs-starter-config.yaml"><img src="./docs/imgs/aws_button.png" height="35"></a>
+ <a href="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=HyperswitchBootstarp&templateURL=https://hyperswitch-synth.s3.eu-central-1.amazonaws.com/hs-starter-config.yaml"><img src="https://github.com/juspay/hyperswitch/blob/main/docs/imgs/aws_button.png?raw=true" height="35"></a>
2. Sign-in to your AWS console.
-3. Follow the instructions provided on the console to successfully deploy Hyperswitch
+3. Follow the instructions provided on the console to successfully deploy Hyperswitch. This takes 30-45mins and gives the following output
+
+| Service| Host|
+|----------------------------------------------|----------------------------------------------|
+| App server running on | `http://hyperswitch-<host-id.region>.elb.amazonaws.com` |
+| HyperloaderJS Hosted at | `http://<cloudfront.host-id>/0.103.1/v0/HyperLoader.js` |
+| Control center server running on | `http://hyperswitch-control-center-<host-id.region>.elb.amazonaws.com`, Login with Email: `test@gmail.com` |
+| Hyperswitch Demo Store running on | `http://hyperswitch-sdk-demo-<host-id.region>.elb.amazonaws.com` |
+| Logs server running on | `http://hyperswitch-logs-<host-id.region>.elb.amazonaws.com`, Login with username: `admin`, password: `admin` |
+
+We support deployment on GCP and Azure via Helm charts which takes 30-45mins. You can read more at [Hyperswitch docs](https://docs.hyperswitch.io/hyperswitch-open-source/deploy-on-kubernetes-using-helm).
+
+### 3. Hosted Sandbox
+
+You can experience the product by signing up for our [hosted sandbox](https://app.hyperswitch.io/). The signup process accepts any email ID and provides access to the entire Control Center. You can set up connectors, define workflows for routing and retries, and even try payments from the dashboard.
[docs-link-for-enterprise]: https://docs.hyperswitch.io/hyperswitch-cloud/quickstart
[docs-link-for-developers]: https://docs.hyperswitch.io/hyperswitch-open-source/overview
@@ -101,43 +134,31 @@ The fastest and easiest way to try Hyperswitch is via our CDK scripts
[local-setup-guide]: /docs/try_local_system.md
[docker-compose-scheduler-monitoring]: /docs/try_local_system.md#running-additional-services
-<a href="https://app.hyperswitch.io/">
- <h2 id="try-a-payment">⚡️ Try a Payment</h2>
-</a>
-
-To quickly experience the ease of Hyperswitch, sign up on the [Hyperswitch Control Center](https://app.hyperswitch.io/) and try a payment. Once you've completed your first transaction, you’ve successfully made your first payment with Hyperswitch!
-<a href="#community-contributions">
- <h2 id="community-contributions">✅ Community & Contributions</h2>
+<a href="support-feature-requests">
+ <h2 id="support-feature-requests">Support, Feature requests & Bugs</h2>
</a>
-The community and core team are available in [GitHub Discussions](https://github.com/juspay/hyperswitch/discussions), where you can ask for support, discuss roadmap, and share ideas.
+For any support, join the conversation in [Slack](https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw)
-Our [Contribution Guide](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md) describes how to contribute to the codebase and Docs.
+For new product features, enhancements, roadmap discussions, or to share queries and ideas, visit our [GitHub Discussions](https://github.com/juspay/hyperswitch/discussions)
-Join our Conversation in [Slack](https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw), [Discord](https://discord.gg/wJZ7DVW8mm), [Twitter](https://x.com/hyperswitchio)
+For reporting a bug, please read the issue guidelines and search for [existing and closed issues]. If your problem or idea is not addressed yet, please [open a new issue].
+[existing and closed issues]: https://github.com/juspay/hyperswitch/issues
+[open a new issue]: https://github.com/juspay/hyperswitch/issues/new/choose
-<a href="#Join-us-in-building-Hyperswitch">
- <h2 id="join-us-in-building-hyperswitch">💪 Join us in building Hyperswitch</h2>
+<a href="our-vision">
+ <h2 id="our-vision">Our Vision</h2>
</a>
-### 🤝 Our Belief
+> Linux for Payments
-> Payments should be open, fast, reliable and affordable to serve
-> the billions of people at scale.
+Payments are evolving rapidly worldwide, with hundreds of processors, fraud detection systems, authentication modules, and new payment methods and flows emerging. Businesses building or managing their own payment stacks often face similar challenges, struggle with comparable issues, and find it hard to innovate at the desired pace.
-Globally payment diversity has been growing at a rapid pace.
-There are hundreds of payment processors and new payment methods like BNPL,
-RTP etc.
-Businesses need to embrace this diversity to increase conversion, reduce cost
-and improve control.
-But integrating and maintaining multiple processors needs a lot of dev effort.
-Why should devs across companies repeat the same work?
-Why can't it be unified and reused? Hence, Hyperswitch was born to create that
-reusable core and let companies build and customise it as per their specific requirements.
+Hyperswitch serves as a well-architected designed reference platform, built on best-in-class design principles, empowering businesses to own and customize their payment stack. It provides a reusable core payments stack that can be tailored to specific requirements while relying on the Hyperswitch team for enhancements, support, and continuous innovation.
-### ✨ Our Values
+### Our Values
1. Embrace Payments Diversity: It will drive innovation in the ecosystem in
multiple ways.
@@ -150,33 +171,24 @@ reusable core and let companies build and customise it as per their specific req
This project is being created and maintained by [Juspay](https://juspay.io)
-<a href="#Bugs and feature requests">
- <h2 id="bugs-and-feature-requests">🐞 Bugs and feature requests</h2>
-</a>
-
-Please read the issue guidelines and search for [existing and closed issues].
-If your problem or idea is not addressed yet, please [open a new issue].
-
-[existing and closed issues]: https://github.com/juspay/hyperswitch/issues
-[open a new issue]: https://github.com/juspay/hyperswitch/issues/new/choose
-
-<a href="#Versioning">
- <h2 id="versioning">🔖 Versioning</h2>
+<a href="#versioning">
+ <h2 id="versioning">Versioning</h2>
</a>
Check the [CHANGELOG.md](./CHANGELOG.md) file for details.
-<a href="#©Copyright and License">
- <h2 id="copyright-and-license">©️ Copyright and License</h2>
+<a href="#copyright-and-license">
+ <h2 id="copyright-and-license">Copyright and License</h2>
</a>
This product is licensed under the [Apache 2.0 License](LICENSE).
-<a href="#Thanks to all contributors">
- <h2 id="Thanks to all contributors">✨ Thanks to all contributors</h2>
+
+<a href="team-behind-hyperswitch">
+ <h2 id="team-behind-hyperswitch">Team behind Hyperswitch</h2>
</a>
-Thank you for your support in hyperswitch's growth. Keep up the great work! 🥂
+The core team of 150+ engineers building Hyperswitch. Keep up the great work! 🥂
<a href="https://github.com/juspay/hyperswitch/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=juspay/hyperswitch" alt="Contributors"/>
|
2025-01-10T11:26:08Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [X] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Update readme with vision, product offering, architecture diagram, setup steps and output
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
7b306a9015a55b573731414c210d4c684c802f7a
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7055
|
Bug: FEAT: Add Support for Amazon Pay Redirect and Amazon Pay payment via Stripe
Add Support for Amazon Pay Redirect and Amazon Pay payment via Stripe
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 892931256bc..8cd818f2919 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -3052,6 +3052,9 @@
"AliPayRedirection": {
"type": "object"
},
+ "AmazonPayRedirectData": {
+ "type": "object"
+ },
"AmountDetails": {
"type": "object",
"required": [
@@ -14202,6 +14205,7 @@
"ali_pay",
"ali_pay_hk",
"alma",
+ "amazon_pay",
"apple_pay",
"atome",
"bacs",
@@ -21522,6 +21526,17 @@
}
}
},
+ {
+ "type": "object",
+ "required": [
+ "amazon_pay_redirect"
+ ],
+ "properties": {
+ "amazon_pay_redirect": {
+ "$ref": "#/components/schemas/AmazonPayRedirectData"
+ }
+ }
+ },
{
"type": "object",
"required": [
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index b6152cc9787..25b35b7d3b0 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2362,6 +2362,7 @@ impl GetPaymentMethodType for WalletData {
match self {
Self::AliPayQr(_) | Self::AliPayRedirect(_) => api_enums::PaymentMethodType::AliPay,
Self::AliPayHkRedirect(_) => api_enums::PaymentMethodType::AliPayHk,
+ Self::AmazonPayRedirect(_) => api_enums::PaymentMethodType::AmazonPay,
Self::MomoRedirect(_) => api_enums::PaymentMethodType::Momo,
Self::KakaoPayRedirect(_) => api_enums::PaymentMethodType::KakaoPay,
Self::GoPayRedirect(_) => api_enums::PaymentMethodType::GoPay,
@@ -3240,6 +3241,8 @@ pub enum WalletData {
AliPayRedirect(AliPayRedirection),
/// The wallet data for Ali Pay HK redirect
AliPayHkRedirect(AliPayHkRedirection),
+ /// The wallet data for Amazon Pay redirect
+ AmazonPayRedirect(AmazonPayRedirectData),
/// The wallet data for Momo redirect
MomoRedirect(MomoRedirection),
/// The wallet data for KakaoPay redirect
@@ -3323,6 +3326,7 @@ impl GetAddressFromPaymentMethodData for WalletData {
| Self::KakaoPayRedirect(_)
| Self::GoPayRedirect(_)
| Self::GcashRedirect(_)
+ | Self::AmazonPayRedirect(_)
| Self::ApplePay(_)
| Self::ApplePayRedirect(_)
| Self::ApplePayThirdPartySdk(_)
@@ -3480,6 +3484,9 @@ pub struct GooglePayWalletData {
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayRedirectData {}
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct AmazonPayRedirectData {}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayRedirectData {}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 562b4fdf269..80dcef43032 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1532,6 +1532,7 @@ pub enum PaymentMethodType {
AliPay,
AliPayHk,
Alma,
+ AmazonPay,
ApplePay,
Atome,
Bacs,
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index 7611ae127ee..d351f5c927e 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1799,6 +1799,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::AliPay => Self::Wallet,
PaymentMethodType::AliPayHk => Self::Wallet,
PaymentMethodType::Alma => Self::PayLater,
+ PaymentMethodType::AmazonPay => Self::Wallet,
PaymentMethodType::ApplePay => Self::Wallet,
PaymentMethodType::Bacs => Self::BankDebit,
PaymentMethodType::BancontactCard => Self::BankRedirect,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 2ab348d5dd5..a2dc3911cc4 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -3131,6 +3131,8 @@ merchant_secret="Source verification key"
payment_method_type = "sepa"
[[stripe.bank_transfer]]
payment_method_type = "multibanco"
+[[stripe.wallet]]
+ payment_method_type = "amazon_pay"
[[stripe.wallet]]
payment_method_type = "apple_pay"
[[stripe.wallet]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 35f2f14c748..80ad46c0e72 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -2281,6 +2281,8 @@ merchant_secret="Source verification key"
payment_method_type = "bacs"
[[stripe.bank_transfer]]
payment_method_type = "sepa"
+[[stripe.wallet]]
+ payment_method_type = "amazon_pay"
[[stripe.wallet]]
payment_method_type = "apple_pay"
[[stripe.wallet]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index ed903812219..51a075f40ff 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -3072,6 +3072,8 @@ merchant_secret="Source verification key"
payment_method_type = "sepa"
[[stripe.bank_transfer]]
payment_method_type = "multibanco"
+[[stripe.wallet]]
+ payment_method_type = "amazon_pay"
[[stripe.wallet]]
payment_method_type = "apple_pay"
[[stripe.wallet]]
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index 6c96070159b..6fb302641db 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -71,6 +71,7 @@ pub enum PayLaterType {
#[strum(serialize_all = "snake_case")]
pub enum WalletType {
GooglePay,
+ AmazonPay,
ApplePay,
Paypal,
AliPay,
diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs
index 07ff2c4364e..04a029bd109 100644
--- a/crates/euclid/src/frontend/dir/lowering.rs
+++ b/crates/euclid/src/frontend/dir/lowering.rs
@@ -38,6 +38,7 @@ impl From<enums::WalletType> for global_enums::PaymentMethodType {
fn from(value: enums::WalletType) -> Self {
match value {
enums::WalletType::GooglePay => Self::GooglePay,
+ enums::WalletType::AmazonPay => Self::AmazonPay,
enums::WalletType::ApplePay => Self::ApplePay,
enums::WalletType::Paypal => Self::Paypal,
enums::WalletType::AliPay => Self::AliPay,
diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs
index 914a9444918..1a3bb52e0fa 100644
--- a/crates/euclid/src/frontend/dir/transformers.rs
+++ b/crates/euclid/src/frontend/dir/transformers.rs
@@ -19,6 +19,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
global_enums::PaymentMethodType::AfterpayClearpay => {
Ok(dirval!(PayLaterType = AfterpayClearpay))
}
+ global_enums::PaymentMethodType::AmazonPay => Ok(dirval!(WalletType = AmazonPay)),
global_enums::PaymentMethodType::GooglePay => Ok(dirval!(WalletType = GooglePay)),
global_enums::PaymentMethodType::ApplePay => Ok(dirval!(WalletType = ApplePay)),
global_enums::PaymentMethodType::Paypal => Ok(dirval!(WalletType = Paypal)),
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
index 45a7b577a86..8c5adefc613 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
@@ -337,6 +337,7 @@ fn get_wallet_details(
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index 3602f771928..59e18f0421f 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -296,6 +296,7 @@ impl TryFrom<&SetupMandateRouterData> for BankOfAmericaPaymentsRequest {
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
@@ -1023,6 +1024,7 @@ impl TryFrom<&BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>>
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
index 7970b1b1d42..809902fa2a2 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
@@ -368,6 +368,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
index da5f775489c..8bc7b3639b7 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
@@ -180,6 +180,7 @@ fn get_wallet_type(wallet_data: &WalletData) -> Result<String, errors::Connector
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::ApplePay(_)
| WalletData::ApplePayRedirect(_)
| WalletData::ApplePayThirdPartySdk(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index 9f3d0241719..953ff304b91 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -247,6 +247,7 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
@@ -1937,6 +1938,7 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 51fc23eee41..726775ed681 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -505,6 +505,7 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
index 5d30146293c..36c83859be9 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
@@ -59,6 +59,7 @@ impl TryFrom<&GlobepayRouterData<&types::PaymentsAuthorizeRouterData>> for Globe
WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat,
WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index a60e8bdc79e..54aca37a76a 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -492,6 +492,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
@@ -556,6 +557,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
@@ -715,6 +717,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
index 8d6dc42926b..21fa1ec3217 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
@@ -705,6 +705,7 @@ fn get_wallet_details(
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 6d3199ecf1a..edc05d32153 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -341,6 +341,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
WalletDataPaymentMethod::AliPayQr(_)
| WalletDataPaymentMethod::AliPayRedirect(_)
| WalletDataPaymentMethod::AliPayHkRedirect(_)
+ | WalletDataPaymentMethod::AmazonPayRedirect(_)
| WalletDataPaymentMethod::MomoRedirect(_)
| WalletDataPaymentMethod::KakaoPayRedirect(_)
| WalletDataPaymentMethod::GoPayRedirect(_)
@@ -1586,6 +1587,7 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
WalletDataPaymentMethod::AliPayQr(_)
| WalletDataPaymentMethod::AliPayRedirect(_)
| WalletDataPaymentMethod::AliPayHkRedirect(_)
+ | WalletDataPaymentMethod::AmazonPayRedirect(_)
| WalletDataPaymentMethod::MomoRedirect(_)
| WalletDataPaymentMethod::KakaoPayRedirect(_)
| WalletDataPaymentMethod::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index 1973e622be1..5c5615aa945 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -286,6 +286,7 @@ impl TryFrom<&WalletData> for Shift4PaymentMethod {
fn try_from(wallet_data: &WalletData) -> Result<Self, Self::Error> {
match wallet_data {
WalletData::AliPayRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::ApplePay(_)
| WalletData::WeChatPayRedirect(_)
| WalletData::AliPayQr(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index 5abc93b3f88..a926f9b3c45 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -107,6 +107,7 @@ impl TryFrom<(&types::TokenizationRouterData, WalletData)> for SquareTokenReques
| WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
index 6ce9a4d7aa9..0e8da800fd5 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
@@ -184,6 +184,7 @@ impl TryFrom<&SetupMandateRouterData> for WellsfargoZeroMandateRequest {
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
@@ -1242,6 +1243,7 @@ impl TryFrom<&WellsfargoRouterData<&PaymentsAuthorizeRouterData>> for Wellsfargo
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index cd028e81ef1..a72e5e8427c 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -156,6 +156,7 @@ fn fetch_payment_instrument(
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index cc6795f157a..a9e21f9071c 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -487,6 +487,7 @@ impl
| WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPayRedirect(_)
| WalletData::MomoRedirect(_)
| WalletData::KakaoPayRedirect(_)
| WalletData::GoPayRedirect(_)
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index e99777ad27e..f617f6ccf3a 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -2266,6 +2266,7 @@ pub enum PaymentMethodDataType {
AliPayQr,
AliPayRedirect,
AliPayHkRedirect,
+ AmazonPayRedirect,
MomoRedirect,
KakaoPayRedirect,
GoPayRedirect,
@@ -2385,6 +2386,7 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
payment_method_data::WalletData::AliPayQr(_) => Self::AliPayQr,
payment_method_data::WalletData::AliPayRedirect(_) => Self::AliPayRedirect,
payment_method_data::WalletData::AliPayHkRedirect(_) => Self::AliPayHkRedirect,
+ payment_method_data::WalletData::AmazonPayRedirect(_) => Self::AmazonPayRedirect,
payment_method_data::WalletData::MomoRedirect(_) => Self::MomoRedirect,
payment_method_data::WalletData::KakaoPayRedirect(_) => Self::KakaoPayRedirect,
payment_method_data::WalletData::GoPayRedirect(_) => Self::GoPayRedirect,
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 8c19a20ef32..59863ad632b 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -1,6 +1,8 @@
use api_models::{
mandates, payment_methods,
- payments::{additional_info as payment_additional_types, ExtendedCardInfo},
+ payments::{
+ additional_info as payment_additional_types, AmazonPayRedirectData, ExtendedCardInfo,
+ },
};
use common_enums::enums as api_enums;
use common_utils::{
@@ -169,6 +171,7 @@ pub enum WalletData {
AliPayQr(Box<AliPayQr>),
AliPayRedirect(AliPayRedirection),
AliPayHkRedirect(AliPayHkRedirection),
+ AmazonPayRedirect(Box<AmazonPayRedirectData>),
MomoRedirect(MomoRedirection),
KakaoPayRedirect(KakaoPayRedirection),
GoPayRedirect(GoPayRedirection),
@@ -729,6 +732,9 @@ impl From<api_models::payments::WalletData> for WalletData {
api_models::payments::WalletData::AliPayHkRedirect(_) => {
Self::AliPayHkRedirect(AliPayHkRedirection {})
}
+ api_models::payments::WalletData::AmazonPayRedirect(_) => {
+ Self::AmazonPayRedirect(Box::new(AmazonPayRedirectData {}))
+ }
api_models::payments::WalletData::MomoRedirect(_) => {
Self::MomoRedirect(MomoRedirection {})
}
@@ -1518,6 +1524,7 @@ impl GetPaymentMethodType for WalletData {
match self {
Self::AliPayQr(_) | Self::AliPayRedirect(_) => api_enums::PaymentMethodType::AliPay,
Self::AliPayHkRedirect(_) => api_enums::PaymentMethodType::AliPayHk,
+ Self::AmazonPayRedirect(_) => api_enums::PaymentMethodType::AmazonPay,
Self::MomoRedirect(_) => api_enums::PaymentMethodType::Momo,
Self::KakaoPayRedirect(_) => api_enums::PaymentMethodType::KakaoPay,
Self::GoPayRedirect(_) => api_enums::PaymentMethodType::GoPay,
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index a3e1dfc6220..e224078493f 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -21,6 +21,7 @@ fn get_dir_value_payment_method(
from: api_enums::PaymentMethodType,
) -> Result<dir::DirValue, KgraphError> {
match from {
+ api_enums::PaymentMethodType::AmazonPay => Ok(dirval!(WalletType = AmazonPay)),
api_enums::PaymentMethodType::Credit => Ok(dirval!(CardType = Credit)),
api_enums::PaymentMethodType::Debit => Ok(dirval!(CardType = Debit)),
api_enums::PaymentMethodType::Giropay => Ok(dirval!(BankRedirectType = Giropay)),
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index 89b8c5a34ad..adfe5820866 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -130,6 +130,7 @@ impl IntoDirValue for api_enums::FutureUsage {
impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
fn into_dir_value(self) -> Result<dir::DirValue, KgraphError> {
match self.0 {
+ api_enums::PaymentMethodType::AmazonPay => Ok(dirval!(WalletType = AmazonPay)),
api_enums::PaymentMethodType::Credit => Ok(dirval!(CardType = Credit)),
api_enums::PaymentMethodType::Debit => Ok(dirval!(CardType = Debit)),
api_enums::PaymentMethodType::Giropay => Ok(dirval!(BankRedirectType = Giropay)),
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 3a634ae2a54..e7d85f45ab9 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -479,6 +479,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::AchTransfer,
api_models::payments::MultibancoTransferInstructions,
api_models::payments::DokuBankTransferInstructions,
+ api_models::payments::AmazonPayRedirectData,
api_models::payments::ApplePayRedirectData,
api_models::payments::ApplePayThirdPartySdkData,
api_models::payments::GooglePayRedirectData,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 3b1fefefa15..a69489075f0 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -438,6 +438,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::AchTransfer,
api_models::payments::MultibancoTransferInstructions,
api_models::payments::DokuBankTransferInstructions,
+ api_models::payments::AmazonPayRedirectData,
api_models::payments::ApplePayRedirectData,
api_models::payments::ApplePayThirdPartySdkData,
api_models::payments::GooglePayRedirectData,
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 d957109bcef..64c6a3f9d44 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -9503,6 +9503,21 @@ impl Default for settings::RequiredFields {
]),
},
),
+ (
+ enums::PaymentMethodType::AmazonPay,
+ ConnectorFields {
+ fields: HashMap::from([
+ (
+ enums::Connector::Stripe,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ ]),
+ },
+ ),
(
enums::PaymentMethodType::Cashapp,
ConnectorFields {
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index 3e25799c02e..11d34e55b7b 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -108,6 +108,7 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)> for Pay
account_id: None,
})),
domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index d6f6fdc8f0f..91e65759573 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -215,7 +215,8 @@ impl ConnectorValidation for Adyen {
)
}
},
- PaymentMethodType::CardRedirect
+ PaymentMethodType::AmazonPay
+ | PaymentMethodType::CardRedirect
| PaymentMethodType::DirectCarrierBilling
| PaymentMethodType::Fps
| PaymentMethodType::DuitNow
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 394652c33e1..adb1a795f70 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2211,6 +2211,7 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
domain::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana),
domain::WalletData::SwishQr(_) => Ok(AdyenPaymentMethod::Swish),
domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::ApplePayRedirect(_)
| domain::WalletData::ApplePayThirdPartySdk(_)
| domain::WalletData::GooglePayRedirect(_)
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index d2b212e3ea0..b4f12bd5a35 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1748,6 +1748,7 @@ fn get_wallet_data(
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index cd758fffb69..6902fa5e1f3 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -93,6 +93,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest {
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
@@ -341,6 +342,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs
index 4e54311a89a..6fbc48a66a0 100644
--- a/crates/router/src/connector/klarna.rs
+++ b/crates/router/src/connector/klarna.rs
@@ -577,6 +577,7 @@ impl
| common_enums::PaymentMethodType::AliPay
| common_enums::PaymentMethodType::AliPayHk
| common_enums::PaymentMethodType::Alma
+ | common_enums::PaymentMethodType::AmazonPay
| common_enums::PaymentMethodType::ApplePay
| common_enums::PaymentMethodType::Atome
| common_enums::PaymentMethodType::Bacs
@@ -693,6 +694,7 @@ impl
| common_enums::PaymentMethodType::AliPay
| common_enums::PaymentMethodType::AliPayHk
| common_enums::PaymentMethodType::Alma
+ | common_enums::PaymentMethodType::AmazonPay
| common_enums::PaymentMethodType::ApplePay
| common_enums::PaymentMethodType::Atome
| common_enums::PaymentMethodType::Bacs
diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs
index 1e2c420c767..f913077d1dc 100644
--- a/crates/router/src/connector/mifinity/transformers.rs
+++ b/crates/router/src/connector/mifinity/transformers.rs
@@ -154,6 +154,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 4c33f020017..19f03cb1b2c 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -545,6 +545,7 @@ impl
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index b96283247b4..5816aaa9295 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -314,6 +314,7 @@ impl TryFrom<&NoonRouterData<&types::PaymentsAuthorizeRouterData>> for NoonPayme
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index c98a0647778..eea700f695c 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -902,6 +902,7 @@ where
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index cd8ba814eb7..d76f33a8293 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -393,6 +393,7 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod {
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 8f739792a0c..18739851ae8 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -1044,6 +1044,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
domain::WalletData::AliPayQr(_)
| domain::WalletData::AliPayRedirect(_)
| domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::AmazonPayRedirect(_)
| domain::WalletData::MomoRedirect(_)
| domain::WalletData::KakaoPayRedirect(_)
| domain::WalletData::GoPayRedirect(_)
@@ -1134,6 +1135,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
| enums::PaymentMethodType::AliPay
| enums::PaymentMethodType::AliPayHk
| enums::PaymentMethodType::Alma
+ | enums::PaymentMethodType::AmazonPay
| enums::PaymentMethodType::ApplePay
| enums::PaymentMethodType::Atome
| enums::PaymentMethodType::Bacs
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 48736c00e7d..6a6be9f1992 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -531,6 +531,7 @@ pub enum StripeWallet {
ApplepayToken(StripeApplePay),
GooglepayToken(GooglePayToken),
ApplepayPayment(ApplepayPayment),
+ AmazonpayPayment(AmazonpayPayment),
WechatpayPayment(WechatpayPayment),
AlipayPayment(AlipayPayment),
Cashapp(CashappPayment),
@@ -577,6 +578,12 @@ pub struct ApplepayPayment {
pub payment_method_types: StripePaymentMethodType,
}
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct AmazonpayPayment {
+ #[serde(rename = "payment_method_data[type]")]
+ pub payment_method_types: StripePaymentMethodType,
+}
+
#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct AlipayPayment {
#[serde(rename = "payment_method_data[type]")]
@@ -620,6 +627,8 @@ pub enum StripePaymentMethodType {
Affirm,
AfterpayClearpay,
Alipay,
+ #[serde(rename = "amazon_pay")]
+ AmazonPay,
#[serde(rename = "au_becs_debit")]
Becs,
#[serde(rename = "bacs_debit")]
@@ -667,6 +676,7 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
enums::PaymentMethodType::Giropay => Ok(Self::Giropay),
enums::PaymentMethodType::Ideal => Ok(Self::Ideal),
enums::PaymentMethodType::Sofort => Ok(Self::Sofort),
+ enums::PaymentMethodType::AmazonPay => Ok(Self::AmazonPay),
enums::PaymentMethodType::ApplePay => Ok(Self::Card),
enums::PaymentMethodType::Ach => Ok(Self::Ach),
enums::PaymentMethodType::Sepa => Ok(Self::Sepa),
@@ -1048,6 +1058,9 @@ impl ForeignTryFrom<&domain::WalletData> for Option<StripePaymentMethodType> {
domain::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)),
domain::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)),
domain::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)),
+ domain::WalletData::AmazonPayRedirect(_) => {
+ Ok(Some(StripePaymentMethodType::AmazonPay))
+ }
domain::WalletData::MobilePayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
@@ -1466,6 +1479,11 @@ impl TryFrom<(&domain::WalletData, Option<types::PaymentMethodToken>)> for Strip
payment_method_data_type: StripePaymentMethodType::Cashapp,
})))
}
+ domain::WalletData::AmazonPayRedirect(_) => Ok(Self::Wallet(
+ StripeWallet::AmazonpayPayment(AmazonpayPayment {
+ payment_method_types: StripePaymentMethodType::AmazonPay,
+ }),
+ )),
domain::WalletData::GooglePay(gpay_data) => Ok(Self::try_from(gpay_data)?),
domain::WalletData::PaypalRedirect(_) | domain::WalletData::MobilePayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
@@ -2298,6 +2316,7 @@ pub enum StripePaymentMethodDetailsResponse {
Klarna,
Affirm,
AfterpayClearpay,
+ AmazonPay,
ApplePay,
#[serde(rename = "us_bank_account")]
Ach,
@@ -2345,6 +2364,7 @@ impl StripePaymentMethodDetailsResponse {
| Self::Klarna
| Self::Affirm
| Self::AfterpayClearpay
+ | Self::AmazonPay
| Self::ApplePay
| Self::Ach
| Self::Sepa
@@ -2661,6 +2681,7 @@ impl<F, T>
| Some(StripePaymentMethodDetailsResponse::Klarna)
| Some(StripePaymentMethodDetailsResponse::Affirm)
| Some(StripePaymentMethodDetailsResponse::AfterpayClearpay)
+ | Some(StripePaymentMethodDetailsResponse::AmazonPay)
| Some(StripePaymentMethodDetailsResponse::ApplePay)
| Some(StripePaymentMethodDetailsResponse::Ach)
| Some(StripePaymentMethodDetailsResponse::Sepa)
@@ -3270,6 +3291,7 @@ pub enum StripePaymentMethodOptions {
Klarna {},
Affirm {},
AfterpayClearpay {},
+ AmazonPay {},
Eps {},
Giropay {},
Ideal {},
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index cbf1867b08b..c4824d65836 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2744,6 +2744,7 @@ pub enum PaymentMethodDataType {
AliPayQr,
AliPayRedirect,
AliPayHkRedirect,
+ AmazonPayRedirect,
MomoRedirect,
KakaoPayRedirect,
GoPayRedirect,
@@ -2862,6 +2863,7 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
domain::payments::WalletData::AliPayQr(_) => Self::AliPayQr,
domain::payments::WalletData::AliPayRedirect(_) => Self::AliPayRedirect,
domain::payments::WalletData::AliPayHkRedirect(_) => Self::AliPayHkRedirect,
+ domain::payments::WalletData::AmazonPayRedirect(_) => Self::AmazonPayRedirect,
domain::payments::WalletData::MomoRedirect(_) => Self::MomoRedirect,
domain::payments::WalletData::KakaoPayRedirect(_) => Self::KakaoPayRedirect,
domain::payments::WalletData::GoPayRedirect(_) => Self::GoPayRedirect,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 93769c71e6c..f4309a39cb4 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2739,7 +2739,8 @@ pub fn validate_payment_method_type_against_payment_method(
),
api_enums::PaymentMethod::Wallet => matches!(
payment_method_type,
- api_enums::PaymentMethodType::ApplePay
+ api_enums::PaymentMethodType::AmazonPay
+ | api_enums::PaymentMethodType::ApplePay
| api_enums::PaymentMethodType::GooglePay
| api_enums::PaymentMethodType::Paypal
| api_enums::PaymentMethodType::AliPay
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 06682f596ed..3b99193d608 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -452,7 +452,8 @@ impl ForeignFrom<api_enums::IntentStatus> for Option<storage_enums::EventType> {
impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
fn foreign_from(payment_method_type: api_enums::PaymentMethodType) -> Self {
match payment_method_type {
- api_enums::PaymentMethodType::ApplePay
+ api_enums::PaymentMethodType::AmazonPay
+ | api_enums::PaymentMethodType::ApplePay
| api_enums::PaymentMethodType::GooglePay
| api_enums::PaymentMethodType::Paypal
| api_enums::PaymentMethodType::AliPay
|
2025-01-17T10:00:25Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add Support for Amazon Pay Redirect and Amazon Pay payment via Stripe
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Create connector
```
curl --location 'http://localhost:8080/account/merchant_1737107777/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
"connector_type": "payment_processor",
"connector_name": "stripe",
"business_country": "US",
"business_label": "default",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key":API_KEY_HERE
},
"test_mode": false,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "amazon_pay",
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": false,
"installment_payment_enabled": false
}
]
}
],
"metadata": {}
}
'
```
Response
```
{
"connector_type": "payment_processor",
"connector_name": "stripe",
"connector_label": "stripe_US_default",
"merchant_connector_id": "mca_Y9GMWdiq1dIGbzUGr0cZ",
"profile_id": "pro_PX125fppN7NPx0QnQ0kW",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "sk*******************************************************************************************************wS"
},
"payment_methods_enabled": [
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "amazon_pay",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": false,
"installment_payment_enabled": false
}
]
}
],
"connector_webhook_details": null,
"metadata": {},
"test_mode": false,
"disabled": false,
"frm_configs": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"applepay_verified_domains": null,
"pm_auth_config": null,
"status": "active",
"additional_merchant_data": null,
"connector_wallets_details": null
}
```
2. Authorization
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0llKWUC3y5Z3vACDU324XIGXXvO8ANUm2FWWjJOPb7ifHOZBllSXLDleAeoXC1ui' \
--data-raw '{
"amount": 1800,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "klarna",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
"email": "guest1@example.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"return_url": "https://google.com",
"business_country": "US",
"payment_method": "wallet",
"payment_method_type": "amazon_pay",
"payment_method_data": {
"wallet": {
"amazon_pay_redirect": {}
}
},
"metadata": {
"order_details": {
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 1800,
"account_name": "transaction_processing"
}
}
}'
```
Response
```
{
"payment_id": "pay_Lcxnnod81tHdyOaL3rKN",
"merchant_id": "merchant_1737039949",
"status": "requires_customer_action",
"amount": 1800,
"net_amount": 1800,
"shipping_cost": null,
"amount_capturable": 1800,
"amount_received": 0,
"connector": "stripe",
"client_secret": "pay_Lcxnnod81tHdyOaL3rKN_secret_koHNJ4k4iszxZGs7UvLS",
"created": "2025-01-17T09:43:30.081Z",
"currency": "USD",
"customer_id": "klarna",
"customer": {
"id": "klarna",
"name": "John Doe",
"email": "guest1@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest1@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_Lcxnnod81tHdyOaL3rKN/merchant_1737039949/pay_Lcxnnod81tHdyOaL3rKN_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "amazon_pay",
"connector_label": "stripe_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "klarna",
"created_at": 1737107010,
"expires": 1737110610,
"secret": "epk_a49fc4c439174510b4916078a67daafc"
},
"manual_retry_allowed": null,
"connector_transaction_id": "pi_3QiC5OAGHc77EJXX19qPFa6Z",
"frm_message": null,
"metadata": {
"order_details": {
"amount": 1800,
"quantity": 1,
"account_name": "transaction_processing",
"product_name": "Apple iphone 15"
}
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QiC5OAGHc77EJXX19qPFa6Z",
"payment_link": null,
"profile_id": "pro_HPdS7uUx46Q3kWNK6x0q",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_5nADZHcVU5I934y0ikbp",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-17T09:58:30.081Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-17T09:43:31.230Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
3. PSync
```
curl --location 'http://localhost:8080/payments/pay_Lcxnnod81tHdyOaL3rKN?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_0llKWUC3y5Z3vACDU324XIGXXvO8ANUm2FWWjJOPb7ifHOZBllSXLDleAeoXC1ui'
```
Response
```
{
"payment_id": "pay_Lcxnnod81tHdyOaL3rKN",
"merchant_id": "merchant_1737039949",
"status": "succeeded",
"amount": 1800,
"net_amount": 1800,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1800,
"connector": "stripe",
"client_secret": "pay_Lcxnnod81tHdyOaL3rKN_secret_koHNJ4k4iszxZGs7UvLS",
"created": "2025-01-17T09:43:30.081Z",
"currency": "USD",
"customer_id": "klarna",
"customer": {
"id": "klarna",
"name": "John Doe",
"email": "guest1@example.com",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "guest1@example.com",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "amazon_pay",
"connector_label": "stripe_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "pi_3QiC5OAGHc77EJXX19qPFa6Z",
"frm_message": null,
"metadata": {
"order_details": {
"amount": 1800,
"quantity": 1,
"account_name": "transaction_processing",
"product_name": "Apple iphone 15"
}
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pi_3QiC5OAGHc77EJXX19qPFa6Z",
"payment_link": null,
"profile_id": "pro_HPdS7uUx46Q3kWNK6x0q",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_5nADZHcVU5I934y0ikbp",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-01-17T09:58:30.081Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-01-17T09:43:40.352Z",
"split_payments": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
cf82861e855bbd055fcbfc2367b23eaa58d8f842
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7037
|
Bug: feat(router): Unify Auth in single layer (V2)
In-efficiency in design
* Currently we have many types of auth and auth is evaluated in multiple places, with multiple ways.
* This indeed required multiple approaches and solution needs to be maintained
* More cognitive load
* We can’t authenticate a request in one infra component/layer
Unify Auth in single layer
* Make Authentication header like,
* authorization: key=value, keyN=valueN
* Examples:
* authorization: api-key=<api-key>
* authorization: publishable-key=<publishable-key>, client-secret=<client-secret>
* authorization: publishable-key=<publishable-key>, ephemeral-key=<ephemeral-key>
* authorization: jwt=<jwt-token>
* Lineage also should be added in headers, when we can’t inferable from authorization
* `profile_id` should be added in headers not in body
* If `api-key` not passed or the passed `api-key` has different scope, then `merchant-id` also should be passed.
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 041cae13ca6..0be5dd8ec2b 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -6705,6 +6705,42 @@
}
}
},
+ "ClientSecretResponse": {
+ "type": "object",
+ "description": "client_secret for the resource_id mentioned",
+ "required": [
+ "id",
+ "resource_id",
+ "created_at",
+ "expires",
+ "secret"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "Client Secret id",
+ "maxLength": 32,
+ "minLength": 1
+ },
+ "resource_id": {
+ "$ref": "#/components/schemas/ResourceId"
+ },
+ "created_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "time at which this client secret was created"
+ },
+ "expires": {
+ "type": "string",
+ "format": "date-time",
+ "description": "time at which this client secret would expire"
+ },
+ "secret": {
+ "type": "string",
+ "description": "client secret"
+ }
+ }
+ },
"Comparison": {
"type": "object",
"description": "Represents a single comparison condition.",
@@ -8413,39 +8449,6 @@
}
}
},
- "EphemeralKeyCreateResponse": {
- "type": "object",
- "description": "ephemeral_key for the customer_id mentioned",
- "required": [
- "customer_id",
- "created_at",
- "expires",
- "secret"
- ],
- "properties": {
- "customer_id": {
- "type": "string",
- "description": "customer_id to which this ephemeral key belongs to",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "maxLength": 64,
- "minLength": 1
- },
- "created_at": {
- "type": "integer",
- "format": "int64",
- "description": "time at which this ephemeral key was created"
- },
- "expires": {
- "type": "integer",
- "format": "int64",
- "description": "time at which this ephemeral key would expire"
- },
- "secret": {
- "type": "string",
- "description": "ephemeral key"
- }
- }
- },
"ErrorCategory": {
"type": "string",
"enum": [
@@ -12297,7 +12300,7 @@
]
},
"object": {
- "$ref": "#/components/schemas/PaymentsResponse"
+ "$ref": "#/components/schemas/PaymentsRetrieveResponse"
}
}
},
@@ -13327,26 +13330,6 @@
},
"additionalProperties": false
},
- "PaymentListResponse": {
- "type": "object",
- "required": [
- "size",
- "data"
- ],
- "properties": {
- "size": {
- "type": "integer",
- "description": "The number of payments included in the list",
- "minimum": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentsResponse"
- }
- }
- }
- },
"PaymentMethod": {
"type": "string",
"description": "Indicates the type of payment method. Eg: 'card', 'wallet', etc.",
@@ -14553,7 +14536,8 @@
"required": [
"id",
"customer_id",
- "expires_at"
+ "expires_at",
+ "client_secret"
],
"properties": {
"id": {
@@ -14594,6 +14578,10 @@
"format": "date-time",
"description": "The iso timestamp when the session will expire\nTrying to retrieve the session or any operations on the session after this time will result in an error",
"example": "2023-01-18T11:04:09.922Z"
+ },
+ "client_secret": {
+ "type": "string",
+ "description": "Client Secret"
}
}
},
@@ -15094,1278 +15082,294 @@
},
"additionalProperties": false
},
- "PaymentsCreateResponseOpenApi": {
+ "PaymentsDynamicTaxCalculationRequest": {
+ "type": "object",
+ "required": [
+ "shipping",
+ "client_secret",
+ "payment_method_type"
+ ],
+ "properties": {
+ "shipping": {
+ "$ref": "#/components/schemas/Address"
+ },
+ "client_secret": {
+ "type": "string",
+ "description": "Client Secret"
+ },
+ "payment_method_type": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "session_id": {
+ "type": "string",
+ "description": "Session Id",
+ "nullable": true
+ }
+ }
+ },
+ "PaymentsDynamicTaxCalculationResponse": {
"type": "object",
"required": [
"payment_id",
- "merchant_id",
- "status",
- "amount",
"net_amount",
- "amount_capturable",
- "currency",
- "payment_method",
- "attempt_count"
+ "display_amount"
],
"properties": {
"payment_id": {
"type": "string",
- "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant.",
- "example": "pay_mbabizu24mvu3mela5njyhpit4",
- "maxLength": 30,
- "minLength": 30
+ "description": "The identifier for the payment"
},
- "merchant_id": {
- "type": "string",
- "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
- "example": "merchant_1668273825",
- "maxLength": 255
+ "net_amount": {
+ "$ref": "#/components/schemas/MinorUnit"
},
- "status": {
+ "order_tax_amount": {
"allOf": [
{
- "$ref": "#/components/schemas/IntentStatus"
+ "$ref": "#/components/schemas/MinorUnit"
}
],
- "default": "requires_confirmation"
- },
- "amount": {
- "type": "integer",
- "format": "int64",
- "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
- "example": 6540
- },
- "net_amount": {
- "type": "integer",
- "format": "int64",
- "description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
- "example": 6540
- },
- "shipping_cost": {
- "type": "integer",
- "format": "int64",
- "description": "The shipping cost for the payment.",
- "example": 6540,
- "nullable": true
- },
- "amount_capturable": {
- "type": "integer",
- "format": "int64",
- "description": "The maximum amount that could be captured from the payment",
- "example": 6540,
- "minimum": 100
- },
- "amount_received": {
- "type": "integer",
- "format": "int64",
- "description": "The amount which is already captured from the payment, this helps in the cases where merchants can't capture all capturable amount at once.",
- "example": 6540,
"nullable": true
},
- "connector": {
- "type": "string",
- "description": "The connector used for the payment",
- "example": "stripe",
+ "shipping_cost": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MinorUnit"
+ }
+ ],
"nullable": true
},
+ "display_amount": {
+ "$ref": "#/components/schemas/DisplayAmountOnSdk"
+ }
+ }
+ },
+ "PaymentsExternalAuthenticationRequest": {
+ "type": "object",
+ "required": [
+ "client_secret",
+ "device_channel",
+ "threeds_method_comp_ind"
+ ],
+ "properties": {
"client_secret": {
"type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
- "nullable": true
+ "description": "Client Secret"
},
- "created": {
- "type": "string",
- "format": "date-time",
- "description": "Time when the payment was created",
- "example": "2022-09-10T10:11:12Z",
+ "sdk_information": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/SdkInformation"
+ }
+ ],
"nullable": true
},
- "currency": {
- "$ref": "#/components/schemas/Currency"
+ "device_channel": {
+ "$ref": "#/components/schemas/DeviceChannel"
},
- "customer_id": {
- "type": "string",
- "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.\nThis field will be deprecated soon. Please refer to `customer.id`",
- "deprecated": true,
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "nullable": true,
- "maxLength": 64,
- "minLength": 1
+ "threeds_method_comp_ind": {
+ "$ref": "#/components/schemas/ThreeDsCompletionIndicator"
+ }
+ }
+ },
+ "PaymentsExternalAuthenticationResponse": {
+ "type": "object",
+ "required": [
+ "trans_status",
+ "three_ds_requestor_url"
+ ],
+ "properties": {
+ "trans_status": {
+ "$ref": "#/components/schemas/TransactionStatus"
},
- "description": {
+ "acs_url": {
"type": "string",
- "description": "A description of the payment",
- "example": "It's my first payment request",
+ "description": "Access Server URL to be used for challenge submission",
"nullable": true
},
- "refunds": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/RefundResponse"
- },
- "description": "List of refunds that happened on this intent, as same payment intent can have multiple refund requests depending on the nature of order",
+ "challenge_request": {
+ "type": "string",
+ "description": "Challenge request which should be sent to acs_url",
"nullable": true
},
- "disputes": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/DisputeResponsePaymentsRetrieve"
- },
- "description": "List of disputes that happened on this intent",
+ "acs_reference_number": {
+ "type": "string",
+ "description": "Unique identifier assigned by the EMVCo(Europay, Mastercard and Visa)",
"nullable": true
},
- "attempts": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentAttemptResponse"
- },
- "description": "List of attempts that happened on this intent",
+ "acs_trans_id": {
+ "type": "string",
+ "description": "Unique identifier assigned by the ACS to identify a single transaction",
"nullable": true
},
- "captures": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/CaptureResponse"
- },
- "description": "List of captures done on latest attempt",
+ "three_dsserver_trans_id": {
+ "type": "string",
+ "description": "Unique identifier assigned by the 3DS Server to identify a single transaction",
"nullable": true
},
- "mandate_id": {
+ "acs_signed_content": {
"type": "string",
- "description": "A unique identifier to link the payment to a mandate, can be used instead of payment_method_data, in case of setting up recurring payments",
- "example": "mandate_iwer89rnjef349dni3",
- "nullable": true,
- "maxLength": 255
- },
- "mandate_data": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MandateData"
- }
- ],
+ "description": "Contains the JWS object created by the ACS for the ARes(Authentication Response) message",
"nullable": true
},
- "setup_future_usage": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FutureUsage"
- }
- ],
- "nullable": true
- },
- "off_session": {
- "type": "boolean",
- "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with confirm=true.",
- "example": true,
- "nullable": true
- },
- "capture_method": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CaptureMethod"
- }
- ],
- "nullable": true
- },
- "payment_method": {
- "$ref": "#/components/schemas/PaymentMethod"
- },
- "payment_method_data": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodDataResponseWithBilling"
- }
- ],
- "nullable": true
- },
- "payment_token": {
- "type": "string",
- "description": "Provide a reference to a stored payment method",
- "example": "187282ab-40ef-47a9-9206-5099ba31e432",
- "nullable": true
- },
- "shipping": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "order_details": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OrderDetailsWithAmount"
- },
- "description": "Information about the product , quantity and amount for connectors. (e.g. Klarna)",
- "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]",
- "nullable": true
- },
- "email": {
- "type": "string",
- "description": "description: The customer's email address\nThis field will be deprecated soon. Please refer to `customer.email` object",
- "deprecated": true,
- "example": "johntest@test.com",
- "nullable": true,
- "maxLength": 255
- },
- "name": {
- "type": "string",
- "description": "description: The customer's name\nThis field will be deprecated soon. Please refer to `customer.name` object",
- "deprecated": true,
- "example": "John Test",
- "nullable": true,
- "maxLength": 255
- },
- "phone": {
- "type": "string",
- "description": "The customer's phone number\nThis field will be deprecated soon. Please refer to `customer.phone` object",
- "deprecated": true,
- "example": "9123456789",
- "nullable": true,
- "maxLength": 255
- },
- "return_url": {
- "type": "string",
- "description": "The URL to redirect after the completion of the operation",
- "example": "https://hyperswitch.io",
- "nullable": true
- },
- "authentication_type": {
- "allOf": [
- {
- "$ref": "#/components/schemas/AuthenticationType"
- }
- ],
- "default": "three_ds",
- "nullable": true
- },
- "statement_descriptor_name": {
- "type": "string",
- "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
- "example": "Hyperswitch Router",
- "nullable": true,
- "maxLength": 255
- },
- "statement_descriptor_suffix": {
- "type": "string",
- "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 255 characters for the concatenated descriptor.",
- "example": "Payment for shoes purchase",
- "nullable": true,
- "maxLength": 255
- },
- "next_action": {
- "allOf": [
- {
- "$ref": "#/components/schemas/NextActionData"
- }
- ],
- "nullable": true
- },
- "cancellation_reason": {
- "type": "string",
- "description": "If the payment was cancelled the reason will be provided here",
- "nullable": true
- },
- "error_code": {
- "type": "string",
- "description": "If there was an error while calling the connectors the code is received here",
- "example": "E0001",
- "nullable": true
- },
- "error_message": {
- "type": "string",
- "description": "If there was an error while calling the connector the error message is received here",
- "example": "Failed while verifying the card",
- "nullable": true
- },
- "payment_experience": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentExperience"
- }
- ],
- "nullable": true
- },
- "payment_method_type": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodType"
- }
- ],
- "nullable": true
- },
- "connector_label": {
- "type": "string",
- "description": "The connector used for this payment along with the country and business details",
- "example": "stripe_US_food",
- "nullable": true
- },
- "business_country": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CountryAlpha2"
- }
- ],
- "nullable": true
- },
- "business_label": {
- "type": "string",
- "description": "The business label of merchant for this payment",
- "nullable": true
- },
- "business_sub_label": {
- "type": "string",
- "description": "The business_sub_label for this payment",
- "nullable": true
- },
- "allowed_payment_method_types": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "description": "Allowed Payment Method Types for a given PaymentIntent",
- "nullable": true
- },
- "ephemeral_key": {
- "allOf": [
- {
- "$ref": "#/components/schemas/EphemeralKeyCreateResponse"
- }
- ],
- "nullable": true
- },
- "manual_retry_allowed": {
- "type": "boolean",
- "description": "If true the payment can be retried with same or different payment method which means the confirm call can be made again.",
- "nullable": true
- },
- "connector_transaction_id": {
- "type": "string",
- "description": "A unique identifier for a payment provided by the connector",
- "example": "993672945374576J",
- "nullable": true
- },
- "frm_message": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FrmMessage"
- }
- ],
- "nullable": true
- },
- "metadata": {
- "type": "object",
- "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.",
- "nullable": true
- },
- "connector_metadata": {
- "allOf": [
- {
- "$ref": "#/components/schemas/ConnectorMetadata"
- }
- ],
- "nullable": true
- },
- "feature_metadata": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FeatureMetadata"
- }
- ],
- "nullable": true
- },
- "reference_id": {
- "type": "string",
- "description": "reference(Identifier) to the payment at connector side",
- "example": "993672945374576J",
- "nullable": true
- },
- "payment_link": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentLinkResponse"
- }
- ],
- "nullable": true
- },
- "profile_id": {
- "type": "string",
- "description": "The business profile that is associated with this payment",
- "nullable": true
- },
- "surcharge_details": {
- "allOf": [
- {
- "$ref": "#/components/schemas/RequestSurchargeDetails"
- }
- ],
- "nullable": true
- },
- "attempt_count": {
- "type": "integer",
- "format": "int32",
- "description": "Total number of attempts associated with this payment"
- },
- "merchant_decision": {
- "type": "string",
- "description": "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",
- "nullable": true
- },
- "merchant_connector_id": {
- "type": "string",
- "description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
- "nullable": true
- },
- "incremental_authorization_allowed": {
- "type": "boolean",
- "description": "If true, incremental authorization can be performed on this payment, in case the funds authorized initially fall short.",
- "nullable": true
- },
- "authorization_count": {
- "type": "integer",
- "format": "int32",
- "description": "Total number of authorizations happened in an incremental_authorization payment",
- "nullable": true
- },
- "incremental_authorizations": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/IncrementalAuthorizationResponse"
- },
- "description": "List of incremental authorizations happened to the payment",
- "nullable": true
- },
- "external_authentication_details": {
- "allOf": [
- {
- "$ref": "#/components/schemas/ExternalAuthenticationDetailsResponse"
- }
- ],
- "nullable": true
- },
- "external_3ds_authentication_attempted": {
- "type": "boolean",
- "description": "Flag indicating if external 3ds authentication is made or not",
- "nullable": true
- },
- "expires_on": {
- "type": "string",
- "format": "date-time",
- "description": "Date Time for expiry of the payment",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "fingerprint": {
- "type": "string",
- "description": "Payment Fingerprint, to identify a particular card.\nIt is a 20 character long alphanumeric code.",
- "nullable": true
- },
- "browser_info": {
- "allOf": [
- {
- "$ref": "#/components/schemas/BrowserInformation"
- }
- ],
- "nullable": true
- },
- "payment_method_id": {
- "type": "string",
- "description": "Identifier for Payment Method used for the payment",
- "nullable": true
- },
- "payment_method_status": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodStatus"
- }
- ],
- "nullable": true
- },
- "updated": {
- "type": "string",
- "format": "date-time",
- "description": "Date time at which payment was updated",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "split_payments": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SplitPaymentsResponse"
- }
- ],
- "nullable": true
- },
- "frm_metadata": {
- "type": "object",
- "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM.",
- "nullable": true
- },
- "merchant_order_reference_id": {
- "type": "string",
- "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.",
- "example": "Custom_Order_id_123",
- "nullable": true,
- "maxLength": 255
- },
- "order_tax_amount": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MinorUnit"
- }
- ],
- "nullable": true
- },
- "connector_mandate_id": {
- "type": "string",
- "description": "Connector Identifier for the payment method",
- "nullable": true
- }
- }
- },
- "PaymentsDynamicTaxCalculationRequest": {
- "type": "object",
- "required": [
- "shipping",
- "client_secret",
- "payment_method_type"
- ],
- "properties": {
- "shipping": {
- "$ref": "#/components/schemas/Address"
- },
- "client_secret": {
- "type": "string",
- "description": "Client Secret"
- },
- "payment_method_type": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "session_id": {
- "type": "string",
- "description": "Session Id",
- "nullable": true
- }
- }
- },
- "PaymentsDynamicTaxCalculationResponse": {
- "type": "object",
- "required": [
- "payment_id",
- "net_amount",
- "display_amount"
- ],
- "properties": {
- "payment_id": {
- "type": "string",
- "description": "The identifier for the payment"
- },
- "net_amount": {
- "$ref": "#/components/schemas/MinorUnit"
- },
- "order_tax_amount": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MinorUnit"
- }
- ],
- "nullable": true
- },
- "shipping_cost": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MinorUnit"
- }
- ],
- "nullable": true
- },
- "display_amount": {
- "$ref": "#/components/schemas/DisplayAmountOnSdk"
- }
- }
- },
- "PaymentsExternalAuthenticationRequest": {
- "type": "object",
- "required": [
- "client_secret",
- "device_channel",
- "threeds_method_comp_ind"
- ],
- "properties": {
- "client_secret": {
- "type": "string",
- "description": "Client Secret"
- },
- "sdk_information": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SdkInformation"
- }
- ],
- "nullable": true
- },
- "device_channel": {
- "$ref": "#/components/schemas/DeviceChannel"
- },
- "threeds_method_comp_ind": {
- "$ref": "#/components/schemas/ThreeDsCompletionIndicator"
- }
- }
- },
- "PaymentsExternalAuthenticationResponse": {
- "type": "object",
- "required": [
- "trans_status",
- "three_ds_requestor_url"
- ],
- "properties": {
- "trans_status": {
- "$ref": "#/components/schemas/TransactionStatus"
- },
- "acs_url": {
- "type": "string",
- "description": "Access Server URL to be used for challenge submission",
- "nullable": true
- },
- "challenge_request": {
- "type": "string",
- "description": "Challenge request which should be sent to acs_url",
- "nullable": true
- },
- "acs_reference_number": {
- "type": "string",
- "description": "Unique identifier assigned by the EMVCo(Europay, Mastercard and Visa)",
- "nullable": true
- },
- "acs_trans_id": {
- "type": "string",
- "description": "Unique identifier assigned by the ACS to identify a single transaction",
- "nullable": true
- },
- "three_dsserver_trans_id": {
- "type": "string",
- "description": "Unique identifier assigned by the 3DS Server to identify a single transaction",
- "nullable": true
- },
- "acs_signed_content": {
- "type": "string",
- "description": "Contains the JWS object created by the ACS for the ARes(Authentication Response) message",
- "nullable": true
- },
- "three_ds_requestor_url": {
- "type": "string",
- "description": "Three DS Requestor URL"
- }
- }
- },
- "PaymentsIncrementalAuthorizationRequest": {
- "type": "object",
- "required": [
- "amount"
- ],
- "properties": {
- "amount": {
- "type": "integer",
- "format": "int64",
- "description": "The total amount including previously authorized amount and additional amount",
- "example": 6540
- },
- "reason": {
- "type": "string",
- "description": "Reason for incremental authorization",
- "nullable": true
- }
- }
- },
- "PaymentsIntentResponse": {
- "type": "object",
- "required": [
- "id",
- "status",
- "amount_details",
- "client_secret",
- "profile_id",
- "capture_method",
- "authentication_type",
- "customer_id",
- "customer_present",
- "setup_future_usage",
- "apply_mit_exemption",
- "payment_link_enabled",
- "request_incremental_authorization",
- "expires_on",
- "request_external_three_ds_authentication"
- ],
- "properties": {
- "id": {
- "type": "string",
- "description": "Global Payment Id for the payment"
- },
- "status": {
- "$ref": "#/components/schemas/IntentStatus"
- },
- "amount_details": {
- "$ref": "#/components/schemas/AmountDetailsResponse"
- },
- "client_secret": {
- "type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo"
- },
- "profile_id": {
- "type": "string",
- "description": "The identifier for the profile. This is inferred from the `x-profile-id` header"
- },
- "merchant_reference_id": {
- "type": "string",
- "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant.",
- "example": "pay_mbabizu24mvu3mela5njyhpit4",
- "nullable": true,
- "maxLength": 30,
- "minLength": 30
- },
- "routing_algorithm_id": {
- "type": "string",
- "description": "The routing algorithm id to be used for the payment",
- "nullable": true
- },
- "capture_method": {
- "$ref": "#/components/schemas/CaptureMethod"
- },
- "authentication_type": {
- "allOf": [
- {
- "$ref": "#/components/schemas/AuthenticationType"
- }
- ],
- "default": "no_three_ds"
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "shipping": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "customer_id": {
- "type": "string",
- "description": "The identifier for the customer",
- "example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
- "maxLength": 64,
- "minLength": 32
- },
- "customer_present": {
- "$ref": "#/components/schemas/PresenceOfCustomerDuringPayment"
- },
- "description": {
- "type": "string",
- "description": "A description for the payment",
- "example": "It's my first payment request",
- "nullable": true
- },
- "return_url": {
- "type": "string",
- "description": "The URL to which you want the user to be redirected after the completion of the payment operation",
- "example": "https://hyperswitch.io",
- "nullable": true
- },
- "setup_future_usage": {
- "$ref": "#/components/schemas/FutureUsage"
- },
- "apply_mit_exemption": {
- "$ref": "#/components/schemas/MitExemptionRequest"
- },
- "statement_descriptor": {
- "type": "string",
- "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
- "example": "Hyperswitch Router",
- "nullable": true,
- "maxLength": 22
- },
- "order_details": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OrderDetailsWithAmount"
- },
- "description": "Use this object to capture the details about the different products for which the payment is being made. The sum of amount across different products here should be equal to the overall payment amount",
- "example": "[{\n \"product_name\": \"Apple iPhone 16\",\n \"quantity\": 1,\n \"amount\" : 69000\n \"product_img_link\" : \"https://dummy-img-link.com\"\n }]",
- "nullable": true
- },
- "allowed_payment_method_types": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "description": "Use this parameter to restrict the Payment Method Types to show for a given PaymentIntent",
- "nullable": true
- },
- "metadata": {
- "type": "object",
- "description": "Metadata is useful for storing additional, unstructured information on an object.",
- "nullable": true
- },
- "connector_metadata": {
- "allOf": [
- {
- "$ref": "#/components/schemas/ConnectorMetadata"
- }
- ],
- "nullable": true
- },
- "feature_metadata": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FeatureMetadata"
- }
- ],
- "nullable": true
- },
- "payment_link_enabled": {
- "$ref": "#/components/schemas/EnablePaymentLinkRequest"
- },
- "payment_link_config": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentLinkConfigRequest"
- }
- ],
- "nullable": true
- },
- "request_incremental_authorization": {
- "$ref": "#/components/schemas/RequestIncrementalAuthorization"
- },
- "expires_on": {
- "type": "string",
- "format": "date-time",
- "description": "Will be used to expire client secret after certain amount of time to be supplied in seconds"
- },
- "frm_metadata": {
- "type": "object",
- "description": "Additional data related to some frm(Fraud Risk Management) connectors",
- "nullable": true
- },
- "request_external_three_ds_authentication": {
- "$ref": "#/components/schemas/External3dsAuthenticationRequest"
+ "three_ds_requestor_url": {
+ "type": "string",
+ "description": "Three DS Requestor URL"
}
- },
- "additionalProperties": false
+ }
},
- "PaymentsResponse": {
+ "PaymentsIncrementalAuthorizationRequest": {
"type": "object",
"required": [
- "payment_id",
- "merchant_id",
- "status",
- "amount",
- "net_amount",
- "amount_capturable",
- "currency",
- "payment_method",
- "attempt_count"
+ "amount"
],
"properties": {
- "payment_id": {
- "type": "string",
- "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant.",
- "example": "pay_mbabizu24mvu3mela5njyhpit4",
- "maxLength": 30,
- "minLength": 30
- },
- "merchant_id": {
- "type": "string",
- "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
- "example": "merchant_1668273825",
- "maxLength": 255
- },
- "status": {
- "allOf": [
- {
- "$ref": "#/components/schemas/IntentStatus"
- }
- ],
- "default": "requires_confirmation"
- },
"amount": {
"type": "integer",
"format": "int64",
- "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
- "example": 6540
- },
- "net_amount": {
- "type": "integer",
- "format": "int64",
- "description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
+ "description": "The total amount including previously authorized amount and additional amount",
"example": 6540
},
- "shipping_cost": {
- "type": "integer",
- "format": "int64",
- "description": "The shipping cost for the payment.",
- "example": 6540,
- "nullable": true
- },
- "amount_capturable": {
- "type": "integer",
- "format": "int64",
- "description": "The maximum amount that could be captured from the payment",
- "example": 6540,
- "minimum": 100
- },
- "amount_received": {
- "type": "integer",
- "format": "int64",
- "description": "The amount which is already captured from the payment, this helps in the cases where merchants can't capture all capturable amount at once.",
- "example": 6540,
- "nullable": true
- },
- "connector": {
- "type": "string",
- "description": "The connector used for the payment",
- "example": "stripe",
- "nullable": true
- },
- "client_secret": {
- "type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
- "nullable": true
- },
- "created": {
- "type": "string",
- "format": "date-time",
- "description": "Time when the payment was created",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "currency": {
- "$ref": "#/components/schemas/Currency"
- },
- "customer_id": {
- "type": "string",
- "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.\nThis field will be deprecated soon. Please refer to `customer.id`",
- "deprecated": true,
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "nullable": true,
- "maxLength": 64,
- "minLength": 1
- },
- "customer": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CustomerDetailsResponse"
- }
- ],
- "nullable": true
- },
- "description": {
- "type": "string",
- "description": "A description of the payment",
- "example": "It's my first payment request",
- "nullable": true
- },
- "refunds": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/RefundResponse"
- },
- "description": "List of refunds that happened on this intent, as same payment intent can have multiple refund requests depending on the nature of order",
- "nullable": true
- },
- "disputes": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/DisputeResponsePaymentsRetrieve"
- },
- "description": "List of disputes that happened on this intent",
- "nullable": true
- },
- "attempts": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentAttemptResponse"
- },
- "description": "List of attempts that happened on this intent",
- "nullable": true
- },
- "captures": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/CaptureResponse"
- },
- "description": "List of captures done on latest attempt",
- "nullable": true
- },
- "mandate_id": {
- "type": "string",
- "description": "A unique identifier to link the payment to a mandate, can be used instead of payment_method_data, in case of setting up recurring payments",
- "example": "mandate_iwer89rnjef349dni3",
- "nullable": true,
- "maxLength": 255
- },
- "mandate_data": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MandateData"
- }
- ],
- "nullable": true
- },
- "setup_future_usage": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FutureUsage"
- }
- ],
- "nullable": true
- },
- "off_session": {
- "type": "boolean",
- "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with confirm=true.",
- "example": true,
- "nullable": true
- },
- "capture_on": {
- "type": "string",
- "format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "capture_method": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CaptureMethod"
- }
- ],
- "nullable": true
- },
- "payment_method": {
- "$ref": "#/components/schemas/PaymentMethod"
- },
- "payment_method_data": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodDataResponseWithBilling"
- }
- ],
- "nullable": true
- },
- "payment_token": {
- "type": "string",
- "description": "Provide a reference to a stored payment method",
- "example": "187282ab-40ef-47a9-9206-5099ba31e432",
- "nullable": true
- },
- "shipping": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "order_details": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OrderDetailsWithAmount"
- },
- "description": "Information about the product , quantity and amount for connectors. (e.g. Klarna)",
- "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]",
- "nullable": true
- },
- "email": {
- "type": "string",
- "description": "description: The customer's email address\nThis field will be deprecated soon. Please refer to `customer.email` object",
- "deprecated": true,
- "example": "johntest@test.com",
- "nullable": true,
- "maxLength": 255
- },
- "name": {
- "type": "string",
- "description": "description: The customer's name\nThis field will be deprecated soon. Please refer to `customer.name` object",
- "deprecated": true,
- "example": "John Test",
- "nullable": true,
- "maxLength": 255
- },
- "phone": {
- "type": "string",
- "description": "The customer's phone number\nThis field will be deprecated soon. Please refer to `customer.phone` object",
- "deprecated": true,
- "example": "9123456789",
- "nullable": true,
- "maxLength": 255
- },
- "return_url": {
+ "reason": {
"type": "string",
- "description": "The URL to redirect after the completion of the operation",
- "example": "https://hyperswitch.io",
- "nullable": true
- },
- "authentication_type": {
- "allOf": [
- {
- "$ref": "#/components/schemas/AuthenticationType"
- }
- ],
- "default": "three_ds",
+ "description": "Reason for incremental authorization",
"nullable": true
- },
- "statement_descriptor_name": {
+ }
+ }
+ },
+ "PaymentsIntentResponse": {
+ "type": "object",
+ "required": [
+ "id",
+ "status",
+ "amount_details",
+ "client_secret",
+ "profile_id",
+ "capture_method",
+ "authentication_type",
+ "customer_id",
+ "customer_present",
+ "setup_future_usage",
+ "apply_mit_exemption",
+ "payment_link_enabled",
+ "request_incremental_authorization",
+ "expires_on",
+ "request_external_three_ds_authentication"
+ ],
+ "properties": {
+ "id": {
"type": "string",
- "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
- "example": "Hyperswitch Router",
- "nullable": true,
- "maxLength": 255
+ "description": "Global Payment Id for the payment"
},
- "statement_descriptor_suffix": {
- "type": "string",
- "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 255 characters for the concatenated descriptor.",
- "example": "Payment for shoes purchase",
- "nullable": true,
- "maxLength": 255
+ "status": {
+ "$ref": "#/components/schemas/IntentStatus"
},
- "next_action": {
- "allOf": [
- {
- "$ref": "#/components/schemas/NextActionData"
- }
- ],
- "nullable": true
+ "amount_details": {
+ "$ref": "#/components/schemas/AmountDetailsResponse"
},
- "cancellation_reason": {
+ "client_secret": {
"type": "string",
- "description": "If the payment was cancelled the reason will be provided here",
- "nullable": true
+ "description": "It's a token used for client side verification.",
+ "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo"
},
- "error_code": {
+ "profile_id": {
"type": "string",
- "description": "If there was an error while calling the connectors the code is received here",
- "example": "E0001",
- "nullable": true
+ "description": "The identifier for the profile. This is inferred from the `x-profile-id` header"
},
- "error_message": {
+ "merchant_reference_id": {
"type": "string",
- "description": "If there was an error while calling the connector the error message is received here",
- "example": "Failed while verifying the card",
- "nullable": true
+ "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant.",
+ "example": "pay_mbabizu24mvu3mela5njyhpit4",
+ "nullable": true,
+ "maxLength": 30,
+ "minLength": 30
},
- "unified_code": {
+ "routing_algorithm_id": {
"type": "string",
- "description": "error code unified across the connectors is received here if there was an error while calling connector",
+ "description": "The routing algorithm id to be used for the payment",
"nullable": true
},
- "unified_message": {
- "type": "string",
- "description": "error message unified across the connectors is received here if there was an error while calling connector",
- "nullable": true
+ "capture_method": {
+ "$ref": "#/components/schemas/CaptureMethod"
},
- "payment_experience": {
+ "authentication_type": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentExperience"
+ "$ref": "#/components/schemas/AuthenticationType"
}
],
- "nullable": true
+ "default": "no_three_ds"
},
- "payment_method_type": {
+ "billing": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodType"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "connector_label": {
- "type": "string",
- "description": "The connector used for this payment along with the country and business details",
- "example": "stripe_US_food",
- "nullable": true
- },
- "business_country": {
+ "shipping": {
"allOf": [
{
- "$ref": "#/components/schemas/CountryAlpha2"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "business_label": {
+ "customer_id": {
"type": "string",
- "description": "The business label of merchant for this payment",
- "nullable": true
+ "description": "The identifier for the customer",
+ "example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
+ "maxLength": 64,
+ "minLength": 32
+ },
+ "customer_present": {
+ "$ref": "#/components/schemas/PresenceOfCustomerDuringPayment"
},
- "business_sub_label": {
+ "description": {
"type": "string",
- "description": "The business_sub_label for this payment",
+ "description": "A description for the payment",
+ "example": "It's my first payment request",
"nullable": true
},
- "allowed_payment_method_types": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "description": "Allowed Payment Method Types for a given PaymentIntent",
+ "return_url": {
+ "type": "string",
+ "description": "The URL to which you want the user to be redirected after the completion of the payment operation",
+ "example": "https://hyperswitch.io",
"nullable": true
},
- "ephemeral_key": {
- "allOf": [
- {
- "$ref": "#/components/schemas/EphemeralKeyCreateResponse"
- }
- ],
- "nullable": true
+ "setup_future_usage": {
+ "$ref": "#/components/schemas/FutureUsage"
},
- "manual_retry_allowed": {
- "type": "boolean",
- "description": "If true the payment can be retried with same or different payment method which means the confirm call can be made again.",
- "nullable": true
+ "apply_mit_exemption": {
+ "$ref": "#/components/schemas/MitExemptionRequest"
},
- "connector_transaction_id": {
+ "statement_descriptor": {
"type": "string",
- "description": "A unique identifier for a payment provided by the connector",
- "example": "993672945374576J",
+ "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
+ "example": "Hyperswitch Router",
+ "nullable": true,
+ "maxLength": 22
+ },
+ "order_details": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/OrderDetailsWithAmount"
+ },
+ "description": "Use this object to capture the details about the different products for which the payment is being made. The sum of amount across different products here should be equal to the overall payment amount",
+ "example": "[{\n \"product_name\": \"Apple iPhone 16\",\n \"quantity\": 1,\n \"amount\" : 69000\n \"product_img_link\" : \"https://dummy-img-link.com\"\n }]",
"nullable": true
},
- "frm_message": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FrmMessage"
- }
- ],
+ "allowed_payment_method_types": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "description": "Use this parameter to restrict the Payment Method Types to show for a given PaymentIntent",
"nullable": true
},
"metadata": {
"type": "object",
- "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
},
"connector_metadata": {
@@ -16384,154 +15388,35 @@
],
"nullable": true
},
- "reference_id": {
- "type": "string",
- "description": "reference(Identifier) to the payment at connector side",
- "example": "993672945374576J",
- "nullable": true
- },
- "payment_link": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentLinkResponse"
- }
- ],
- "nullable": true
- },
- "profile_id": {
- "type": "string",
- "description": "The business profile that is associated with this payment",
- "nullable": true
- },
- "surcharge_details": {
- "allOf": [
- {
- "$ref": "#/components/schemas/RequestSurchargeDetails"
- }
- ],
- "nullable": true
- },
- "attempt_count": {
- "type": "integer",
- "format": "int32",
- "description": "Total number of attempts associated with this payment"
- },
- "merchant_decision": {
- "type": "string",
- "description": "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",
- "nullable": true
- },
- "merchant_connector_id": {
- "type": "string",
- "description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
- "nullable": true
- },
- "incremental_authorization_allowed": {
- "type": "boolean",
- "description": "If true, incremental authorization can be performed on this payment, in case the funds authorized initially fall short.",
- "nullable": true
- },
- "authorization_count": {
- "type": "integer",
- "format": "int32",
- "description": "Total number of authorizations happened in an incremental_authorization payment",
- "nullable": true
- },
- "incremental_authorizations": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/IncrementalAuthorizationResponse"
- },
- "description": "List of incremental authorizations happened to the payment",
- "nullable": true
+ "payment_link_enabled": {
+ "$ref": "#/components/schemas/EnablePaymentLinkRequest"
},
- "external_authentication_details": {
+ "payment_link_config": {
"allOf": [
{
- "$ref": "#/components/schemas/ExternalAuthenticationDetailsResponse"
+ "$ref": "#/components/schemas/PaymentLinkConfigRequest"
}
],
"nullable": true
},
- "external_3ds_authentication_attempted": {
- "type": "boolean",
- "description": "Flag indicating if external 3ds authentication is made or not",
- "nullable": true
+ "request_incremental_authorization": {
+ "$ref": "#/components/schemas/RequestIncrementalAuthorization"
},
"expires_on": {
"type": "string",
"format": "date-time",
- "description": "Date Time for expiry of the payment",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "fingerprint": {
- "type": "string",
- "description": "Payment Fingerprint, to identify a particular card.\nIt is a 20 character long alphanumeric code.",
- "nullable": true
- },
- "browser_info": {
- "allOf": [
- {
- "$ref": "#/components/schemas/BrowserInformation"
- }
- ],
- "nullable": true
- },
- "payment_method_id": {
- "type": "string",
- "description": "Identifier for Payment Method used for the payment",
- "nullable": true
- },
- "payment_method_status": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodStatus"
- }
- ],
- "nullable": true
- },
- "updated": {
- "type": "string",
- "format": "date-time",
- "description": "Date time at which payment was updated",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "split_payments": {
- "allOf": [
- {
- "$ref": "#/components/schemas/SplitPaymentsResponse"
- }
- ],
- "nullable": true
+ "description": "Will be used to expire client secret after certain amount of time to be supplied in seconds"
},
"frm_metadata": {
"type": "object",
- "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM.",
- "nullable": true
- },
- "merchant_order_reference_id": {
- "type": "string",
- "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.",
- "example": "Custom_Order_id_123",
- "nullable": true,
- "maxLength": 255
- },
- "order_tax_amount": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MinorUnit"
- }
- ],
+ "description": "Additional data related to some frm(Fraud Risk Management) connectors",
"nullable": true
},
- "connector_mandate_id": {
- "type": "string",
- "description": "Connector Identifier for the payment method",
- "nullable": true
+ "request_external_three_ds_authentication": {
+ "$ref": "#/components/schemas/External3dsAuthenticationRequest"
}
- }
+ },
+ "additionalProperties": false
},
"PaymentsRetrieveRequest": {
"type": "object",
@@ -19351,6 +18236,21 @@
}
}
},
+ "ResourceId": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "customer"
+ ],
+ "properties": {
+ "customer": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ },
"ResponsePaymentMethodTypes": {
"allOf": [
{
diff --git a/crates/api_models/src/ephemeral_key.rs b/crates/api_models/src/ephemeral_key.rs
index fa61642e353..b5681f60ba2 100644
--- a/crates/api_models/src/ephemeral_key.rs
+++ b/crates/api_models/src/ephemeral_key.rs
@@ -19,51 +19,55 @@ pub struct EphemeralKeyCreateRequest {
}
#[cfg(feature = "v2")]
-/// Information required to create an ephemeral key.
+#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum ResourceId {
+ #[schema(value_type = String)]
+ Customer(id_type::GlobalCustomerId),
+}
+
+#[cfg(feature = "v2")]
+/// Information required to create a client secret.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
-pub struct EphemeralKeyCreateRequest {
- /// Customer ID for which an ephemeral key must be created
- #[schema(
- min_length = 32,
- max_length = 64,
- value_type = String,
- example = "12345_cus_01926c58bc6e77c09e809964e72af8c8"
- )]
- pub customer_id: id_type::GlobalCustomerId,
+pub struct ClientSecretCreateRequest {
+ /// Resource ID for which a client secret must be created
+ pub resource_id: ResourceId,
}
#[cfg(feature = "v2")]
-/// ephemeral_key for the customer_id mentioned
+/// client_secret for the resource_id mentioned
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)]
-pub struct EphemeralKeyResponse {
- /// Ephemeral key id
+pub struct ClientSecretResponse {
+ /// Client Secret id
#[schema(value_type = String, max_length = 32, min_length = 1)]
- pub id: id_type::EphemeralKeyId,
- /// customer_id to which this ephemeral key belongs to
- #[schema(value_type = String, max_length = 64, min_length = 32, example = "12345_cus_01926c58bc6e77c09e809964e72af8c8")]
- pub customer_id: id_type::GlobalCustomerId,
- /// time at which this ephemeral key was created
+ pub id: id_type::ClientSecretId,
+ /// resource_id to which this client secret belongs to
+ #[schema(value_type = ResourceId)]
+ pub resource_id: ResourceId,
+ /// time at which this client secret was created
pub created_at: time::PrimitiveDateTime,
- /// time at which this ephemeral key would expire
+ /// time at which this client secret would expire
pub expires: time::PrimitiveDateTime,
#[schema(value_type=String)]
- /// ephemeral key
+ /// client secret
pub secret: Secret<String>,
}
-impl common_utils::events::ApiEventMetric for EphemeralKeyCreateRequest {
+#[cfg(feature = "v2")]
+impl common_utils::events::ApiEventMetric for ClientSecretCreateRequest {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Miscellaneous)
}
}
#[cfg(feature = "v2")]
-impl common_utils::events::ApiEventMetric for EphemeralKeyResponse {
+impl common_utils::events::ApiEventMetric for ClientSecretResponse {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Miscellaneous)
}
}
+#[cfg(feature = "v1")]
/// ephemeral_key for the customer_id mentioned
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)]
pub struct EphemeralKeyCreateResponse {
diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index e6de6190b83..7c7ba060541 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -10,6 +10,8 @@ use super::{
not(feature = "payment_methods_v2")
))]
use crate::payment_methods::CustomerPaymentMethodsListResponse;
+#[cfg(feature = "v1")]
+use crate::payments::{PaymentListResponse, PaymentListResponseV2, PaymentsResponse};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use crate::{events, payment_methods::CustomerPaymentMethodsListResponse};
use crate::{
@@ -23,15 +25,14 @@ use crate::{
payments::{
self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints,
PaymentListFilterConstraints, PaymentListFilters, PaymentListFiltersV2,
- PaymentListResponse, PaymentListResponseV2, PaymentsAggregateResponse,
- PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
- PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
- PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
- PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
- PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
- PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
- PaymentsResponse, PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
- RedirectionResponse,
+ PaymentsAggregateResponse, PaymentsApproveRequest, PaymentsCancelRequest,
+ PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
+ PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
+ PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse,
+ PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,
+ PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
+ PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsRetrieveRequest,
+ PaymentsSessionResponse, PaymentsStartRequest, RedirectionResponse,
},
};
@@ -355,12 +356,14 @@ impl ApiEventMetric for PaymentListConstraints {
}
}
+#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
+#[cfg(feature = "v1")]
impl ApiEventMetric for PaymentListResponseV2 {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 8df2c948736..5ec043fd400 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -2441,4 +2441,8 @@ pub struct PaymentMethodsSessionResponse {
#[schema(value_type = PrimitiveDateTime, example = "2023-01-18T11:04:09.922Z")]
#[serde(with = "common_utils::custom_serde::iso8601")]
pub expires_at: time::PrimitiveDateTime,
+
+ /// Client Secret
+ #[schema(value_type = String)]
+ pub client_secret: masking::Secret<String>,
}
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index b6152cc9787..6177f9070bb 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -27,12 +27,13 @@ use time::{Date, PrimitiveDateTime};
use url::Url;
use utoipa::ToSchema;
+#[cfg(feature = "v1")]
+use crate::ephemeral_key::EphemeralKeyCreateResponse;
#[cfg(feature = "v2")]
use crate::payment_methods;
use crate::{
admin::{self, MerchantConnectorInfo},
disputes, enums as api_enums,
- ephemeral_key::EphemeralKeyCreateResponse,
mandates::RecurringDetails,
refunds,
};
@@ -4411,6 +4412,7 @@ pub struct ReceiverDetails {
amount_remaining: Option<i64>,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema, router_derive::PolymorphicSchema)]
#[generate_schemas(PaymentsCreateResponseOpenApi)]
pub struct PaymentsResponse {
@@ -5101,6 +5103,7 @@ pub struct PaymentListConstraints {
pub created_gte: Option<PrimitiveDateTime>,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse {
/// The number of payments included in the list
@@ -5127,6 +5130,7 @@ pub struct IncrementalAuthorizationResponse {
pub previously_authorized_amount: MinorUnit,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListResponseV2 {
/// The number of payments included in the list for given constraints
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index f99e3a450b2..ddefea542c2 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -285,7 +285,7 @@ pub enum OutgoingWebhookContent {
#[serde(tag = "type", content = "object", rename_all = "snake_case")]
#[cfg(feature = "v2")]
pub enum OutgoingWebhookContent {
- #[schema(value_type = PaymentsResponse, title = "PaymentsResponse")]
+ #[schema(value_type = PaymentsRetrieveResponse, title = "PaymentsResponse")]
PaymentDetails(Box<payments::PaymentsRetrieveResponse>),
#[schema(value_type = RefundResponse, title = "RefundResponse")]
RefundDetails(Box<refunds::RefundResponse>),
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 823b48083e7..2e90d646e9e 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -112,8 +112,9 @@ pub enum ApiEventsType {
poll_id: String,
},
Analytics,
- EphemeralKey {
- key_id: id_type::EphemeralKeyId,
+ #[cfg(feature = "v2")]
+ ClientSecret {
+ key_id: id_type::ClientSecretId,
},
#[cfg(feature = "v2")]
PaymentMethodSession {
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index ebb5e8e481b..30b6a3888da 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -2,8 +2,8 @@
//! The id type can be used to create specific id types with custom behaviour
mod api_key;
+mod client_secret;
mod customer;
-mod ephemeral_key;
#[cfg(feature = "v2")]
mod global_id;
mod merchant;
@@ -38,8 +38,8 @@ pub use self::global_id::{
};
pub use self::{
api_key::ApiKeyId,
+ client_secret::ClientSecretId,
customer::CustomerId,
- ephemeral_key::EphemeralKeyId,
merchant::MerchantId,
merchant_connector_account::MerchantConnectorAccountId,
organization::OrganizationId,
diff --git a/crates/common_utils/src/id_type/client_secret.rs b/crates/common_utils/src/id_type/client_secret.rs
new file mode 100644
index 00000000000..b9d7f2e09e6
--- /dev/null
+++ b/crates/common_utils/src/id_type/client_secret.rs
@@ -0,0 +1,32 @@
+crate::id_type!(
+ ClientSecretId,
+ "A type for key_id that can be used for Ephemeral key IDs"
+);
+crate::impl_id_type_methods!(ClientSecretId, "key_id");
+
+// This is to display the `ClientSecretId` as ClientSecretId(abcd)
+crate::impl_debug_id_type!(ClientSecretId);
+crate::impl_try_from_cow_str_id_type!(ClientSecretId, "key_id");
+
+crate::impl_generate_id_id_type!(ClientSecretId, "csi");
+crate::impl_serializable_secret_id_type!(ClientSecretId);
+crate::impl_queryable_id_type!(ClientSecretId);
+crate::impl_to_sql_from_sql_id_type!(ClientSecretId);
+
+#[cfg(feature = "v2")]
+impl crate::events::ApiEventMetric for ClientSecretId {
+ fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
+ Some(crate::events::ApiEventsType::ClientSecret {
+ key_id: self.clone(),
+ })
+ }
+}
+
+crate::impl_default_id_type!(ClientSecretId, "key");
+
+impl ClientSecretId {
+ /// Generate a key for redis
+ pub fn generate_redis_key(&self) -> String {
+ format!("cs_{}", self.get_string_repr())
+ }
+}
diff --git a/crates/common_utils/src/id_type/ephemeral_key.rs b/crates/common_utils/src/id_type/ephemeral_key.rs
deleted file mode 100644
index 071980fc6a4..00000000000
--- a/crates/common_utils/src/id_type/ephemeral_key.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-crate::id_type!(
- EphemeralKeyId,
- "A type for key_id that can be used for Ephemeral key IDs"
-);
-crate::impl_id_type_methods!(EphemeralKeyId, "key_id");
-
-// This is to display the `EphemeralKeyId` as EphemeralKeyId(abcd)
-crate::impl_debug_id_type!(EphemeralKeyId);
-crate::impl_try_from_cow_str_id_type!(EphemeralKeyId, "key_id");
-
-crate::impl_generate_id_id_type!(EphemeralKeyId, "eki");
-crate::impl_serializable_secret_id_type!(EphemeralKeyId);
-crate::impl_queryable_id_type!(EphemeralKeyId);
-crate::impl_to_sql_from_sql_id_type!(EphemeralKeyId);
-
-impl crate::events::ApiEventMetric for EphemeralKeyId {
- fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
- Some(crate::events::ApiEventsType::EphemeralKey {
- key_id: self.clone(),
- })
- }
-}
-
-crate::impl_default_id_type!(EphemeralKeyId, "key");
-
-impl EphemeralKeyId {
- /// Generate a key for redis
- pub fn generate_redis_key(&self) -> String {
- format!("epkey_{}", self.get_string_repr())
- }
-}
diff --git a/crates/common_utils/src/id_type/global_id/payment_methods.rs b/crates/common_utils/src/id_type/global_id/payment_methods.rs
index 6e3c95068fe..b88cb784682 100644
--- a/crates/common_utils/src/id_type/global_id/payment_methods.rs
+++ b/crates/common_utils/src/id_type/global_id/payment_methods.rs
@@ -54,7 +54,7 @@ impl GlobalPaymentMethodSessionId {
Ok(Self(global_id))
}
- fn get_string_repr(&self) -> &str {
+ pub fn get_string_repr(&self) -> &str {
self.0.get_string_repr()
}
diff --git a/crates/diesel_models/src/ephemeral_key.rs b/crates/diesel_models/src/ephemeral_key.rs
index c7fc103ed09..7af6569a5ae 100644
--- a/crates/diesel_models/src/ephemeral_key.rs
+++ b/crates/diesel_models/src/ephemeral_key.rs
@@ -1,30 +1,29 @@
#[cfg(feature = "v2")]
use masking::{PeekInterface, Secret};
+
#[cfg(feature = "v2")]
-pub struct EphemeralKeyTypeNew {
- pub id: common_utils::id_type::EphemeralKeyId,
+pub struct ClientSecretTypeNew {
+ pub id: common_utils::id_type::ClientSecretId,
pub merchant_id: common_utils::id_type::MerchantId,
- pub customer_id: common_utils::id_type::GlobalCustomerId,
pub secret: Secret<String>,
- pub resource_type: ResourceType,
+ pub resource_id: ResourceId,
}
#[cfg(feature = "v2")]
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
-pub struct EphemeralKeyType {
- pub id: common_utils::id_type::EphemeralKeyId,
+pub struct ClientSecretType {
+ pub id: common_utils::id_type::ClientSecretId,
pub merchant_id: common_utils::id_type::MerchantId,
- pub customer_id: common_utils::id_type::GlobalCustomerId,
- pub resource_type: ResourceType,
+ pub resource_id: ResourceId,
pub created_at: time::PrimitiveDateTime,
pub expires: time::PrimitiveDateTime,
pub secret: Secret<String>,
}
#[cfg(feature = "v2")]
-impl EphemeralKeyType {
+impl ClientSecretType {
pub fn generate_secret_key(&self) -> String {
- format!("epkey_{}", self.secret.peek())
+ format!("cs_{}", self.secret.peek())
}
}
@@ -51,20 +50,22 @@ impl common_utils::events::ApiEventMetric for EphemeralKey {
}
}
-#[derive(
- Clone,
- Copy,
- Debug,
- serde::Serialize,
- serde::Deserialize,
- strum::Display,
- strum::EnumString,
- PartialEq,
- Eq,
-)]
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
-#[strum(serialize_all = "snake_case")]
-pub enum ResourceType {
- Payment,
- PaymentMethod,
+pub enum ResourceId {
+ Payment(common_utils::id_type::GlobalPaymentId),
+ Customer(common_utils::id_type::GlobalCustomerId),
+ PaymentMethodSession(common_utils::id_type::GlobalPaymentMethodSessionId),
+}
+
+#[cfg(feature = "v2")]
+impl ResourceId {
+ pub fn to_str(&self) -> &str {
+ match self {
+ Self::Payment(id) => id.get_string_repr(),
+ Self::Customer(id) => id.get_string_repr(),
+ Self::PaymentMethodSession(id) => id.get_string_repr(),
+ }
+ }
}
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 299bec55398..8f663ffc2aa 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -194,6 +194,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::customers::CustomerRequest,
api_models::customers::CustomerUpdateRequest,
api_models::customers::CustomerDeleteResponse,
+ api_models::ephemeral_key::ResourceId,
api_models::payment_methods::PaymentMethodCreate,
api_models::payment_methods::PaymentMethodIntentCreate,
api_models::payment_methods::PaymentMethodIntentConfirm,
@@ -364,8 +365,6 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::CardRedirectData,
api_models::payments::CardToken,
api_models::payments::CustomerAcceptance,
- api_models::payments::PaymentsResponse,
- api_models::payments::PaymentsCreateResponseOpenApi,
api_models::payments::PaymentRetrieveBody,
api_models::payments::PaymentsRetrieveRequest,
api_models::payments::PaymentsCaptureRequest,
@@ -429,7 +428,6 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::SamsungPayTokenData,
api_models::payments::PaymentsCancelRequest,
api_models::payments::PaymentListConstraints,
- api_models::payments::PaymentListResponse,
api_models::payments::CashappQr,
api_models::payments::BankTransferData,
api_models::payments::BankTransferNextStepsData,
@@ -501,7 +499,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::mandates::MandateCardDetails,
api_models::mandates::RecurringDetails,
api_models::mandates::ProcessorPaymentToken,
- api_models::ephemeral_key::EphemeralKeyCreateResponse,
+ api_models::ephemeral_key::ClientSecretResponse,
api_models::payments::CustomerDetails,
api_models::payments::GiftCardData,
api_models::payments::GiftCardDetails,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 62e0f1d29d1..9aca771e22b 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1030,105 +1030,6 @@ pub async fn payment_method_intent_create(
Ok(services::ApplicationResponse::Json(resp))
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[instrument(skip_all)]
-pub async fn payment_method_intent_confirm(
- state: &SessionState,
- req: api::PaymentMethodIntentConfirm,
- merchant_account: &domain::MerchantAccount,
- key_store: &domain::MerchantKeyStore,
- pm_id: id_type::GlobalPaymentMethodId,
-) -> RouterResponse<api::PaymentMethodResponse> {
- let key_manager_state = &(state).into();
- req.validate()?;
-
- let db = &*state.store;
-
- let payment_method = db
- .find_payment_method(
- key_manager_state,
- key_store,
- &pm_id,
- merchant_account.storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::PaymentMethodNotFound)
- .attach_printable("Unable to find payment method")?;
-
- when(
- payment_method.status != enums::PaymentMethodStatus::AwaitingData,
- || {
- Err(errors::ApiErrorResponse::InvalidRequestData {
- message: "Invalid pm_id provided: This Payment method cannot be confirmed"
- .to_string(),
- })
- },
- )?;
-
- let payment_method_data = pm_types::PaymentMethodVaultingData::from(req.payment_method_data);
-
- let vaulting_result = vault_payment_method(
- state,
- &payment_method_data,
- merchant_account,
- key_store,
- None,
- )
- .await;
-
- let response = match vaulting_result {
- Ok((vaulting_resp, fingerprint_id)) => {
- let pm_update = create_pm_additional_data_update(
- &payment_method_data,
- state,
- key_store,
- Some(vaulting_resp.vault_id.get_string_repr().clone()),
- Some(req.payment_method_type),
- Some(req.payment_method_subtype),
- Some(fingerprint_id),
- )
- .await
- .attach_printable("Unable to create Payment method data")?;
-
- let payment_method = db
- .update_payment_method(
- &(state.into()),
- key_store,
- payment_method,
- pm_update,
- merchant_account.storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to update payment method in db")?;
-
- let resp = pm_transforms::generate_payment_method_response(&payment_method)?;
-
- Ok(resp)
- }
- Err(e) => {
- let pm_update = storage::PaymentMethodUpdate::StatusUpdate {
- status: Some(enums::PaymentMethodStatus::Inactive),
- };
-
- db.update_payment_method(
- &(state.into()),
- key_store,
- payment_method,
- pm_update,
- merchant_account.storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to update payment method in db")?;
-
- Err(e)
- }
- }?;
-
- Ok(services::ApplicationResponse::Json(response))
-}
-
#[cfg(feature = "v2")]
trait PerformFilteringOnEnabledPaymentMethods {
fn perform_filtering(self) -> FilteredPaymentMethodsEnabled;
@@ -1934,6 +1835,15 @@ pub async fn payment_methods_session_create(
let expires_at = common_utils::date_time::now().saturating_add(Duration::seconds(expires_in));
+ let client_secret = payment_helpers::create_client_secret(
+ &state,
+ merchant_account.get_id(),
+ diesel_models::ResourceId::PaymentMethodSession(payment_methods_session_id.clone()),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to create client secret")?;
+
let payment_method_session_domain_model =
hyperswitch_domain_models::payment_methods::PaymentMethodsSession {
id: payment_methods_session_id,
@@ -1954,9 +1864,10 @@ pub async fn payment_methods_session_create(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to insert payment methods session in db")?;
- let response = payment_methods::PaymentMethodsSessionResponse::foreign_from(
+ let response = payment_methods::PaymentMethodsSessionResponse::foreign_from((
payment_method_session_domain_model,
- );
+ client_secret.secret,
+ ));
Ok(services::ApplicationResponse::Json(response))
}
@@ -1979,9 +1890,10 @@ pub async fn payment_methods_session_retrieve(
})
.attach_printable("Failed to retrieve payment methods session from db")?;
- let response = payment_methods::PaymentMethodsSessionResponse::foreign_from(
+ let response = payment_methods::PaymentMethodsSessionResponse::foreign_from((
payment_method_session_domain_model,
- );
+ Secret::new("CLIENT_SECRET_REDACTED".to_string()),
+ ));
Ok(services::ApplicationResponse::Json(response))
}
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index d8e3bbf3829..c4d3eafe463 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -972,22 +972,30 @@ impl transformers::ForeignTryFrom<domain::PaymentMethod> for api::CustomerPaymen
}
#[cfg(feature = "v2")]
-impl transformers::ForeignFrom<hyperswitch_domain_models::payment_methods::PaymentMethodsSession>
- for api_models::payment_methods::PaymentMethodsSessionResponse
+impl
+ transformers::ForeignFrom<(
+ hyperswitch_domain_models::payment_methods::PaymentMethodsSession,
+ Secret<String>,
+ )> for api_models::payment_methods::PaymentMethodsSessionResponse
{
fn foreign_from(
- item: hyperswitch_domain_models::payment_methods::PaymentMethodsSession,
+ item: (
+ hyperswitch_domain_models::payment_methods::PaymentMethodsSession,
+ Secret<String>,
+ ),
) -> Self {
+ let (session, client_secret) = item;
Self {
- id: item.id,
- customer_id: item.customer_id,
- billing: item
+ id: session.id,
+ customer_id: session.customer_id,
+ billing: session
.billing
.map(|address| address.into_inner())
.map(From::from),
- psp_tokenization: item.psp_tokenization,
- network_tokenization: item.network_tokenization,
- expires_at: item.expires_at,
+ psp_tokenization: session.psp_tokenization,
+ network_tokenization: session.network_tokenization,
+ expires_at: session.expires_at,
+ client_secret,
}
}
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 797aadbbc05..70f921fa817 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1,7 +1,7 @@
use std::{borrow::Cow, collections::HashSet, str::FromStr};
#[cfg(feature = "v2")]
-use api_models::ephemeral_key::EphemeralKeyResponse;
+use api_models::ephemeral_key::ClientSecretResponse;
use api_models::{
mandates::RecurringDetails,
payments::{additional_info as payment_additional_types, RequestSurchargeDetails},
@@ -3053,76 +3053,72 @@ pub async fn make_ephemeral_key(
}
#[cfg(feature = "v2")]
-pub async fn make_ephemeral_key(
+pub async fn make_client_secret(
state: SessionState,
- customer_id: id_type::GlobalCustomerId,
+ resource_id: api_models::ephemeral_key::ResourceId,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
headers: &actix_web::http::header::HeaderMap,
-) -> errors::RouterResponse<EphemeralKeyResponse> {
+) -> errors::RouterResponse<ClientSecretResponse> {
let db = &state.store;
let key_manager_state = &((&state).into());
- db.find_customer_by_global_id(
- key_manager_state,
- &customer_id,
- merchant_account.get_id(),
- &key_store,
- merchant_account.storage_scheme,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
-
- let resource_type = services::authentication::get_header_value_by_key(
- headers::X_RESOURCE_TYPE.to_string(),
- headers,
- )?
- .map(ephemeral_key::ResourceType::from_str)
- .transpose()
- .change_context(errors::ApiErrorResponse::InvalidRequestData {
- message: format!("`{}` header is invalid", headers::X_RESOURCE_TYPE),
- })?
- .get_required_value("ResourceType")
- .attach_printable("Failed to convert ResourceType from string")?;
-
- let ephemeral_key = create_ephemeral_key(
- &state,
- &customer_id,
- merchant_account.get_id(),
- resource_type,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to create ephemeral key")?;
- let response = EphemeralKeyResponse::foreign_from(ephemeral_key);
+ match &resource_id {
+ api_models::ephemeral_key::ResourceId::Customer(global_customer_id) => {
+ db.find_customer_by_global_id(
+ key_manager_state,
+ global_customer_id,
+ merchant_account.get_id(),
+ &key_store,
+ merchant_account.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
+ }
+ }
+
+ let resource_id = match resource_id {
+ api_models::ephemeral_key::ResourceId::Customer(global_customer_id) => {
+ diesel_models::ResourceId::Customer(global_customer_id)
+ }
+ };
+
+ let resource_id = resource_id;
+
+ let client_secret = create_client_secret(&state, merchant_account.get_id(), resource_id)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to create client secret")?;
+
+ let response = ClientSecretResponse::foreign_try_from(client_secret)
+ .attach_printable("Only customer is supported as resource_id in response")?;
Ok(services::ApplicationResponse::Json(response))
}
#[cfg(feature = "v2")]
-pub async fn create_ephemeral_key(
+pub async fn create_client_secret(
state: &SessionState,
- customer_id: &id_type::GlobalCustomerId,
merchant_id: &id_type::MerchantId,
- resource_type: ephemeral_key::ResourceType,
-) -> RouterResult<ephemeral_key::EphemeralKeyType> {
+ resource_id: diesel_models::ephemeral_key::ResourceId,
+) -> RouterResult<ephemeral_key::ClientSecretType> {
use common_utils::generate_time_ordered_id;
let store = &state.store;
- let id = id_type::EphemeralKeyId::generate();
- let secret = masking::Secret::new(generate_time_ordered_id("epk"));
- let ephemeral_key = ephemeral_key::EphemeralKeyTypeNew {
+ let id = id_type::ClientSecretId::generate();
+ let secret = masking::Secret::new(generate_time_ordered_id("cs"));
+
+ let client_secret = ephemeral_key::ClientSecretTypeNew {
id,
- customer_id: customer_id.to_owned(),
merchant_id: merchant_id.to_owned(),
secret,
- resource_type,
+ resource_id,
};
- let ephemeral_key = store
- .create_ephemeral_key(ephemeral_key, state.conf.eph_key.validity)
+ let client_secret = store
+ .create_client_secret(client_secret, state.conf.eph_key.validity)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to create ephemeral key")?;
- Ok(ephemeral_key)
+ .attach_printable("Unable to create client secret")?;
+ Ok(client_secret)
}
#[cfg(feature = "v1")]
@@ -3140,13 +3136,13 @@ pub async fn delete_ephemeral_key(
}
#[cfg(feature = "v2")]
-pub async fn delete_ephemeral_key(
+pub async fn delete_client_secret(
state: SessionState,
ephemeral_key_id: String,
-) -> errors::RouterResponse<EphemeralKeyResponse> {
+) -> errors::RouterResponse<ClientSecretResponse> {
let db = state.store.as_ref();
let ephemeral_key = db
- .delete_ephemeral_key(&ephemeral_key_id)
+ .delete_client_secret(&ephemeral_key_id)
.await
.map_err(|err| match err.current_context() {
errors::StorageError::ValueNotFound(_) => {
@@ -3158,10 +3154,12 @@ pub async fn delete_ephemeral_key(
})
.attach_printable("Unable to delete ephemeral key")?;
- let response = EphemeralKeyResponse::foreign_from(ephemeral_key);
+ let response = ClientSecretResponse::foreign_try_from(ephemeral_key)
+ .attach_printable("Only customer is supported as resource_id in response")?;
Ok(services::ApplicationResponse::Json(response))
}
+#[cfg(feature = "v1")]
pub fn make_pg_redirect_response(
payment_id: id_type::PaymentId,
response: &api::PaymentsResponse,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 80c10a294ec..b70c08d82c7 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1725,7 +1725,7 @@ pub fn payments_to_payments_response<Op, F: Clone, D>(
_connector_http_status_code: Option<u16>,
_external_latency: Option<u128>,
_is_latency_header_enabled: Option<bool>,
-) -> RouterResponse<api::PaymentsResponse>
+) -> RouterResponse<api_models::payments::PaymentsRetrieveResponse>
where
Op: Debug,
D: OperationSessionGetters<F>,
@@ -2565,6 +2565,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
}
}
+#[cfg(feature = "v1")]
impl ForeignFrom<ephemeral_key::EphemeralKey> for api::ephemeral_key::EphemeralKeyCreateResponse {
fn foreign_from(from: ephemeral_key::EphemeralKey) -> Self {
Self {
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 0f775eda855..0f51c67669d 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1415,6 +1415,7 @@ pub fn get_external_authentication_request_poll_id(
payment_id.get_external_authentication_request_poll_id()
}
+#[cfg(feature = "v1")]
pub fn get_html_redirect_response_for_external_authentication(
return_url_with_query_params: String,
payment_response: &api_models::payments::PaymentsResponse,
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index 124161454a0..17da4902bac 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -99,6 +99,7 @@ pub trait StorageInterface:
+ dashboard_metadata::DashboardMetadataInterface
+ dispute::DisputeInterface
+ ephemeral_key::EphemeralKeyInterface
+ + ephemeral_key::ClientSecretInterface
+ events::EventInterface
+ file::FileMetadataInterface
+ FraudCheckInterface
diff --git a/crates/router/src/db/ephemeral_key.rs b/crates/router/src/db/ephemeral_key.rs
index b3e33cd777f..2799d1c9ccb 100644
--- a/crates/router/src/db/ephemeral_key.rs
+++ b/crates/router/src/db/ephemeral_key.rs
@@ -3,7 +3,7 @@ use common_utils::id_type;
use time::ext::NumericalDuration;
#[cfg(feature = "v2")]
-use crate::types::storage::ephemeral_key::{EphemeralKeyType, EphemeralKeyTypeNew, ResourceType};
+use crate::types::storage::ephemeral_key::{ClientSecretType, ClientSecretTypeNew};
use crate::{
core::errors::{self, CustomResult},
db::MockDb,
@@ -19,36 +19,39 @@ pub trait EphemeralKeyInterface {
_validity: i64,
) -> CustomResult<EphemeralKey, errors::StorageError>;
- #[cfg(feature = "v2")]
- async fn create_ephemeral_key(
- &self,
- _ek: EphemeralKeyTypeNew,
- _validity: i64,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError>;
-
#[cfg(feature = "v1")]
async fn get_ephemeral_key(
&self,
_key: &str,
) -> CustomResult<EphemeralKey, errors::StorageError>;
- #[cfg(feature = "v2")]
- async fn get_ephemeral_key(
- &self,
- _key: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError>;
-
#[cfg(feature = "v1")]
async fn delete_ephemeral_key(
&self,
_id: &str,
) -> CustomResult<EphemeralKey, errors::StorageError>;
+}
+#[async_trait::async_trait]
+pub trait ClientSecretInterface {
#[cfg(feature = "v2")]
- async fn delete_ephemeral_key(
+ async fn create_client_secret(
+ &self,
+ _ek: ClientSecretTypeNew,
+ _validity: i64,
+ ) -> CustomResult<ClientSecretType, errors::StorageError>;
+
+ #[cfg(feature = "v2")]
+ async fn get_client_secret(
+ &self,
+ _key: &str,
+ ) -> CustomResult<ClientSecretType, errors::StorageError>;
+
+ #[cfg(feature = "v2")]
+ async fn delete_client_secret(
&self,
_id: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError>;
+ ) -> CustomResult<ClientSecretType, errors::StorageError>;
}
mod storage {
@@ -65,11 +68,9 @@ mod storage {
use storage_impl::redis::kv_store::RedisConnInterface;
use time::ext::NumericalDuration;
- use super::EphemeralKeyInterface;
+ use super::{ClientSecretInterface, EphemeralKeyInterface};
#[cfg(feature = "v2")]
- use crate::types::storage::ephemeral_key::{
- EphemeralKeyType, EphemeralKeyTypeNew, ResourceType,
- };
+ use crate::types::storage::ephemeral_key::{ClientSecretType, ClientSecretTypeNew};
use crate::{
core::errors::{self, CustomResult},
services::Store,
@@ -137,37 +138,74 @@ mod storage {
}
}
+ #[cfg(feature = "v1")]
+ #[instrument(skip_all)]
+ async fn get_ephemeral_key(
+ &self,
+ key: &str,
+ ) -> CustomResult<EphemeralKey, errors::StorageError> {
+ let key = format!("epkey_{key}");
+ self.get_redis_conn()
+ .map_err(Into::<errors::StorageError>::into)?
+ .get_hash_field_and_deserialize(&key.into(), "ephkey", "EphemeralKey")
+ .await
+ .change_context(errors::StorageError::KVError)
+ }
+
+ #[cfg(feature = "v1")]
+ async fn delete_ephemeral_key(
+ &self,
+ id: &str,
+ ) -> CustomResult<EphemeralKey, errors::StorageError> {
+ let ek = self.get_ephemeral_key(id).await?;
+
+ self.get_redis_conn()
+ .map_err(Into::<errors::StorageError>::into)?
+ .delete_key(&format!("epkey_{}", &ek.id).into())
+ .await
+ .change_context(errors::StorageError::KVError)?;
+
+ self.get_redis_conn()
+ .map_err(Into::<errors::StorageError>::into)?
+ .delete_key(&format!("epkey_{}", &ek.secret).into())
+ .await
+ .change_context(errors::StorageError::KVError)?;
+ Ok(ek)
+ }
+ }
+
+ #[async_trait::async_trait]
+ impl ClientSecretInterface for Store {
#[cfg(feature = "v2")]
#[instrument(skip_all)]
- async fn create_ephemeral_key(
+ async fn create_client_secret(
&self,
- new: EphemeralKeyTypeNew,
+ new: ClientSecretTypeNew,
validity: i64,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
let created_at = date_time::now();
let expires = created_at.saturating_add(validity.hours());
let id_key = new.id.generate_redis_key();
- let created_ephemeral_key = EphemeralKeyType {
+ let created_client_secret = ClientSecretType {
id: new.id,
created_at,
expires,
- customer_id: new.customer_id,
merchant_id: new.merchant_id,
secret: new.secret,
- resource_type: new.resource_type,
+ resource_id: new.resource_id,
};
- let secret_key = created_ephemeral_key.generate_secret_key();
+ let secret_key = created_client_secret.generate_secret_key();
match self
.get_redis_conn()
.map_err(Into::<errors::StorageError>::into)?
.serialize_and_set_multiple_hash_field_if_not_exist(
&[
- (&secret_key.as_str().into(), &created_ephemeral_key),
- (&id_key.as_str().into(), &created_ephemeral_key),
+ (&secret_key.as_str().into(), &created_client_secret),
+ (&id_key.as_str().into(), &created_client_secret),
],
- "ephkey",
+ "csh",
None,
)
.await
@@ -191,69 +229,34 @@ mod storage {
.set_expire_at(&id_key.into(), expire_at)
.await
.change_context(errors::StorageError::KVError)?;
- Ok(created_ephemeral_key)
+ Ok(created_client_secret)
}
Err(er) => Err(er).change_context(errors::StorageError::KVError),
}
}
- #[cfg(feature = "v1")]
- #[instrument(skip_all)]
- async fn get_ephemeral_key(
- &self,
- key: &str,
- ) -> CustomResult<EphemeralKey, errors::StorageError> {
- let key = format!("epkey_{key}");
- self.get_redis_conn()
- .map_err(Into::<errors::StorageError>::into)?
- .get_hash_field_and_deserialize(&key.into(), "ephkey", "EphemeralKey")
- .await
- .change_context(errors::StorageError::KVError)
- }
-
#[cfg(feature = "v2")]
#[instrument(skip_all)]
- async fn get_ephemeral_key(
+ async fn get_client_secret(
&self,
key: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- let key = format!("epkey_{key}");
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ let key = format!("cs_{key}");
self.get_redis_conn()
.map_err(Into::<errors::StorageError>::into)?
- .get_hash_field_and_deserialize(&key.into(), "ephkey", "EphemeralKeyType")
+ .get_hash_field_and_deserialize(&key.into(), "csh", "ClientSecretType")
.await
.change_context(errors::StorageError::KVError)
}
- #[cfg(feature = "v1")]
- async fn delete_ephemeral_key(
- &self,
- id: &str,
- ) -> CustomResult<EphemeralKey, errors::StorageError> {
- let ek = self.get_ephemeral_key(id).await?;
-
- self.get_redis_conn()
- .map_err(Into::<errors::StorageError>::into)?
- .delete_key(&format!("epkey_{}", &ek.id).into())
- .await
- .change_context(errors::StorageError::KVError)?;
-
- self.get_redis_conn()
- .map_err(Into::<errors::StorageError>::into)?
- .delete_key(&format!("epkey_{}", &ek.secret).into())
- .await
- .change_context(errors::StorageError::KVError)?;
- Ok(ek)
- }
-
#[cfg(feature = "v2")]
- async fn delete_ephemeral_key(
+ async fn delete_client_secret(
&self,
id: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- let ephemeral_key = self.get_ephemeral_key(id).await?;
- let redis_id_key = ephemeral_key.id.generate_redis_key();
- let secret_key = ephemeral_key.generate_secret_key();
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ let client_secret = self.get_client_secret(id).await?;
+ let redis_id_key = client_secret.id.generate_redis_key();
+ let secret_key = client_secret.generate_secret_key();
self.get_redis_conn()
.map_err(Into::<errors::StorageError>::into)?
@@ -276,7 +279,7 @@ mod storage {
}
_ => err.change_context(errors::StorageError::KVError),
})?;
- Ok(ephemeral_key)
+ Ok(client_secret)
}
}
}
@@ -305,15 +308,6 @@ impl EphemeralKeyInterface for MockDb {
Ok(ephemeral_key)
}
- #[cfg(feature = "v2")]
- async fn create_ephemeral_key(
- &self,
- ek: EphemeralKeyTypeNew,
- validity: i64,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- todo!()
- }
-
#[cfg(feature = "v1")]
async fn get_ephemeral_key(
&self,
@@ -333,14 +327,6 @@ impl EphemeralKeyInterface for MockDb {
}
}
- #[cfg(feature = "v2")]
- async fn get_ephemeral_key(
- &self,
- key: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- todo!()
- }
-
#[cfg(feature = "v1")]
async fn delete_ephemeral_key(
&self,
@@ -356,12 +342,32 @@ impl EphemeralKeyInterface for MockDb {
);
}
}
+}
+#[async_trait::async_trait]
+impl ClientSecretInterface for MockDb {
#[cfg(feature = "v2")]
- async fn delete_ephemeral_key(
+ async fn create_client_secret(
+ &self,
+ new: ClientSecretTypeNew,
+ validity: i64,
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ todo!()
+ }
+
+ #[cfg(feature = "v2")]
+ async fn get_client_secret(
+ &self,
+ key: &str,
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ todo!()
+ }
+
+ #[cfg(feature = "v2")]
+ async fn delete_client_secret(
&self,
id: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
todo!()
}
}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index d10465562f9..47f4b7dbf87 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -7,7 +7,7 @@ use common_utils::{
types::{keymanager::KeyManagerState, theme::ThemeLineage},
};
#[cfg(feature = "v2")]
-use diesel_models::ephemeral_key::{EphemeralKeyType, EphemeralKeyTypeNew};
+use diesel_models::ephemeral_key::{ClientSecretType, ClientSecretTypeNew};
use diesel_models::{
enums,
enums::ProcessTrackerStatus,
@@ -39,6 +39,7 @@ use time::PrimitiveDateTime;
use super::{
dashboard_metadata::DashboardMetadataInterface,
+ ephemeral_key::ClientSecretInterface,
role::RoleInterface,
user::{sample_data::BatchSampleDataInterface, theme::ThemeInterface, UserInterface},
user_authentication_method::UserAuthenticationMethodInterface,
@@ -659,15 +660,6 @@ impl EphemeralKeyInterface for KafkaStore {
self.diesel_store.create_ephemeral_key(ek, validity).await
}
- #[cfg(feature = "v2")]
- async fn create_ephemeral_key(
- &self,
- ek: EphemeralKeyTypeNew,
- validity: i64,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- self.diesel_store.create_ephemeral_key(ek, validity).await
- }
-
#[cfg(feature = "v1")]
async fn get_ephemeral_key(
&self,
@@ -676,14 +668,6 @@ impl EphemeralKeyInterface for KafkaStore {
self.diesel_store.get_ephemeral_key(key).await
}
- #[cfg(feature = "v2")]
- async fn get_ephemeral_key(
- &self,
- key: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- self.diesel_store.get_ephemeral_key(key).await
- }
-
#[cfg(feature = "v1")]
async fn delete_ephemeral_key(
&self,
@@ -691,13 +675,33 @@ impl EphemeralKeyInterface for KafkaStore {
) -> CustomResult<EphemeralKey, errors::StorageError> {
self.diesel_store.delete_ephemeral_key(id).await
}
+}
+#[async_trait::async_trait]
+impl ClientSecretInterface for KafkaStore {
#[cfg(feature = "v2")]
- async fn delete_ephemeral_key(
+ async fn create_client_secret(
+ &self,
+ ek: ClientSecretTypeNew,
+ validity: i64,
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ self.diesel_store.create_client_secret(ek, validity).await
+ }
+
+ #[cfg(feature = "v2")]
+ async fn get_client_secret(
+ &self,
+ key: &str,
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ self.diesel_store.get_client_secret(key).await
+ }
+
+ #[cfg(feature = "v2")]
+ async fn delete_client_secret(
&self,
id: &str,
- ) -> CustomResult<EphemeralKeyType, errors::StorageError> {
- self.diesel_store.delete_ephemeral_key(id).await
+ ) -> CustomResult<ClientSecretType, errors::StorageError> {
+ self.diesel_store.delete_client_secret(id).await
}
}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index b1eb6e239f2..9b43d7f2b16 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -90,8 +90,8 @@ pub mod headers {
pub const X_REDIRECT_URI: &str = "x-redirect-uri";
pub const X_TENANT_ID: &str = "x-tenant-id";
pub const X_CLIENT_SECRET: &str = "X-Client-Secret";
+ pub const X_CUSTOMER_ID: &str = "X-Customer-Id";
pub const X_CONNECTED_MERCHANT_ID: &str = "x-connected-merchant-id";
- pub const X_RESOURCE_TYPE: &str = "X-Resource-Type";
}
pub mod pii {
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0a413ae021e..ef6564c55e3 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1166,10 +1166,6 @@ impl PaymentMethods {
.service(web::resource("/list-enabled-payment-methods").route(
web::get().to(payment_methods::payment_method_session_list_payment_methods),
))
- .service(
- web::resource("/confirm-intent")
- .route(web::post().to(payment_methods::confirm_payment_method_intent_api)),
- )
.service(
web::resource("/update-saved-payment-method")
.route(web::put().to(payment_methods::payment_method_update_api)),
@@ -1497,10 +1493,10 @@ impl EphemeralKey {
#[cfg(feature = "v2")]
impl EphemeralKey {
pub fn server(config: AppState) -> Scope {
- web::scope("/v2/ephemeral-keys")
+ web::scope("/v2/client-secret")
.app_data(web::Data::new(config))
- .service(web::resource("").route(web::post().to(ephemeral_key_create)))
- .service(web::resource("/{id}").route(web::delete().to(ephemeral_key_delete)))
+ .service(web::resource("").route(web::post().to(client_secret_create)))
+ .service(web::resource("/{id}").route(web::delete().to(client_secret_delete)))
}
}
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index 09b6983d2a7..67088316799 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -85,19 +85,25 @@ pub async fn customers_retrieve(
req: HttpRequest,
path: web::Path<id_type::GlobalCustomerId>,
) -> HttpResponse {
+ use crate::services::authentication::V2Auth;
+
let flow = Flow::CustomersRetrieve;
let id = path.into_inner();
- let auth = if auth::is_jwt_auth(req.headers()) {
+ let auth: Box<
+ dyn auth::AuthenticateAndFetch<auth::AuthenticationData, crate::routes::SessionState>
+ + Send
+ + Sync,
+ > = if auth::is_jwt_auth(req.headers()) {
Box::new(auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
})
} else {
- match auth::is_ephemeral_auth(req.headers()) {
- Ok(auth) => auth,
- Err(err) => return api::log_and_return_error_response(err),
- }
+ Box::new(vec![
+ V2Auth::ApiKeyAuth,
+ V2Auth::ClientAuth(diesel_models::ResourceId::Customer(id.clone())),
+ ])
};
Box::pin(api::server_wrap(
diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs
index 0330482e81a..1986106a08e 100644
--- a/crates/router/src/routes/ephemeral_key.rs
+++ b/crates/router/src/routes/ephemeral_key.rs
@@ -36,10 +36,10 @@ pub async fn ephemeral_key_create(
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::EphemeralKeyCreate))]
-pub async fn ephemeral_key_create(
+pub async fn client_secret_create(
state: web::Data<AppState>,
req: HttpRequest,
- json_payload: web::Json<api_models::ephemeral_key::EphemeralKeyCreateRequest>,
+ json_payload: web::Json<api_models::ephemeral_key::ClientSecretCreateRequest>,
) -> HttpResponse {
let flow = Flow::EphemeralKeyCreate;
let payload = json_payload.into_inner();
@@ -49,9 +49,9 @@ pub async fn ephemeral_key_create(
&req,
payload,
|state, auth: auth::AuthenticationData, payload, _| {
- helpers::make_ephemeral_key(
+ helpers::make_client_secret(
state,
- payload.customer_id.to_owned(),
+ payload.resource_id.to_owned(),
auth.merchant_account,
auth.key_store,
req.headers(),
@@ -64,7 +64,7 @@ pub async fn ephemeral_key_create(
}
#[instrument(skip_all, fields(flow = ?Flow::EphemeralKeyDelete))]
-pub async fn ephemeral_key_delete(
+pub async fn client_secret_delete(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
@@ -76,7 +76,7 @@ pub async fn ephemeral_key_delete(
state,
&req,
payload,
- |state, _: auth::AuthenticationData, req, _| helpers::delete_ephemeral_key(state, req),
+ |state, _: auth::AuthenticationData, req, _| helpers::delete_client_secret(state, req),
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
)
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 26f0e64763a..b1b9d689261 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -117,7 +117,7 @@ pub async fn create_payment_method_intent_api(
))
.await
},
- &auth::HeaderAuth(auth::ApiKeyAuth),
+ &auth::V2Auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -149,52 +149,6 @@ impl common_utils::events::ApiEventMetric for PaymentMethodIntentConfirmInternal
}
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsCreate))]
-pub async fn confirm_payment_method_intent_api(
- state: web::Data<AppState>,
- req: HttpRequest,
- json_payload: web::Json<payment_methods::PaymentMethodIntentConfirm>,
- path: web::Path<id_type::GlobalPaymentMethodId>,
-) -> HttpResponse {
- let flow = Flow::PaymentMethodsCreate;
- let pm_id = path.into_inner();
- let payload = json_payload.into_inner();
-
- let auth = match auth::is_ephemeral_or_publishible_auth(req.headers()) {
- Ok(auth) => auth,
- Err(e) => return api::log_and_return_error_response(e),
- };
-
- let inner_payload = PaymentMethodIntentConfirmInternal {
- id: pm_id.to_owned(),
- request: payload,
- };
-
- Box::pin(api::server_wrap(
- flow,
- state,
- &req,
- inner_payload,
- |state, auth: auth::AuthenticationData, req, _| {
- let pm_id = pm_id.clone();
- async move {
- Box::pin(payment_methods_routes::payment_method_intent_confirm(
- &state,
- req.request,
- &auth.merchant_account,
- &auth.key_store,
- pm_id,
- ))
- .await
- }
- },
- &*auth,
- api_locking::LockAction::NotApplicable,
- ))
- .await
-}
-
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsUpdate))]
pub async fn payment_method_update_api(
@@ -207,11 +161,6 @@ pub async fn payment_method_update_api(
let payment_method_id = path.into_inner();
let payload = json_payload.into_inner();
- let auth = match auth::is_ephemeral_or_publishible_auth(req.headers()) {
- Ok(auth) => auth,
- Err(e) => return api::log_and_return_error_response(e),
- };
-
Box::pin(api::server_wrap(
flow,
state,
@@ -226,7 +175,7 @@ pub async fn payment_method_update_api(
&payment_method_id,
)
},
- &*auth,
+ &auth::V2Auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -948,11 +897,6 @@ pub async fn payment_methods_session_create(
let flow = Flow::PaymentMethodSessionCreate;
let payload = json_payload.into_inner();
- let ephemeral_auth = match auth::is_ephemeral_auth(req.headers()) {
- Ok(auth) => auth,
- Err(err) => return api::log_and_return_error_response(err),
- };
-
Box::pin(api::server_wrap(
flow,
state,
@@ -967,7 +911,7 @@ pub async fn payment_methods_session_create(
)
.await
},
- &*ephemeral_auth,
+ &auth::V2Auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
@@ -983,16 +927,11 @@ pub async fn payment_methods_session_retrieve(
let flow = Flow::PaymentMethodSessionRetrieve;
let payment_method_session_id = path.into_inner();
- let ephemeral_auth = match auth::is_ephemeral_auth(req.headers()) {
- Ok(auth) => auth,
- Err(err) => return api::log_and_return_error_response(err),
- };
-
Box::pin(api::server_wrap(
flow,
state,
&req,
- payment_method_session_id,
+ payment_method_session_id.clone(),
|state, auth: auth::AuthenticationData, payment_method_session_id, _| async move {
payment_methods_routes::payment_methods_session_retrieve(
state,
@@ -1002,7 +941,12 @@ pub async fn payment_methods_session_retrieve(
)
.await
},
- &*ephemeral_auth,
+ &vec![
+ auth::V2Auth::ApiKeyAuth,
+ auth::V2Auth::ClientAuth(diesel_models::ResourceId::PaymentMethodSession(
+ payment_method_session_id,
+ )),
+ ],
api_locking::LockAction::NotApplicable,
))
.await
@@ -1018,16 +962,11 @@ pub async fn payment_method_session_list_payment_methods(
let flow = Flow::PaymentMethodsList;
let payment_method_session_id = path.into_inner();
- let auth = match auth::is_ephemeral_or_publishible_auth(req.headers()) {
- Ok(auth) => auth,
- Err(e) => return api::log_and_return_error_response(e),
- };
-
Box::pin(api::server_wrap(
flow,
state,
&req,
- payment_method_session_id,
+ payment_method_session_id.clone(),
|state, auth: auth::AuthenticationData, payment_method_session_id, _| {
payment_methods_routes::list_payment_methods_for_session(
state,
@@ -1037,7 +976,9 @@ pub async fn payment_method_session_list_payment_methods(
payment_method_session_id,
)
},
- &*auth,
+ &auth::V2Auth::ClientAuth(diesel_models::ResourceId::PaymentMethodSession(
+ payment_method_session_id,
+ )),
api_locking::LockAction::NotApplicable,
))
.await
@@ -1076,11 +1017,6 @@ pub async fn payment_method_session_update_saved_payment_method(
let payload = json_payload.into_inner();
let payment_method_session_id = path.into_inner();
- let auth = match auth::is_ephemeral_or_publishible_auth(req.headers()) {
- Ok(auth) => auth,
- Err(e) => return api::log_and_return_error_response(e),
- };
-
let request = PaymentMethodsSessionGenericRequest {
payment_method_session_id: payment_method_session_id.clone(),
request: payload,
@@ -1100,7 +1036,9 @@ pub async fn payment_method_session_update_saved_payment_method(
request.request,
)
},
- &*auth,
+ &auth::V2Auth::ClientAuth(diesel_models::ResourceId::PaymentMethodSession(
+ payment_method_session_id,
+ )),
api_locking::LockAction::NotApplicable,
))
.await
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 99800b55512..d270005a058 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -20,6 +20,8 @@ use common_utils::{date_time, id_type};
use diesel_models::ephemeral_key;
use error_stack::{report, ResultExt};
use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation};
+#[cfg(feature = "v2")]
+use masking::ExposeInterface;
use masking::PeekInterface;
use router_env::logger;
use serde::Serialize;
@@ -1286,6 +1288,18 @@ impl<'a> HeaderMapStruct<'a> {
})
}
+ #[cfg(feature = "v2")]
+ pub fn get_auth_string_from_header(&self) -> RouterResult<&str> {
+ self.headers
+ .get(headers::AUTHORIZATION)
+ .get_required_value(headers::AUTHORIZATION)?
+ .to_str()
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: headers::AUTHORIZATION,
+ })
+ .attach_printable("Failed to convert authorization header to string")
+ }
+
pub fn get_id_type_from_header_if_present<T>(&self, key: &str) -> RouterResult<Option<T>>
where
T: TryFrom<
@@ -1510,44 +1524,6 @@ where
}
}
-#[cfg(feature = "v2")]
-#[async_trait]
-impl<A> AuthenticateAndFetch<AuthenticationData, A> for EphemeralKeyAuth
-where
- A: SessionStateInfo + Sync,
-{
- async fn authenticate_and_fetch(
- &self,
- request_headers: &HeaderMap,
- state: &A,
- ) -> RouterResult<(AuthenticationData, AuthenticationType)> {
- let api_key =
- get_api_key(request_headers).change_context(errors::ApiErrorResponse::Unauthorized)?;
- let ephemeral_key = state
- .store()
- .get_ephemeral_key(api_key)
- .await
- .change_context(errors::ApiErrorResponse::Unauthorized)?;
-
- let resource_type = HeaderMapStruct::new(request_headers)
- .get_mandatory_header_value_by_key(headers::X_RESOURCE_TYPE)
- .and_then(|val| {
- ephemeral_key::ResourceType::from_str(val).change_context(
- errors::ApiErrorResponse::InvalidRequestData {
- message: format!("`{}` header is invalid", headers::X_RESOURCE_TYPE),
- },
- )
- })?;
-
- fp_utils::when(resource_type != ephemeral_key.resource_type, || {
- Err(errors::ApiErrorResponse::Unauthorized)
- })?;
-
- MerchantIdAuth(ephemeral_key.merchant_id)
- .authenticate_and_fetch(request_headers, state)
- .await
- }
-}
#[derive(Debug)]
pub struct MerchantIdAuth(pub id_type::MerchantId);
@@ -1778,6 +1754,267 @@ where
}
}
+#[derive(Debug)]
+#[cfg(feature = "v2")]
+pub enum V2Auth {
+ ApiKeyAuth, // API Key
+ ClientAuth(diesel_models::ResourceId), // Publishable Key + Client Secret
+ DashboardAuth, // JWT
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<A> AuthenticateAndFetch<AuthenticationData, A> for V2Auth
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<(AuthenticationData, AuthenticationType)> {
+ let auth_string = request_headers
+ .get(headers::AUTHORIZATION)
+ .get_required_value(headers::AUTHORIZATION)?
+ .to_str()
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: headers::AUTHORIZATION,
+ })
+ .attach_printable("Failed to convert authorization header to string")?
+ .to_owned();
+
+ match self {
+ Self::ApiKeyAuth => {
+ let api_key = auth_string
+ .split(',')
+ .find_map(|part| part.trim().strip_prefix("api-key="))
+ .ok_or_else(|| {
+ report!(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Unable to parse api_key")
+ })?;
+ if api_key.is_empty() {
+ return Err(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("API key is empty");
+ }
+
+ let profile_id = HeaderMapStruct::new(request_headers)
+ .get_id_type_from_header::<id_type::ProfileId>(headers::X_PROFILE_ID)?;
+
+ let api_key = api_keys::PlaintextApiKey::from(api_key);
+ let hash_key = {
+ let config = state.conf();
+ config.api_keys.get_inner().get_hash_key()?
+ };
+ let hashed_api_key = api_key.keyed_hash(hash_key.peek());
+
+ let stored_api_key = state
+ .store()
+ .find_api_key_by_hash_optional(hashed_api_key.into())
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError) // If retrieve failed
+ .attach_printable("Failed to retrieve API key")?
+ .ok_or(report!(errors::ApiErrorResponse::Unauthorized)) // If retrieve returned `None`
+ .attach_printable("Merchant not authenticated")?;
+
+ if stored_api_key
+ .expires_at
+ .map(|expires_at| expires_at < date_time::now())
+ .unwrap_or(false)
+ {
+ return Err(report!(errors::ApiErrorResponse::Unauthorized))
+ .attach_printable("API key has expired");
+ }
+
+ let key_manager_state = &(&state.session_state()).into();
+
+ let key_store = state
+ .store()
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &stored_api_key.merchant_id,
+ &state.store().get_master_key().to_vec().into(),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Failed to fetch merchant key store for the merchant id")?;
+
+ let merchant = state
+ .store()
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &stored_api_key.merchant_id,
+ &key_store,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+
+ // Get connected merchant account if API call is done by Platform merchant account on behalf of connected merchant account
+ let (merchant, platform_merchant_account) = if state.conf().platform.enabled {
+ get_platform_merchant_account(state, request_headers, merchant).await?
+ } else {
+ (merchant, None)
+ };
+
+ let key_store = if platform_merchant_account.is_some() {
+ state
+ .store()
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ merchant.get_id(),
+ &state.store().get_master_key().to_vec().into(),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable(
+ "Failed to fetch merchant key store for the merchant id",
+ )?
+ } else {
+ key_store
+ };
+
+ let profile = state
+ .store()
+ .find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+
+ let auth = AuthenticationData {
+ merchant_account: merchant,
+ platform_merchant_account,
+ key_store,
+ profile,
+ };
+ Ok((
+ auth.clone(),
+ AuthenticationType::ApiKey {
+ merchant_id: auth.merchant_account.get_id().clone(),
+ key_id: stored_api_key.key_id,
+ },
+ ))
+ }
+ Self::ClientAuth(resource_id) => {
+ let publishable_key = auth_string
+ .split(',')
+ .find_map(|part| part.trim().strip_prefix("publishable-key="))
+ .ok_or_else(|| {
+ report!(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Unable to parse publishable_key")
+ })?;
+
+ let client_secret = auth_string
+ .split(',')
+ .find_map(|part| part.trim().strip_prefix("client-secret="))
+ .ok_or_else(|| {
+ report!(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Unable to parse client_secret")
+ })?;
+
+ let key_manager_state: &common_utils::types::keymanager::KeyManagerState =
+ &(&state.session_state()).into();
+
+ let db_client_secret: diesel_models::ClientSecretType = state
+ .store()
+ .get_client_secret(client_secret)
+ .await
+ .change_context(errors::ApiErrorResponse::Unauthorized)
+ .attach_printable("Invalid ephemeral_key")?;
+
+ let profile_id = get_id_type_by_key_from_headers(
+ headers::X_PROFILE_ID.to_string(),
+ request_headers,
+ )?
+ .get_required_value(headers::X_PROFILE_ID)?;
+
+ match db_client_secret.resource_id {
+ diesel_models::ResourceId::Payment(global_payment_id) => todo!(),
+ diesel_models::ResourceId::Customer(global_customer_id) => {
+ if global_customer_id.get_string_repr() != resource_id.to_str() {
+ return Err(errors::ApiErrorResponse::Unauthorized.into());
+ }
+ }
+ diesel_models::ResourceId::PaymentMethodSession(
+ global_payment_method_session_id,
+ ) => {
+ if global_payment_method_session_id.get_string_repr()
+ != resource_id.to_str()
+ {
+ return Err(errors::ApiErrorResponse::Unauthorized.into());
+ }
+ }
+ };
+
+ let (merchant_account, key_store) = state
+ .store()
+ .find_merchant_account_by_publishable_key(key_manager_state, publishable_key)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+ let merchant_id = merchant_account.get_id().clone();
+
+ if db_client_secret.merchant_id != merchant_id {
+ return Err(errors::ApiErrorResponse::Unauthorized.into());
+ }
+ let profile = state
+ .store()
+ .find_business_profile_by_merchant_id_profile_id(
+ key_manager_state,
+ &key_store,
+ &merchant_id,
+ &profile_id,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+ Ok((
+ AuthenticationData {
+ merchant_account,
+ key_store,
+ profile,
+ platform_merchant_account: None,
+ },
+ AuthenticationType::PublishableKey { merchant_id },
+ ))
+ }
+ Self::DashboardAuth => Err(errors::ApiErrorResponse::Unauthorized.into()),
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<A> AuthenticateAndFetch<AuthenticationData, A> for Vec<V2Auth>
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<(AuthenticationData, AuthenticationType)> {
+ let header_map_struct = HeaderMapStruct::new(request_headers);
+ let auth_string = header_map_struct.get_auth_string_from_header()?;
+
+ match auth_string.trim() {
+ s if s.starts_with("api-key=") => {
+ if let Some(handler) = self.iter().find(|auth| matches!(auth, V2Auth::ApiKeyAuth)) {
+ handler.authenticate_and_fetch(request_headers, state).await
+ } else {
+ Err(errors::ApiErrorResponse::Unauthorized.into())
+ }
+ }
+ s if s.starts_with("publishable-key=") || s.starts_with("client-secret=") => {
+ if let Some(handler) = self
+ .iter()
+ .find(|auth| matches!(auth, V2Auth::ClientAuth(_)))
+ {
+ handler.authenticate_and_fetch(request_headers, state).await
+ } else {
+ Err(errors::ApiErrorResponse::Unauthorized.into())
+ }
+ }
+ _ => Err(errors::ApiErrorResponse::Unauthorized.into()),
+ }
+ }
+}
+
#[derive(Debug)]
pub struct PublishableKeyAuth;
@@ -3282,20 +3519,7 @@ where
}
}
-pub fn is_ephemeral_or_publishible_auth<A: SessionStateInfo + Sync + Send>(
- headers: &HeaderMap,
-) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
- let api_key = get_api_key(headers)?;
-
- if api_key.starts_with("epk") {
- Ok(Box::new(EphemeralKeyAuth))
- } else if api_key.starts_with("pk_") {
- Ok(Box::new(HeaderAuth(PublishableKeyAuth)))
- } else {
- Ok(Box::new(HeaderAuth(ApiKeyAuth)))
- }
-}
-
+#[cfg(feature = "v1")]
pub fn is_ephemeral_auth<A: SessionStateInfo + Sync + Send>(
headers: &HeaderMap,
) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 2ae2af92478..1d0cdaad3df 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -542,6 +542,7 @@ pub struct RedirectPaymentFlowResponse<D> {
pub profile: domain::Profile,
}
+#[cfg(feature = "v1")]
#[derive(Clone, Debug)]
pub struct AuthenticatePaymentFlowResponse {
pub payments_response: api_models::payments::PaymentsResponse,
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 6ec0fe701e9..2c5b07359c8 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -1,5 +1,7 @@
#[cfg(feature = "v1")]
pub use api_models::payments::PaymentsRequest;
+#[cfg(feature = "v1")]
+pub use api_models::payments::{PaymentListResponse, PaymentListResponseV2, PaymentsResponse};
#[cfg(feature = "v2")]
pub use api_models::payments::{
PaymentsCreateIntentRequest, PaymentsIntentResponse, PaymentsUpdateIntentRequest,
@@ -14,15 +16,15 @@ pub use api_models::{
MandateTransactionType, MandateType, MandateValidationFields, NextActionType,
OnlineMandate, OpenBankingSessionToken, PayLaterData, PaymentIdType,
PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,
- PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, PaymentMethodData,
- PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
+ PaymentListFiltersV2, PaymentMethodData, PaymentMethodDataRequest,
+ PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
PaymentRetrieveBodyWithCredentials, PaymentsAggregateResponse, PaymentsApproveRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,
PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,
PaymentsExternalAuthenticationRequest, PaymentsIncrementalAuthorizationRequest,
PaymentsManualUpdateRequest, PaymentsPostSessionTokensRequest,
PaymentsPostSessionTokensResponse, PaymentsRedirectRequest, PaymentsRedirectionResponse,
- PaymentsRejectRequest, PaymentsResponse, PaymentsResponseForm, PaymentsRetrieveRequest,
+ PaymentsRejectRequest, PaymentsResponseForm, PaymentsRetrieveRequest,
PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest, PgRedirectResponse,
PhoneDetails, RedirectionResponse, SessionToken, UrlDetails, VerifyRequest, VerifyResponse,
WalletData,
diff --git a/crates/router/src/types/storage/ephemeral_key.rs b/crates/router/src/types/storage/ephemeral_key.rs
index c4b8e2ba701..f913827e3a0 100644
--- a/crates/router/src/types/storage/ephemeral_key.rs
+++ b/crates/router/src/types/storage/ephemeral_key.rs
@@ -1,18 +1,31 @@
-pub use diesel_models::ephemeral_key::{EphemeralKey, EphemeralKeyNew};
#[cfg(feature = "v2")]
-pub use diesel_models::ephemeral_key::{EphemeralKeyType, EphemeralKeyTypeNew, ResourceType};
+pub use diesel_models::ephemeral_key::{ClientSecretType, ClientSecretTypeNew};
+pub use diesel_models::ephemeral_key::{EphemeralKey, EphemeralKeyNew};
#[cfg(feature = "v2")]
-use crate::types::transformers::ForeignFrom;
+use crate::db::errors;
+#[cfg(feature = "v2")]
+use crate::types::transformers::ForeignTryFrom;
#[cfg(feature = "v2")]
-impl ForeignFrom<EphemeralKeyType> for api_models::ephemeral_key::EphemeralKeyResponse {
- fn foreign_from(from: EphemeralKeyType) -> Self {
- Self {
- customer_id: from.customer_id,
- created_at: from.created_at,
- expires: from.expires,
- secret: from.secret,
- id: from.id,
+impl ForeignTryFrom<ClientSecretType> for api_models::ephemeral_key::ClientSecretResponse {
+ type Error = errors::ApiErrorResponse;
+ fn foreign_try_from(from: ClientSecretType) -> Result<Self, errors::ApiErrorResponse> {
+ match from.resource_id {
+ diesel_models::ResourceId::Payment(global_payment_id) => {
+ Err(errors::ApiErrorResponse::InternalServerError)
+ }
+ diesel_models::ResourceId::PaymentMethodSession(global_payment_id) => {
+ Err(errors::ApiErrorResponse::InternalServerError)
+ }
+ diesel_models::ResourceId::Customer(global_customer_id) => Ok(Self {
+ resource_id: api_models::ephemeral_key::ResourceId::Customer(
+ global_customer_id.clone(),
+ ),
+ created_at: from.created_at,
+ expires: from.expires,
+ secret: from.secret,
+ id: from.id,
+ }),
}
}
}
|
2025-01-15T07:11:21Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added an enum `V2Auth` (name subject to change) to encapsulate different authentication scenarios. Currently only works for Client Authentication using `publishable_key` and `ephemeral_key` in `Authorization` header
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #7037
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1a. Payment method intent create request:
```bash
curl --location 'http://localhost:8080/v2/payment-methods/create-intent' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: pro_hOlRnOdewwhXSV9l7TJJ' \
--header 'api-key: dev_XLbxcbVTqGoxcd8rVlt48b0QhbleB8ZuiqeSj2XXToUBXPDbVzeS0I5cMCaSnsYb' \
--data '{
"customer_id": "12345_cus_0194a71908247490bbc38202cece425b"
}'
```
1b. Payment method intent create response:
```json
{
"id": "12345_pm_0194a71929907523adbb332ddb699f0f",
"merchant_id": "cloth_seller_a8Sp7qm2hHWJbjAuffaz",
"customer_id": "12345_cus_0194a71908247490bbc38202cece425b",
"payment_method_type": null,
"payment_method_subtype": null,
"recurring_enabled": false,
"created": "2025-01-27T09:30:31.703Z",
"last_used_at": "2025-01-27T09:30:31.703Z",
"client_secret": "cs_0194a71929917da2b83fafc6c97388d1",
"payment_method_data": null
}
```
2a. List payment methods enabled request:
```bash
curl --location 'http://localhost:8080/v2/payment-methods/12345_pm_0194a71929907523adbb332ddb699f0f/list-enabled-payment-methods' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_hOlRnOdewwhXSV9l7TJJ' \
--header 'Authorization: publishable-key=pk_dev_8dc540967cb24672bea6d5afed3720e4, client-secret=cs_0194a71929917da2b83fafc6c97388d1' \
--header 'x-customer-id: 12345_cus_0194a71908247490bbc38202cece425b'
```
2b. List payment methods enabled response:
```json
{
"payment_methods_enabled": [
{
"payment_method_type": "card_redirect",
"payment_method_subtype": "card_redirect",
"required_fields": []
},
{
"payment_method_type": "card",
"payment_method_subtype": "credit",
"required_fields": [
{
"required_field": "payment_method_data.card.card_number",
"display_name": "card_number",
"field_type": "user_card_number",
"value": null
},
{
"required_field": "payment_method_data.card.card_exp_year",
"display_name": "card_exp_year",
"field_type": "user_card_expiry_year",
"value": null
},
{
"required_field": "payment_method_data.card.card_cvc",
"display_name": "card_cvc",
"field_type": "user_card_cvc",
"value": null
},
{
"required_field": "payment_method_data.card.card_exp_month",
"display_name": "card_exp_month",
"field_type": "user_card_expiry_month",
"value": null
}
]
},
{
"payment_method_type": "card",
"payment_method_subtype": "debit",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "google_pay",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "apple_pay",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "we_chat_pay",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "ali_pay",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "paypal",
"required_fields": []
},
{
"payment_method_type": "wallet",
"payment_method_subtype": "mb_way",
"required_fields": []
},
{
"payment_method_type": "pay_later",
"payment_method_subtype": "klarna",
"required_fields": []
},
{
"payment_method_type": "pay_later",
"payment_method_subtype": "affirm",
"required_fields": []
},
{
"payment_method_type": "pay_later",
"payment_method_subtype": "afterpay_clearpay",
"required_fields": []
},
{
"payment_method_type": "pay_later",
"payment_method_subtype": "walley",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "giropay",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "ideal",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "eps",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "bancontact_card",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "przelewy24",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "sofort",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "blik",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "trustly",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "online_banking_finland",
"required_fields": []
},
{
"payment_method_type": "bank_redirect",
"payment_method_subtype": "online_banking_poland",
"required_fields": []
},
{
"payment_method_type": "bank_transfer",
"payment_method_subtype": "ach",
"required_fields": []
},
{
"payment_method_type": "bank_transfer",
"payment_method_subtype": "sepa",
"required_fields": []
},
{
"payment_method_type": "bank_transfer",
"payment_method_subtype": "bacs",
"required_fields": []
},
{
"payment_method_type": "bank_debit",
"payment_method_subtype": "ach",
"required_fields": []
},
{
"payment_method_type": "bank_debit",
"payment_method_subtype": "sepa",
"required_fields": []
},
{
"payment_method_type": "bank_debit",
"payment_method_subtype": "bacs",
"required_fields": []
},
{
"payment_method_type": "bank_debit",
"payment_method_subtype": "becs",
"required_fields": []
}
]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
afcf1ef56bf61b84bd9d1070a22964ae4c08c5fc
|
|
juspay/hyperswitch
|
juspay__hyperswitch-7033
|
Bug: refactor(RouterData): Add customer email and brower Information
Refactoring RouterData for v2.
Refactored customer email and browser information fields.
|
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 2517559e2fc..2f8594662eb 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -491,6 +491,27 @@ pub struct BrowserInformation {
pub device_model: Option<String>,
}
+#[cfg(feature = "v2")]
+impl From<common_utils::types::BrowserInformation> for BrowserInformation {
+ fn from(value: common_utils::types::BrowserInformation) -> Self {
+ Self {
+ color_depth: value.color_depth,
+ java_enabled: value.java_enabled,
+ java_script_enabled: value.java_script_enabled,
+ language: value.language,
+ screen_height: value.screen_height,
+ screen_width: value.screen_width,
+ time_zone: value.time_zone,
+ ip_address: value.ip_address,
+ accept_header: value.accept_header,
+ user_agent: value.user_agent,
+ os_type: value.os_type,
+ os_version: value.os_version,
+ device_model: value.device_model,
+ }
+ }
+}
+
#[derive(Debug, Clone, Default, Serialize)]
pub enum ResponseId {
ConnectorTransactionId(String),
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 70db7a581a2..80c10a294ec 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -241,6 +241,17 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
.map(|id| id.get_string_repr().to_owned())
.unwrap_or(payment_data.payment_attempt.id.get_string_repr().to_owned());
+ let email = customer
+ .as_ref()
+ .and_then(|customer| customer.email.clone())
+ .map(pii::Email::from);
+
+ let browser_info = payment_data
+ .payment_attempt
+ .browser_info
+ .clone()
+ .map(types::BrowserInformation::from);
+
// TODO: few fields are repeated in both routerdata and request
let request = types::PaymentsAuthorizeData {
payment_method_data: payment_data
@@ -262,8 +273,8 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
minor_amount: payment_data.payment_attempt.amount_details.get_net_amount(),
order_tax_amount: None,
currency: payment_data.payment_intent.amount_details.currency,
- browser_info: None,
- email: None,
+ browser_info,
+ email,
customer_name: None,
payment_experience: None,
order_details: None,
|
2025-01-13T10:01:16Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Refactored customer email and browser information in router data
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
This refactoring provides data to the connector integrations, so that it can be used in connector calls.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Confirm Intent API Call for trustpay connector.
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_01945e865f697553bbf0eb847611cfcd/confirm-intent' \
--header 'x-client-secret: 1secret-client-secret' \
--header 'x-profile-id: pro_id' \
--header 'Content-Type: application/json' \
--header 'api-key: api-key' \
--data '{
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "01",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"card_cvc": "100"
}
},
"payment_method_type": "card",
"payment_method_subtype": "credit",
"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"
}
}'
```
- Response from above call
```
{
"id": "12345_pay_01945f254dc27802a54be556c0acab7a",
"status": "failed",
"amount": {
"order_amount": 100,
"currency": "USD",
"shipping_cost": null,
"order_tax_amount": null,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": null,
"tax_on_surcharge": null,
"net_amount": 100,
"amount_to_capture": null,
"amount_capturable": 0,
"amount_captured": null
},
"customer_id": "12345_cus_01945f252cb37e20a6fb6105be0c976f",
"connector": "trustpay",
"client_secret": "12345_pay_01945f254dc27802a54be556c0acab7a_secret_01945f254ddd7cb385275b8d620bbb24",
"created": "2025-01-13T10:11:07.869Z",
"payment_method_data": {
"billing": null
},
"payment_method_type": "card",
"payment_method_subtype": "credit",
"next_action": null,
"connector_transaction_id": null,
"connector_reference_id": null,
"merchant_connector_id": "mca_lZ6moeYo6Ce2vdD01f7s",
"browser_info": null,
"error": {
"code": "4",
"message": "The field Reference must be a string with a maximum length of 35.",
"unified_code": null,
"unified_message": null
}
}
```
- This refactoring fixes availability of email and browser information fields for trustpay.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
1d993055d221eba72c81e3ba0c0b0e6a7e1313a0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.