hash
stringlengths 40
40
| date
stringdate 2022-11-17 13:04:47
2025-03-21 17:04:41
| author
stringclasses 141
values | commit_message
stringlengths 22
166
| is_merge
bool 1
class | git_diff
stringlengths 238
9.63M
| type
stringclasses 17
values | masked_commit_message
stringlengths 6
143
|
|---|---|---|---|---|---|---|---|
7b306a9015a55b573731414c210d4c684c802f7a
|
2025-01-10 14:46:37
|
Debarati Ghatak
|
feat(connector): [Novalnet] Add zero auth mandate (#6631)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index 99da9c5cace..0a47c8ccfba 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -28,7 +28,7 @@ use hyperswitch_domain_models::{
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
- PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,
},
};
use hyperswitch_interfaces::{
@@ -231,6 +231,79 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
for Novalnet
{
+ fn get_headers(
+ &self,
+ req: &SetupMandateRouterData,
+ 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: &SetupMandateRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let endpoint = self.base_url(connectors);
+ Ok(format!("{}/payment", endpoint))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &SetupMandateRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = novalnet::NovalnetPaymentsRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &SetupMandateRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::SetupMandateType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::SetupMandateType::get_headers(self, req, connectors)?)
+ .set_body(types::SetupMandateType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &SetupMandateRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<SetupMandateRouterData, errors::ConnectorError> {
+ let response: novalnet::NovalnetPaymentsResponse = res
+ .response
+ .parse_struct("Novalnet PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Novalnet {
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 0a70393a13c..d62d3d2a755 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -17,7 +17,7 @@ use hyperswitch_domain_models::{
},
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
- PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,
},
};
use hyperswitch_interfaces::errors;
@@ -28,8 +28,9 @@ use strum::Display;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, ApplePay, PaymentsAuthorizeRequestData, PaymentsCancelRequestData,
- PaymentsCaptureRequestData, PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
+ self, AddressDetailsData, ApplePay, PaymentsAuthorizeRequestData,
+ PaymentsCancelRequestData, PaymentsCaptureRequestData, PaymentsSetupMandateRequestData,
+ PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
},
};
@@ -47,6 +48,19 @@ impl<T> From<(StringMinorUnit, T)> for NovalnetRouterData<T> {
}
}
+const MINIMAL_CUSTOMER_DATA_PASSED: i64 = 1;
+const CREATE_TOKEN_REQUIRED: i8 = 1;
+
+const TEST_MODE_ENABLED: i8 = 1;
+const TEST_MODE_DISABLED: i8 = 0;
+
+fn get_test_mode(item: Option<bool>) -> i8 {
+ match item {
+ Some(true) => TEST_MODE_ENABLED,
+ Some(false) | None => TEST_MODE_DISABLED,
+ }
+}
+
#[derive(Debug, Copy, Serialize, Deserialize, Clone)]
pub enum NovalNetPaymentTypes {
CREDITCARD,
@@ -117,11 +131,18 @@ pub struct NovalnetCustom {
lang: String,
}
+#[derive(Debug, Serialize, Deserialize, Clone)]
+#[serde(untagged)]
+pub enum NovalNetAmount {
+ StringMinor(StringMinorUnit),
+ Int(i64),
+}
+
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct NovalnetPaymentsRequestTransaction {
test_mode: i8,
payment_type: NovalNetPaymentTypes,
- amount: StringMinorUnit,
+ amount: NovalNetAmount,
currency: common_enums::Currency,
order_no: String,
payment_data: Option<NovalNetPaymentData>,
@@ -171,10 +192,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
enums::AuthenticationType::ThreeDs => Some(1),
enums::AuthenticationType::NoThreeDs => None,
};
- let test_mode = match item.router_data.test_mode {
- Some(true) => 1,
- Some(false) | None => 0,
- };
+ let test_mode = get_test_mode(item.router_data.test_mode);
let billing = NovalnetPaymentsRequestBilling {
house_no: item.router_data.get_optional_billing_line1(),
@@ -197,7 +215,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
mobile: item.router_data.get_optional_billing_phone_number(),
billing: Some(billing),
// no_nc is used to indicate if minimal customer data is passed or not
- no_nc: 1,
+ no_nc: MINIMAL_CUSTOMER_DATA_PASSED,
};
let lang = item
@@ -209,7 +227,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let hook_url = item.router_data.request.get_webhook_url()?;
let return_url = item.router_data.request.get_router_return_url()?;
let create_token = if item.router_data.request.is_mandate_payment() {
- Some(1)
+ Some(CREATE_TOKEN_REQUIRED)
} else {
None
};
@@ -234,7 +252,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
payment_type: NovalNetPaymentTypes::CREDITCARD,
- amount: item.amount.clone(),
+ amount: NovalNetAmount::StringMinor(item.amount.clone()),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
@@ -265,7 +283,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
payment_type: NovalNetPaymentTypes::GOOGLEPAY,
- amount: item.amount.clone(),
+ amount: NovalNetAmount::StringMinor(item.amount.clone()),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
@@ -287,7 +305,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
payment_type: NovalNetPaymentTypes::APPLEPAY,
- amount: item.amount.clone(),
+ amount: NovalNetAmount::StringMinor(item.amount.clone()),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
@@ -331,7 +349,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
payment_type: NovalNetPaymentTypes::PAYPAL,
- amount: item.amount.clone(),
+ amount: NovalNetAmount::StringMinor(item.amount.clone()),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
@@ -389,7 +407,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
payment_type,
- amount: item.amount.clone(),
+ amount: NovalNetAmount::StringMinor(item.amount.clone()),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
@@ -1380,3 +1398,194 @@ pub fn get_novalnet_dispute_status(status: WebhookEventType) -> WebhookDisputeSt
pub fn option_to_result<T>(opt: Option<T>) -> Result<T, errors::ConnectorError> {
opt.ok_or(errors::ConnectorError::WebhookBodyDecodingFailed)
}
+
+impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &SetupMandateRouterData) -> Result<Self, Self::Error> {
+ let auth = NovalnetAuthType::try_from(&item.connector_auth_type)?;
+
+ let merchant = NovalnetPaymentsRequestMerchant {
+ signature: auth.product_activation_key,
+ tariff: auth.tariff_id,
+ };
+
+ let enforce_3d = match item.auth_type {
+ enums::AuthenticationType::ThreeDs => Some(1),
+ enums::AuthenticationType::NoThreeDs => None,
+ };
+ let test_mode = get_test_mode(item.test_mode);
+ let req_address = item.get_billing_address()?.to_owned();
+
+ let billing = NovalnetPaymentsRequestBilling {
+ house_no: item.get_optional_billing_line1(),
+ street: item.get_optional_billing_line2(),
+ city: item.get_optional_billing_city().map(Secret::new),
+ zip: item.get_optional_billing_zip(),
+ country_code: item.get_optional_billing_country(),
+ };
+
+ let customer = NovalnetPaymentsRequestCustomer {
+ first_name: req_address.get_first_name()?.clone(),
+ last_name: req_address.get_last_name()?.clone(),
+ email: item.request.get_email()?.clone(),
+ mobile: item.get_optional_billing_phone_number(),
+ billing: Some(billing),
+ // no_nc is used to indicate if minimal customer data is passed or not
+ no_nc: MINIMAL_CUSTOMER_DATA_PASSED,
+ };
+
+ let lang = item
+ .request
+ .get_optional_language_from_browser_info()
+ .unwrap_or(consts::DEFAULT_LOCALE.to_string().to_string());
+
+ let custom = NovalnetCustom { lang };
+ let hook_url = item.request.get_webhook_url()?;
+ let return_url = item.request.get_return_url()?;
+ let create_token = Some(CREATE_TOKEN_REQUIRED);
+
+ match item.request.payment_method_data {
+ PaymentMethodData::Card(ref req_card) => {
+ let novalnet_card = NovalNetPaymentData::Card(NovalnetCard {
+ card_number: req_card.card_number.clone(),
+ 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(),
+ });
+
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::CREDITCARD,
+ amount: NovalNetAmount::Int(0),
+ currency: item.request.currency,
+ order_no: item.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: Some(return_url.clone()),
+ error_return_url: Some(return_url.clone()),
+ payment_data: Some(novalnet_card),
+ enforce_3d,
+ create_token,
+ };
+
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+
+ PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
+ WalletDataPaymentMethod::GooglePay(ref req_wallet) => {
+ let novalnet_google_pay: NovalNetPaymentData =
+ NovalNetPaymentData::GooglePay(NovalnetGooglePay {
+ wallet_data: Secret::new(req_wallet.tokenization_data.token.clone()),
+ });
+
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::GOOGLEPAY,
+ amount: NovalNetAmount::Int(0),
+ currency: item.request.currency,
+ order_no: item.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: None,
+ error_return_url: None,
+ payment_data: Some(novalnet_google_pay),
+ enforce_3d,
+ create_token,
+ };
+
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+ WalletDataPaymentMethod::ApplePay(payment_method_data) => {
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::APPLEPAY,
+ amount: NovalNetAmount::Int(0),
+ currency: item.request.currency,
+ order_no: item.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: None,
+ error_return_url: None,
+ payment_data: Some(NovalNetPaymentData::ApplePay(NovalnetApplePay {
+ wallet_data: Secret::new(payment_method_data.payment_data.clone()),
+ })),
+ enforce_3d: None,
+ create_token,
+ };
+
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+ WalletDataPaymentMethod::AliPayQr(_)
+ | WalletDataPaymentMethod::AliPayRedirect(_)
+ | WalletDataPaymentMethod::AliPayHkRedirect(_)
+ | WalletDataPaymentMethod::MomoRedirect(_)
+ | WalletDataPaymentMethod::KakaoPayRedirect(_)
+ | WalletDataPaymentMethod::GoPayRedirect(_)
+ | WalletDataPaymentMethod::GcashRedirect(_)
+ | WalletDataPaymentMethod::ApplePayRedirect(_)
+ | WalletDataPaymentMethod::ApplePayThirdPartySdk(_)
+ | WalletDataPaymentMethod::DanaRedirect {}
+ | WalletDataPaymentMethod::GooglePayRedirect(_)
+ | WalletDataPaymentMethod::GooglePayThirdPartySdk(_)
+ | WalletDataPaymentMethod::MbWayRedirect(_)
+ | WalletDataPaymentMethod::MobilePayRedirect(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("novalnet"),
+ ))?
+ }
+ WalletDataPaymentMethod::PaypalRedirect(_) => {
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::PAYPAL,
+ amount: NovalNetAmount::Int(0),
+ currency: item.request.currency,
+ order_no: item.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: Some(return_url.clone()),
+ error_return_url: Some(return_url.clone()),
+ payment_data: None,
+ enforce_3d: None,
+ create_token,
+ };
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+ WalletDataPaymentMethod::PaypalSdk(_)
+ | WalletDataPaymentMethod::Paze(_)
+ | WalletDataPaymentMethod::SamsungPay(_)
+ | WalletDataPaymentMethod::TwintRedirect {}
+ | WalletDataPaymentMethod::VippsRedirect {}
+ | WalletDataPaymentMethod::TouchNGoRedirect(_)
+ | WalletDataPaymentMethod::WeChatPayRedirect(_)
+ | WalletDataPaymentMethod::CashappQr(_)
+ | WalletDataPaymentMethod::SwishQr(_)
+ | WalletDataPaymentMethod::WeChatPayQr(_)
+ | WalletDataPaymentMethod::Mifinity(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("novalnet"),
+ ))?
+ }
+ },
+ _ => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("novalnet"),
+ ))?,
+ }
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 9061a758bea..169e5ae146e 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1595,6 +1595,9 @@ pub trait PaymentsSetupMandateRequestData {
fn get_email(&self) -> Result<Email, Error>;
fn get_router_return_url(&self) -> Result<String, Error>;
fn is_card(&self) -> bool;
+ fn get_return_url(&self) -> Result<String, Error>;
+ fn get_webhook_url(&self) -> Result<String, Error>;
+ fn get_optional_language_from_browser_info(&self) -> Option<String>;
}
impl PaymentsSetupMandateRequestData for SetupMandateRequestData {
@@ -1614,6 +1617,21 @@ impl PaymentsSetupMandateRequestData for SetupMandateRequestData {
fn is_card(&self) -> bool {
matches!(self.payment_method_data, PaymentMethodData::Card(_))
}
+ fn get_return_url(&self) -> Result<String, Error> {
+ self.router_return_url
+ .clone()
+ .ok_or_else(missing_field_err("return_url"))
+ }
+ fn get_webhook_url(&self) -> Result<String, Error> {
+ self.webhook_url
+ .clone()
+ .ok_or_else(missing_field_err("webhook_url"))
+ }
+ fn get_optional_language_from_browser_info(&self) -> Option<String> {
+ self.browser_info
+ .clone()
+ .and_then(|browser_info| browser_info.language)
+ }
}
pub trait PaymentMethodTokenizationRequestData {
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index aa9fb2b5f1f..2517559e2fc 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -871,6 +871,7 @@ pub struct SetupMandateRequestData {
pub off_session: Option<bool>,
pub setup_mandate_details: Option<mandates::MandateData>,
pub router_return_url: Option<String>,
+ pub webhook_url: Option<String>,
pub browser_info: Option<BrowserInformation>,
pub email: Option<pii::Email>,
pub customer_name: Option<Secret<String>>,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index cbf2cdea538..1ba6209cf52 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6564,8 +6564,17 @@ pub async fn payment_external_authentication(
&payment_attempt.clone(),
payment_connector_name,
));
- let webhook_url =
- helpers::create_webhook_url(&state.base_url, merchant_id, &authentication_connector);
+ let mca_id_option = merchant_connector_account.get_mca_id(); // Bind temporary value
+ let merchant_connector_account_id_or_connector_name = mca_id_option
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .unwrap_or(&authentication_connector);
+
+ let webhook_url = helpers::create_webhook_url(
+ &state.base_url,
+ merchant_id,
+ merchant_connector_account_id_or_connector_name,
+ );
let authentication_details = business_profile
.authentication_connector_details
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 7f6e8c7fc86..262639e4615 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1241,17 +1241,18 @@ pub fn create_authorize_url(
}
pub fn create_webhook_url(
- router_base_url: &String,
+ router_base_url: &str,
merchant_id: &id_type::MerchantId,
- connector_name: impl std::fmt::Display,
+ merchant_connector_id_or_connector_name: &str,
) -> String {
format!(
"{}/webhooks/{}/{}",
router_base_url,
merchant_id.get_string_repr(),
- connector_name
+ merchant_connector_id_or_connector_name,
)
}
+
pub fn create_complete_authorize_url(
router_base_url: &String,
payment_attempt: &PaymentAttempt,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index c6686912193..70db7a581a2 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -225,7 +225,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
let webhook_url = Some(helpers::create_webhook_url(
router_base_url,
&attempt.merchant_id,
- connector_id,
+ merchant_connector_account.get_id().get_string_repr(),
));
let router_return_url = payment_data
@@ -2751,11 +2751,17 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
attempt,
connector_name,
));
+ let merchant_connector_account_id_or_connector_name = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .unwrap_or(connector_name);
let webhook_url = Some(helpers::create_webhook_url(
router_base_url,
&attempt.merchant_id,
- connector_name,
+ merchant_connector_account_id_or_connector_name,
));
let router_return_url = Some(helpers::create_redirect_url(
router_base_url,
@@ -3575,6 +3581,18 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
.map(|customer| customer.clone().into_inner())
});
let amount = payment_data.payment_attempt.get_total_amount();
+ let merchant_connector_account_id_or_connector_name = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .unwrap_or(connector_name);
+ let webhook_url = Some(helpers::create_webhook_url(
+ router_base_url,
+ &attempt.merchant_id,
+ merchant_connector_account_id_or_connector_name,
+ ));
+
Ok(Self {
currency: payment_data.currency,
confirm: true,
@@ -3604,6 +3622,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
),
metadata: payment_data.payment_intent.metadata.clone().map(Into::into),
shipping_cost: payment_data.payment_intent.shipping_cost,
+ webhook_url,
})
}
}
@@ -3770,11 +3789,16 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProce
.collect::<Result<Vec<_>, _>>()
})
.transpose()?;
-
+ let merchant_connector_account_id_or_connector_name = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .unwrap_or(connector_name);
let webhook_url = Some(helpers::create_webhook_url(
router_base_url,
&attempt.merchant_id,
- connector_name,
+ merchant_connector_account_id_or_connector_name,
));
let router_return_url = Some(helpers::create_redirect_url(
router_base_url,
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index 0829934fdc7..7c485ab4304 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -32,7 +32,7 @@ pub async fn construct_relay_refund_router_data<'a, F>(
let webhook_url = Some(payments::helpers::create_webhook_url(
&state.base_url.clone(),
merchant_id,
- connector_name,
+ connector_account.get_id().get_string_repr(),
));
let supported_connector = &state
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index fac89112df8..5e126310fa6 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -288,11 +288,16 @@ pub async fn construct_refund_router_data<'a, F>(
.payment_method
.get_required_value("payment_method_type")
.change_context(errors::ApiErrorResponse::InternalServerError)?;
+ let merchant_connector_account_id_or_connector_name = payment_attempt
+ .merchant_connector_id
+ .as_ref()
+ .map(|mca_id| mca_id.get_string_repr())
+ .unwrap_or(connector_id);
let webhook_url = Some(helpers::create_webhook_url(
&state.base_url.clone(),
merchant_account.get_id(),
- connector_id,
+ merchant_connector_account_id_or_connector_name,
));
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
index 52e6acd6481..049997c541c 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
@@ -6,6 +6,31 @@ const successfulThreeDSTestCardDetails = {
card_cvc: "123",
};
+const successfulNo3DSCardDetails = {
+ card_number: "4242424242424242",
+ card_exp_month: "01",
+ card_exp_year: "50",
+ card_holder_name: "joseph Doe",
+ card_cvc: "123",
+};
+
+const singleUseMandateData = {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ mandate_type: {
+ single_use: {
+ amount: 8000,
+ currency: "EUR",
+ },
+ },
+};
+
export const connectorDetails = {
card_pm: {
PaymentIntent: {
@@ -206,6 +231,87 @@ export const connectorDetails = {
},
},
},
+ SaveCardConfirmAutoCaptureOffSession: {
+ Request: {
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ trigger_skip: true,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ PaymentIntentOffSession: {
+ Request: {
+ currency: "EUR",
+ amount: 6500,
+ authentication_type: "no_three_ds",
+ customer_acceptance: null,
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ trigger_skip: true,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "off_session",
+ },
+ },
+ },
+ ZeroAuthPaymentIntent: {
+ Request: {
+ amount: 0,
+ setup_future_usage: "off_session",
+ currency: "EUR",
+ },
+ Response: {
+ status: 200,
+ trigger_skip: true,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "off_session",
+ },
+ },
+ },
+ ZeroAuthMandate: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ trigger_skip: true,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ ZeroAuthConfirmPayment: {
+ Request: {
+ payment_type: "setup_mandate",
+ payment_method: "card",
+ payment_method_type: "credit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Novalnet is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
},
pm_list: {
PmListResponse: {
|
feat
|
[Novalnet] Add zero auth mandate (#6631)
|
087932f06044454570c971def0e82dc3d838598c
|
2024-03-05 12:10:29
|
cb-alfredjoseph
|
fix(router): [nuvei] Nuvei error handling for payment declined status and included tests (#3832)
| false
|
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index eef33616cea..1312eadadf7 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -1367,7 +1367,7 @@ fn build_error_response<T>(
http_code,
));
match response.transaction_status {
- Some(NuveiTransactionStatus::Error) => err,
+ Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
_ => match response
.gw_error_reason
.as_ref()
diff --git a/postman/collection-dir/nuvei/.auth.json b/postman/collection-dir/nuvei/.auth.json
new file mode 100644
index 00000000000..915a2835790
--- /dev/null
+++ b/postman/collection-dir/nuvei/.auth.json
@@ -0,0 +1,22 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/nuvei/.event.meta.json b/postman/collection-dir/nuvei/.event.meta.json
new file mode 100644
index 00000000000..2df9d47d936
--- /dev/null
+++ b/postman/collection-dir/nuvei/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.prerequest.js",
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/.info.json b/postman/collection-dir/nuvei/.info.json
new file mode 100644
index 00000000000..b1f71f3eee2
--- /dev/null
+++ b/postman/collection-dir/nuvei/.info.json
@@ -0,0 +1,9 @@
+{
+ "info": {
+ "_postman_id": "d329ee53-0de4-4154-b0b1-78708ec6e708",
+ "name": "nuvei",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "19204656"
+ }
+}
diff --git a/postman/collection-dir/nuvei/.meta.json b/postman/collection-dir/nuvei/.meta.json
new file mode 100644
index 00000000000..91b6a65c5bc
--- /dev/null
+++ b/postman/collection-dir/nuvei/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Health check",
+ "Flow Testcases"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/.variable.json b/postman/collection-dir/nuvei/.variable.json
new file mode 100644
index 00000000000..84482b418fb
--- /dev/null
+++ b/postman/collection-dir/nuvei/.variable.json
@@ -0,0 +1,86 @@
+{
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "https://sandbox.hyperswitch.io",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/.meta.json b/postman/collection-dir/nuvei/Flow Testcases/.meta.json
new file mode 100644
index 00000000000..78d8ddcf5bb
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "QuickStart",
+ "Variation Cases"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/.meta.json
new file mode 100644
index 00000000000..c4939d7ab91
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/.meta.json
@@ -0,0 +1,11 @@
+{
+ "childrenOrder": [
+ "Merchant Account - Create",
+ "API Key - Create",
+ "Payment Connector - Create",
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/event.test.js
new file mode 100644
index 00000000000..4e27c5a5025
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/event.test.js
@@ -0,0 +1,46 @@
+// Validate status 2xx
+pm.test("[POST]::/api_keys/:merchant_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/api_keys/:merchant_id - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id
+if (jsonData?.key_id) {
+ pm.collectionVariables.set("api_key_id", jsonData.key_id);
+ console.log(
+ "- use {{api_key_id}} as collection variable for value",
+ jsonData.key_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/request.json
new file mode 100644
index 00000000000..4e4c6628497
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/request.json
@@ -0,0 +1,52 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw_json_formatted": {
+ "name": "API Key 1",
+ "description": null,
+ "expiration": "2069-09-23T01:02:03.000Z"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/API Key - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
new file mode 100644
index 00000000000..7de0d5beb31
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
@@ -0,0 +1,56 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/accounts - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id
+if (jsonData?.merchant_id) {
+ pm.collectionVariables.set("merchant_id", jsonData.merchant_id);
+ console.log(
+ "- use {{merchant_id}} as collection variable for value",
+ jsonData.merchant_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key
+if (jsonData?.publishable_key) {
+ pm.collectionVariables.set("publishable_key", jsonData.publishable_key);
+ console.log(
+ "- use {{publishable_key}} as collection variable for value",
+ jsonData.publishable_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/request.json
new file mode 100644
index 00000000000..ffeea3410a4
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/request.json
@@ -0,0 +1,95 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "merchant_id": "postman_merchant_GHAction_{{$guid}}",
+ "locker_id": "m0010",
+ "merchant_name": "NewAge Retailer",
+ "primary_business_details": [
+ {
+ "country": "US",
+ "business": "default"
+ }
+ ],
+ "merchant_details": {
+ "primary_contact_person": "John Test",
+ "primary_email": "[email protected]",
+ "primary_phone": "sunt laborum",
+ "secondary_contact_person": "John Test2",
+ "secondary_email": "[email protected]",
+ "secondary_phone": "cillum do dolor id",
+ "website": "www.example.com",
+ "about_business": "Online Retail with a wide selection of organic products for North America",
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US"
+ }
+ },
+ "return_url": "https://duck.com",
+ "webhook_details": {
+ "webhook_version": "1.0.1",
+ "webhook_username": "ekart_retail",
+ "webhook_password": "password_ekart@123",
+ "payment_created_enabled": true,
+ "payment_succeeded_enabled": true,
+ "payment_failed_enabled": true
+ },
+ "sub_merchants_enabled": false,
+ "metadata": {
+ "city": "NY",
+ "unit": "245"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Merchant Account - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/event.prerequest.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
new file mode 100644
index 00000000000..88e92d8d84a
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test(
+ "[POST]::/account/:account_id/connectors - Status code is 2xx",
+ function () {
+ pm.response.to.be.success;
+ },
+);
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/account/:account_id/connectors - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id
+if (jsonData?.merchant_connector_id) {
+ pm.collectionVariables.set(
+ "merchant_connector_id",
+ jsonData.merchant_connector_id,
+ );
+ console.log(
+ "- use {{merchant_connector_id}} as collection variable for value",
+ jsonData.merchant_connector_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/request.json
new file mode 100644
index 00000000000..32e3afc6348
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -0,0 +1,98 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "connector_type": "payment_processor",
+ "connector_name": "nuvei",
+ "connector_account_details": {
+ "auth_type": "SignatureKey",
+ "key1": "{{connector_key1}}",
+ "api_key": "{{connector_api_key}}",
+ "api_secret": "{{connector_api_secret}}"
+ },
+ "test_mode": true,
+ "disabled": false,
+ "payment_methods_enabled": [
+ {
+ "payment_method": "card",
+ "payment_method_types": [
+ {
+ "payment_method_type": "credit",
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ },
+ {
+ "payment_method": "card",
+ "payment_method_types": [
+ {
+ "payment_method_type": "debit",
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payment Connector - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..27965bb9c01
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.test.js
new file mode 100644
index 00000000000..dc285fb1afe
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/event.test.js
@@ -0,0 +1,66 @@
+pm.environment.set("random_number", _.random(1000, 100000));
+
+// Set the environment variable 'amount' with the value from the response
+pm.environment.set("amount", pm.response.json().amount);
+
+// 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.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/request.json
new file mode 100644
index 00000000000..9ca781cb8f8
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..bbd8e544e2c
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
@@ -0,0 +1,30 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..203cc8ad8d1
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique 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/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..61f29c86540
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/event.test.js
@@ -0,0 +1,33 @@
+// Get the value of 'amount' from the environment
+const amount = pm.environment.get("amount");
+
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/request.json
new file mode 100644
index 00000000000..e9cb375957e
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/request.json
@@ -0,0 +1,32 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{amount}},\n \"reason\": \"Customer returned product\",\n \"refund_type\": \"instant\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..bbd8e544e2c
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
@@ -0,0 +1,30 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/request.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..06b44cf7fd3
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "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/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/response.json b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/QuickStart/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/.meta.json
new file mode 100644
index 00000000000..8ae4ccb0019
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Scenario1- Create Payment with Invalid card",
+ "Scenario1- Payment Decline scenario"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/.meta.json
new file mode 100644
index 00000000000..10f13eaa42a
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create(Expired Card)",
+ "Payments - Create(Invalid CVV)",
+ "Payments - Create(Lost Card)"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/event.test.js
new file mode 100644
index 00000000000..f6232ceea45
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Expired Card"
+pm.test("[POST]::/payments - Content check if 'error_message : Expired Card' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Expired Card");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/request.json
new file mode 100644
index 00000000000..6bfc1515950
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4000247422310226",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Expired Card)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/event.test.js
new file mode 100644
index 00000000000..4dee6c97027
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Invalid CVV"
+pm.test("[POST]::/payments - Content check if 'error_message : Invalid CVV' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Invalid CVV");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/request.json
new file mode 100644
index 00000000000..f936588a9f5
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "5333583123003909",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Invalid CVV)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/event.test.js
new file mode 100644
index 00000000000..c603c454610
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Lost/Stolen"
+pm.test("[POST]::/payments - Content check if 'error_message : Lost/Stolen' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Lost/Stolen");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/request.json
new file mode 100644
index 00000000000..9d317ce5293
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "5333452804487502",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Create Payment with Invalid card/Payments - Create(Lost Card)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/.meta.json
new file mode 100644
index 00000000000..c0cc1f23cc1
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create(Decline)",
+ "Payments - Create(Do Not Honor)",
+ "Payments - Create(Insufficient Funds)"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/event.test.js
new file mode 100644
index 00000000000..354776fa309
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Decline"
+pm.test("[POST]::/payments - Content check if 'error_message : Decline' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Decline");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/request.json
new file mode 100644
index 00000000000..93f6d30da08
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "375521501910816",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Decline)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/event.test.js
new file mode 100644
index 00000000000..c2070d7a153
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Do Not Honor"
+pm.test("[POST]::/payments - Content check if 'error_message : Do Not Honor' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Do Not Honor");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/request.json
new file mode 100644
index 00000000000..b9cbf1fa7a5
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "5333463046218753",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Do Not Honor)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/.event.meta.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/event.test.js b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/event.test.js
new file mode 100644
index 00000000000..09d39c6965c
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/event.test.js
@@ -0,0 +1,73 @@
+pm.environment.set("random_number", _.random(100, 100000));
+
+// 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 "error_message: Insufficient Funds"
+pm.test("[POST]::/payments - Content check if 'error_message : Insufficient Funds' exists", function () {
+ pm.expect(jsonData.error_message).to.eql("Insufficient Funds");
+});
+
+
+
diff --git a/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/request.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/request.json
new file mode 100644
index 00000000000..41edc08e2f9
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/request.json
@@ -0,0 +1,111 @@
+{
+ "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": 100,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "connector": [
+ "nuvei"
+ ],
+ "customer_id": "futurebilling",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "testing",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "setup_future_usage": "off_session",
+ "payment_method_data": {
+ "card": {
+ "card_number": "5333475572200849",
+ "card_exp_month": "12",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 100,
+ "currency": "USD",
+ "metadata": {
+ "frequency": "1"
+ },
+ "end_date": "2025-05-03T04:07:52.723Z"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "jkjj Street",
+ "line3": "no 1111 Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "JP",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "127.0.0.1"
+ }
+ }
+ },
+ "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/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/response.json b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Flow Testcases/Variation Cases/Scenario1- Payment Decline scenario/Payments - Create(Insufficient Funds)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/Health check/.meta.json b/postman/collection-dir/nuvei/Health check/.meta.json
new file mode 100644
index 00000000000..66ee7e50cab
--- /dev/null
+++ b/postman/collection-dir/nuvei/Health check/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "New Request"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Health check/New Request/.event.meta.json b/postman/collection-dir/nuvei/Health check/New Request/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/nuvei/Health check/New Request/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/nuvei/Health check/New Request/event.test.js b/postman/collection-dir/nuvei/Health check/New Request/event.test.js
new file mode 100644
index 00000000000..b490b8be090
--- /dev/null
+++ b/postman/collection-dir/nuvei/Health check/New Request/event.test.js
@@ -0,0 +1,4 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
diff --git a/postman/collection-dir/nuvei/Health check/New Request/request.json b/postman/collection-dir/nuvei/Health check/New Request/request.json
new file mode 100644
index 00000000000..4cc8d4b1a96
--- /dev/null
+++ b/postman/collection-dir/nuvei/Health check/New Request/request.json
@@ -0,0 +1,20 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+}
diff --git a/postman/collection-dir/nuvei/Health check/New Request/response.json b/postman/collection-dir/nuvei/Health check/New Request/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/nuvei/Health check/New Request/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/nuvei/event.prerequest.js b/postman/collection-dir/nuvei/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/nuvei/event.test.js b/postman/collection-dir/nuvei/event.test.js
new file mode 100644
index 00000000000..fb52caec30f
--- /dev/null
+++ b/postman/collection-dir/nuvei/event.test.js
@@ -0,0 +1,13 @@
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log("[LOG]::payment_id - " + jsonData.payment_id);
+}
+
+console.log("[LOG]::x-request-id - " + pm.response.headers.get("x-request-id"));
diff --git a/postman/collection-json/nuvei.postman_collection.json b/postman/collection-json/nuvei.postman_collection.json
new file mode 100644
index 00000000000..4c6b80a3d5c
--- /dev/null
+++ b/postman/collection-json/nuvei.postman_collection.json
@@ -0,0 +1,1662 @@
+
+{
+ "info": {
+ "_postman_id": "d329ee53-0de4-4154-b0b1-78708ec6e708",
+ "name": "nuvei",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "19204656"
+ },
+ "item": [
+ {
+ "name": "Health check",
+ "item": [
+ {
+ "name": "New Request",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Flow Testcases",
+ "item": [
+ {
+ "name": "QuickStart",
+ "item": [
+ {
+ "name": "Merchant Account - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id",
+ "if (jsonData?.merchant_id) {",
+ " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);",
+ " console.log(",
+ " \"- use {{merchant_id}} as collection variable for value\",",
+ " jsonData.merchant_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key",
+ "if (jsonData?.publishable_key) {",
+ " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);",
+ " console.log(",
+ " \"- use {{publishable_key}} as collection variable for value\",",
+ " jsonData.publishable_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"merchant_id\":\"postman_merchant_GHAction_{{$guid}}\",\"locker_id\":\"m0010\",\"merchant_name\":\"NewAge Retailer\",\"primary_business_details\":[{\"country\":\"US\",\"business\":\"default\"}],\"merchant_details\":{\"primary_contact_person\":\"John Test\",\"primary_email\":\"[email protected]\",\"primary_phone\":\"sunt laborum\",\"secondary_contact_person\":\"John Test2\",\"secondary_email\":\"[email protected]\",\"secondary_phone\":\"cillum do dolor id\",\"website\":\"www.example.com\",\"about_business\":\"Online Retail with a wide selection of organic products for North America\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"return_url\":\"https://duck.com\",\"webhook_details\":{\"webhook_version\":\"1.0.1\",\"webhook_username\":\"ekart_retail\",\"webhook_password\":\"password_ekart@123\",\"payment_created_enabled\":true,\"payment_succeeded_enabled\":true,\"payment_failed_enabled\":true},\"sub_merchants_enabled\":false,\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+ },
+ "response": []
+ },
+ {
+ "name": "API Key - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id",
+ "if (jsonData?.key_id) {",
+ " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);",
+ " console.log(",
+ " \"- use {{api_key_id}} as collection variable for value\",",
+ " jsonData.key_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Payment Connector - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",",
+ " function () {",
+ " pm.response.to.be.success;",
+ " },",
+ ");",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id",
+ "if (jsonData?.merchant_connector_id) {",
+ " pm.collectionVariables.set(",
+ " \"merchant_connector_id\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ " console.log(",
+ " \"- use {{merchant_connector_id}} as collection variable for value\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"connector_type\":\"payment_processor\",\"connector_name\":\"nuvei\",\"connector_account_details\":{\"auth_type\":\"SignatureKey\",\"key1\":\"{{connector_key1}}\",\"api_key\":\"{{connector_api_key}}\",\"api_secret\":\"{{connector_api_secret}}\"},\"test_mode\":true,\"disabled\":false,\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"debit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}]}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ "",
+ "// Set the environment variable 'amount' with the value from the response",
+ "pm.environment.set(\"amount\", pm.response.json().amount);",
+ "",
+ "// 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.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique 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"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// 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.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{amount}},\n \"reason\": \"Customer returned product\",\n \"refund_type\": \"instant\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "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"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Variation Cases",
+ "item": [
+ {
+ "name": "Scenario1- Create Payment with Invalid card",
+ "item": [
+ {
+ "name": "Payments - Create(Expired Card)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Expired Card\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Expired Card' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Expired Card\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000247422310226\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Invalid CVV)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Invalid CVV\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Invalid CVV' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Invalid CVV\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"5333583123003909\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Lost Card)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Lost/Stolen\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Lost/Stolen' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Lost/Stolen\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"5333452804487502\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario1- Payment Decline scenario",
+ "item": [
+ {
+ "name": "Payments - Create(Decline)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Decline\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Decline' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Decline\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"375521501910816\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Do Not Honor)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Do Not Honor\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Do Not Honor' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Do Not Honor\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"5333463046218753\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Insufficient Funds)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "",
+ "// 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 \"error_message: Insufficient Funds\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error_message : Insufficient Funds' exists\", function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"Insufficient Funds\");",
+ "});",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"amount\":100,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"connector\":[\"nuvei\"],\"customer_id\":\"futurebilling\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"testing\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"setup_future_usage\":\"off_session\",\"payment_method_data\":{\"card\":{\"card_number\":\"5333475572200849\",\"card_exp_month\":\"12\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":100,\"currency\":\"USD\",\"metadata\":{\"frequency\":\"1\"},\"end_date\":\"2025-05-03T04:07:52.723Z\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"jkjj Street\",\"line3\":\"no 1111 Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"JP\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);",
+ "}",
+ "",
+ "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "https://sandbox.hyperswitch.io",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
\ No newline at end of file
|
fix
|
[nuvei] Nuvei error handling for payment declined status and included tests (#3832)
|
ce7d0d427d817eb4199f2f6ea8ea86a04bd98a26
|
2024-06-26 19:15:55
|
Rachit Naithani
|
feat(users): implemented openidconnect (#5124)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 8c7c88e6196..9b08fcbd57b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1430,6 +1430,12 @@ dependencies = [
"rustc-demangle",
]
+[[package]]
+name = "base16ct"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
+
[[package]]
name = "base32"
version = "0.4.0"
@@ -2307,6 +2313,18 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
+[[package]]
+name = "crypto-bigint"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
+dependencies = [
+ "generic-array",
+ "rand_core",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "crypto-common"
version = "0.1.6"
@@ -2328,6 +2346,34 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "curve25519-dalek"
+version = "4.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348"
+dependencies = [
+ "cfg-if 1.0.0",
+ "cpufeatures",
+ "curve25519-dalek-derive",
+ "digest",
+ "fiat-crypto",
+ "platforms",
+ "rustc_version 0.4.0",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "curve25519-dalek-derive"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.57",
+]
+
[[package]]
name = "darling"
version = "0.14.4"
@@ -2677,6 +2723,44 @@ version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
+[[package]]
+name = "ecdsa"
+version = "0.16.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
+dependencies = [
+ "der",
+ "digest",
+ "elliptic-curve",
+ "rfc6979",
+ "signature",
+ "spki",
+]
+
+[[package]]
+name = "ed25519"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
+dependencies = [
+ "pkcs8",
+ "signature",
+]
+
+[[package]]
+name = "ed25519-dalek"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871"
+dependencies = [
+ "curve25519-dalek",
+ "ed25519",
+ "serde",
+ "sha2",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "either"
version = "1.10.0"
@@ -2686,6 +2770,27 @@ dependencies = [
"serde",
]
+[[package]]
+name = "elliptic-curve"
+version = "0.13.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
+dependencies = [
+ "base16ct",
+ "crypto-bigint",
+ "digest",
+ "ff",
+ "generic-array",
+ "group",
+ "hkdf",
+ "pem-rfc7468",
+ "pkcs8",
+ "rand_core",
+ "sec1",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "encoding_rs"
version = "0.8.33"
@@ -2915,6 +3020,22 @@ dependencies = [
"simd-adler32",
]
+[[package]]
+name = "ff"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
+dependencies = [
+ "rand_core",
+ "subtle",
+]
+
+[[package]]
+name = "fiat-crypto"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
+
[[package]]
name = "finl_unicode"
version = "1.2.0"
@@ -3197,6 +3318,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
+ "zeroize",
]
[[package]]
@@ -3287,6 +3409,17 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "group"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
+dependencies = [
+ "ff",
+ "rand_core",
+ "subtle",
+]
+
[[package]]
name = "h2"
version = "0.3.25"
@@ -4550,6 +4683,26 @@ dependencies = [
"libc",
]
+[[package]]
+name = "oauth2"
+version = "4.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c38841cdd844847e3e7c8d29cef9dcfed8877f8f56f9071f77843ecf3baf937f"
+dependencies = [
+ "base64 0.13.1",
+ "chrono",
+ "getrandom",
+ "http 0.2.12",
+ "rand",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_path_to_error",
+ "sha2",
+ "thiserror",
+ "url",
+]
+
[[package]]
name = "object"
version = "0.32.2"
@@ -4596,6 +4749,38 @@ dependencies = [
"utoipa",
]
+[[package]]
+name = "openidconnect"
+version = "3.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f47e80a9cfae4462dd29c41e987edd228971d6565553fbc14b8a11e666d91590"
+dependencies = [
+ "base64 0.13.1",
+ "chrono",
+ "dyn-clone",
+ "ed25519-dalek",
+ "hmac",
+ "http 0.2.12",
+ "itertools 0.10.5",
+ "log",
+ "oauth2",
+ "p256",
+ "p384",
+ "rand",
+ "rsa",
+ "serde",
+ "serde-value",
+ "serde_derive",
+ "serde_json",
+ "serde_path_to_error",
+ "serde_plain",
+ "serde_with",
+ "sha2",
+ "subtle",
+ "thiserror",
+ "url",
+]
+
[[package]]
name = "opensearch"
version = "2.2.0"
@@ -4743,6 +4928,15 @@ dependencies = [
"tokio-stream",
]
+[[package]]
+name = "ordered-float"
+version = "2.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c"
+dependencies = [
+ "num-traits",
+]
+
[[package]]
name = "ordered-multimap"
version = "0.6.0"
@@ -4765,6 +4959,30 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+[[package]]
+name = "p256"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
+dependencies = [
+ "ecdsa",
+ "elliptic-curve",
+ "primeorder",
+ "sha2",
+]
+
+[[package]]
+name = "p384"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209"
+dependencies = [
+ "ecdsa",
+ "elliptic-curve",
+ "primeorder",
+ "sha2",
+]
+
[[package]]
name = "parking_lot"
version = "0.9.0"
@@ -5040,6 +5258,12 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
+[[package]]
+name = "platforms"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7"
+
[[package]]
name = "plotters"
version = "0.3.5"
@@ -5123,6 +5347,15 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "primeorder"
+version = "0.13.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
+dependencies = [
+ "elliptic-curve",
+]
+
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
@@ -5584,6 +5817,16 @@ dependencies = [
"winreg",
]
+[[package]]
+name = "rfc6979"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
+dependencies = [
+ "hmac",
+ "subtle",
+]
+
[[package]]
name = "ring"
version = "0.16.20"
@@ -5728,6 +5971,7 @@ dependencies = [
"num_cpus",
"once_cell",
"openapi",
+ "openidconnect",
"openssl",
"pm_auth",
"qrcode",
@@ -6116,6 +6360,20 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
+[[package]]
+name = "sec1"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
+dependencies = [
+ "base16ct",
+ "der",
+ "generic-array",
+ "pkcs8",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "security-framework"
version = "2.9.2"
@@ -6172,6 +6430,16 @@ dependencies = [
"serde_derive",
]
+[[package]]
+name = "serde-value"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
+dependencies = [
+ "ordered-float",
+ "serde",
+]
+
[[package]]
name = "serde-wasm-bindgen"
version = "0.5.0"
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index e5d217cd8ea..4f5651e0a3c 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -12,14 +12,14 @@ use crate::user::{
},
AcceptInviteFromEmailRequest, AuthorizeResponse, BeginTotpResponse, ChangePasswordRequest,
ConnectAccountRequest, CreateInternalUserRequest, CreateUserAuthenticationMethodRequest,
- DashboardEntryResponse, ForgotPasswordRequest, GetUserAuthenticationMethodsRequest,
- GetUserDetailsResponse, GetUserRoleDetailsRequest, GetUserRoleDetailsResponse,
- InviteUserRequest, ListUsersResponse, ReInviteUserRequest, RecoveryCodes, ResetPasswordRequest,
- RotatePasswordRequest, SendVerifyEmailRequest, SignInResponse, SignUpRequest,
- SignUpWithMerchantIdRequest, SwitchMerchantIdRequest, TokenOrPayloadResponse, TokenResponse,
- TwoFactorAuthStatusResponse, UpdateUserAccountDetailsRequest,
- UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantCreate,
- VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
+ DashboardEntryResponse, ForgotPasswordRequest, GetSsoAuthUrlRequest,
+ GetUserAuthenticationMethodsRequest, GetUserDetailsResponse, GetUserRoleDetailsRequest,
+ GetUserRoleDetailsResponse, InviteUserRequest, ListUsersResponse, ReInviteUserRequest,
+ RecoveryCodes, ResetPasswordRequest, RotatePasswordRequest, SendVerifyEmailRequest,
+ SignInResponse, SignUpRequest, SignUpWithMerchantIdRequest, SsoSignInRequest,
+ SwitchMerchantIdRequest, TokenOrPayloadResponse, TokenResponse, TwoFactorAuthStatusResponse,
+ UpdateUserAccountDetailsRequest, UpdateUserAuthenticationMethodRequest, UserFromEmailRequest,
+ UserMerchantCreate, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
};
impl ApiEventMetric for DashboardEntryResponse {
@@ -81,7 +81,9 @@ common_utils::impl_misc_api_event_type!(
RecoveryCodes,
GetUserAuthenticationMethodsRequest,
CreateUserAuthenticationMethodRequest,
- UpdateUserAuthenticationMethodRequest
+ UpdateUserAuthenticationMethodRequest,
+ GetSsoAuthUrlRequest,
+ SsoSignInRequest
);
#[cfg(feature = "dummy_connector")]
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index 0006afea0d9..b2ed491b677 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -306,8 +306,9 @@ pub struct OpenIdConnectPublicConfig {
pub name: OpenIdProvider,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, strum::Display)]
#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
pub enum OpenIdProvider {
Okta,
}
@@ -356,6 +357,17 @@ pub struct AuthMethodDetails {
pub name: Option<OpenIdProvider>,
}
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct GetSsoAuthUrlRequest {
+ pub id: String,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct SsoSignInRequest {
+ pub state: Secret<String>,
+ pub code: Secret<String>,
+}
+
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct AuthIdQueryParam {
pub auth_id: Option<String>,
diff --git a/crates/diesel_models/src/query/user_authentication_method.rs b/crates/diesel_models/src/query/user_authentication_method.rs
index 08ea6556b82..14a28269cec 100644
--- a/crates/diesel_models/src/query/user_authentication_method.rs
+++ b/crates/diesel_models/src/query/user_authentication_method.rs
@@ -12,6 +12,13 @@ impl UserAuthenticationMethodNew {
}
impl UserAuthenticationMethod {
+ pub async fn get_user_authentication_method_by_id(
+ conn: &PgPooledConn,
+ id: &str,
+ ) -> StorageResult<Self> {
+ generics::generic_find_by_id::<<Self as HasTable>::Table, _, _>(conn, id.to_owned()).await
+ }
+
pub async fn list_user_authentication_methods_for_auth_id(
conn: &PgPooledConn,
auth_id: &str,
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index e48a6b44194..dd14c8d8960 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -66,6 +66,7 @@ mime = "0.3.17"
nanoid = "0.4.0"
num_cpus = "1.16.0"
once_cell = "1.19.0"
+openidconnect = "3.5.0" # TODO: remove reqwest
openssl = "0.10.64"
qrcode = "0.14.0"
rand = "0.8.5"
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 80b4e188075..ae3b03f7b82 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -130,7 +130,7 @@ pub mod routes {
state,
&req,
domain.into_inner(),
- |_, _, domain: analytics::AnalyticsDomain, _| async {
+ |_, _: (), domain: analytics::AnalyticsDomain, _| async {
analytics::core::get_domain_info(domain)
.await
.map(ApplicationResponse::Json)
diff --git a/crates/router/src/consts/user.rs b/crates/router/src/consts/user.rs
index 331c256e8a4..261f8a1efcc 100644
--- a/crates/router/src/consts/user.rs
+++ b/crates/router/src/consts/user.rs
@@ -19,3 +19,6 @@ pub const REDIS_TOTP_PREFIX: &str = "TOTP_";
pub const REDIS_RECOVERY_CODE_PREFIX: &str = "RC_";
pub const REDIS_TOTP_SECRET_PREFIX: &str = "TOTP_SEC_";
pub const REDIS_TOTP_SECRET_TTL_IN_SECS: i64 = 15 * 60; // 15 minutes
+
+pub const REDIS_SSO_PREFIX: &str = "SSO_";
+pub const REDIS_SSO_TTL: i64 = 5 * 60; // 5 minutes
diff --git a/crates/router/src/core/errors/user.rs b/crates/router/src/core/errors/user.rs
index 28b80e16cc0..1cd37679ad4 100644
--- a/crates/router/src/core/errors/user.rs
+++ b/crates/router/src/core/errors/user.rs
@@ -86,6 +86,8 @@ pub enum UserErrors {
InvalidUserAuthMethodOperation,
#[error("Auth config parsing error")]
AuthConfigParsingError,
+ #[error("Invalid SSO request")]
+ SSOFailed,
}
impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorResponse> for UserErrors {
@@ -219,6 +221,9 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
Self::AuthConfigParsingError => {
AER::BadRequest(ApiError::new(sub_code, 45, self.get_error_message(), None))
}
+ Self::SSOFailed => {
+ AER::BadRequest(ApiError::new(sub_code, 46, self.get_error_message(), None))
+ }
}
}
}
@@ -265,6 +270,7 @@ impl UserErrors {
Self::UserAuthMethodAlreadyExists => "User auth method already exists",
Self::InvalidUserAuthMethodOperation => "Invalid user auth method operation",
Self::AuthConfigParsingError => "Auth config parsing error",
+ Self::SSOFailed => "Invalid SSO request",
}
}
}
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 0fd583143cc..c4260a92948 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -1,6 +1,9 @@
use std::collections::HashMap;
-use api_models::user::{self as user_api, InviteMultipleUserResponse};
+use api_models::{
+ payments::RedirectionResponse,
+ user::{self as user_api, InviteMultipleUserResponse},
+};
use common_utils::ext_traits::ValueExt;
#[cfg(feature = "email")]
use diesel_models::user_role::UserRoleUpdate;
@@ -13,7 +16,7 @@ use diesel_models::{
use error_stack::{report, ResultExt};
#[cfg(feature = "email")]
use external_services::email::EmailData;
-use masking::{ExposeInterface, PeekInterface};
+use masking::{ExposeInterface, PeekInterface, Secret};
#[cfg(feature = "email")]
use router_env::env;
use router_env::logger;
@@ -26,7 +29,7 @@ use crate::services::email::types as email_types;
use crate::{
consts,
routes::{app::ReqState, SessionState},
- services::{authentication as auth, authorization::roles, ApplicationResponse},
+ services::{authentication as auth, authorization::roles, openidconnect, ApplicationResponse},
types::{domain, transformers::ForeignInto},
utils::{self, user::two_factor_auth as tfa_utils},
};
@@ -2198,3 +2201,114 @@ pub async fn list_user_authentication_methods(
.collect::<UserResult<_>>()?,
))
}
+
+pub async fn get_sso_auth_url(
+ state: SessionState,
+ request: user_api::GetSsoAuthUrlRequest,
+) -> UserResponse<()> {
+ let user_authentication_method = state
+ .store
+ .get_user_authentication_method_by_id(request.id.as_str())
+ .await
+ .to_not_found_response(UserErrors::InvalidUserAuthMethodOperation)?;
+
+ let open_id_private_config =
+ utils::user::decrypt_oidc_private_config(&state, user_authentication_method.private_config)
+ .await?;
+
+ let open_id_public_config: user_api::OpenIdConnectPublicConfig = user_authentication_method
+ .public_config
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("Public config not present")?
+ .parse_value("OpenIdConnectPublicConfig")
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("unable to parse OpenIdConnectPublicConfig")?;
+
+ let oidc_state = Secret::new(nanoid::nanoid!());
+ utils::user::set_sso_id_in_redis(&state, oidc_state.clone(), request.id).await?;
+
+ let redirect_url =
+ utils::user::get_oidc_sso_redirect_url(&state, &open_id_public_config.name.to_string());
+
+ openidconnect::get_authorization_url(
+ state,
+ redirect_url,
+ oidc_state,
+ open_id_private_config.base_url.into(),
+ open_id_private_config.client_id,
+ )
+ .await
+ .map(|url| {
+ ApplicationResponse::JsonForRedirection(RedirectionResponse {
+ headers: Vec::with_capacity(0),
+ return_url: String::new(),
+ http_method: String::new(),
+ params: Vec::with_capacity(0),
+ return_url_with_query_params: url.to_string(),
+ })
+ })
+}
+
+pub async fn sso_sign(
+ state: SessionState,
+ request: user_api::SsoSignInRequest,
+ user_from_single_purpose_token: Option<auth::UserFromSinglePurposeToken>,
+) -> UserResponse<user_api::TokenResponse> {
+ let authentication_method_id =
+ utils::user::get_sso_id_from_redis(&state, request.state.clone()).await?;
+
+ let user_authentication_method = state
+ .store
+ .get_user_authentication_method_by_id(&authentication_method_id)
+ .await
+ .change_context(UserErrors::InternalServerError)?;
+
+ let open_id_private_config =
+ utils::user::decrypt_oidc_private_config(&state, user_authentication_method.private_config)
+ .await?;
+
+ let open_id_public_config: user_api::OpenIdConnectPublicConfig = user_authentication_method
+ .public_config
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("Public config not present")?
+ .parse_value("OpenIdConnectPublicConfig")
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("unable to parse OpenIdConnectPublicConfig")?;
+
+ let redirect_url =
+ utils::user::get_oidc_sso_redirect_url(&state, &open_id_public_config.name.to_string());
+ let email = openidconnect::get_user_email_from_oidc_provider(
+ &state,
+ redirect_url,
+ request.state,
+ open_id_private_config.base_url.into(),
+ open_id_private_config.client_id,
+ request.code,
+ open_id_private_config.client_secret,
+ )
+ .await?;
+
+ // TODO: Use config to handle not found error
+ let user_from_db = state
+ .global_store
+ .find_user_by_email(&email.into_inner())
+ .await
+ .map(Into::into)
+ .to_not_found_response(UserErrors::UserNotFound)?;
+
+ let next_flow = if let Some(user_from_single_purpose_token) = user_from_single_purpose_token {
+ let current_flow =
+ domain::CurrentFlow::new(user_from_single_purpose_token, domain::SPTFlow::SSO.into())?;
+ current_flow.next(user_from_db, &state).await?
+ } else {
+ domain::NextFlow::from_origin(domain::Origin::SignInWithSSO, user_from_db, &state).await?
+ };
+
+ let token = next_flow.get_token(&state).await?;
+ let response = user_api::TokenResponse {
+ token: token.clone(),
+ token_type: next_flow.get_flow().into(),
+ };
+
+ auth::cookies::set_cookie_response(response, token)
+}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index e60bcc79bdb..e5686d616d4 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -2971,6 +2971,15 @@ impl UserAuthenticationMethodInterface for KafkaStore {
.await
}
+ async fn get_user_authentication_method_by_id(
+ &self,
+ id: &str,
+ ) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
+ self.diesel_store
+ .get_user_authentication_method_by_id(id)
+ .await
+ }
+
async fn list_user_authentication_methods_for_auth_id(
&self,
auth_id: &str,
diff --git a/crates/router/src/db/user_authentication_method.rs b/crates/router/src/db/user_authentication_method.rs
index 5b9aa5da8c9..bcc2313d5db 100644
--- a/crates/router/src/db/user_authentication_method.rs
+++ b/crates/router/src/db/user_authentication_method.rs
@@ -16,6 +16,11 @@ pub trait UserAuthenticationMethodInterface {
user_authentication_method: storage::UserAuthenticationMethodNew,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError>;
+ async fn get_user_authentication_method_by_id(
+ &self,
+ id: &str,
+ ) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError>;
+
async fn list_user_authentication_methods_for_auth_id(
&self,
auth_id: &str,
@@ -47,6 +52,17 @@ impl UserAuthenticationMethodInterface for Store {
.map_err(|error| report!(errors::StorageError::from(error)))
}
+ #[instrument(skip_all)]
+ async fn get_user_authentication_method_by_id(
+ &self,
+ id: &str,
+ ) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage::UserAuthenticationMethod::get_user_authentication_method_by_id(&conn, id)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ }
+
#[instrument(skip_all)]
async fn list_user_authentication_methods_for_auth_id(
&self,
@@ -120,6 +136,28 @@ impl UserAuthenticationMethodInterface for MockDb {
Ok(user_authentication_method)
}
+ #[instrument(skip_all)]
+ async fn get_user_authentication_method_by_id(
+ &self,
+ id: &str,
+ ) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
+ let user_authentication_methods = self.user_authentication_methods.lock().await;
+
+ let user_authentication_method = user_authentication_methods
+ .iter()
+ .find(|&auth_method_inner| auth_method_inner.id == id);
+
+ if let Some(user_authentication_method) = user_authentication_method {
+ Ok(user_authentication_method.to_owned())
+ } else {
+ return Err(errors::StorageError::ValueNotFound(format!(
+ "No user authentication method found for id = {}",
+ id
+ ))
+ .into());
+ }
+ }
+
async fn list_user_authentication_methods_for_auth_id(
&self,
auth_id: &str,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0124f6ae6a5..80157c476b3 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1351,6 +1351,8 @@ impl User {
route = route
.service(web::resource("").route(web::get().to(get_user_details)))
.service(web::resource("/v2/signin").route(web::post().to(user_signin)))
+ // signin/signup with sso using openidconnect
+ .service(web::resource("/oidc").route(web::post().to(sso_sign)))
.service(web::resource("/signout").route(web::post().to(signout)))
.service(web::resource("/rotate_password").route(web::post().to(rotate_password)))
.service(web::resource("/change_password").route(web::post().to(change_password)))
@@ -1414,7 +1416,8 @@ impl User {
)
.service(
web::resource("/list").route(web::get().to(list_user_authentication_methods)),
- ),
+ )
+ .service(web::resource("/url").route(web::get().to(get_sso_auth_url))),
);
#[cfg(feature = "email")]
diff --git a/crates/router/src/routes/dummy_connector.rs b/crates/router/src/routes/dummy_connector.rs
index 79338fc620c..a0c85f90ef7 100644
--- a/crates/router/src/routes/dummy_connector.rs
+++ b/crates/router/src/routes/dummy_connector.rs
@@ -27,7 +27,7 @@ pub async fn dummy_connector_authorize_payment(
state,
&req,
payload,
- |state, _, req, _| core::payment_authorize(state, req),
+ |state, _: (), req, _| core::payment_authorize(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
@@ -51,7 +51,7 @@ pub async fn dummy_connector_complete_payment(
state,
&req,
payload,
- |state, _, req, _| core::payment_complete(state, req),
+ |state, _: (), req, _| core::payment_complete(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
@@ -70,7 +70,7 @@ pub async fn dummy_connector_payment(
state,
&req,
payload,
- |state, _, req, _| core::payment(state, req),
+ |state, _: (), req, _| core::payment(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
@@ -90,7 +90,7 @@ pub async fn dummy_connector_payment_data(
state,
&req,
payload,
- |state, _, req, _| core::payment_data(state, req),
+ |state, _: (), req, _| core::payment_data(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
@@ -111,7 +111,7 @@ pub async fn dummy_connector_refund(
state,
&req,
payload,
- |state, _, req, _| core::refund_payment(state, req),
+ |state, _: (), req, _| core::refund_payment(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
@@ -131,7 +131,7 @@ pub async fn dummy_connector_refund_data(
state,
&req,
payload,
- |state, _, req, _| core::refund_data(state, req),
+ |state, _: (), req, _| core::refund_data(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
diff --git a/crates/router/src/routes/health.rs b/crates/router/src/routes/health.rs
index 3e2f42bcc25..f15a0db1923 100644
--- a/crates/router/src/routes/health.rs
+++ b/crates/router/src/routes/health.rs
@@ -34,7 +34,7 @@ pub async fn deep_health_check(
state,
&request,
(),
- |state, _, _, _| deep_health_check_func(state),
+ |state, _: (), _, _| deep_health_check_func(state),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index e5c4f1c8e95..115bcf6b9a0 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -230,7 +230,9 @@ impl From<Flow> for ApiIdentifier {
| Flow::TwoFactorAuthStatus
| Flow::CreateUserAuthenticationMethod
| Flow::UpdateUserAuthenticationMethod
- | Flow::ListUserAuthenticationMethods => Self::User,
+ | Flow::ListUserAuthenticationMethods
+ | Flow::GetSsoAuthUrl
+ | Flow::SignInWithSso => Self::User,
Flow::ListRoles
| Flow::GetRole
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 816e7f7e2f8..dae78d31bf0 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -72,7 +72,7 @@ pub async fn user_signup(
state,
&http_req,
req_payload.clone(),
- |state, _, req_body, _| async move {
+ |state, _: (), req_body, _| async move {
if let Some(true) = is_token_only {
user_core::signup_token_only_flow(state, req_body).await
} else {
@@ -99,7 +99,7 @@ pub async fn user_signin(
state,
&http_req,
req_payload.clone(),
- |state, _, req_body, _| async move {
+ |state, _: (), req_body, _| async move {
if let Some(true) = is_token_only {
user_core::signin_token_only_flow(state, req_body).await
} else {
@@ -127,7 +127,7 @@ pub async fn user_connect_account(
state,
&http_req,
req_payload.clone(),
- |state, _, req_body, _| user_core::connect_account(state, req_body, auth_id.clone()),
+ |state, _: (), req_body, _| user_core::connect_account(state, req_body, auth_id.clone()),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
@@ -397,7 +397,7 @@ pub async fn forgot_password(
state.clone(),
&req,
payload.into_inner(),
- |state, _, payload, _| user_core::forgot_password(state, payload, auth_id.clone()),
+ |state, _: (), payload, _| user_core::forgot_password(state, payload, auth_id.clone()),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
@@ -432,7 +432,7 @@ pub async fn reset_password(
state.clone(),
&req,
payload.into_inner(),
- |state, _, payload, _| user_core::reset_password(state, payload),
+ |state, _: (), payload, _| user_core::reset_password(state, payload),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
@@ -522,7 +522,7 @@ pub async fn accept_invite_from_email(
state.clone(),
&req,
payload.into_inner(),
- |state, _, request_payload, _| {
+ |state, _: (), request_payload, _| {
user_core::accept_invite_from_email(state, request_payload)
},
&auth::NoAuth,
@@ -560,7 +560,7 @@ pub async fn verify_email(
state,
&http_req,
json_payload.into_inner(),
- |state, _, req_payload, _| user_core::verify_email(state, req_payload),
+ |state, _: (), req_payload, _| user_core::verify_email(state, req_payload),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
@@ -582,7 +582,9 @@ pub async fn verify_email_request(
state.clone(),
&http_req,
json_payload.into_inner(),
- |state, _, req_body, _| user_core::send_verification_mail(state, req_body, auth_id.clone()),
+ |state, _: (), req_body, _| {
+ user_core::send_verification_mail(state, req_body, auth_id.clone())
+ },
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
@@ -774,6 +776,50 @@ pub async fn check_two_factor_auth_status(
.await
}
+pub async fn get_sso_auth_url(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ query: web::Query<user_api::GetSsoAuthUrlRequest>,
+) -> HttpResponse {
+ let flow = Flow::GetSsoAuthUrl;
+ let payload = query.into_inner();
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ payload,
+ |state, _: (), req, _| user_core::get_sso_auth_url(state, req),
+ &auth::NoAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn sso_sign(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ json_payload: web::Json<user_api::SsoSignInRequest>,
+) -> HttpResponse {
+ let flow = Flow::SignInWithSso;
+ let payload = json_payload.into_inner();
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ payload,
+ |state, user: Option<auth::UserFromSinglePurposeToken>, payload, _| {
+ user_core::sso_sign(state, payload, user)
+ },
+ auth::auth_type(
+ &auth::NoAuth,
+ &auth::SinglePurposeJWTAuth(TokenPurpose::SSO),
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
pub async fn create_user_authentication_method(
state: web::Data<AppState>,
req: HttpRequest,
@@ -824,7 +870,7 @@ pub async fn list_user_authentication_methods(
state.clone(),
&req,
query.into_inner(),
- |state, _, req, _| user_core::list_user_authentication_methods(state, req),
+ |state, _: (), req, _| user_core::list_user_authentication_methods(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index 7aed9fdb40a..8792f0c8d80 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -14,6 +14,9 @@ pub mod pm_auth;
#[cfg(feature = "recon")]
pub mod recon;
+#[cfg(feature = "olap")]
+pub mod openidconnect;
+
use std::sync::Arc;
use error_stack::ResultExt;
diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs
index add93e99119..7f8a01736ed 100644
--- a/crates/router/src/services/api/client.rs
+++ b/crates/router/src/services/api/client.rs
@@ -80,7 +80,7 @@ fn get_base_client(
// We may need to use outbound proxy to connect to external world.
// Precedence will be the environment variables, followed by the config.
-pub(super) fn create_client(
+pub fn create_client(
proxy_config: &Proxy,
should_bypass_proxy: bool,
client_certificate: Option<masking::Secret<String>>,
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 43d49b92efb..adca724e454 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -261,6 +261,20 @@ where
}
}
+#[async_trait]
+impl<A, T> AuthenticateAndFetch<Option<T>, A> for NoAuth
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ _request_headers: &HeaderMap,
+ _state: &A,
+ ) -> RouterResult<(Option<T>, AuthenticationType)> {
+ Ok((None, AuthenticationType::NoAuth))
+ }
+}
+
#[async_trait]
impl<A> AuthenticateAndFetch<AuthenticationData, A> for ApiKeyAuth
where
@@ -372,6 +386,40 @@ where
}
}
+#[cfg(feature = "olap")]
+#[async_trait]
+impl<A> AuthenticateAndFetch<Option<UserFromSinglePurposeToken>, A> for SinglePurposeJWTAuth
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<(Option<UserFromSinglePurposeToken>, AuthenticationType)> {
+ let payload = parse_jwt_payload::<A, SinglePurposeToken>(request_headers, state).await?;
+ if payload.check_in_blacklist(state).await? {
+ return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
+ }
+
+ if self.0 != payload.purpose {
+ return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
+ }
+
+ Ok((
+ Some(UserFromSinglePurposeToken {
+ user_id: payload.user_id.clone(),
+ origin: payload.origin.clone(),
+ path: payload.path,
+ }),
+ AuthenticationType::SinglePurposeJwt {
+ user_id: payload.user_id,
+ purpose: payload.purpose,
+ },
+ ))
+ }
+}
+
#[cfg(feature = "olap")]
#[derive(Debug)]
pub struct SinglePurposeOrLoginTokenAuth(pub TokenPurpose);
diff --git a/crates/router/src/services/openidconnect.rs b/crates/router/src/services/openidconnect.rs
new file mode 100644
index 00000000000..4f5056f3273
--- /dev/null
+++ b/crates/router/src/services/openidconnect.rs
@@ -0,0 +1,197 @@
+use error_stack::ResultExt;
+use masking::{ExposeInterface, Secret};
+use oidc::TokenResponse;
+use openidconnect::{self as oidc, core as oidc_core};
+use redis_interface::RedisConnectionPool;
+use storage_impl::errors::ApiClientError;
+
+use crate::{
+ consts,
+ core::errors::{UserErrors, UserResult},
+ routes::SessionState,
+ services::api::client,
+ types::domain::user::UserEmail,
+};
+
+pub async fn get_authorization_url(
+ state: SessionState,
+ redirect_url: String,
+ redirect_state: Secret<String>,
+ base_url: Secret<String>,
+ client_id: Secret<String>,
+) -> UserResult<url::Url> {
+ let discovery_document = get_discovery_document(base_url, &state).await?;
+
+ let (auth_url, csrf_token, nonce) =
+ get_oidc_core_client(discovery_document, client_id, None, redirect_url)?
+ .authorize_url(
+ oidc_core::CoreAuthenticationFlow::AuthorizationCode,
+ || oidc::CsrfToken::new(redirect_state.expose()),
+ oidc::Nonce::new_random,
+ )
+ .add_scope(oidc::Scope::new("email".to_string()))
+ .url();
+
+ // Save csrf & nonce as key value respectively
+ let key = get_oidc_redis_key(csrf_token.secret());
+ get_redis_connection(&state)?
+ .set_key_with_expiry(&key, nonce.secret(), consts::user::REDIS_SSO_TTL)
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to save csrf-nonce in redis")?;
+
+ Ok(auth_url)
+}
+
+pub async fn get_user_email_from_oidc_provider(
+ state: &SessionState,
+ redirect_url: String,
+ redirect_state: Secret<String>,
+ base_url: Secret<String>,
+ client_id: Secret<String>,
+ authorization_code: Secret<String>,
+ client_secret: Secret<String>,
+) -> UserResult<UserEmail> {
+ let nonce = get_nonce_from_redis(state, &redirect_state).await?;
+ let discovery_document = get_discovery_document(base_url, state).await?;
+ let client = get_oidc_core_client(
+ discovery_document,
+ client_id,
+ Some(client_secret),
+ redirect_url,
+ )?;
+
+ let nonce_clone = nonce.clone();
+ client
+ .authorize_url(
+ oidc_core::CoreAuthenticationFlow::AuthorizationCode,
+ || oidc::CsrfToken::new(redirect_state.expose()),
+ || nonce_clone,
+ )
+ .add_scope(oidc::Scope::new("email".to_string()));
+
+ // Send request to OpenId provider with authorization code
+ let token_response = client
+ .exchange_code(oidc::AuthorizationCode::new(authorization_code.expose()))
+ .request_async(|req| get_oidc_reqwest_client(state, req))
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to exchange code and fetch oidc token")?;
+
+ // Fetch id token from response
+ let id_token = token_response
+ .id_token()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("Id Token not provided in token response")?;
+
+ // Verify id token
+ let id_token_claims = id_token
+ .claims(&client.id_token_verifier(), &nonce)
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to verify id token")?;
+
+ // Get email from token
+ let email_from_token = id_token_claims
+ .email()
+ .map(|email| email.to_string())
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("OpenID Provider Didnt provide email")?;
+
+ UserEmail::new(Secret::new(email_from_token))
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to create email type")
+}
+
+// TODO: Cache Discovery Document
+async fn get_discovery_document(
+ base_url: Secret<String>,
+ state: &SessionState,
+) -> UserResult<oidc_core::CoreProviderMetadata> {
+ let issuer_url =
+ oidc::IssuerUrl::new(base_url.expose()).change_context(UserErrors::InternalServerError)?;
+ oidc_core::CoreProviderMetadata::discover_async(issuer_url, |req| {
+ get_oidc_reqwest_client(state, req)
+ })
+ .await
+ .change_context(UserErrors::InternalServerError)
+}
+
+fn get_oidc_core_client(
+ discovery_document: oidc_core::CoreProviderMetadata,
+ client_id: Secret<String>,
+ client_secret: Option<Secret<String>>,
+ redirect_url: String,
+) -> UserResult<oidc_core::CoreClient> {
+ let client_id = oidc::ClientId::new(client_id.expose());
+ let client_secret = client_secret.map(|secret| oidc::ClientSecret::new(secret.expose()));
+ let redirect_url = oidc::RedirectUrl::new(redirect_url)
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Error creating redirect URL type")?;
+
+ Ok(
+ oidc_core::CoreClient::from_provider_metadata(discovery_document, client_id, client_secret)
+ .set_redirect_uri(redirect_url),
+ )
+}
+
+async fn get_nonce_from_redis(
+ state: &SessionState,
+ redirect_state: &Secret<String>,
+) -> UserResult<oidc::Nonce> {
+ let redis_connection = get_redis_connection(state)?;
+ let redirect_state = redirect_state.clone().expose();
+ let key = get_oidc_redis_key(&redirect_state);
+ redis_connection
+ .get_key::<Option<String>>(&key)
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Error Fetching CSRF from redis")?
+ .map(oidc::Nonce::new)
+ .ok_or(UserErrors::SSOFailed)
+ .attach_printable("Cannot find csrf in redis. Csrf invalid or expired")
+}
+
+async fn get_oidc_reqwest_client(
+ state: &SessionState,
+ request: oidc::HttpRequest,
+) -> Result<oidc::HttpResponse, ApiClientError> {
+ let client = client::create_client(&state.conf.proxy, false, None, None)
+ .map_err(|e| e.current_context().to_owned())?;
+
+ let mut request_builder = client
+ .request(request.method, request.url)
+ .body(request.body);
+ for (name, value) in &request.headers {
+ request_builder = request_builder.header(name.as_str(), value.as_bytes());
+ }
+
+ let request = request_builder
+ .build()
+ .map_err(|_| ApiClientError::ClientConstructionFailed)?;
+ let response = client
+ .execute(request)
+ .await
+ .map_err(|_| ApiClientError::RequestNotSent("OpenIDConnect".to_string()))?;
+
+ Ok(oidc::HttpResponse {
+ status_code: response.status(),
+ headers: response.headers().to_owned(),
+ body: response
+ .bytes()
+ .await
+ .map_err(|_| ApiClientError::ResponseDecodingFailed)?
+ .to_vec(),
+ })
+}
+
+fn get_oidc_redis_key(csrf: &str) -> String {
+ format!("{}OIDC_{}", consts::user::REDIS_SSO_PREFIX, csrf)
+}
+
+fn get_redis_connection(state: &SessionState) -> UserResult<std::sync::Arc<RedisConnectionPool>> {
+ state
+ .store
+ .get_redis_conn()
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to get redis connection")
+}
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 25c851549d1..6b957281f76 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -1,12 +1,14 @@
use std::{collections::HashMap, sync::Arc};
use api_models::user as user_api;
-use common_utils::errors::CustomResult;
-use diesel_models::{enums::UserStatus, user_role::UserRole};
+use common_utils::{errors::CustomResult, ext_traits::ValueExt};
+use diesel_models::{encryption::Encryption, enums::UserStatus, user_role::UserRole};
use error_stack::ResultExt;
+use masking::{ExposeInterface, Secret};
use redis_interface::RedisConnectionPool;
use crate::{
+ consts::user::{REDIS_SSO_PREFIX, REDIS_SSO_TTL},
core::errors::{StorageError, UserErrors, UserResult},
routes::SessionState,
services::{
@@ -78,7 +80,7 @@ pub async fn generate_jwt_auth_token(
state: &SessionState,
user: &UserFromStorage,
user_role: &UserRole,
-) -> UserResult<masking::Secret<String>> {
+) -> UserResult<Secret<String>> {
let token = AuthToken::new_token(
user.get_user_id().to_string(),
user_role.merchant_id.clone(),
@@ -87,7 +89,7 @@ pub async fn generate_jwt_auth_token(
user_role.org_id.clone(),
)
.await?;
- Ok(masking::Secret::new(token))
+ Ok(Secret::new(token))
}
pub async fn generate_jwt_auth_token_with_custom_role_attributes(
@@ -96,7 +98,7 @@ pub async fn generate_jwt_auth_token_with_custom_role_attributes(
merchant_id: String,
org_id: String,
role_id: String,
-) -> UserResult<masking::Secret<String>> {
+) -> UserResult<Secret<String>> {
let token = AuthToken::new_token(
user.get_user_id().to_string(),
merchant_id,
@@ -105,14 +107,14 @@ pub async fn generate_jwt_auth_token_with_custom_role_attributes(
org_id,
)
.await?;
- Ok(masking::Secret::new(token))
+ Ok(Secret::new(token))
}
pub fn get_dashboard_entry_response(
state: &SessionState,
user: UserFromStorage,
user_role: UserRole,
- token: masking::Secret<String>,
+ token: Secret<String>,
) -> UserResult<user_api::DashboardEntryResponse> {
let verification_days_left = get_verification_days_left(state, &user)?;
@@ -189,7 +191,7 @@ pub async fn get_user_from_db_by_email(
.map(UserFromStorage::from)
}
-pub fn get_token_from_signin_response(resp: &user_api::SignInResponse) -> masking::Secret<String> {
+pub fn get_token_from_signin_response(resp: &user_api::SignInResponse) -> Secret<String> {
match resp {
user_api::SignInResponse::DashboardEntry(data) => data.token.clone(),
user_api::SignInResponse::MerchantSelect(data) => data.token.clone(),
@@ -213,3 +215,74 @@ impl ForeignFrom<user_api::AuthConfig> for common_enums::UserAuthType {
}
}
}
+
+pub async fn decrypt_oidc_private_config(
+ state: &SessionState,
+ encrypted_config: Option<Encryption>,
+) -> UserResult<user_api::OpenIdConnectPrivateConfig> {
+ let user_auth_key = hex::decode(
+ state
+ .conf
+ .user_auth_methods
+ .get_inner()
+ .encryption_key
+ .clone()
+ .expose(),
+ )
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to decode DEK")?;
+
+ let private_config = domain::types::decrypt::<serde_json::Value, masking::WithType>(
+ encrypted_config,
+ &user_auth_key,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to decrypt private config")?
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("Private config not found")?
+ .into_inner()
+ .expose();
+
+ private_config
+ .parse_value("OpenIdConnectPrivateConfig")
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("unable to parse OpenIdConnectPrivateConfig")
+}
+
+pub async fn set_sso_id_in_redis(
+ state: &SessionState,
+ oidc_state: Secret<String>,
+ sso_id: String,
+) -> UserResult<()> {
+ let connection = get_redis_connection(state)?;
+ let key = get_oidc_key(&oidc_state.expose());
+ connection
+ .set_key_with_expiry(&key, sso_id, REDIS_SSO_TTL)
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to set sso id in redis")
+}
+
+pub async fn get_sso_id_from_redis(
+ state: &SessionState,
+ oidc_state: Secret<String>,
+) -> UserResult<String> {
+ let connection = get_redis_connection(state)?;
+ let key = get_oidc_key(&oidc_state.expose());
+ connection
+ .get_key::<Option<String>>(&key)
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to get sso id from redis")?
+ .ok_or(UserErrors::SSOFailed)
+ .attach_printable("Cannot find oidc state in redis. Oidc state invalid or expired")
+}
+
+fn get_oidc_key(oidc_state: &str) -> String {
+ format!("{}{oidc_state}", REDIS_SSO_PREFIX)
+}
+
+pub fn get_oidc_sso_redirect_url(state: &SessionState, provider: &str) -> String {
+ format!("{}/redirect/oidc/{}", state.conf.user.base_url, provider)
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 46bb93f06e7..023cd2a7944 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -432,6 +432,10 @@ pub enum Flow {
UpdateUserAuthenticationMethod,
// List user authentication methods
ListUserAuthenticationMethods,
+ /// Get sso auth url
+ GetSsoAuthUrl,
+ /// Signin with SSO
+ SignInWithSso,
/// List initial webhook delivery attempts
WebhookEventInitialDeliveryAttemptList,
/// List delivery attempts for a webhook event
|
feat
|
implemented openidconnect (#5124)
|
156430a5703f40b6bb899caf9904323e39003986
|
2023-08-18 13:09:16
|
Shankar Singh C
|
fix(payment_methods): return parent_payment_method_token for other payment methods (BankTransfer, Wallet, BankRedirect) (#1951)
| false
|
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3c13d6bdad8..118708ba1c5 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -5,7 +5,7 @@ use common_utils::{
ext_traits::{AsyncExt, ByteSliceExt, ValueExt},
fp_utils, generate_id, pii,
};
-use diesel_models::{enums, payment_intent};
+use diesel_models::{enums, payment_attempt, payment_intent};
// TODO : Evaluate all the helper functions ()
use error_stack::{report, IntoReport, ResultExt};
use josekit::jwe;
@@ -27,7 +27,7 @@ use crate::{
payments,
},
db::StorageInterface,
- routes::{metrics, payment_methods::ParentPaymentMethodToken, AppState},
+ routes::{metrics, payment_methods, AppState},
scheduler::metrics as scheduler_metrics,
services,
types::{
@@ -1277,36 +1277,15 @@ pub async fn make_pm_data<'a, F: Clone, R>(
})
}
(pm_opt @ Some(pm @ api::PaymentMethodData::Card(_)), _) => {
- let hyperswitch_token = vault::Vault::store_payment_method_data_in_locker(
+ let parent_payment_method_token = store_in_vault_and_generate_ppmt(
state,
- None,
pm,
- payment_data.payment_intent.customer_id.to_owned(),
+ &payment_data.payment_intent,
+ &payment_data.payment_attempt,
enums::PaymentMethod::Card,
)
.await?;
- let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");
- let key_for_hyperswitch_token =
- payment_data
- .payment_attempt
- .payment_method
- .map(|payment_method| {
- ParentPaymentMethodToken::create_key_for_token((
- &parent_payment_method_token,
- payment_method,
- ))
- });
- if let Some(key_for_hyperswitch_token) = key_for_hyperswitch_token {
- key_for_hyperswitch_token
- .insert(
- Some(payment_data.payment_intent.created_at),
- hyperswitch_token,
- state,
- )
- .await?;
- };
-
payment_data.token = Some(parent_payment_method_token);
Ok(pm_opt.to_owned())
@@ -1320,39 +1299,42 @@ pub async fn make_pm_data<'a, F: Clone, R>(
(pm @ Some(api::PaymentMethodData::CardRedirect(_)), _) => Ok(pm.to_owned()),
(pm @ Some(api::PaymentMethodData::GiftCard(_)), _) => Ok(pm.to_owned()),
(pm_opt @ Some(pm @ api::PaymentMethodData::BankTransfer(_)), _) => {
- let token = vault::Vault::store_payment_method_data_in_locker(
+ let parent_payment_method_token = store_in_vault_and_generate_ppmt(
state,
- None,
pm,
- payment_data.payment_intent.customer_id.to_owned(),
+ &payment_data.payment_intent,
+ &payment_data.payment_attempt,
enums::PaymentMethod::BankTransfer,
)
.await?;
- payment_data.token = Some(token);
+
+ payment_data.token = Some(parent_payment_method_token);
+
Ok(pm_opt.to_owned())
}
(pm_opt @ Some(pm @ api::PaymentMethodData::Wallet(_)), _) => {
- let token = vault::Vault::store_payment_method_data_in_locker(
+ let parent_payment_method_token = store_in_vault_and_generate_ppmt(
state,
- None,
pm,
- payment_data.payment_intent.customer_id.to_owned(),
+ &payment_data.payment_intent,
+ &payment_data.payment_attempt,
enums::PaymentMethod::Wallet,
)
.await?;
- payment_data.token = Some(token);
+
+ payment_data.token = Some(parent_payment_method_token);
Ok(pm_opt.to_owned())
}
(pm_opt @ Some(pm @ api::PaymentMethodData::BankRedirect(_)), _) => {
- let token = vault::Vault::store_payment_method_data_in_locker(
+ let parent_payment_method_token = store_in_vault_and_generate_ppmt(
state,
- None,
pm,
- payment_data.payment_intent.customer_id.to_owned(),
+ &payment_data.payment_intent,
+ &payment_data.payment_attempt,
enums::PaymentMethod::BankRedirect,
)
.await?;
- payment_data.token = Some(token);
+ payment_data.token = Some(parent_payment_method_token);
Ok(pm_opt.to_owned())
}
_ => Ok(None),
@@ -1361,6 +1343,36 @@ pub async fn make_pm_data<'a, F: Clone, R>(
Ok((operation, payment_method))
}
+pub async fn store_in_vault_and_generate_ppmt(
+ state: &AppState,
+ payment_method_data: &api_models::payments::PaymentMethodData,
+ payment_intent: &payment_intent::PaymentIntent,
+ payment_attempt: &payment_attempt::PaymentAttempt,
+ payment_method: enums::PaymentMethod,
+) -> RouterResult<String> {
+ let router_token = vault::Vault::store_payment_method_data_in_locker(
+ state,
+ None,
+ payment_method_data,
+ payment_intent.customer_id.to_owned(),
+ payment_method,
+ )
+ .await?;
+ let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");
+ let key_for_hyperswitch_token = payment_attempt.payment_method.map(|payment_method| {
+ payment_methods::ParentPaymentMethodToken::create_key_for_token((
+ &parent_payment_method_token,
+ payment_method,
+ ))
+ });
+ if let Some(key_for_hyperswitch_token) = key_for_hyperswitch_token {
+ key_for_hyperswitch_token
+ .insert(Some(payment_intent.created_at), router_token, state)
+ .await?;
+ };
+ Ok(parent_payment_method_token)
+}
+
#[instrument(skip_all)]
pub(crate) fn validate_capture_method(
capture_method: storage_enums::CaptureMethod,
|
fix
|
return parent_payment_method_token for other payment methods (BankTransfer, Wallet, BankRedirect) (#1951)
|
55ae0fc5f704d8b35815fcd2170befb4a726ea8d
|
2024-05-09 18:42:05
|
Narayan Bhat
|
refactor(billing): store `payment_method_data_billing` for recurring payments (#4513)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index e9ff261a632..96136d69370 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -951,6 +951,10 @@ pub struct CustomerPaymentMethod {
/// Indicates if the payment method has been set to default or not
#[schema(example = true)]
pub default_payment_method_set: bool,
+
+ /// The billing details of the payment method
+ #[schema(value_type = Option<Address>)]
+ pub billing: Option<payments::Address>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs
index 262848e1d55..e7184174314 100644
--- a/crates/diesel_models/src/payment_method.rs
+++ b/crates/diesel_models/src/payment_method.rs
@@ -40,6 +40,7 @@ pub struct PaymentMethod {
pub status: storage_enums::PaymentMethodStatus,
pub network_transaction_id: Option<String>,
pub client_secret: Option<String>,
+ pub payment_method_billing_address: Option<Encryption>,
}
#[derive(
@@ -75,43 +76,7 @@ pub struct PaymentMethodNew {
pub status: storage_enums::PaymentMethodStatus,
pub network_transaction_id: Option<String>,
pub client_secret: Option<String>,
-}
-
-impl Default for PaymentMethodNew {
- fn default() -> Self {
- let now = common_utils::date_time::now();
-
- Self {
- customer_id: String::default(),
- merchant_id: String::default(),
- payment_method_id: String::default(),
- locker_id: Option::default(),
- payment_method: Option::default(),
- payment_method_type: Option::default(),
- payment_method_issuer: Option::default(),
- payment_method_issuer_code: Option::default(),
- accepted_currency: Option::default(),
- scheme: Option::default(),
- token: Option::default(),
- cardholder_name: Option::default(),
- issuer_name: Option::default(),
- issuer_country: Option::default(),
- payer_country: Option::default(),
- is_stored: Option::default(),
- swift_code: Option::default(),
- direct_debit_token: Option::default(),
- created_at: now,
- last_modified: now,
- metadata: Option::default(),
- payment_method_data: Option::default(),
- last_used_at: now,
- connector_mandate_details: Option::default(),
- customer_acceptance: Option::default(),
- status: storage_enums::PaymentMethodStatus::Active,
- network_transaction_id: Option::default(),
- client_secret: Option::default(),
- }
- }
+ pub payment_method_billing_address: Option<Encryption>,
}
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
@@ -337,6 +302,9 @@ impl From<&PaymentMethodNew> for PaymentMethod {
status: payment_method_new.status,
network_transaction_id: payment_method_new.network_transaction_id.clone(),
client_secret: payment_method_new.client_secret.clone(),
+ payment_method_billing_address: payment_method_new
+ .payment_method_billing_address
+ .clone(),
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 0bea0402b51..a81c240e8b0 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -926,6 +926,7 @@ diesel::table! {
network_transaction_id -> Nullable<Varchar>,
#[max_length = 128]
client_secret -> Nullable<Varchar>,
+ payment_method_billing_address -> Nullable<Bytea>,
}
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index efde37b92a8..8c946630c8a 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1,5 +1,6 @@
use std::{
collections::{HashMap, HashSet},
+ fmt::Debug,
str::FromStr,
};
@@ -88,6 +89,7 @@ pub async fn create_payment_method(
status: Option<enums::PaymentMethodStatus>,
network_transaction_id: Option<String>,
storage_scheme: MerchantStorageScheme,
+ payment_method_billing_address: Option<Encryption>,
) -> errors::CustomResult<storage::PaymentMethod, errors::ApiErrorResponse> {
let customer = db
.find_customer_by_customer_id_merchant_id(
@@ -104,6 +106,8 @@ pub async fn create_payment_method(
format!("{payment_method_id}_secret").as_str(),
);
+ let current_time = common_utils::date_time::now();
+
let response = db
.insert_payment_method(
storage::PaymentMethodNew {
@@ -122,7 +126,20 @@ pub async fn create_payment_method(
client_secret: Some(client_secret),
status: status.unwrap_or(enums::PaymentMethodStatus::Active),
network_transaction_id: network_transaction_id.to_owned(),
- ..storage::PaymentMethodNew::default()
+ payment_method_issuer_code: None,
+ accepted_currency: None,
+ token: None,
+ cardholder_name: None,
+ issuer_name: None,
+ issuer_country: None,
+ payer_country: None,
+ is_stored: None,
+ swift_code: None,
+ direct_debit_token: None,
+ created_at: current_time,
+ last_modified: current_time,
+ last_used_at: current_time,
+ payment_method_billing_address,
},
storage_scheme,
)
@@ -231,6 +248,7 @@ pub async fn get_or_insert_payment_method(
None,
None,
merchant_account.storage_scheme,
+ None,
)
.await
} else {
@@ -278,6 +296,7 @@ pub async fn get_client_secret_or_add_payment_method(
Some(enums::PaymentMethodStatus::AwaitingData),
None,
merchant_account.storage_scheme,
+ None,
)
.await?;
@@ -434,7 +453,7 @@ pub async fn add_payment_method_data(
let updated_pmd = Some(PaymentMethodsData::Card(updated_card));
let pm_data_encrypted =
- create_encrypted_payment_method_data(&key_store, updated_pmd).await;
+ create_encrypted_data(&key_store, updated_pmd).await;
let pm_update = storage::PaymentMethodUpdate::AdditionalDataUpdate {
payment_method_data: pm_data_encrypted,
@@ -644,8 +663,7 @@ pub async fn add_payment_method(
let updated_pmd = updated_card.as_ref().map(|card| {
PaymentMethodsData::Card(CardDetailsPaymentMethod::from(card.clone()))
});
- let pm_data_encrypted =
- create_encrypted_payment_method_data(key_store, updated_pmd).await;
+ let pm_data_encrypted = create_encrypted_data(key_store, updated_pmd).await;
let pm_update = storage::PaymentMethodUpdate::PaymentMethodDataUpdate {
payment_method_data: pm_data_encrypted,
@@ -688,6 +706,7 @@ pub async fn add_payment_method(
None,
None,
merchant_account.storage_scheme,
+ None,
)
.await?;
@@ -712,12 +731,13 @@ pub async fn insert_payment_method(
connector_mandate_details: Option<serde_json::Value>,
network_transaction_id: Option<String>,
storage_scheme: MerchantStorageScheme,
+ payment_method_billing_address: Option<Encryption>,
) -> errors::RouterResult<diesel_models::PaymentMethod> {
let pm_card_details = resp
.card
.as_ref()
.map(|card| PaymentMethodsData::Card(CardDetailsPaymentMethod::from(card.clone())));
- let pm_data_encrypted = create_encrypted_payment_method_data(key_store, pm_card_details).await;
+ let pm_data_encrypted = create_encrypted_data(key_store, pm_card_details).await;
create_payment_method(
db,
&req,
@@ -733,6 +753,7 @@ pub async fn insert_payment_method(
None,
network_transaction_id,
storage_scheme,
+ payment_method_billing_address,
)
.await
}
@@ -891,8 +912,7 @@ pub async fn update_customer_payment_method(
let updated_pmd = updated_card
.as_ref()
.map(|card| PaymentMethodsData::Card(CardDetailsPaymentMethod::from(card.clone())));
- let pm_data_encrypted =
- create_encrypted_payment_method_data(&key_store, updated_pmd).await;
+ let pm_data_encrypted = create_encrypted_data(&key_store, updated_pmd).await;
let pm_update = storage::PaymentMethodUpdate::PaymentMethodDataUpdate {
payment_method_data: pm_data_encrypted,
@@ -3463,8 +3483,14 @@ pub async fn list_customer_payment_method(
None
};
- //Need validation for enabled payment method ,querying MCA
+ let payment_method_billing = decrypt_generic_data::<api_models::payments::Address>(
+ pm.payment_method_billing_address,
+ key,
+ )
+ .await
+ .attach_printable("unable to decrypt payment method billing address details")?;
+ // Need validation for enabled payment method ,querying MCA
let pma = api::CustomerPaymentMethod {
payment_token: parent_payment_method_token.to_owned(),
payment_method_id: pm.payment_method_id.clone(),
@@ -3488,6 +3514,7 @@ pub async fn list_customer_payment_method(
last_used_at: Some(pm.last_used_at),
default_payment_method_set: customer.default_payment_method_id.is_some()
&& customer.default_payment_method_id == Some(pm.payment_method_id),
+ billing: payment_method_billing,
};
customer_pms.push(pma.to_owned());
@@ -3605,6 +3632,27 @@ pub async fn list_customer_payment_method(
Ok(services::ApplicationResponse::Json(response))
}
+pub async fn decrypt_generic_data<T>(
+ data: Option<Encryption>,
+ key: &[u8],
+) -> errors::RouterResult<Option<T>>
+where
+ T: serde::de::DeserializeOwned,
+{
+ let decrypted_data = decrypt::<serde_json::Value, masking::WithType>(data, key)
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to decrypt data")?;
+
+ decrypted_data
+ .map(|decrypted_data| decrypted_data.into_inner().expose())
+ .map(|decrypted_value| decrypted_value.parse_value("generic_data"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("unable to parse generic data value")
+}
+
pub async fn get_card_details_with_locker_fallback(
pm: &payment_method::PaymentMethod,
key: &[u8],
@@ -4171,18 +4219,21 @@ pub async fn delete_payment_method(
))
}
-pub async fn create_encrypted_payment_method_data(
+pub async fn create_encrypted_data<T>(
key_store: &domain::MerchantKeyStore,
- pm_data: Option<PaymentMethodsData>,
-) -> Option<Encryption> {
+ data: Option<T>,
+) -> Option<Encryption>
+where
+ T: Debug + serde::Serialize,
+{
let key = key_store.key.get_inner().peek();
- let pm_data_encrypted: Option<Encryption> = pm_data
+ let encrypted_data: Option<Encryption> = data
.as_ref()
.map(Encode::encode_to_value)
.transpose()
.change_context(errors::StorageError::SerializationFailed)
- .attach_printable("Unable to convert payment method data to a value")
+ .attach_printable("Unable to convert data to a value")
.unwrap_or_else(|err| {
logger::error!(err=?err);
None
@@ -4191,14 +4242,14 @@ pub async fn create_encrypted_payment_method_data(
.async_lift(|inner| encrypt_optional(inner, key))
.await
.change_context(errors::StorageError::EncryptionError)
- .attach_printable("Unable to encrypt payment method data")
+ .attach_printable("Unable to encrypt data")
.unwrap_or_else(|err| {
logger::error!(err=?err);
None
})
.map(|details| details.into());
- pm_data_encrypted
+ encrypted_data
}
pub async fn list_countries_currencies_for_connector_payment_method(
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e4c4540cacf..cd61de6a933 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -214,6 +214,7 @@ pub async fn create_or_update_address_for_payment_by_request(
storage_scheme,
)
.await
+ .map(|payment_address| payment_address.address)
.to_not_found_response(errors::ApiErrorResponse::AddressNotFound)?,
)
}
@@ -225,38 +226,39 @@ pub async fn create_or_update_address_for_payment_by_request(
merchant_key_store,
storage_scheme,
)
- .await,
+ .await
+ .map(|payment_address| payment_address.address),
)
.transpose()
.to_not_found_response(errors::ApiErrorResponse::AddressNotFound)?,
},
None => match req_address {
Some(address) => {
- // generate a new address here
- let address_details = address.address.clone().unwrap_or_default();
+ let address = get_domain_address(address, merchant_id, key, storage_scheme)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while encrypting address while insert")?;
+
+ let payment_address = domain::PaymentAddress {
+ address,
+ payment_id: payment_id.to_string(),
+ customer_id: customer_id.cloned(),
+ };
+
Some(
db.insert_address_for_payments(
payment_id,
- get_domain_address_for_payments(
- address_details,
- address,
- merchant_id,
- customer_id,
- payment_id,
- key,
- storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed while encrypting address while insert")?,
+ payment_address,
merchant_key_store,
storage_scheme,
)
.await
+ .map(|payment_address| payment_address.address)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while inserting new address")?,
)
}
+
None => None,
},
})
@@ -285,34 +287,34 @@ pub async fn create_or_find_address_for_payment_by_request(
merchant_key_store,
storage_scheme,
)
- .await,
+ .await
+ .map(|payment_address| payment_address.address),
)
.transpose()
.to_not_found_response(errors::ApiErrorResponse::AddressNotFound)?,
None => match req_address {
Some(address) => {
// generate a new address here
+ let address = get_domain_address(address, merchant_id, key, storage_scheme)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while encrypting address while insert")?;
+
+ let payment_address = domain::PaymentAddress {
+ address,
+ payment_id: payment_id.to_string(),
+ customer_id: customer_id.cloned(),
+ };
- let address_details = address.address.clone().unwrap_or_default();
Some(
db.insert_address_for_payments(
payment_id,
- get_domain_address_for_payments(
- address_details,
- address,
- merchant_id,
- customer_id,
- payment_id,
- key,
- storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed while encrypting address while insert")?,
+ payment_address,
merchant_key_store,
storage_scheme,
)
.await
+ .map(|payment_address| payment_address.address)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while inserting new address")?,
)
@@ -322,16 +324,14 @@ pub async fn create_or_find_address_for_payment_by_request(
})
}
-pub async fn get_domain_address_for_payments(
- address_details: api_models::payments::AddressDetails,
+pub async fn get_domain_address(
address: &api_models::payments::Address,
merchant_id: &str,
- customer_id: Option<&String>,
- payment_id: &str,
key: &[u8],
storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<domain::Address, common_utils::errors::CryptoError> {
async {
+ let address_details = address.address.as_ref();
Ok(domain::Address {
id: None,
phone_number: address
@@ -341,42 +341,40 @@ pub async fn get_domain_address_for_payments(
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
country_code: address.phone.as_ref().and_then(|a| a.country_code.clone()),
- customer_id: customer_id.cloned(),
merchant_id: merchant_id.to_string(),
address_id: generate_id(consts::ID_LENGTH, "add"),
- city: address_details.city,
- country: address_details.country,
+ city: address_details.and_then(|address_details| address_details.city.clone()),
+ country: address_details.and_then(|address_details| address_details.country),
line1: address_details
- .line1
+ .and_then(|address_details| address_details.line1.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
line2: address_details
- .line2
+ .and_then(|address_details| address_details.line2.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
line3: address_details
- .line3
+ .and_then(|address_details| address_details.line3.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
state: address_details
- .state
+ .and_then(|address_details| address_details.state.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
created_at: common_utils::date_time::now(),
first_name: address_details
- .first_name
+ .and_then(|address_details| address_details.first_name.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
last_name: address_details
- .last_name
+ .and_then(|address_details| address_details.last_name.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
modified_at: common_utils::date_time::now(),
zip: address_details
- .zip
+ .and_then(|address_details| address_details.zip.clone())
.async_lift(|inner| types::encrypt_optional(inner, key))
.await?,
- payment_id: Some(payment_id.to_owned()),
updated_by: storage_scheme.to_string(),
email: address
.email
@@ -408,6 +406,7 @@ pub async fn get_address_by_id(
storage_scheme,
)
.await
+ .map(|payment_address| payment_address.address)
.ok()),
}
}
@@ -461,7 +460,7 @@ pub async fn get_token_pm_type_mandate_details(
None,
mandate_generic_data.recurring_mandate_payment_data,
mandate_generic_data.mandate_connector,
- None,
+ mandate_generic_data.payment_method_info,
)
}
RecurringDetails::PaymentMethodId(payment_method_id) => {
@@ -515,7 +514,7 @@ pub async fn get_token_pm_type_mandate_details(
None,
mandate_generic_data.recurring_mandate_payment_data,
mandate_generic_data.mandate_connector,
- None,
+ mandate_generic_data.payment_method_info,
)
} else {
(
@@ -673,7 +672,7 @@ pub async fn get_token_for_recurring_mandate(
payment_method_type: payment_method.payment_method_type,
mandate_connector: Some(mandate_connector_details),
mandate_data: None,
- payment_method_info: None,
+ payment_method_info: Some(payment_method),
})
} else {
Ok(MandateGenericData {
@@ -687,7 +686,7 @@ pub async fn get_token_for_recurring_mandate(
payment_method_type: payment_method.payment_method_type,
mandate_connector: Some(mandate_connector_details),
mandate_data: None,
- payment_method_info: None,
+ payment_method_info: Some(payment_method),
})
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index ee4f499d426..e77ffa611e0 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -471,6 +471,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
}
.in_current_span(),
);
+
let mandate_type = m_helpers::get_mandate_type(
request.mandate_data.clone(),
request.off_session,
@@ -560,6 +561,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
} else {
(None, payment_method_info)
};
+
// The operation merges mandate data from both request and payment_attempt
let setup_mandate = mandate_data.map(|mut sm| {
sm.mandate_type = payment_attempt.mandate_details.clone().or(sm.mandate_type);
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index c3ef748c037..d70052f7310 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -95,6 +95,7 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
{
let customer_id = payment_data.payment_intent.customer_id.clone();
let save_payment_data = tokenization::SavePaymentMethodData::from(resp);
+ let payment_method_billing_address = payment_data.address.get_payment_method_billing();
let connector_name = payment_data
.payment_attempt
@@ -125,6 +126,7 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
Some(resp.request.amount),
Some(resp.request.currency),
billing_name.clone(),
+ payment_method_billing_address,
business_profile,
));
@@ -178,6 +180,7 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
let currency = resp.request.currency;
let payment_method_type = resp.request.payment_method_type;
let storage_scheme = merchant_account.clone().storage_scheme;
+ let payment_method_billing_address = payment_method_billing_address.cloned();
logger::info!("Call to save_payment_method in locker");
let _task_handle = tokio::spawn(
@@ -196,6 +199,7 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
Some(amount),
Some(currency),
billing_name,
+ payment_method_billing_address.as_ref(),
&business_profile,
))
.await;
@@ -599,6 +603,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
.get_payment_method_billing()
.and_then(|billing_details| billing_details.address.as_ref())
.and_then(|address| address.get_optional_full_name());
+
let save_payment_data = tokenization::SavePaymentMethodData::from(resp);
let customer_id = payment_data.payment_intent.customer_id.clone();
let connector_name = payment_data
@@ -625,6 +630,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
resp.request.amount,
Some(resp.request.currency),
billing_name,
+ None,
business_profile,
))
.await?;
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index e7bb8f86d5d..d41bfcf66d4 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -65,6 +65,7 @@ pub async fn save_payment_method<FData>(
amount: Option<i64>,
currency: Option<storage_enums::Currency>,
billing_name: Option<masking::Secret<String>>,
+ payment_method_billing_address: Option<&api::Address>,
business_profile: &storage::business_profile::BusinessProfile,
) -> RouterResult<(Option<String>, Option<common_enums::PaymentMethodStatus>)>
where
@@ -209,9 +210,12 @@ where
});
let pm_data_encrypted =
- payment_methods::cards::create_encrypted_payment_method_data(
+ payment_methods::cards::create_encrypted_data(key_store, pm_card_details).await;
+
+ let encrypted_payment_method_billing_address =
+ payment_methods::cards::create_encrypted_data(
key_store,
- pm_card_details,
+ payment_method_billing_address,
)
.await;
@@ -315,6 +319,7 @@ where
None,
network_transaction_id,
merchant_account.storage_scheme,
+ encrypted_payment_method_billing_address,
)
.await
} else {
@@ -404,6 +409,7 @@ where
connector_mandate_details,
network_transaction_id,
merchant_account.storage_scheme,
+ encrypted_payment_method_billing_address,
)
.await
} else {
@@ -486,7 +492,7 @@ where
))
});
let pm_data_encrypted =
- payment_methods::cards::create_encrypted_payment_method_data(
+ payment_methods::cards::create_encrypted_data(
key_store,
updated_pmd,
)
@@ -535,6 +541,7 @@ where
None,
network_transaction_id,
merchant_account.storage_scheme,
+ encrypted_payment_method_billing_address,
)
.await?;
}
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 790cb25c479..c22f74bab4a 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -452,7 +452,7 @@ pub async fn save_payout_data_to_locker(
)
});
(
- cards::create_encrypted_payment_method_data(key_store, Some(pm_data)).await,
+ cards::create_encrypted_data(key_store, Some(pm_data)).await,
payment_method,
)
} else {
@@ -495,6 +495,7 @@ pub async fn save_payout_data_to_locker(
None,
None,
merchant_account.storage_scheme,
+ None,
)
.await?;
}
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 1de52e940e2..8d30a79df19 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -420,7 +420,7 @@ async fn store_bank_details_in_payment_methods(
let payment_method_data = payment_methods::PaymentMethodsData::BankDetails(pmd);
let encrypted_data =
- cards::create_encrypted_payment_method_data(&key_store, Some(payment_method_data))
+ cards::create_encrypted_data(&key_store, Some(payment_method_data))
.await
.ok_or(ApiErrorResponse::InternalServerError)?;
let pm_update = storage::PaymentMethodUpdate::PaymentMethodDataUpdate {
@@ -431,21 +431,42 @@ async fn store_bank_details_in_payment_methods(
} else {
let payment_method_data = payment_methods::PaymentMethodsData::BankDetails(pmd);
let encrypted_data =
- cards::create_encrypted_payment_method_data(&key_store, Some(payment_method_data))
+ cards::create_encrypted_data(&key_store, Some(payment_method_data))
.await
.ok_or(ApiErrorResponse::InternalServerError)?;
let pm_id = generate_id(consts::ID_LENGTH, "pm");
+ let now = common_utils::date_time::now();
let pm_new = storage::PaymentMethodNew {
customer_id: customer_id.clone(),
merchant_id: merchant_account.merchant_id.clone(),
payment_method_id: pm_id,
payment_method: Some(enums::PaymentMethod::BankDebit),
payment_method_type: Some(creds.payment_method_type),
+ status: enums::PaymentMethodStatus::Active,
payment_method_issuer: None,
scheme: None,
metadata: None,
payment_method_data: Some(encrypted_data),
- ..storage::PaymentMethodNew::default()
+ payment_method_issuer_code: None,
+ accepted_currency: None,
+ token: None,
+ cardholder_name: None,
+ issuer_name: None,
+ issuer_country: None,
+ payer_country: None,
+ is_stored: None,
+ swift_code: None,
+ direct_debit_token: None,
+ created_at: now,
+ last_modified: now,
+ locker_id: None,
+ last_used_at: now,
+ connector_mandate_details: None,
+ customer_acceptance: None,
+
+ network_transaction_id: None,
+ client_secret: None,
+ payment_method_billing_address: None,
};
new_entries.push(pm_new);
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 8eb281184f6..c93e33b1471 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -28,12 +28,12 @@ where
async fn update_address_for_payments(
&self,
- this: domain::Address,
+ this: domain::PaymentAddress,
address: domain::AddressUpdate,
payment_id: String,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError>;
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError>;
async fn find_address_by_address_id(
&self,
@@ -44,14 +44,14 @@ where
async fn insert_address_for_payments(
&self,
payment_id: &str,
- address: domain::Address,
+ address: domain::PaymentAddress,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError>;
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError>;
async fn insert_address_for_customers(
&self,
- address: domain::Address,
+ address: domain::CustomerAddress,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError>;
@@ -62,7 +62,7 @@ where
address_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError>;
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError>;
async fn update_address_by_merchant_id_customer_id(
&self,
@@ -121,7 +121,7 @@ mod storage {
address_id: &str,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage_types::Address::find_by_merchant_id_payment_id_address_id(
&conn,
@@ -163,12 +163,12 @@ mod storage {
#[instrument(skip_all)]
async fn update_address_for_payments(
&self,
- this: domain::Address,
+ this: domain::PaymentAddress,
address_update: domain::AddressUpdate,
_payment_id: String,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
let address = Conversion::convert(this)
.await
@@ -190,10 +190,10 @@ mod storage {
async fn insert_address_for_payments(
&self,
_payment_id: &str,
- address: domain::Address,
+ address: domain::PaymentAddress,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
address
.construct_new()
@@ -214,7 +214,7 @@ mod storage {
#[instrument(skip_all)]
async fn insert_address_for_customers(
&self,
- address: domain::Address,
+ address: domain::CustomerAddress,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -320,7 +320,7 @@ mod storage {
address_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
let database_call = || async {
storage_types::Address::find_by_merchant_id_payment_id_address_id(
@@ -384,12 +384,12 @@ mod storage {
#[instrument(skip_all)]
async fn update_address_for_payments(
&self,
- this: domain::Address,
+ this: domain::PaymentAddress,
address_update: domain::AddressUpdate,
payment_id: String,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
let address = Conversion::convert(this)
.await
@@ -456,10 +456,10 @@ mod storage {
async fn insert_address_for_payments(
&self,
payment_id: &str,
- address: domain::Address,
+ address: domain::PaymentAddress,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let address_new = address
.clone()
.construct_new()
@@ -547,7 +547,7 @@ mod storage {
#[instrument(skip_all)]
async fn insert_address_for_customers(
&self,
- address: domain::Address,
+ address: domain::CustomerAddress,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -635,7 +635,7 @@ impl AddressInterface for MockDb {
address_id: &str,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
match self
.addresses
.lock()
@@ -688,18 +688,18 @@ impl AddressInterface for MockDb {
async fn update_address_for_payments(
&self,
- this: domain::Address,
+ this: domain::PaymentAddress,
address_update: domain::AddressUpdate,
_payment_id: String,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let updated_addr = self
.addresses
.lock()
.await
.iter_mut()
- .find(|address| address.address_id == this.address_id)
+ .find(|address| address.address_id == this.address.address_id)
.map(|a| {
let address_updated =
AddressUpdateInternal::from(address_update).create_address(a.clone());
@@ -721,10 +721,10 @@ impl AddressInterface for MockDb {
async fn insert_address_for_payments(
&self,
_payment_id: &str,
- address_new: domain::Address,
+ address_new: domain::PaymentAddress,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
let mut addresses = self.addresses.lock().await;
let address = Conversion::convert(address_new)
@@ -741,7 +741,7 @@ impl AddressInterface for MockDb {
async fn insert_address_for_customers(
&self,
- address_new: domain::Address,
+ address_new: domain::CustomerAddress,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError> {
let mut addresses = self.addresses.lock().await;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index a64e3cc7e38..a01395ed0cf 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -121,12 +121,12 @@ impl AddressInterface for KafkaStore {
async fn update_address_for_payments(
&self,
- this: domain::Address,
+ this: domain::PaymentAddress,
address: domain::AddressUpdate,
payment_id: String,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
self.diesel_store
.update_address_for_payments(this, address, payment_id, key_store, storage_scheme)
.await
@@ -135,10 +135,10 @@ impl AddressInterface for KafkaStore {
async fn insert_address_for_payments(
&self,
payment_id: &str,
- address: domain::Address,
+ address: domain::PaymentAddress,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
self.diesel_store
.insert_address_for_payments(payment_id, address, key_store, storage_scheme)
.await
@@ -151,7 +151,7 @@ impl AddressInterface for KafkaStore {
address_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
- ) -> CustomResult<domain::Address, errors::StorageError> {
+ ) -> CustomResult<domain::PaymentAddress, errors::StorageError> {
self.diesel_store
.find_address_by_merchant_id_payment_id_address_id(
merchant_id,
@@ -165,7 +165,7 @@ impl AddressInterface for KafkaStore {
async fn insert_address_for_customers(
&self,
- address: domain::Address,
+ address: domain::CustomerAddress,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError> {
self.diesel_store
diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs
index 528861a70aa..7c987c38d5b 100644
--- a/crates/router/src/db/payment_method.rs
+++ b/crates/router/src/db/payment_method.rs
@@ -662,6 +662,7 @@ impl PaymentMethodInterface for MockDb {
status: payment_method_new.status,
client_secret: payment_method_new.client_secret,
network_transaction_id: payment_method_new.network_transaction_id,
+ payment_method_billing_address: payment_method_new.payment_method_billing_address,
};
payment_methods.push(payment_method.clone());
Ok(payment_method)
diff --git a/crates/router/src/types/domain/address.rs b/crates/router/src/types/domain/address.rs
index 458ccb8114d..147c523e0b2 100644
--- a/crates/router/src/types/domain/address.rs
+++ b/crates/router/src/types/domain/address.rs
@@ -35,13 +35,119 @@ pub struct Address {
#[serde(skip_serializing)]
#[serde(with = "custom_serde::iso8601")]
pub modified_at: PrimitiveDateTime,
- pub customer_id: Option<String>,
pub merchant_id: String,
- pub payment_id: Option<String>,
pub updated_by: String,
pub email: crypto::OptionalEncryptableEmail,
}
+/// Based on the flow, appropriate address has to be used
+/// In case of Payments, The `PaymentAddress`[PaymentAddress] has to be used
+/// which contains only the `Address`[Address] object and `payment_id` and optional `customer_id`
+#[derive(Debug, Clone)]
+pub struct PaymentAddress {
+ pub address: Address,
+ pub payment_id: String,
+ // This is present in `PaymentAddress` because even `payouts` uses `PaymentAddress`
+ pub customer_id: Option<String>,
+}
+
+#[derive(Debug, Clone)]
+pub struct CustomerAddress {
+ pub address: Address,
+ pub customer_id: String,
+}
+
+#[async_trait]
+impl behaviour::Conversion for CustomerAddress {
+ type DstType = diesel_models::address::Address;
+ type NewDstType = diesel_models::address::AddressNew;
+
+ async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
+ let converted_address = Address::convert(self.address).await?;
+ Ok(diesel_models::address::Address {
+ customer_id: Some(self.customer_id),
+ payment_id: None,
+ ..converted_address
+ })
+ }
+
+ async fn convert_back(
+ other: Self::DstType,
+ key: &Secret<Vec<u8>>,
+ ) -> CustomResult<Self, ValidationError> {
+ let customer_id =
+ other
+ .customer_id
+ .clone()
+ .ok_or(ValidationError::MissingRequiredField {
+ field_name: "cutomer_id".to_string(),
+ })?;
+
+ let address = Address::convert_back(other, key).await?;
+
+ Ok(Self {
+ address,
+ customer_id,
+ })
+ }
+
+ async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
+ let address_new = Address::construct_new(self.address).await?;
+
+ Ok(Self::NewDstType {
+ customer_id: Some(self.customer_id),
+ payment_id: None,
+ ..address_new
+ })
+ }
+}
+#[async_trait]
+impl behaviour::Conversion for PaymentAddress {
+ type DstType = diesel_models::address::Address;
+ type NewDstType = diesel_models::address::AddressNew;
+
+ async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
+ let converted_address = Address::convert(self.address).await?;
+ Ok(diesel_models::address::Address {
+ customer_id: self.customer_id,
+ payment_id: Some(self.payment_id),
+ ..converted_address
+ })
+ }
+
+ async fn convert_back(
+ other: Self::DstType,
+ key: &Secret<Vec<u8>>,
+ ) -> CustomResult<Self, ValidationError> {
+ let payment_id = other
+ .payment_id
+ .clone()
+ .ok_or(ValidationError::MissingRequiredField {
+ field_name: "payment_id".to_string(),
+ })?;
+
+ let customer_id = other.customer_id.clone();
+
+ let address = Address::convert_back(other, key).await?;
+
+ Ok(Self {
+ address,
+ payment_id,
+ customer_id,
+ })
+ }
+
+ async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
+ let address_new = Address::construct_new(self.address).await?;
+
+ Ok(Self::NewDstType {
+ customer_id: self.customer_id,
+ payment_id: Some(self.payment_id),
+ ..address_new
+ })
+ }
+}
+
#[async_trait]
impl behaviour::Conversion for Address {
type DstType = diesel_models::address::Address;
@@ -64,11 +170,11 @@ impl behaviour::Conversion for Address {
country_code: self.country_code,
created_at: self.created_at,
modified_at: self.modified_at,
- customer_id: self.customer_id,
merchant_id: self.merchant_id,
- payment_id: self.payment_id,
updated_by: self.updated_by,
email: self.email.map(Encryption::from),
+ payment_id: None,
+ customer_id: None,
})
}
@@ -95,10 +201,8 @@ impl behaviour::Conversion for Address {
country_code: other.country_code,
created_at: other.created_at,
modified_at: other.modified_at,
- customer_id: other.customer_id,
- merchant_id: other.merchant_id,
- payment_id: other.payment_id,
updated_by: other.updated_by,
+ merchant_id: other.merchant_id,
email: other.email.async_lift(inner_decrypt_email).await?,
})
}
@@ -123,13 +227,13 @@ impl behaviour::Conversion for Address {
last_name: self.last_name.map(Encryption::from),
phone_number: self.phone_number.map(Encryption::from),
country_code: self.country_code,
- customer_id: self.customer_id,
merchant_id: self.merchant_id,
- payment_id: self.payment_id,
created_at: now,
modified_at: now,
updated_by: self.updated_by,
email: self.email.map(Encryption::from),
+ customer_id: None,
+ payment_id: None,
})
}
}
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 51854978b9e..87cd95364d5 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -577,7 +577,7 @@ pub trait CustomerAddress {
customer_id: &str,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
- ) -> CustomResult<domain::Address, common_utils::errors::CryptoError>;
+ ) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError>;
}
#[async_trait::async_trait]
@@ -645,9 +645,9 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
customer_id: &str,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
- ) -> CustomResult<domain::Address, common_utils::errors::CryptoError> {
+ ) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError> {
async {
- Ok(domain::Address {
+ let address = domain::Address {
id: None,
city: address_details.city,
country: address_details.country,
@@ -685,10 +685,8 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
.async_lift(|inner| encrypt_optional(inner, key))
.await?,
country_code: self.phone_country_code.clone(),
- customer_id: Some(customer_id.to_string()),
merchant_id: merchant_id.to_string(),
address_id: generate_id(consts::ID_LENGTH, "add"),
- payment_id: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
updated_by: storage_scheme.to_string(),
@@ -698,6 +696,11 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
.cloned()
.async_lift(|inner| encrypt_optional(inner.map(|inner| inner.expose()), key))
.await?,
+ };
+
+ Ok(domain::CustomerAddress {
+ address,
+ customer_id: customer_id.to_string(),
})
}
.await
diff --git a/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/down.sql b/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/down.sql
new file mode 100644
index 00000000000..d6b2aa8b8c2
--- /dev/null
+++ b/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_methods DROP COLUMN IF EXISTS payment_method_billing_address;
diff --git a/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/up.sql b/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/up.sql
new file mode 100644
index 00000000000..127b0bf5d89
--- /dev/null
+++ b/migrations/2024-04-29-075651_store_payment_method_data_billing_in_payment_methods/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE payment_methods
+ADD COLUMN IF NOT EXISTS payment_method_billing_address BYTEA;
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index b6b64ed47ab..26ad3366d42 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -8162,6 +8162,14 @@
"type": "boolean",
"description": "Indicates if the payment method has been set to default or not",
"example": true
+ },
+ "billing": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Address"
+ }
+ ],
+ "nullable": true
}
}
},
|
refactor
|
store `payment_method_data_billing` for recurring payments (#4513)
|
9d6e4ee37d9a1edced01f24f504c1034d85ebdcd
|
2023-03-30 04:26:19
|
Sanchith Hegde
|
refactor(drainer, router): KMS decrypt database password when `kms` feature is enabled (#733)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 3d84539f0de..4c53c4a9349 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1527,6 +1527,7 @@ dependencies = [
"config",
"diesel",
"error-stack",
+ "external_services",
"once_cell",
"redis_interface",
"router_env",
diff --git a/config/config.example.toml b/config/config.example.toml
index 4cd4e75bc97..56d4500cba2 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -19,23 +19,25 @@ request_body_limit = 16_384
# Main SQL data store credentials
[master_database]
-username = "db_user" # DB Username
-password = "db_pass" # DB Password
-host = "localhost" # DB Host
-port = 5432 # DB Port
-dbname = "hyperswitch_db" # Name of Database
-pool_size = 5 # Number of connections to keep open
-connection_timeout = 10 # Timeout for database connection in seconds
+username = "db_user" # DB Username
+password = "db_pass" # DB Password. Only applicable when KMS is disabled.
+host = "localhost" # DB Host
+port = 5432 # DB Port
+dbname = "hyperswitch_db" # Name of Database
+pool_size = 5 # Number of connections to keep open
+connection_timeout = 10 # Timeout for database connection in seconds
+kms_encrypted_password = "" # Base64-encoded (KMS encrypted) ciphertext of the database password. Only applicable when KMS is enabled.
# Replica SQL data store credentials
[replica_database]
-username = "replica_user" # DB Username
-password = "replica_pass" # DB Password
-host = "localhost" # DB Host
-port = 5432 # DB Port
-dbname = "hyperswitch_db" # Name of Database
-pool_size = 5 # Number of connections to keep open
-connection_timeout = 10 # Timeout for database connection in seconds
+username = "replica_user" # DB Username
+password = "replica_pass" # DB Password. Only applicable when KMS is disabled.
+host = "localhost" # DB Host
+port = 5432 # DB Port
+dbname = "hyperswitch_db" # Name of Database
+pool_size = 5 # Number of connections to keep open
+connection_timeout = 10 # Timeout for database connection in seconds
+kms_encrypted_password = "" # Base64-encoded (KMS encrypted) ciphertext of the database password. Only applicable when KMS is enabled.
# Redis credentials
[redis]
diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.toml
index 387c0b796ae..d67108ce847 100644
--- a/crates/drainer/Cargo.toml
+++ b/crates/drainer/Cargo.toml
@@ -8,7 +8,8 @@ readme = "README.md"
license = "Apache-2.0"
[features]
-vergen = [ "router_env/vergen" ]
+kms = ["external_services/kms"]
+vergen = ["router_env/vergen"]
[dependencies]
async-bb8-diesel = { git = "https://github.com/juspay/async-bb8-diesel", rev = "9a71d142726dbc33f41c1fd935ddaa79841c7be5" }
@@ -26,9 +27,10 @@ tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] }
# First Party Crates
common_utils = { version = "0.1.0", path = "../common_utils" }
+external_services = { version = "0.1.0", path = "../external_services" }
redis_interface = { version = "0.1.0", path = "../redis_interface" }
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
storage_models = { version = "0.1.0", path = "../storage_models", features = ["kv_store"] }
[build-dependencies]
-router_env = { version = "0.1.0", path = "../router_env", default-features = false }
\ No newline at end of file
+router_env = { version = "0.1.0", path = "../router_env", default-features = false }
diff --git a/crates/drainer/src/connection.rs b/crates/drainer/src/connection.rs
index 0f05a2d86f4..d4902c8f428 100644
--- a/crates/drainer/src/connection.rs
+++ b/crates/drainer/src/connection.rs
@@ -1,5 +1,7 @@
use bb8::PooledConnection;
use diesel::PgConnection;
+#[cfg(feature = "kms")]
+use external_services::kms;
use crate::settings::Database;
@@ -15,13 +17,29 @@ pub async fn redis_connection(
}
#[allow(clippy::expect_used)]
-pub async fn diesel_make_pg_pool(database: &Database, _test_transaction: bool) -> PgPool {
+pub async fn diesel_make_pg_pool(
+ database: &Database,
+ _test_transaction: bool,
+ #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+) -> PgPool {
+ #[cfg(feature = "kms")]
+ let password = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&database.kms_encrypted_password)
+ .await
+ .expect("Failed to KMS decrypt database password");
+
+ #[cfg(not(feature = "kms"))]
+ let password = &database.password;
+
let database_url = format!(
"postgres://{}:{}@{}:{}/{}",
- database.username, database.password, database.host, database.port, database.dbname
+ database.username, password, database.host, database.port, database.dbname
);
let manager = async_bb8_diesel::ConnectionManager::<PgConnection>::new(database_url);
- let pool = bb8::Pool::builder().max_size(database.pool_size);
+ let pool = bb8::Pool::builder()
+ .max_size(database.pool_size)
+ .connection_timeout(std::time::Duration::from_secs(database.connection_timeout));
pool.build(manager)
.await
diff --git a/crates/drainer/src/services.rs b/crates/drainer/src/services.rs
index a9cbf12378f..5d72d836216 100644
--- a/crates/drainer/src/services.rs
+++ b/crates/drainer/src/services.rs
@@ -18,7 +18,13 @@ pub struct StoreConfig {
impl Store {
pub async fn new(config: &crate::settings::Settings, test_transaction: bool) -> Self {
Self {
- master_pool: diesel_make_pg_pool(&config.master_database, test_transaction).await,
+ master_pool: diesel_make_pg_pool(
+ &config.master_database,
+ test_transaction,
+ #[cfg(feature = "kms")]
+ &config.kms,
+ )
+ .await,
redis_conn: Arc::new(crate::connection::redis_connection(config).await),
config: StoreConfig {
drainer_stream_name: config.drainer.stream_name.clone(),
diff --git a/crates/drainer/src/settings.rs b/crates/drainer/src/settings.rs
index 5367d0dd596..d78f495a194 100644
--- a/crates/drainer/src/settings.rs
+++ b/crates/drainer/src/settings.rs
@@ -2,6 +2,8 @@ use std::path::PathBuf;
use common_utils::ext_traits::ConfigExt;
use config::{Environment, File};
+#[cfg(feature = "kms")]
+use external_services::kms;
use redis_interface as redis;
pub use router_env::config::{Log, LogConsole, LogFile, LogTelemetry};
use router_env::{env, logger};
@@ -25,17 +27,23 @@ pub struct Settings {
pub redis: redis::RedisSettings,
pub log: Log,
pub drainer: DrainerSettings,
+ #[cfg(feature = "kms")]
+ pub kms: kms::KmsConfig,
}
#[derive(Debug, Deserialize, Clone)]
#[serde(default)]
pub struct Database {
pub username: String,
+ #[cfg(not(feature = "kms"))]
pub password: String,
pub host: String,
pub port: u16,
pub dbname: String,
pub pool_size: u32,
+ pub connection_timeout: u64,
+ #[cfg(feature = "kms")]
+ pub kms_encrypted_password: String,
}
#[derive(Debug, Clone, Deserialize)]
@@ -51,12 +59,16 @@ pub struct DrainerSettings {
impl Default for Database {
fn default() -> Self {
Self {
- username: String::default(),
- password: String::default(),
+ username: String::new(),
+ #[cfg(not(feature = "kms"))]
+ password: String::new(),
host: "localhost".into(),
port: 5432,
- dbname: String::default(),
+ dbname: String::new(),
pool_size: 5,
+ connection_timeout: 10,
+ #[cfg(feature = "kms")]
+ kms_encrypted_password: String::new(),
}
}
}
@@ -77,29 +89,41 @@ impl Database {
fn validate(&self) -> Result<(), errors::DrainerError> {
use common_utils::fp_utils::when;
- when(self.username.is_default_or_empty(), || {
+ when(self.host.is_default_or_empty(), || {
Err(errors::DrainerError::ConfigParsingError(
- "database username must not be empty".into(),
+ "database host must not be empty".into(),
))
})?;
- when(self.password.is_default_or_empty(), || {
+ when(self.dbname.is_default_or_empty(), || {
Err(errors::DrainerError::ConfigParsingError(
- "database user password must not be empty".into(),
+ "database name must not be empty".into(),
))
})?;
- when(self.host.is_default_or_empty(), || {
+ when(self.username.is_default_or_empty(), || {
Err(errors::DrainerError::ConfigParsingError(
- "database host must not be empty".into(),
+ "database user username must not be empty".into(),
))
})?;
- when(self.dbname.is_default_or_empty(), || {
- Err(errors::DrainerError::ConfigParsingError(
- "database name must not be empty".into(),
- ))
- })
+ #[cfg(not(feature = "kms"))]
+ {
+ when(self.password.is_default_or_empty(), || {
+ Err(errors::DrainerError::ConfigParsingError(
+ "database user password must not be empty".into(),
+ ))
+ })
+ }
+
+ #[cfg(feature = "kms")]
+ {
+ when(self.kms_encrypted_password.is_default_or_empty(), || {
+ Err(errors::DrainerError::ConfigParsingError(
+ "database KMS encrypted password must not be empty".into(),
+ ))
+ })
+ }
}
}
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 465ceb4ef02..4b48d4292e0 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -15,12 +15,15 @@ impl Default for super::settings::Database {
fn default() -> Self {
Self {
username: String::new(),
+ #[cfg(not(feature = "kms"))]
password: String::new(),
host: "localhost".into(),
port: 5432,
dbname: String::new(),
pool_size: 5,
connection_timeout: 10,
+ #[cfg(feature = "kms")]
+ kms_encrypted_password: String::new(),
}
}
}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 883583a08b0..1a20db82ff2 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -223,12 +223,15 @@ pub struct Server {
#[serde(default)]
pub struct Database {
pub username: String,
+ #[cfg(not(feature = "kms"))]
pub password: String,
pub host: String,
pub port: u16,
pub dbname: String,
pub pool_size: u32,
pub connection_timeout: u64,
+ #[cfg(feature = "kms")]
+ pub kms_encrypted_password: String,
}
#[derive(Debug, Deserialize, Clone)]
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index 4cf28b3dcef..d74ffe4b9b8 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -61,23 +61,35 @@ impl super::settings::Database {
))
})?;
- when(self.username.is_default_or_empty(), || {
+ when(self.dbname.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
- "database user username must not be empty".into(),
+ "database name must not be empty".into(),
))
})?;
- when(self.password.is_default_or_empty(), || {
+ when(self.username.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
- "database user password must not be empty".into(),
+ "database user username must not be empty".into(),
))
})?;
- when(self.dbname.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "database name must not be empty".into(),
- ))
- })
+ #[cfg(not(feature = "kms"))]
+ {
+ when(self.password.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "database user password must not be empty".into(),
+ ))
+ })
+ }
+
+ #[cfg(feature = "kms")]
+ {
+ when(self.kms_encrypted_password.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "database KMS encrypted password must not be empty".into(),
+ ))
+ })
+ }
}
}
diff --git a/crates/router/src/connection.rs b/crates/router/src/connection.rs
index f692d446915..a84039a9035 100644
--- a/crates/router/src/connection.rs
+++ b/crates/router/src/connection.rs
@@ -2,6 +2,8 @@ use async_bb8_diesel::{AsyncConnection, ConnectionError};
use bb8::{CustomizeConnection, PooledConnection};
use diesel::PgConnection;
use error_stack::{IntoReport, ResultExt};
+#[cfg(feature = "kms")]
+use external_services::kms;
use crate::{configs::settings::Database, errors};
@@ -37,10 +39,24 @@ pub async fn redis_connection(
}
#[allow(clippy::expect_used)]
-pub async fn diesel_make_pg_pool(database: &Database, test_transaction: bool) -> PgPool {
+pub async fn diesel_make_pg_pool(
+ database: &Database,
+ test_transaction: bool,
+ #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+) -> PgPool {
+ #[cfg(feature = "kms")]
+ let password = kms::get_kms_client(kms_config)
+ .await
+ .decrypt(&database.kms_encrypted_password)
+ .await
+ .expect("Failed to KMS decrypt database password");
+
+ #[cfg(not(feature = "kms"))]
+ let password = &database.password;
+
let database_url = format!(
"postgres://{}:{}@{}:{}/{}",
- database.username, database.password, database.host, database.port, database.dbname
+ database.username, password, database.host, database.port, database.dbname
);
let manager = async_bb8_diesel::ConnectionManager::<PgConnection>::new(database_url);
let mut pool = bb8::Pool::builder()
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index a9021a34372..74c4a71c6dc 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -109,9 +109,21 @@ impl Store {
});
Self {
- master_pool: diesel_make_pg_pool(&config.master_database, test_transaction).await,
+ master_pool: diesel_make_pg_pool(
+ &config.master_database,
+ test_transaction,
+ #[cfg(feature = "kms")]
+ &config.kms,
+ )
+ .await,
#[cfg(feature = "olap")]
- replica_pool: diesel_make_pg_pool(&config.replica_database, test_transaction).await,
+ replica_pool: diesel_make_pg_pool(
+ &config.replica_database,
+ test_transaction,
+ #[cfg(feature = "kms")]
+ &config.kms,
+ )
+ .await,
redis_conn,
#[cfg(feature = "kv_store")]
config: StoreConfig {
|
refactor
|
KMS decrypt database password when `kms` feature is enabled (#733)
|
52154cbbe2fa83d2a51943934a86963d37c7ce1c
|
2024-08-07 14:00:29
|
Pa1NarK
|
feat(cypress): add configs for not overriding screenshots (#5524)
| false
|
diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js
index e36f68e80e2..2e132c74d3b 100644
--- a/cypress-tests/cypress.config.js
+++ b/cypress-tests/cypress.config.js
@@ -21,4 +21,5 @@ module.exports = {
chromeWebSecurity: false,
defaultCommandTimeout: 10000,
pageLoadTimeout: 20000,
+ trashAssetsBeforeRuns: false,
};
diff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.js
index 3a252243880..e3108016d8e 100644
--- a/cypress-tests/cypress/support/e2e.js
+++ b/cypress-tests/cypress/support/e2e.js
@@ -15,6 +15,7 @@
// Import commands.js using ES2015 syntax:
import "./commands";
+import "./screenshotConfigs";
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/cypress-tests/cypress/support/screenshotConfigs.js b/cypress-tests/cypress/support/screenshotConfigs.js
new file mode 100644
index 00000000000..a9f790c0b70
--- /dev/null
+++ b/cypress-tests/cypress/support/screenshotConfigs.js
@@ -0,0 +1,21 @@
+Cypress.Screenshot.defaults({
+ blackout: [".secret-info", "[data-hide=true]"],
+ capture: "runner",
+ overwrite: false,
+
+ onBeforeScreenshot($el) {
+ const $clock = $el.find(".clock");
+
+ if ($clock) {
+ $clock.hide();
+ }
+ },
+
+ onAfterScreenshot($el, props) {
+ const $clock = $el.find(".clock");
+
+ if ($clock) {
+ $clock.show();
+ }
+ },
+});
|
feat
|
add configs for not overriding screenshots (#5524)
|
36409bdc9185d4241971a30c55e1e331568abd2f
|
2024-05-20 19:14:41
|
Chethan Rao
|
refactor(cache): remove `deref` impl on `Cache` type (#4671)
| false
|
diff --git a/crates/router/src/db/cache.rs b/crates/router/src/db/cache.rs
index d9db13dde80..ba0aae55e89 100644
--- a/crates/router/src/db/cache.rs
+++ b/crates/router/src/db/cache.rs
@@ -88,7 +88,7 @@ where
Fut: futures::Future<Output = CustomResult<T, errors::StorageError>> + Send,
{
let data = fun().await?;
- in_memory.async_map(|cache| cache.invalidate(key)).await;
+ in_memory.async_map(|cache| cache.remove(key)).await;
let redis_conn = store
.get_redis_conn()
diff --git a/crates/router/tests/cache.rs b/crates/router/tests/cache.rs
index 040e0dddf97..c6eef06db7b 100644
--- a/crates/router/tests/cache.rs
+++ b/crates/router/tests/cache.rs
@@ -50,8 +50,14 @@ async fn invalidate_existing_cache_success() {
let response_body = response.body().await;
println!("invalidate Cache: {response:?} : {response_body:?}");
assert_eq!(response.status(), awc::http::StatusCode::OK);
- assert!(cache::CONFIG_CACHE.get(&cache_key).await.is_none());
- assert!(cache::ACCOUNTS_CACHE.get(&cache_key).await.is_none());
+ assert!(cache::CONFIG_CACHE
+ .get_val::<String>(&cache_key)
+ .await
+ .is_none());
+ assert!(cache::ACCOUNTS_CACHE
+ .get_val::<String>(&cache_key)
+ .await
+ .is_none());
}
#[actix_web::test]
diff --git a/crates/storage_impl/src/redis/cache.rs b/crates/storage_impl/src/redis/cache.rs
index dc2a2225dc9..4cd2fc0c504 100644
--- a/crates/storage_impl/src/redis/cache.rs
+++ b/crates/storage_impl/src/redis/cache.rs
@@ -94,13 +94,6 @@ pub struct Cache {
inner: MokaCache<String, Arc<dyn Cacheable>>,
}
-impl std::ops::Deref for Cache {
- type Target = MokaCache<String, Arc<dyn Cacheable>>;
- fn deref(&self) -> &Self::Target {
- &self.inner
- }
-}
-
impl Cache {
/// With given `time_to_live` and `time_to_idle` creates a moka cache.
///
@@ -122,16 +115,16 @@ impl Cache {
}
pub async fn push<T: Cacheable>(&self, key: String, val: T) {
- self.insert(key, Arc::new(val)).await;
+ self.inner.insert(key, Arc::new(val)).await;
}
pub async fn get_val<T: Clone + Cacheable>(&self, key: &str) -> Option<T> {
- let val = self.get(key).await?;
+ let val = self.inner.get(key).await?;
(*val).as_any().downcast_ref::<T>().cloned()
}
pub async fn remove(&self, key: &str) {
- self.invalidate(key).await;
+ self.inner.invalidate(key).await;
}
}
@@ -208,7 +201,7 @@ where
Fut: futures::Future<Output = CustomResult<T, StorageError>> + Send,
{
let data = fun().await?;
- in_memory.async_map(|cache| cache.invalidate(key)).await;
+ in_memory.async_map(|cache| cache.remove(key)).await;
let redis_conn = store
.get_redis_conn()
diff --git a/crates/storage_impl/src/redis/pub_sub.rs b/crates/storage_impl/src/redis/pub_sub.rs
index 349d1872d2a..2922dbcadba 100644
--- a/crates/storage_impl/src/redis/pub_sub.rs
+++ b/crates/storage_impl/src/redis/pub_sub.rs
@@ -60,16 +60,16 @@ impl PubSubInterface for redis_interface::RedisConnectionPool {
let key = match key {
CacheKind::Config(key) => {
- CONFIG_CACHE.invalidate(key.as_ref()).await;
+ CONFIG_CACHE.remove(key.as_ref()).await;
key
}
CacheKind::Accounts(key) => {
- ACCOUNTS_CACHE.invalidate(key.as_ref()).await;
+ ACCOUNTS_CACHE.remove(key.as_ref()).await;
key
}
CacheKind::All(key) => {
- CONFIG_CACHE.invalidate(key.as_ref()).await;
- ACCOUNTS_CACHE.invalidate(key.as_ref()).await;
+ CONFIG_CACHE.remove(key.as_ref()).await;
+ ACCOUNTS_CACHE.remove(key.as_ref()).await;
key
}
};
|
refactor
|
remove `deref` impl on `Cache` type (#4671)
|
13c621ae62cda8f03ebd3958825b28a66b885234
|
2025-03-13 05:58:30
|
github-actions
|
chore(version): 2025.03.13.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 859c044c5ed..0a7ece3585b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,33 @@
All notable changes to HyperSwitch will be documented here.
+- - -
+
+## 2025.03.13.0
+
+### Features
+
+- **analytics:** Modified authentication queries and added generate report for authentications ([#7483](https://github.com/juspay/hyperswitch/pull/7483)) ([`9683b2a`](https://github.com/juspay/hyperswitch/commit/9683b2a8955f876d99625cd5cf70c4bdf3836e9e))
+- **connector:** Add record back connector integration flow ([#7416](https://github.com/juspay/hyperswitch/pull/7416)) ([`13a2749`](https://github.com/juspay/hyperswitch/commit/13a274909962872f1d663d082af33fc44205d419))
+- **core:** Add V2 Authentication to all available endpoints ([#7487](https://github.com/juspay/hyperswitch/pull/7487)) ([`3667a7f`](https://github.com/juspay/hyperswitch/commit/3667a7ffd216e165e1f51ad1ceac05d6901bb187))
+- **payment_methods_v2:** Add total-payment-method-count api ([#7479](https://github.com/juspay/hyperswitch/pull/7479)) ([`4f6174d`](https://github.com/juspay/hyperswitch/commit/4f6174d1bf6dd0713b0a3d8e005671c884555144))
+- **users:** Add V2 User APIs to Support Modularity for Merchant Accounts ([#7386](https://github.com/juspay/hyperswitch/pull/7386)) ([`d1f5303`](https://github.com/juspay/hyperswitch/commit/d1f53036c75771d8387a9579a544c1e2b3c17353))
+
+### Bug Fixes
+
+- **connector:** Fix mapping of feature matrix for coinbase ([#7454](https://github.com/juspay/hyperswitch/pull/7454)) ([`e949600`](https://github.com/juspay/hyperswitch/commit/e9496007889350f78af5875566c806f79c397544))
+- **payment_methods:** Payment method type not being stored in payment method ([#7411](https://github.com/juspay/hyperswitch/pull/7411)) ([`833da1c`](https://github.com/juspay/hyperswitch/commit/833da1c3c5a0f006a689b05554c547205774c823))
+- **routing:** Enable filtering of default connectors for contract based routing ([#7420](https://github.com/juspay/hyperswitch/pull/7420)) ([`c0c08d0`](https://github.com/juspay/hyperswitch/commit/c0c08d05ef04d914e07d49f163e43bdddf5c885b))
+
+### Refactors
+
+- **connector:** [FISERV, HELCIM] Add amount conversion framework to Fiserv, Helcim ([#7336](https://github.com/juspay/hyperswitch/pull/7336)) ([`4352101`](https://github.com/juspay/hyperswitch/commit/4352101555f77bc0c18a2b83e5dbb432fae4e0c9))
+- **cypress:** Fiuu connector configuration changes ([#7297](https://github.com/juspay/hyperswitch/pull/7297)) ([`a387ae2`](https://github.com/juspay/hyperswitch/commit/a387ae290ef899c252049f270cbf9b716dbe1c55))
+- **payment_methods_v2:** Refactor network tokenization flow for v2 ([#7309](https://github.com/juspay/hyperswitch/pull/7309)) ([`bba414c`](https://github.com/juspay/hyperswitch/commit/bba414cd198bef0f2fb8bfbd077f7f775a2eb8a5))
+
+**Full Changelog:** [`2025.03.12.0...2025.03.13.0`](https://github.com/juspay/hyperswitch/compare/2025.03.12.0...2025.03.13.0)
+
+
- - -
## 2025.03.12.0
|
chore
|
2025.03.13.0
|
bdf48320f9d4f1dc8c13f42f6e1e06d1056acf33
|
2023-09-06 23:41:44
|
Sakil Mostak
|
refactor(connector): [Payme] Response Handling for Preprocessing (#2097)
| false
|
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index 672cf811352..4cf87bde26d 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -1,6 +1,9 @@
use std::collections::HashMap;
-use api_models::{enums::AuthenticationType, payments::PaymentMethodData};
+use api_models::{
+ enums::{AuthenticationType, PaymentMethod},
+ payments::PaymentMethodData,
+};
use common_utils::pii;
use error_stack::{IntoReport, ResultExt};
use masking::{ExposeInterface, Secret};
@@ -454,8 +457,49 @@ impl<F>
types::PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- match item.data.auth_type {
- AuthenticationType::NoThreeDs => {
+ match item.data.payment_method {
+ PaymentMethod::Card => {
+ match item.data.auth_type {
+ AuthenticationType::NoThreeDs => {
+ Ok(Self {
+ // We don't get any status from payme, so defaulting it to pending
+ // then move to authorize flow
+ status: enums::AttemptStatus::Pending,
+ preprocessing_id: Some(item.response.payme_sale_id.to_owned()),
+ response: Ok(types::PaymentsResponseData::PreProcessingResponse {
+ pre_processing_id:
+ types::PreprocessingResponseId::ConnectorTransactionId(
+ item.response.payme_sale_id,
+ ),
+ connector_metadata: None,
+ session_token: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ })
+ }
+ AuthenticationType::ThreeDs => Ok(Self {
+ // We don't go to authorize flow in 3ds,
+ // Response is send directly after preprocessing flow
+ // redirection data is send to run script along
+ // status is made authentication_pending to show redirection
+ status: enums::AttemptStatus::AuthenticationPending,
+ preprocessing_id: Some(item.response.payme_sale_id.to_owned()),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.payme_sale_id.to_owned(),
+ ),
+ redirection_data: Some(services::RedirectForm::Payme),
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ }),
+ }
+ }
+ _ => {
let currency_code = item.data.request.get_currency()?;
let amount = item.data.request.get_amount()?;
let amount_in_base_unit = utils::to_currency_base_unit(amount, currency_code)?;
@@ -514,21 +558,6 @@ impl<F>
..item.data
})
}
- AuthenticationType::ThreeDs => Ok(Self {
- status: enums::AttemptStatus::AuthenticationPending,
- preprocessing_id: Some(item.response.payme_sale_id.to_owned()),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.payme_sale_id.to_owned(),
- ),
- redirection_data: Some(services::RedirectForm::Payme),
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- }),
- ..item.data
- }),
}
}
}
@@ -588,7 +617,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest {
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PaymePayloadData {
+pub struct PaymeRedirectResponseData {
meta_data: String,
}
@@ -602,7 +631,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest {
let payload_data = item.request.get_redirect_response_payload()?.expose();
- let jwt_data: PaymePayloadData = serde_json::from_value(payload_data)
+ let jwt_data: PaymeRedirectResponseData = serde_json::from_value(payload_data)
.into_report()
.change_context(errors::ConnectorError::MissingConnectorRedirectionPayload {
field_name: "meta_data_jwt",
|
refactor
|
[Payme] Response Handling for Preprocessing (#2097)
|
4833f1ac31b725c275465cf9fba34c5950b3c500
|
2024-05-31 05:42:25
|
github-actions
|
chore(postman): update Postman collection files
| false
|
diff --git a/postman/collection-json/adyen_uk.postman_collection.json b/postman/collection-json/adyen_uk.postman_collection.json
index dc34efad9e3..255e099f090 100644
--- a/postman/collection-json/adyen_uk.postman_collection.json
+++ b/postman/collection-json/adyen_uk.postman_collection.json
@@ -8960,7 +8960,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -9780,7 +9780,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -10423,7 +10423,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
diff --git a/postman/collection-json/bluesnap.postman_collection.json b/postman/collection-json/bluesnap.postman_collection.json
index d1188336c11..e796a01eaca 100644
--- a/postman/collection-json/bluesnap.postman_collection.json
+++ b/postman/collection-json/bluesnap.postman_collection.json
@@ -1909,7 +1909,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -2562,7 +2562,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -3701,7 +3701,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
diff --git a/postman/collection-json/checkout.postman_collection.json b/postman/collection-json/checkout.postman_collection.json
index cdb94b4a84b..3f022e58853 100644
--- a/postman/collection-json/checkout.postman_collection.json
+++ b/postman/collection-json/checkout.postman_collection.json
@@ -997,7 +997,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -2004,7 +2004,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -2640,7 +2640,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -3304,7 +3304,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
diff --git a/postman/collection-json/cybersource.postman_collection.json b/postman/collection-json/cybersource.postman_collection.json
index 1616eb0c445..9c8dbc65291 100644
--- a/postman/collection-json/cybersource.postman_collection.json
+++ b/postman/collection-json/cybersource.postman_collection.json
@@ -6936,7 +6936,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -7712,7 +7712,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -8106,7 +8106,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.json
index 519b1409544..136c2d24737 100644
--- a/postman/collection-json/nmi.postman_collection.json
+++ b/postman/collection-json/nmi.postman_collection.json
@@ -6603,7 +6603,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"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",
@@ -7207,7 +7207,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
|
chore
|
update Postman collection files
|
d2626fa3fe4216504fd0df216eea8462c87cce07
|
2024-06-28 15:08:07
|
Nishant Joshi
|
chore(cards): add configuration option to change the decryption scheme locker (#5140)
| false
|
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 35bfbc88f69..95b585d3445 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -69,6 +69,7 @@ impl Default for super::settings::Locker {
locker_enabled: true,
//Time to live for storage entries in locker
ttl_for_storage_in_secs: 60 * 60 * 24 * 365 * 7,
+ decryption_scheme: Default::default(),
}
}
}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 0569c4dbed6..2bbb50d6812 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -497,6 +497,16 @@ pub struct Locker {
pub locker_signing_key_id: String,
pub locker_enabled: bool,
pub ttl_for_storage_in_secs: i64,
+ pub decryption_scheme: DecryptionScheme,
+}
+
+#[derive(Debug, Deserialize, Clone, Default)]
+pub enum DecryptionScheme {
+ #[default]
+ #[serde(rename = "RSA-OAEP")]
+ RsaOaep,
+ #[serde(rename = "RSA-OAEP-256")]
+ RsaOaep256,
}
#[derive(Debug, Deserialize, Clone)]
diff --git a/crates/router/src/core/blocklist/transformers.rs b/crates/router/src/core/blocklist/transformers.rs
index c3499445602..d17322f2be5 100644
--- a/crates/router/src/core/blocklist/transformers.rs
+++ b/crates/router/src/core/blocklist/transformers.rs
@@ -144,11 +144,15 @@ async fn call_to_locker_for_fingerprint(
.get_response_inner("JweBody")
.change_context(errors::VaultError::GenerateFingerprintFailed)?;
- let decrypted_payload =
- decrypt_generate_fingerprint_response_payload(jwekey, jwe_body, Some(locker_choice))
- .await
- .change_context(errors::VaultError::GenerateFingerprintFailed)
- .attach_printable("Error getting decrypted fingerprint response payload")?;
+ let decrypted_payload = decrypt_generate_fingerprint_response_payload(
+ jwekey,
+ jwe_body,
+ Some(locker_choice),
+ locker.decryption_scheme.clone(),
+ )
+ .await
+ .change_context(errors::VaultError::GenerateFingerprintFailed)
+ .attach_printable("Error getting decrypted fingerprint response payload")?;
let generate_fingerprint_response: blocklist::GenerateFingerprintResponsePayload =
decrypted_payload
.parse_struct("GenerateFingerprintResponse")
@@ -159,9 +163,9 @@ async fn call_to_locker_for_fingerprint(
async fn decrypt_generate_fingerprint_response_payload(
jwekey: &settings::Jwekey,
-
jwe_body: encryption::JweBody,
locker_choice: Option<api_enums::LockerChoice>,
+ decryption_scheme: settings::DecryptionScheme,
) -> CustomResult<String, errors::VaultError> {
let target_locker = locker_choice.unwrap_or(api_enums::LockerChoice::HyperswitchCardVault);
@@ -174,7 +178,10 @@ async fn decrypt_generate_fingerprint_response_payload(
let private_key = jwekey.vault_private_key.peek().as_bytes();
let jwt = payment_methods::get_dotted_jwe(jwe_body);
- let alg = jwe::RSA_OAEP;
+ let alg = match decryption_scheme {
+ settings::DecryptionScheme::RsaOaep => jwe::RSA_OAEP,
+ settings::DecryptionScheme::RsaOaep256 => jwe::RSA_OAEP_256,
+ };
let jwe_decrypted = encryption::decrypt_jwe(
&jwt,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 21f26124391..5fb923704c5 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1325,11 +1325,15 @@ pub async fn get_payment_method_from_hs_locker<'a>(
let jwe_body: services::JweBody = response
.get_response_inner("JweBody")
.change_context(errors::VaultError::FetchPaymentMethodFailed)?;
- let decrypted_payload =
- payment_methods::get_decrypted_response_payload(jwekey, jwe_body, locker_choice)
- .await
- .change_context(errors::VaultError::FetchPaymentMethodFailed)
- .attach_printable("Error getting decrypted response payload for get card")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ locker_choice,
+ locker.decryption_scheme.clone(),
+ )
+ .await
+ .change_context(errors::VaultError::FetchPaymentMethodFailed)
+ .attach_printable("Error getting decrypted response payload for get card")?;
let get_card_resp: payment_methods::RetrieveCardResp = decrypted_payload
.parse_struct("RetrieveCardResp")
.change_context(errors::VaultError::FetchPaymentMethodFailed)
@@ -1378,11 +1382,15 @@ pub async fn call_to_locker_hs<'a>(
.get_response_inner("JweBody")
.change_context(errors::VaultError::FetchCardFailed)?;
- let decrypted_payload =
- payment_methods::get_decrypted_response_payload(jwekey, jwe_body, Some(locker_choice))
- .await
- .change_context(errors::VaultError::SaveCardFailed)
- .attach_printable("Error getting decrypted response payload")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ Some(locker_choice),
+ locker.decryption_scheme.clone(),
+ )
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error getting decrypted response payload")?;
let stored_card_resp: payment_methods::StoreCardResp = decrypted_payload
.parse_struct("StoreCardResp")
.change_context(errors::VaultError::ResponseDeserializationFailed)?;
@@ -1459,11 +1467,15 @@ pub async fn get_card_from_hs_locker<'a>(
let jwe_body: services::JweBody = response
.get_response_inner("JweBody")
.change_context(errors::VaultError::FetchCardFailed)?;
- let decrypted_payload =
- payment_methods::get_decrypted_response_payload(jwekey, jwe_body, Some(locker_choice))
- .await
- .change_context(errors::VaultError::FetchCardFailed)
- .attach_printable("Error getting decrypted response payload for get card")?;
+ let decrypted_payload = payment_methods::get_decrypted_response_payload(
+ jwekey,
+ jwe_body,
+ Some(locker_choice),
+ locker.decryption_scheme.clone(),
+ )
+ .await
+ .change_context(errors::VaultError::FetchCardFailed)
+ .attach_printable("Error getting decrypted response payload for get card")?;
let get_card_resp: payment_methods::RetrieveCardResp = decrypted_payload
.parse_struct("RetrieveCardResp")
.change_context(errors::VaultError::FetchCardFailed)?;
@@ -1513,6 +1525,7 @@ pub async fn delete_card_from_hs_locker<'a>(
jwekey,
jwe_body,
Some(api_enums::LockerChoice::HyperswitchCardVault),
+ locker.decryption_scheme.clone(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index ca0cbb2a0f8..887c02dd023 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -199,6 +199,7 @@ pub async fn get_decrypted_response_payload(
jwekey: &settings::Jwekey,
jwe_body: encryption::JweBody,
locker_choice: Option<api_enums::LockerChoice>,
+ decryption_scheme: settings::DecryptionScheme,
) -> CustomResult<String, errors::VaultError> {
let target_locker = locker_choice.unwrap_or(api_enums::LockerChoice::HyperswitchCardVault);
@@ -211,7 +212,10 @@ pub async fn get_decrypted_response_payload(
let private_key = jwekey.vault_private_key.peek().as_bytes();
let jwt = get_dotted_jwe(jwe_body);
- let alg = jwe::RSA_OAEP;
+ let alg = match decryption_scheme {
+ settings::DecryptionScheme::RsaOaep => jwe::RSA_OAEP,
+ settings::DecryptionScheme::RsaOaep256 => jwe::RSA_OAEP_256,
+ };
let jwe_decrypted = encryption::decrypt_jwe(
&jwt,
|
chore
|
add configuration option to change the decryption scheme locker (#5140)
|
fad23ad032971497b07035c530397539413b7653
|
2024-03-13 17:43:31
|
Hrithikesh
|
fix: get valid test cards list based on wasm feature config (#4066)
| false
|
diff --git a/crates/cards/src/validate.rs b/crates/cards/src/validate.rs
index 14d4c6e4c12..08ad127047c 100644
--- a/crates/cards/src/validate.rs
+++ b/crates/cards/src/validate.rs
@@ -2,7 +2,7 @@ use std::{fmt, ops::Deref, str::FromStr};
use masking::{PeekInterface, Strategy, StrongSecret, WithType};
#[cfg(not(target_arch = "wasm32"))]
-use router_env::logger;
+use router_env::{logger, which as router_env_which, Env};
use serde::{Deserialize, Deserializer, Serialize};
use thiserror::Error;
@@ -52,14 +52,16 @@ impl FromStr for CardNumber {
fn from_str(s: &str) -> Result<Self, Self::Err> {
// Valid test cards for threedsecureio
- let valid_test_cards = match router_env::which() {
- router_env::Env::Development | router_env::Env::Sandbox => vec![
- "4000100511112003",
- "6000100611111203",
- "3000100811111072",
- "9000100111111111",
- ],
- router_env::Env::Production => vec![],
+ let valid_test_cards = vec![
+ "4000100511112003",
+ "6000100611111203",
+ "3000100811111072",
+ "9000100111111111",
+ ];
+ #[cfg(not(target_arch = "wasm32"))]
+ let valid_test_cards = match router_env_which() {
+ Env::Development | Env::Sandbox => valid_test_cards,
+ Env::Production => vec![],
};
if luhn::valid(s) || valid_test_cards.contains(&s) {
let cc_no_whitespace: String = s.split_whitespace().collect();
|
fix
|
get valid test cards list based on wasm feature config (#4066)
|
a4f6f3fdaa23f7bd849eb44971de8311f9363ac3
|
2023-05-03 12:16:25
|
Kartikeya Hegde
|
build(deps): make AWS dependencies optional (#1030)
| false
|
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 102d0287ff7..f21d82bd1cc 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -11,8 +11,8 @@ build = "src/build.rs"
[features]
default = ["kv_store", "stripe", "oltp", "olap", "accounts_cache"]
-s3 = []
-kms = ["external_services/kms"]
+s3 = ["dep:aws-sdk-s3","dep:aws-config"]
+kms = ["external_services/kms","dep:aws-config"]
basilisk = ["kms"]
stripe = ["dep:serde_qs"]
sandbox = ["kms", "stripe", "basilisk", "s3"]
@@ -89,8 +89,8 @@ router_derive = { version = "0.1.0", path = "../router_derive" }
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
storage_models = { version = "0.1.0", path = "../storage_models", features = ["kv_store"] }
actix-multipart = "0.6.0"
-aws-sdk-s3 = "0.25.0"
-aws-config = "0.55.1"
+aws-sdk-s3 = { version = "0.25.0", optional = true }
+aws-config = {version = "0.55.1", optional = true }
infer = "0.13.0"
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
build
|
make AWS dependencies optional (#1030)
|
6b0f7e4870886997ca300935e727283c739be486
|
2024-09-30 20:16:38
|
Sakil Mostak
|
fix(connector): [Adyen Platform] wasm configs and webhook status mapping (#6161)
| false
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 3863f5364b5..abe25e5c2b0 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -320,6 +320,8 @@ label="Source balance account ID"
placeholder="Enter Source balance account ID"
required=true
type="Text"
+[adyenplatform_payout.connector_webhook_details]
+merchant_secret="Source verification key"
[airwallex]
[[airwallex.credit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 0dc86b2f555..32d6d96bb90 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -124,6 +124,21 @@ key1="Adyen Account Id"
[adyen.connector_webhook_details]
merchant_secret="Source verification key"
+[adyenplatform_payout]
+[[adyenplatform_payout.bank_transfer]]
+ payment_method_type = "sepa"
+[adyenplatform_payout.connector_auth.HeaderKey]
+api_key = "Adyen platform's API Key"
+
+[adyenplatform_payout.metadata.source_balance_account]
+name="source_balance_account"
+label="Source balance account ID"
+placeholder="Enter Source balance account ID"
+required=true
+type="Text"
+[adyenplatform_payout.connector_webhook_details]
+merchant_secret="Source verification key"
+
[[adyen.metadata.apple_pay]]
name="certificate"
label="Merchant Certificate (Base64 Encoded)"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 7861d53d127..b4de938bc80 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -320,6 +320,8 @@ label="Source balance account ID"
placeholder="Enter Source balance account ID"
required=true
type="Text"
+[adyenplatform_payout.connector_webhook_details]
+merchant_secret="Source verification key"
[airwallex]
[[airwallex.credit]]
diff --git a/crates/router/src/connector/adyenplatform/transformers/payouts.rs b/crates/router/src/connector/adyenplatform/transformers/payouts.rs
index 09772fc87de..e2a72ad52b8 100644
--- a/crates/router/src/connector/adyenplatform/transformers/payouts.rs
+++ b/crates/router/src/connector/adyenplatform/transformers/payouts.rs
@@ -367,7 +367,8 @@ pub struct AdyenplatformIncomingWebhookData {
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenplatformInstantStatus {
- status: InstantPriorityStatus,
+ status: Option<InstantPriorityStatus>,
+ estimated_arrival_time: Option<String>,
}
#[cfg(feature = "payouts")]
@@ -416,20 +417,14 @@ impl
) -> Self {
match (event_type, status, instant_status) {
(AdyenplatformWebhookEventType::PayoutCreated, _, _) => Self::PayoutCreated,
- (
- AdyenplatformWebhookEventType::PayoutUpdated,
- _,
- Some(AdyenplatformInstantStatus {
- status: InstantPriorityStatus::Credited,
- }),
- ) => Self::PayoutSuccess,
- (
- AdyenplatformWebhookEventType::PayoutUpdated,
- _,
- Some(AdyenplatformInstantStatus {
- status: InstantPriorityStatus::Pending,
- }),
- ) => Self::PayoutProcessing,
+ (AdyenplatformWebhookEventType::PayoutUpdated, _, Some(instant_status)) => {
+ match (instant_status.status, instant_status.estimated_arrival_time) {
+ (Some(InstantPriorityStatus::Credited), _) | (None, Some(_)) => {
+ Self::PayoutSuccess
+ }
+ _ => Self::PayoutProcessing,
+ }
+ }
(AdyenplatformWebhookEventType::PayoutUpdated, status, _) => match status {
AdyenplatformWebhookStatus::Authorised
| AdyenplatformWebhookStatus::Booked
|
fix
|
[Adyen Platform] wasm configs and webhook status mapping (#6161)
|
bbf20c5b155c003bcef91880653f87c9dedc928f
|
2024-03-15 18:00:41
|
AkshayaFoiger
|
refactor(connector): [NMI] Mask PII data (#3876)
| false
|
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 2f8505522b2..efde37d8715 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -258,7 +258,7 @@ pub struct NmiCompleteRequest {
transaction_type: TransactionType,
security_key: Secret<String>,
orderid: Option<String>,
- customer_vault_id: String,
+ customer_vault_id: Secret<String>,
email: Option<Email>,
cardholder_auth: Option<String>,
cavv: Option<String>,
@@ -266,8 +266,9 @@ pub struct NmiCompleteRequest {
eci: Option<String>,
cvv: Secret<String>,
three_ds_version: Option<String>,
- directory_server_id: Option<String>,
+ directory_server_id: Option<Secret<String>>,
}
+
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(untagged)]
@@ -292,8 +293,8 @@ pub struct NmiRedirectResponseData {
card_holder_auth: Option<String>,
three_ds_version: Option<String>,
order_id: Option<String>,
- directory_server_id: Option<String>,
- customer_vault_id: String,
+ directory_server_id: Option<Secret<String>>,
+ customer_vault_id: Secret<String>,
}
impl TryFrom<&NmiRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for NmiCompleteRequest {
|
refactor
|
[NMI] Mask PII data (#3876)
|
ceed76fb2e67771048e563a13703eb801eeaae08
|
2023-10-31 17:01:06
|
HeetVekariya
|
refactor(connector): [Payeezy] remove default case handling (#2712)
| false
|
diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs
index 98e8ea12c00..efcd1b36d5b 100644
--- a/crates/router/src/connector/payeezy/transformers.rs
+++ b/crates/router/src/connector/payeezy/transformers.rs
@@ -37,11 +37,14 @@ impl TryFrom<utils::CardIssuer> for PayeezyCardType {
utils::CardIssuer::Master => Ok(Self::Mastercard),
utils::CardIssuer::Discover => Ok(Self::Discover),
utils::CardIssuer::Visa => Ok(Self::Visa),
- _ => Err(errors::ConnectorError::NotSupported {
- message: issuer.to_string(),
- connector: "Payeezy",
+
+ utils::CardIssuer::Maestro | utils::CardIssuer::DinersClub | utils::CardIssuer::JCB => {
+ Err(errors::ConnectorError::NotSupported {
+ message: utils::SELECTED_PAYMENT_METHOD.to_string(),
+ connector: "Payeezy",
+ }
+ .into())
}
- .into()),
}
}
}
@@ -97,7 +100,20 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayeezyPaymentsRequest {
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
match item.payment_method {
diesel_models::enums::PaymentMethod::Card => get_card_specific_payment_data(item),
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+
+ diesel_models::enums::PaymentMethod::CardRedirect
+ | diesel_models::enums::PaymentMethod::PayLater
+ | diesel_models::enums::PaymentMethod::Wallet
+ | diesel_models::enums::PaymentMethod::BankRedirect
+ | diesel_models::enums::PaymentMethod::BankTransfer
+ | diesel_models::enums::PaymentMethod::Crypto
+ | diesel_models::enums::PaymentMethod::BankDebit
+ | diesel_models::enums::PaymentMethod::Reward
+ | diesel_models::enums::PaymentMethod::Upi
+ | diesel_models::enums::PaymentMethod::Voucher
+ | diesel_models::enums::PaymentMethod::GiftCard => {
+ Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into())
+ }
}
}
}
@@ -165,7 +181,10 @@ fn get_transaction_type_and_stored_creds(
Some(diesel_models::enums::CaptureMethod::Automatic) => {
Ok((PayeezyTransactionType::Purchase, None))
}
- _ => Err(errors::ConnectorError::FlowNotSupported {
+
+ Some(diesel_models::enums::CaptureMethod::ManualMultiple)
+ | Some(diesel_models::enums::CaptureMethod::Scheduled)
+ | None => Err(errors::ConnectorError::FlowNotSupported {
flow: item.request.capture_method.unwrap_or_default().to_string(),
connector: "Payeezy".to_string(),
}),
@@ -196,7 +215,23 @@ fn get_payment_method_data(
};
Ok(PayeezyPaymentMethod::PayeezyCard(payeezy_card))
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+
+ api::PaymentMethodData::CardRedirect(_)
+ | api::PaymentMethodData::Wallet(_)
+ | api::PaymentMethodData::PayLater(_)
+ | api::PaymentMethodData::BankRedirect(_)
+ | api::PaymentMethodData::BankDebit(_)
+ | api::PaymentMethodData::BankTransfer(_)
+ | api::PaymentMethodData::Crypto(_)
+ | api::PaymentMethodData::MandatePayment
+ | api::PaymentMethodData::Reward
+ | api::PaymentMethodData::Upi(_)
+ | api::PaymentMethodData::Voucher(_)
+ | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported {
+ message: utils::SELECTED_PAYMENT_METHOD.to_string(),
+ connector: "Payeezy",
+ }
+ .into()),
}
}
@@ -383,7 +418,7 @@ impl ForeignFrom<(PayeezyPaymentStatus, PayeezyTransactionType)> for enums::Atte
| PayeezyTransactionType::Purchase
| PayeezyTransactionType::Recurring => Self::Charged,
PayeezyTransactionType::Void => Self::Voided,
- _ => Self::Pending,
+ PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending,
},
PayeezyPaymentStatus::Declined | PayeezyPaymentStatus::NotProcessed => match method {
PayeezyTransactionType::Capture => Self::CaptureFailed,
@@ -391,7 +426,7 @@ impl ForeignFrom<(PayeezyPaymentStatus, PayeezyTransactionType)> for enums::Atte
| PayeezyTransactionType::Purchase
| PayeezyTransactionType::Recurring => Self::AuthorizationFailed,
PayeezyTransactionType::Void => Self::VoidFailed,
- _ => Self::Pending,
+ PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending,
},
}
}
|
refactor
|
[Payeezy] remove default case handling (#2712)
|
c804464d22543cbfd1443c6359537125d447508d
|
2023-08-31 20:02:33
|
github-actions
|
chore(version): v1.32.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53d11a5725d..de9a7ef905e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,42 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.32.0 (2023-08-31)
+
+### Features
+
+- **connector:** [Square] Implement Card Payments for Square ([#1902](https://github.com/juspay/hyperswitch/pull/1902)) ([`c9fe389`](https://github.com/juspay/hyperswitch/commit/c9fe389b2c04817a843e34de0aab3d024bb31f19))
+- **core:** Connector specific validation for Payment Sync ([#2005](https://github.com/juspay/hyperswitch/pull/2005)) ([`098dc89`](https://github.com/juspay/hyperswitch/commit/098dc89d0cc9c1a2e0fbbb5384fa6f55a3a6a9a2))
+- **router:**
+ - Verify service for applepay merchant registration ([#2009](https://github.com/juspay/hyperswitch/pull/2009)) ([`636b871`](https://github.com/juspay/hyperswitch/commit/636b871b1199703ce8e9c7c4b15284c45eff37ac))
+ - Send connector timeouts and connection closures as 2xx response instead of giving 5xx response ([#2047](https://github.com/juspay/hyperswitch/pull/2047)) ([`31088b6`](https://github.com/juspay/hyperswitch/commit/31088b606261d2524f2f84ea0c34a40ab56a7e9d))
+
+### Bug Fixes
+
+- **connector:** [Bluesnap] make error_name as optional field ([#2045](https://github.com/juspay/hyperswitch/pull/2045)) ([`ab85617`](https://github.com/juspay/hyperswitch/commit/ab8561793549712ac50755525eab4dc6b5b19925))
+- **mock_db:** Insert merchant for mock_db ([#1984](https://github.com/juspay/hyperswitch/pull/1984)) ([`fb39795`](https://github.com/juspay/hyperswitch/commit/fb397956adf20219e039548b6a3682ba526a23f4))
+
+### Refactors
+
+- **router:** Fixed unprocessable entity error message to custom message ([#1979](https://github.com/juspay/hyperswitch/pull/1979)) ([`655b388`](https://github.com/juspay/hyperswitch/commit/655b388358ecb7d3c3e990d19989febea9f9d4c9))
+
+### Testing
+
+- **postman:** Update event file format to latest supported ([#2055](https://github.com/juspay/hyperswitch/pull/2055)) ([`eeee0ed`](https://github.com/juspay/hyperswitch/commit/eeee0ed5dc830279d57b07f48f6b3f6ecc95f8f1))
+
+### Documentation
+
+- **CONTRIBUTING:** Fix open a discussion link ([#2054](https://github.com/juspay/hyperswitch/pull/2054)) ([`58105d4`](https://github.com/juspay/hyperswitch/commit/58105d4ae2eedea137c179c91775e5ec5524897a))
+
+### Miscellaneous Tasks
+
+- Add metrics for external api call ([#2021](https://github.com/juspay/hyperswitch/pull/2021)) ([`08fb2a9`](https://github.com/juspay/hyperswitch/commit/08fb2a93c19981f5f8e81ce9a8d267929933f832))
+
+**Full Changelog:** [`v1.31.0...v1.32.0`](https://github.com/juspay/hyperswitch/compare/v1.31.0...v1.32.0)
+
+- - -
+
+
## 1.31.0 (2023-08-30)
### Features
|
chore
|
v1.32.0
|
c2b15615e3c61e6f497180be8fa66d008ed150bb
|
2024-03-11 12:26:59
|
AkshayaFoiger
|
refactor(connector): [Multisafepay] Mask PII data (#3869)
| false
|
diff --git a/crates/masking/src/serde.rs b/crates/masking/src/serde.rs
index bb81717fd67..a96a87f05c8 100644
--- a/crates/masking/src/serde.rs
+++ b/crates/masking/src/serde.rs
@@ -27,6 +27,7 @@ pub trait SerializableSecret: Serialize {}
impl SerializableSecret for Value {}
impl SerializableSecret for u8 {}
impl SerializableSecret for u16 {}
+impl SerializableSecret for i32 {}
impl<'de, T, I> Deserialize<'de> for Secret<T, I>
where
diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs
index 86096ed508b..f6051ea05de 100644
--- a/crates/router/src/connector/multisafepay/transformers.rs
+++ b/crates/router/src/connector/multisafepay/transformers.rs
@@ -1,4 +1,4 @@
-use common_utils::pii::Email;
+use common_utils::pii::{Email, IpAddress};
use masking::ExposeInterface;
use serde::{Deserialize, Serialize};
use url::Url;
@@ -68,7 +68,7 @@ pub enum Gateway {
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct Coupons {
- pub allow: Option<Vec<String>>,
+ pub allow: Option<Vec<Secret<String>>>,
}
#[serde_with::skip_serializing_none]
@@ -126,20 +126,20 @@ pub struct Browser {
pub struct Customer {
pub browser: Option<Browser>,
pub locale: Option<String>,
- pub ip_address: Option<String>,
- pub forward_ip: Option<String>,
- pub first_name: Option<String>,
- pub last_name: Option<String>,
- pub gender: Option<String>,
- pub birthday: Option<String>,
- pub address1: Option<String>,
- pub address2: Option<String>,
- pub house_number: Option<String>,
- pub zip_code: Option<String>,
+ pub ip_address: Option<Secret<String, IpAddress>>,
+ pub forward_ip: Option<Secret<String, IpAddress>>,
+ pub first_name: Option<Secret<String>>,
+ pub last_name: Option<Secret<String>>,
+ pub gender: Option<Secret<String>>,
+ pub birthday: Option<Secret<String>>,
+ pub address1: Option<Secret<String>>,
+ pub address2: Option<Secret<String>>,
+ pub house_number: Option<Secret<String>>,
+ pub zip_code: Option<Secret<String>>,
pub city: Option<String>,
pub state: Option<String>,
pub country: Option<String>,
- pub phone: Option<String>,
+ pub phone: Option<Secret<String>>,
pub email: Option<Email>,
pub user_agent: Option<String>,
pub referrer: Option<String>,
@@ -150,7 +150,7 @@ pub struct Customer {
pub struct CardInfo {
pub card_number: Option<cards::CardNumber>,
pub card_holder_name: Option<Secret<String>>,
- pub card_expiry_date: Option<i32>,
+ pub card_expiry_date: Option<Secret<i32>>,
pub card_cvc: Option<Secret<String>>,
pub flexible_3d: Option<bool>,
pub moto: Option<bool>,
@@ -159,7 +159,7 @@ pub struct CardInfo {
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct GpayInfo {
- pub payment_token: Option<String>,
+ pub payment_token: Option<Secret<String>>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
@@ -242,7 +242,7 @@ pub struct MultisafepayPaymentsRequest {
pub shopping_cart: Option<ShoppingCart>,
pub items: Option<String>,
pub recurring_model: Option<MandateType>,
- pub recurring_id: Option<String>,
+ pub recurring_id: Option<Secret<String>>,
pub capture: Option<String>,
pub days_active: Option<i32>,
pub seconds_active: Option<i32>,
@@ -423,7 +423,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
let gateway_info = match item.router_data.request.payment_method_data {
api::PaymentMethodData::Card(ref ccard) => Some(GatewayInfo::Card(CardInfo {
card_number: Some(ccard.card_number.clone()),
- card_expiry_date: Some(
+ card_expiry_date: Some(Secret::new(
(format!(
"{}{}",
ccard.get_card_expiry_year_2_digit()?.expose(),
@@ -431,7 +431,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
))
.parse::<i32>()
.unwrap_or_default(),
- ),
+ )),
card_cvc: Some(ccard.card_cvc.clone()),
card_holder_name: None,
flexible_3d: None,
@@ -442,7 +442,9 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
api::WalletData::GooglePay(ref google_pay) => {
Some(GatewayInfo::Wallet(WalletInfo::GooglePay({
GpayInfo {
- payment_token: Some(google_pay.tokenization_data.token.clone()),
+ payment_token: Some(Secret::new(
+ google_pay.tokenization_data.token.clone(),
+ )),
}
})))
}
@@ -543,7 +545,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
.and_then(|mandate_ids| match mandate_ids.mandate_reference_id {
Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
connector_mandate_ids,
- )) => connector_mandate_ids.connector_mandate_id,
+ )) => connector_mandate_ids.connector_mandate_id.map(Secret::new),
_ => None,
}),
days_active: Some(30),
@@ -619,13 +621,13 @@ pub struct Data {
#[derive(Default, Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
pub struct MultisafepayPaymentDetails {
- pub account_holder_name: Option<String>,
- pub account_id: Option<String>,
- pub card_expiry_date: Option<i32>,
+ pub account_holder_name: Option<Secret<String>>,
+ pub account_id: Option<Secret<String>>,
+ pub card_expiry_date: Option<Secret<String>>,
pub external_transaction_id: Option<serde_json::Value>,
- pub last4: Option<serde_json::Value>,
+ pub last4: Option<Secret<String>>,
pub recurring_flow: Option<String>,
- pub recurring_id: Option<String>,
+ pub recurring_id: Option<Secret<String>>,
pub recurring_model: Option<String>,
#[serde(rename = "type")]
pub payment_type: Option<String>,
@@ -685,7 +687,7 @@ impl<F, T>
.payment_details
.and_then(|payment_details| payment_details.recurring_id)
.map(|id| types::MandateReference {
- connector_mandate_id: Some(id),
+ connector_mandate_id: Some(id.expose()),
payment_method_id: None,
}),
connector_metadata: None,
|
refactor
|
[Multisafepay] Mask PII data (#3869)
|
f0b443eda53bfb7b56679277e6077a8d55974763
|
2025-02-05 00:14:38
|
Debarati Ghatak
|
fix(connector): [novalnet] Remove first name, last name as required fields for Applepay, Googlepay, Paypal (#7152)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 6d3199ecf1a..c1ef6566e03 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -86,8 +86,8 @@ pub struct NovalnetPaymentsRequestBilling {
#[derive(Default, Debug, Serialize, Clone)]
pub struct NovalnetPaymentsRequestCustomer {
- first_name: Secret<String>,
- last_name: Secret<String>,
+ first_name: Option<Secret<String>>,
+ last_name: Option<Secret<String>>,
email: Email,
mobile: Option<Secret<String>>,
billing: Option<NovalnetPaymentsRequestBilling>,
@@ -215,8 +215,8 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
};
let customer = NovalnetPaymentsRequestCustomer {
- first_name: item.router_data.get_billing_first_name()?,
- last_name: item.router_data.get_billing_last_name()?,
+ first_name: item.router_data.get_optional_billing_first_name(),
+ last_name: item.router_data.get_optional_billing_last_name(),
email: item
.router_data
.get_billing_email()
@@ -1477,8 +1477,8 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
};
let customer = NovalnetPaymentsRequestCustomer {
- first_name: req_address.get_first_name()?.clone(),
- last_name: req_address.get_last_name()?.clone(),
+ first_name: req_address.get_optional_first_name(),
+ last_name: req_address.get_optional_last_name(),
email: item.request.get_email()?.clone(),
mobile: item.get_optional_billing_phone_number(),
billing: Some(billing),
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index e99777ad27e..1180cb68f7c 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1188,6 +1188,8 @@ pub trait AddressDetailsData {
fn get_optional_city(&self) -> Option<String>;
fn get_optional_line1(&self) -> Option<Secret<String>>;
fn get_optional_line2(&self) -> Option<Secret<String>>;
+ fn get_optional_first_name(&self) -> Option<Secret<String>>;
+ fn get_optional_last_name(&self) -> Option<Secret<String>>;
}
impl AddressDetailsData for AddressDetails {
@@ -1296,6 +1298,14 @@ impl AddressDetailsData for AddressDetails {
fn get_optional_line2(&self) -> Option<Secret<String>> {
self.line2.clone()
}
+
+ fn get_optional_first_name(&self) -> Option<Secret<String>> {
+ self.first_name.clone()
+ }
+
+ fn get_optional_last_name(&self) -> Option<Secret<String>> {
+ self.last_name.clone()
+ }
}
pub trait PhoneDetailsData {
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 2ef89f440ad..644c213acd8 100644
--- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs
+++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs
@@ -8706,24 +8706,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.first_name".to_string(),
- display_name: "first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
- (
- "billing.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.last_name".to_string(),
- display_name: "last_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
(
"billing.email".to_string(),
RequiredFieldInfo {
@@ -9032,24 +9014,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.first_name".to_string(),
- display_name: "first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
- (
- "billing.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.last_name".to_string(),
- display_name: "last_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
(
"billing.email".to_string(),
RequiredFieldInfo {
@@ -9733,24 +9697,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.first_name".to_string(),
- display_name: "first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
- (
- "billing.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.last_name".to_string(),
- display_name: "last_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
(
"billing.email".to_string(),
RequiredFieldInfo {
|
fix
|
[novalnet] Remove first name, last name as required fields for Applepay, Googlepay, Paypal (#7152)
|
9aa1c75eca24caa14af5f4801173cd59f76d7e57
|
2023-10-17 23:02:39
|
Sampras Lopes
|
fix(payments): fix payment update enum being inserted into kv (#2612)
| false
|
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 1d8b637720e..d0f56a40d02 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -130,21 +130,21 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
async fn update_payment_intent(
&self,
this: PaymentIntent,
- payment_intent: PaymentIntentUpdate,
+ payment_intent_update: PaymentIntentUpdate,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .update_payment_intent(this, payment_intent, storage_scheme)
+ .update_payment_intent(this, payment_intent_update, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => {
let key = format!("mid_{}_pid_{}", this.merchant_id, this.payment_id);
let field = format!("pi_{}", this.payment_id);
- let updated_intent = payment_intent.clone().apply_changeset(this.clone());
- let diesel_intent = payment_intent.to_storage_model();
+ let updated_intent = payment_intent_update.clone().apply_changeset(this.clone());
+ let diesel_intent = updated_intent.clone().to_storage_model();
// Check for database presence as well Maybe use a read replica here ?
let redis_value =
@@ -156,7 +156,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
updatable: kv::Updateable::PaymentIntentUpdate(
kv::PaymentIntentUpdateMems {
orig: this.to_storage_model(),
- update_data: diesel_intent,
+ update_data: payment_intent_update.to_storage_model(),
},
),
},
|
fix
|
fix payment update enum being inserted into kv (#2612)
|
cfafd5cd29857283d57731dda7c5a332a493f531
|
2023-12-05 19:32:34
|
Apoorv Dixit
|
chore(codeowners): add codeowners for hyperswitch dashboard (#3057)
| false
|
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 3024477bac2..a911d26d865 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -44,6 +44,60 @@ crates/router/src/core/routing.rs @juspay/hyperswitch-routing
crates/router/src/core/payments/routing @juspay/hyperswitch-routing
crates/router/src/core/payments/routing.rs @juspay/hyperswitch-routing
+crates/api_models/src/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/api_models/src/user @juspay/hyperswitch-dashboard
+crates/api_models/src/user.rs @juspay/hyperswitch-dashboard
+crates/api_models/src/user_role.rs @juspay/hyperswitch-dashboard
+crates/api_models/src/verify_connector.rs @juspay/hyperswitch-dashboard
+crates/api_models/src/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/diesel_models/src/query/dashboard_metadata.rs @juspay/hyperswitch-dashboard
+crates/diesel_models/src/query/user @juspay/hyperswitch-dashboard
+crates/diesel_models/src/query/user_role.rs @juspay/hyperswitch-dashboard
+crates/diesel_models/src/query/user.rs @juspay/hyperswitch-dashboard
+crates/diesel_models/src/user @juspay/hyperswitch-dashboard
+crates/diesel_models/src/user.rs @juspay/hyperswitch-dashboard
+crates/diesel_models/src/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/consts/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/consts/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/core/connector_onboarding @juspay/hyperswitch-dashboard
+crates/router/src/core/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/router/src/core/errors/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/core/errors/user @juspay/hyperswitch-dashboard
+crates/router/src/core/user @juspay/hyperswitch-dashboard
+crates/router/src/core/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/core/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/core/verify_connector.rs @juspay/hyperswitch-dashboard
+crates/router/src/db/dashboard_metadata.rs @juspay/hyperswitch-dashboard
+crates/router/src/db/user @juspay/hyperswitch-dashboard
+crates/router/src/db/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/db/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/routes/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/router/src/routes/dummy_connector @juspay/hyperswitch-dashboard
+crates/router/src/routes/dummy_connector.rs @juspay/hyperswitch-dashboard
+crates/router/src/routes/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/routes/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/routes/verify_connector.rs @juspay/hyperswitch-dashboard
+crates/router/src/services/authentication.rs @juspay/hyperswitch-dashboard
+crates/router/src/services/authorization @juspay/hyperswitch-dashboard
+crates/router/src/services/authorization.rs @juspay/hyperswitch-dashboard
+crates/router/src/services/jwt.rs @juspay/hyperswitch-dashboard
+crates/router/src/services/email/types.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/api/connector_onboarding @juspay/hyperswitch-dashboard
+crates/router/src/types/api/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/api/verify_connector @juspay/hyperswitch-dashboard
+crates/router/src/types/api/verify_connector.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/domain/user @juspay/hyperswitch-dashboard
+crates/router/src/types/domain/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/storage/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/storage/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/types/storage/dashboard_metadata.rs @juspay/hyperswitch-dashboard
+crates/router/src/utils/connector_onboarding @juspay/hyperswitch-dashboard
+crates/router/src/utils/connector_onboarding.rs @juspay/hyperswitch-dashboard
+crates/router/src/utils/user @juspay/hyperswitch-dashboard
+crates/router/src/utils/user.rs @juspay/hyperswitch-dashboard
+crates/router/src/utils/user_role.rs @juspay/hyperswitch-dashboard
+crates/router/src/utils/verify_connector.rs @juspay/hyperswitch-dashboard
+
crates/router/src/scheduler/ @juspay/hyperswitch-process-tracker
Dockerfile @juspay/hyperswitch-infra
|
chore
|
add codeowners for hyperswitch dashboard (#3057)
|
9f312aba5b93565190f000235b02dd7883b42aed
|
2024-08-07 05:47:36
|
github-actions
|
chore(version): 2024.08.07.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f827380b78..5f993b4b1c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,29 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.08.07.0
+
+### Features
+
+- **connector:**
+ - Remove Braintree SDK Flow support ([#5264](https://github.com/juspay/hyperswitch/pull/5264)) ([`61a0cb3`](https://github.com/juspay/hyperswitch/commit/61a0cb3e1eeacd1a900e3b06bbde494dfc274b35))
+ - [WELLSFARGO] Implement Payment Flows ([#5463](https://github.com/juspay/hyperswitch/pull/5463)) ([`a082759`](https://github.com/juspay/hyperswitch/commit/a0827596cb243f4187735e8559dd9a759bb51405))
+ - Added configs for Plaid ([#5479](https://github.com/juspay/hyperswitch/pull/5479)) ([`18e328d`](https://github.com/juspay/hyperswitch/commit/18e328d3825847f41184fbda58ee390eeaa54381))
+- **core:** Pass `profile_id` to core from auth layer ([#5532](https://github.com/juspay/hyperswitch/pull/5532)) ([`95e9c85`](https://github.com/juspay/hyperswitch/commit/95e9c8523544bad4a034e61f62f6a321a8990963))
+
+### Bug Fixes
+
+- [CYBERSOURCE] Update status handling for AuthorizedPendingReview ([#5534](https://github.com/juspay/hyperswitch/pull/5534)) ([`2f3a463`](https://github.com/juspay/hyperswitch/commit/2f3a463253c1704218a1bed06b1bec192a3e02b9))
+
+### Refactors
+
+- **core:** Refactor customer payment method list for v2 ([#4856](https://github.com/juspay/hyperswitch/pull/4856)) ([`8302272`](https://github.com/juspay/hyperswitch/commit/8302272460eee5ddfd56a89f280d0d18a04701f1))
+- **merchant_account_v2:** Recreate id and remove deprecated fields from merchant account ([#5493](https://github.com/juspay/hyperswitch/pull/5493)) ([`49892b2`](https://github.com/juspay/hyperswitch/commit/49892b261ef9bd0a54b8e4568d40463fca26862b))
+
+**Full Changelog:** [`2024.08.06.0...2024.08.07.0`](https://github.com/juspay/hyperswitch/compare/2024.08.06.0...2024.08.07.0)
+
+- - -
+
## 2024.08.06.0
### Features
|
chore
|
2024.08.07.0
|
708cce926125a29b406db48cf0ebd35b217927d4
|
2024-03-12 16:18:13
|
Amisha Prabhat
|
refactor(openai): update open-api spec to have payment changes (#4043)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index bf34a23adf8..fa96ea3475f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -354,6 +354,7 @@ pub struct PaymentsRequest {
pub mandate_data: Option<MandateData>,
/// Passing this object during payments confirm . The customer_acceptance sub object is usually passed by the SDK or client
+ #[schema(value_type = Option<CustomerAcceptance>)]
pub customer_acceptance: Option<CustomerAcceptance>,
/// A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data
diff --git a/crates/openapi/src/routes/customers.rs b/crates/openapi/src/routes/customers.rs
index 6011621fc13..6a6f41d98cd 100644
--- a/crates/openapi/src/routes/customers.rs
+++ b/crates/openapi/src/routes/customers.rs
@@ -124,7 +124,8 @@ pub async fn customers_mandates_list() {}
get,
path = "/{customer_id}/payment_methods/{payment_method_id}/default",
params (
- ("method_id" = String, Path, description = "Set the Payment Method as Default for the Customer"),
+ ("customer_id" = String,Path, description ="The unique identifier for the Customer"),
+ ("payment_method_id" = String,Path, description = "The unique identifier for the Payment Method"),
),
responses(
(status = 200, description = "Payment Method has been set as default", body =CustomerDefaultPaymentMethodResponse ),
diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs
index 12fc7778a31..20d87b91e79 100644
--- a/crates/openapi/src/routes/payments.rs
+++ b/crates/openapi/src/routes/payments.rs
@@ -100,6 +100,14 @@
"currency": "USD"
}
}
+ },
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
}
})
)
@@ -302,6 +310,14 @@ pub fn payments_update() {}
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
+ },
+ "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"
+ }
}
}
)
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 1f57fe2c70f..decb4af2db2 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -2606,6 +2606,14 @@
"authentication_type": "no_three_ds",
"confirm": true,
"currency": "USD",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"customer_id": "StripeCustomer123",
"mandate_data": {
"customer_acceptance": {
@@ -3153,6 +3161,14 @@
"examples": {
"Confirm a payment with payment method data": {
"value": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_data": {
"card": {
@@ -4208,9 +4224,18 @@
"operationId": "Set the Payment Method as Default",
"parameters": [
{
- "name": "method_id",
+ "name": "customer_id",
"in": "path",
- "description": "Set the Payment Method as Default for the Customer",
+ "description": "The unique identifier for the Customer",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method_id",
+ "in": "path",
+ "description": "The unique identifier for the Payment Method",
"required": true,
"schema": {
"type": "string"
|
refactor
|
update open-api spec to have payment changes (#4043)
|
2919db874bd84372663228f2531ba18338e039c0
|
2024-11-05 12:34:32
|
Uzair Khan
|
feat(config): update vector config (#6365)
| false
|
diff --git a/config/vector.yaml b/config/vector.yaml
index 3f0709ae03c..4b801935ae5 100644
--- a/config/vector.yaml
+++ b/config/vector.yaml
@@ -1,5 +1,16 @@
acknowledgements:
enabled: true
+enrichment_tables:
+ sdk_map:
+ type: file
+ file:
+ path: /etc/vector/config/sdk_map.csv
+ encoding:
+ type: csv
+ schema:
+ publishable_key: string
+ merchant_id: string
+
api:
enabled: true
@@ -87,6 +98,21 @@ transforms:
key_field: "{{ .payment_id }}{{ .merchant_id }}"
threshold: 1000
window_secs: 60
+
+ amend_sdk_logs:
+ type: remap
+ inputs:
+ - sdk_transformed
+ source: |
+ .before_transform = now()
+
+ merchant_id = .merchant_id
+ row = get_enrichment_table_record!("sdk_map", { "publishable_key" : merchant_id }, case_sensitive: true)
+ .merchant_id = row.merchant_id
+
+ .after_transform = now()
+
+
sinks:
opensearch_events_1:
@@ -110,6 +136,9 @@ sinks:
- offset
- partition
- topic
+ - clickhouse_database
+ - last_synced
+ - sign_flag
bulk:
index: "vector-{{ .topic }}"
@@ -134,6 +163,9 @@ sinks:
- offset
- partition
- topic
+ - clickhouse_database
+ - last_synced
+ - sign_flag
bulk:
# Add a date suffixed index for better grouping
index: "vector-{{ .topic }}-%Y-%m-%d"
@@ -224,7 +256,7 @@ sinks:
- "path"
- "source_type"
inputs:
- - "sdk_transformed"
+ - "amend_sdk_logs"
bootstrap_servers: kafka0:29092
topic: hyper-sdk-logs
key_field: ".merchant_id"
|
feat
|
update vector config (#6365)
|
ca91ce310a94562075c697bf4c8006d2d660b726
|
2022-12-06 12:03:26
|
kos-for-juspay
|
refactor(router): remove `SqlDb`, cleaning (#67)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index d5ab115e30c..530485506b9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1325,17 +1325,6 @@ version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
-[[package]]
-name = "futures-locks"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3eb42d4fb72227be5778429f9ef5240a38a358925a49f05b5cf702ce7c7e558a"
-dependencies = [
- "futures-channel",
- "futures-task",
- "tokio",
-]
-
[[package]]
name = "futures-macro"
version = "0.3.25"
@@ -2639,7 +2628,6 @@ dependencies = [
"fake",
"fred",
"futures",
- "futures-locks",
"hex",
"http",
"josekit",
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index b5d21ae3070..f656e0ac931 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -39,7 +39,6 @@ encoding_rs = "0.8.31"
error-stack = "0.2.1"
fred = { version = "5.2.0", features = ["metrics", "partial-tracing"] , optional = true }
futures = "0.3.25"
-futures-locks = "0.7.0"
hex = "0.4.3"
http = "0.2.8"
josekit = "0.8.1"
diff --git a/crates/router/sqlx-data.json b/crates/router/sqlx-data.json
deleted file mode 100644
index cb93a010046..00000000000
--- a/crates/router/sqlx-data.json
+++ /dev/null
@@ -1,400 +0,0 @@
-{
- "db": "PostgreSQL",
- "81517ed4dc151e2b267f997f62aff37bb86b3e22f6b0446e9d9c835a3b20439c": {
- "describe": {
- "columns": [
- {
- "name": "id",
- "ordinal": 0,
- "type_info": "Int4"
- },
- {
- "name": "customer_id",
- "ordinal": 1,
- "type_info": "Varchar"
- },
- {
- "name": "merchant_id",
- "ordinal": 2,
- "type_info": "Varchar"
- },
- {
- "name": "name",
- "ordinal": 3,
- "type_info": "Varchar"
- },
- {
- "name": "email: _",
- "ordinal": 4,
- "type_info": "Varchar"
- },
- {
- "name": "phone: _",
- "ordinal": 5,
- "type_info": "Varchar"
- },
- {
- "name": "phone_country_code",
- "ordinal": 6,
- "type_info": "Varchar"
- },
- {
- "name": "description",
- "ordinal": 7,
- "type_info": "Varchar"
- },
- {
- "name": "address: _",
- "ordinal": 8,
- "type_info": "Json"
- },
- {
- "name": "created_at",
- "ordinal": 9,
- "type_info": "Timestamp"
- },
- {
- "name": "metadata",
- "ordinal": 10,
- "type_info": "Json"
- }
- ],
- "nullable": [
- false,
- false,
- false,
- true,
- true,
- true,
- true,
- true,
- true,
- false,
- true
- ],
- "parameters": {
- "Left": [
- "Text",
- "Text"
- ]
- }
- },
- "query": "\n SELECT\n \"customers\".\"id\",\n \"customers\".\"customer_id\",\n \"customers\".\"merchant_id\",\n \"customers\".\"name\",\n \"customers\".\"email\" as \"email: _\",\n \"customers\".\"phone\" as \"phone: _\",\n \"customers\".\"phone_country_code\",\n \"customers\".\"description\",\n \"customers\".\"address\" as \"address: _\",\n \"customers\".\"created_at\",\n \"customers\".\"metadata\"\n FROM\n \"customers\"\n WHERE\n (\n (\"customers\".\"customer_id\" = $1)\n AND (\"customers\".\"merchant_id\" = $2)\n )"
- },
- "d184fdec6428364a6e4e2517a4d36af85141d973085d7ab78137d43d3c97364a": {
- "describe": {
- "columns": [
- {
- "name": "id",
- "ordinal": 0,
- "type_info": "Int4"
- },
- {
- "name": "merchant_id",
- "ordinal": 1,
- "type_info": "Varchar"
- },
- {
- "name": "connector_name",
- "ordinal": 2,
- "type_info": "Varchar"
- },
- {
- "name": "connector_account_details",
- "ordinal": 3,
- "type_info": "Json"
- },
- {
- "name": "test_mode",
- "ordinal": 4,
- "type_info": "Bool"
- },
- {
- "name": "disabled",
- "ordinal": 5,
- "type_info": "Bool"
- },
- {
- "name": "merchant_connector_id",
- "ordinal": 6,
- "type_info": "Int4"
- },
- {
- "name": "payment_methods_enabled",
- "ordinal": 7,
- "type_info": "JsonArray"
- },
- {
- "name": "connector_type: _",
- "ordinal": 8,
- "type_info": {
- "Custom": {
- "kind": {
- "Enum": [
- "payment_processor",
- "payment_vas",
- "fin_operations",
- "fiz_operations",
- "networks",
- "banking_entities",
- "non_banking_finance"
- ]
- },
- "name": "ConnectorType"
- }
- }
- }
- ],
- "nullable": [
- false,
- false,
- false,
- false,
- true,
- true,
- false,
- true,
- false
- ],
- "parameters": {
- "Left": [
- "Text",
- "Text"
- ]
- }
- },
- "query": "\n SELECT\n \"merchant_connector_account\".\"id\",\n \"merchant_connector_account\".\"merchant_id\",\n \"merchant_connector_account\".\"connector_name\",\n \"merchant_connector_account\".\"connector_account_details\",\n \"merchant_connector_account\".\"test_mode\",\n \"merchant_connector_account\".\"disabled\",\n \"merchant_connector_account\".\"merchant_connector_id\",\n \"merchant_connector_account\".\"payment_methods_enabled\",\n \"merchant_connector_account\".\"connector_type\" \"connector_type: _\"\n FROM\n \"merchant_connector_account\"\n WHERE\n (\n (\n \"merchant_connector_account\".\"merchant_id\" = $1\n )\n AND (\n \"merchant_connector_account\".\"connector_name\" = $2\n )\n )"
- },
- "fbef5d3470d67da1a07a2189c80ecc711d3d4fcd4887cc7ceb8944b93843da16": {
- "describe": {
- "columns": [
- {
- "name": "id",
- "ordinal": 0,
- "type_info": "Int4"
- },
- {
- "name": "merchant_id",
- "ordinal": 1,
- "type_info": "Varchar"
- },
- {
- "name": "api_key: _",
- "ordinal": 2,
- "type_info": "Varchar"
- },
- {
- "name": "return_url",
- "ordinal": 3,
- "type_info": "Varchar"
- },
- {
- "name": "enable_payment_response_hash",
- "ordinal": 4,
- "type_info": "Bool"
- },
- {
- "name": "payment_response_hash_key",
- "ordinal": 5,
- "type_info": "Varchar"
- },
- {
- "name": "redirect_to_merchant_with_http_post",
- "ordinal": 6,
- "type_info": "Bool"
- },
- {
- "name": "merchant_name",
- "ordinal": 7,
- "type_info": "Varchar"
- },
- {
- "name": "merchant_details",
- "ordinal": 8,
- "type_info": "Json"
- },
- {
- "name": "webhook_details",
- "ordinal": 9,
- "type_info": "Json"
- },
- {
- "name": "routing_algorithm: _",
- "ordinal": 10,
- "type_info": {
- "Custom": {
- "kind": {
- "Enum": [
- "round_robin",
- "max_conversion",
- "min_cost",
- "custom"
- ]
- },
- "name": "RoutingAlgorithm"
- }
- }
- },
- {
- "name": "custom_routing_rules",
- "ordinal": 11,
- "type_info": "Json"
- },
- {
- "name": "sub_merchants_enabled",
- "ordinal": 12,
- "type_info": "Bool"
- },
- {
- "name": "parent_merchant_id",
- "ordinal": 13,
- "type_info": "Varchar"
- },
- {
- "name": "publishable_key",
- "ordinal": 14,
- "type_info": "Varchar"
- }
- ],
- "nullable": [
- false,
- false,
- true,
- true,
- false,
- true,
- false,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true
- ],
- "parameters": {
- "Left": [
- "Text"
- ]
- }
- },
- "query": "\n SELECT\n \"merchant_account\".\"id\",\n \"merchant_account\".\"merchant_id\",\n \"merchant_account\".\"api_key\" as \"api_key: _\",\n \"merchant_account\".\"return_url\",\n \"merchant_account\".\"enable_payment_response_hash\",\n \"merchant_account\".\"payment_response_hash_key\",\n \"merchant_account\".\"redirect_to_merchant_with_http_post\",\n \"merchant_account\".\"merchant_name\",\n \"merchant_account\".\"merchant_details\",\n \"merchant_account\".\"webhook_details\",\n \"merchant_account\".\"routing_algorithm\" as \"routing_algorithm: _\",\n \"merchant_account\".\"custom_routing_rules\",\n \"merchant_account\".\"sub_merchants_enabled\",\n \"merchant_account\".\"parent_merchant_id\",\n \"merchant_account\".\"publishable_key\"\n FROM\n \"merchant_account\"\n WHERE\n (\n \"merchant_account\".\"merchant_id\" = $1\n )\n "
- },
- "fd48a272a849cfb042c961467adb38e929da5552ca008a878ca84cb4f4f75121": {
- "describe": {
- "columns": [
- {
- "name": "id",
- "ordinal": 0,
- "type_info": "Int4"
- },
- {
- "name": "merchant_id",
- "ordinal": 1,
- "type_info": "Varchar"
- },
- {
- "name": "api_key: _",
- "ordinal": 2,
- "type_info": "Varchar"
- },
- {
- "name": "return_url",
- "ordinal": 3,
- "type_info": "Varchar"
- },
- {
- "name": "enable_payment_response_hash",
- "ordinal": 4,
- "type_info": "Bool"
- },
- {
- "name": "payment_response_hash_key",
- "ordinal": 5,
- "type_info": "Varchar"
- },
- {
- "name": "redirect_to_merchant_with_http_post",
- "ordinal": 6,
- "type_info": "Bool"
- },
- {
- "name": "merchant_name",
- "ordinal": 7,
- "type_info": "Varchar"
- },
- {
- "name": "merchant_details",
- "ordinal": 8,
- "type_info": "Json"
- },
- {
- "name": "webhook_details",
- "ordinal": 9,
- "type_info": "Json"
- },
- {
- "name": "routing_algorithm: _",
- "ordinal": 10,
- "type_info": {
- "Custom": {
- "kind": {
- "Enum": [
- "round_robin",
- "max_conversion",
- "min_cost",
- "custom"
- ]
- },
- "name": "RoutingAlgorithm"
- }
- }
- },
- {
- "name": "custom_routing_rules",
- "ordinal": 11,
- "type_info": "Json"
- },
- {
- "name": "sub_merchants_enabled",
- "ordinal": 12,
- "type_info": "Bool"
- },
- {
- "name": "parent_merchant_id",
- "ordinal": 13,
- "type_info": "Varchar"
- },
- {
- "name": "publishable_key",
- "ordinal": 14,
- "type_info": "Varchar"
- }
- ],
- "nullable": [
- false,
- false,
- true,
- true,
- false,
- true,
- false,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true
- ],
- "parameters": {
- "Left": [
- "Text"
- ]
- }
- },
- "query": "\n SELECT\n \"merchant_account\".\"id\",\n \"merchant_account\".\"merchant_id\",\n \"merchant_account\".\"api_key\" as \"api_key: _\",\n \"merchant_account\".\"return_url\",\n \"merchant_account\".\"enable_payment_response_hash\",\n \"merchant_account\".\"payment_response_hash_key\",\n \"merchant_account\".\"redirect_to_merchant_with_http_post\",\n \"merchant_account\".\"merchant_name\",\n \"merchant_account\".\"merchant_details\",\n \"merchant_account\".\"webhook_details\",\n \"merchant_account\".\"routing_algorithm\" as \"routing_algorithm: _\",\n \"merchant_account\".\"custom_routing_rules\",\n \"merchant_account\".\"sub_merchants_enabled\",\n \"merchant_account\".\"parent_merchant_id\",\n \"merchant_account\".\"publishable_key\"\n FROM\n \"merchant_account\"\n WHERE\n (\n \"merchant_account\".\"api_key\" = $1\n )\n "
- }
-}
\ No newline at end of file
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index e2c515e90d9..0e45f84e7bd 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -17,11 +17,9 @@ pub mod temp_card;
use std::sync::Arc;
-use futures_locks::Mutex;
+use futures::lock::Mutex;
use crate::{
- configs::settings::Database,
- connection::{diesel_make_pg_pool, PgPool as PgPoolDiesel},
services::Store,
types::storage::{
ConnectorResponse, Customer, MerchantAccount, MerchantConnectorAccount, PaymentAttempt,
@@ -62,32 +60,6 @@ pub trait StorageInterface:
async fn close(&mut self) {}
}
-#[derive(Clone)]
-pub struct SqlDb {
- pub conn: PgPoolDiesel,
-}
-
-impl SqlDb {
- pub async fn new(database: &Database) -> Self {
- Self {
- conn: diesel_make_pg_pool(database, false).await,
- }
- }
-
- pub async fn test(database: &Database) -> Self {
- Self {
- conn: diesel_make_pg_pool(
- &Database {
- dbname: String::from("test_db"),
- ..database.clone()
- },
- true,
- )
- .await,
- }
- }
-}
-
#[async_trait::async_trait]
impl StorageInterface for Store {
#[allow(clippy::expect_used)]
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index ecdfe892610..26ce838ee1f 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -22,7 +22,7 @@ pub trait AddressInterface {
#[async_trait::async_trait]
impl AddressInterface for super::Store {
async fn find_address(&self, address_id: &str) -> CustomResult<Address, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Address::find_by_address_id(&conn, address_id).await
}
@@ -31,7 +31,7 @@ impl AddressInterface for super::Store {
address_id: String,
address: AddressUpdate,
) -> CustomResult<Address, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Address::update_by_address_id(&conn, address_id, address).await
}
@@ -39,7 +39,7 @@ impl AddressInterface for super::Store {
&self,
address: AddressNew,
) -> CustomResult<Address, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
address.insert(&conn).await
}
}
diff --git a/crates/router/src/db/configs.rs b/crates/router/src/db/configs.rs
index 844837e125c..99d95ce0b72 100644
--- a/crates/router/src/db/configs.rs
+++ b/crates/router/src/db/configs.rs
@@ -19,12 +19,12 @@ pub trait ConfigInterface {
#[async_trait::async_trait]
impl ConfigInterface for super::Store {
async fn insert_config(&self, config: ConfigNew) -> CustomResult<Config, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
config.insert(&conn).await
}
async fn find_config_by_key(&self, key: &str) -> CustomResult<Config, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Config::find_by_key(&conn, key).await
}
@@ -33,7 +33,7 @@ impl ConfigInterface for super::Store {
key: &str,
config_update: ConfigUpdate,
) -> CustomResult<Config, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Config::update_by_key(&conn, key, config_update).await
}
}
diff --git a/crates/router/src/db/connector_response.rs b/crates/router/src/db/connector_response.rs
index 83fdd39d8a5..0cd8091ff6a 100644
--- a/crates/router/src/db/connector_response.rs
+++ b/crates/router/src/db/connector_response.rs
@@ -30,7 +30,7 @@ impl ConnectorResponseInterface for super::Store {
&self,
connector_response: ConnectorResponseNew,
) -> CustomResult<ConnectorResponse, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
connector_response.insert(&conn).await
}
@@ -40,7 +40,7 @@ impl ConnectorResponseInterface for super::Store {
merchant_id: &str,
txn_id: &str,
) -> CustomResult<ConnectorResponse, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
ConnectorResponse::find_by_payment_id_and_merchant_id_transaction_id(
&conn,
payment_id,
@@ -55,7 +55,7 @@ impl ConnectorResponseInterface for super::Store {
this: ConnectorResponse,
connector_response_update: ConnectorResponseUpdate,
) -> CustomResult<ConnectorResponse, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, connector_response_update).await
}
}
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index 747376f9db9..a048a0c78b9 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -48,7 +48,7 @@ impl CustomerInterface for super::Store {
customer_id: &str,
merchant_id: &str,
) -> CustomResult<Option<Customer>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Customer::find_optional_by_customer_id_merchant_id(&conn, customer_id, merchant_id).await
}
@@ -58,7 +58,7 @@ impl CustomerInterface for super::Store {
merchant_id: String,
customer: CustomerUpdate,
) -> CustomResult<Customer, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Customer::update_by_customer_id_merchant_id(&conn, customer_id, merchant_id, customer).await
}
@@ -67,7 +67,7 @@ impl CustomerInterface for super::Store {
customer_id: &str,
merchant_id: &str,
) -> CustomResult<Customer, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Customer::find_by_customer_id_merchant_id(&conn, customer_id, merchant_id).await
}
@@ -75,7 +75,7 @@ impl CustomerInterface for super::Store {
&self,
customer_data: CustomerNew,
) -> CustomResult<Customer, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
customer_data.insert_diesel(&conn).await
}
@@ -84,7 +84,7 @@ impl CustomerInterface for super::Store {
customer_id: &str,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Customer::delete_by_customer_id_merchant_id(&conn, customer_id, merchant_id).await
}
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 2bbf75204a1..f78b6b12dbe 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -13,7 +13,7 @@ pub trait EventInterface {
#[async_trait::async_trait]
impl EventInterface for super::Store {
async fn insert_event(&self, event: EventNew) -> CustomResult<Event, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
event.insert(&conn).await
}
}
diff --git a/crates/router/src/db/locker_mock_up.rs b/crates/router/src/db/locker_mock_up.rs
index 11bea2f211a..01fdaf04830 100644
--- a/crates/router/src/db/locker_mock_up.rs
+++ b/crates/router/src/db/locker_mock_up.rs
@@ -24,7 +24,7 @@ impl LockerMockUpInterface for super::Store {
&self,
card_id: &str,
) -> CustomResult<LockerMockUp, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
LockerMockUp::find_by_card_id(&conn, card_id).await
}
@@ -32,7 +32,7 @@ impl LockerMockUpInterface for super::Store {
&self,
new: LockerMockUpNew,
) -> CustomResult<LockerMockUp, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
new.insert(&conn).await
}
}
diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs
index eaeb43b0bd9..d5e25b84bbb 100644
--- a/crates/router/src/db/mandate.rs
+++ b/crates/router/src/db/mandate.rs
@@ -39,7 +39,7 @@ impl MandateInterface for super::Store {
merchant_id: &str,
mandate_id: &str,
) -> CustomResult<Mandate, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Mandate::find_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id).await
}
@@ -48,7 +48,7 @@ impl MandateInterface for super::Store {
merchant_id: &str,
customer_id: &str,
) -> CustomResult<Vec<Mandate>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id).await
}
@@ -58,7 +58,7 @@ impl MandateInterface for super::Store {
mandate_id: &str,
mandate: MandateUpdate,
) -> CustomResult<Mandate, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Mandate::update_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id, mandate).await
}
@@ -66,7 +66,7 @@ impl MandateInterface for super::Store {
&self,
mandate: MandateNew,
) -> CustomResult<Mandate, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
mandate.insert(&conn).await
}
}
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index 40bd00625e1..3390c0e463d 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -48,7 +48,7 @@ impl MerchantAccountInterface for super::Store {
&self,
merchant_account: MerchantAccountNew,
) -> CustomResult<MerchantAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
merchant_account.insert_diesel(&conn).await
}
@@ -56,7 +56,7 @@ impl MerchantAccountInterface for super::Store {
&self,
merchant_id: &str,
) -> CustomResult<MerchantAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantAccount::find_by_merchant_id(&conn, merchant_id).await
}
@@ -65,7 +65,7 @@ impl MerchantAccountInterface for super::Store {
this: MerchantAccount,
merchant_account: MerchantAccountUpdate,
) -> CustomResult<MerchantAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, merchant_account).await
}
@@ -73,7 +73,7 @@ impl MerchantAccountInterface for super::Store {
&self,
api_key: &str,
) -> CustomResult<MerchantAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantAccount::find_by_api_key(&conn, api_key).await
}
@@ -81,7 +81,7 @@ impl MerchantAccountInterface for super::Store {
&self,
publishable_key: &str,
) -> CustomResult<MerchantAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantAccount::find_by_publishable_key(&conn, publishable_key).await
}
@@ -89,7 +89,7 @@ impl MerchantAccountInterface for super::Store {
&self,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantAccount::delete_by_merchant_id(&conn, merchant_id).await
}
}
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 2bbf5b4f877..548f705c623 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -53,7 +53,7 @@ impl MerchantConnectorAccountInterface for super::Store {
merchant_id: &str,
connector: &str,
) -> CustomResult<MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantConnectorAccount::find_by_merchant_id_connector(&conn, merchant_id, connector).await
}
@@ -62,7 +62,7 @@ impl MerchantConnectorAccountInterface for super::Store {
merchant_id: &str,
merchant_connector_id: &i32,
) -> CustomResult<MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantConnectorAccount::find_by_merchant_id_merchant_connector_id(
&conn,
merchant_id,
@@ -75,7 +75,7 @@ impl MerchantConnectorAccountInterface for super::Store {
&self,
t: MerchantConnectorAccountNew,
) -> CustomResult<MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
t.insert_diesel(&conn).await
}
@@ -83,7 +83,7 @@ impl MerchantConnectorAccountInterface for super::Store {
&self,
merchant_id: &str,
) -> CustomResult<Vec<MerchantConnectorAccount>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantConnectorAccount::find_by_merchant_id(&conn, merchant_id).await
}
@@ -92,7 +92,7 @@ impl MerchantConnectorAccountInterface for super::Store {
this: MerchantConnectorAccount,
merchant_connector_account: MerchantConnectorAccountUpdate,
) -> CustomResult<MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, merchant_connector_account).await
}
@@ -101,7 +101,7 @@ impl MerchantConnectorAccountInterface for super::Store {
merchant_id: &str,
merchant_connector_id: &i32,
) -> CustomResult<bool, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
MerchantConnectorAccount::delete_by_merchant_id_merchant_connector_id(
&conn,
merchant_id,
diff --git a/crates/router/src/db/payment_attempt.rs b/crates/router/src/db/payment_attempt.rs
index 5cf6ce492f7..73c31c71f35 100644
--- a/crates/router/src/db/payment_attempt.rs
+++ b/crates/router/src/db/payment_attempt.rs
@@ -65,7 +65,7 @@ mod storage {
&self,
payment_attempt: PaymentAttemptNew,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
payment_attempt.insert_diesel(&conn).await
}
@@ -74,7 +74,7 @@ mod storage {
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, payment_attempt).await
}
@@ -83,7 +83,7 @@ mod storage {
payment_id: &str,
merchant_id: &str,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentAttempt::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id).await
}
@@ -93,7 +93,7 @@ mod storage {
payment_id: &str,
merchant_id: &str,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentAttempt::find_by_transaction_id_payment_id_merchant_id(
&conn,
transaction_id,
@@ -108,7 +108,7 @@ mod storage {
payment_id: &str,
merchant_id: &str,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentAttempt::find_last_successful_attempt_by_payment_id_merchant_id(
&conn,
payment_id,
@@ -122,7 +122,7 @@ mod storage {
merchant_id: &str,
connector_txn_id: &str,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
// TODO: update logic to lookup all payment attempts for an intent
// and apply filter logic on top of them to get the desired one.
PaymentAttempt::find_by_merchant_id_connector_txn_id(
@@ -138,7 +138,7 @@ mod storage {
merchant_id: &str,
txn_id: &str,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentAttempt::find_by_merchant_id_transaction_id(&conn, merchant_id, txn_id).await
}
@@ -334,7 +334,7 @@ mod storage {
)))
.into_report(),
Ok(1) => {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
let query = payment_attempt
.insert_diesel(&conn)
.await
@@ -387,7 +387,7 @@ mod storage {
.into_report()
.change_context(errors::StorageError::KVError)?;
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
let query = this
.update(&conn, payment_attempt)
.await
diff --git a/crates/router/src/db/payment_intent.rs b/crates/router/src/db/payment_intent.rs
index 7d280269313..bbb2c4f7765 100644
--- a/crates/router/src/db/payment_intent.rs
+++ b/crates/router/src/db/payment_intent.rs
@@ -95,7 +95,7 @@ mod storage {
)))
.into_report(),
Ok(1) => {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
let query = new
.insert_diesel(&conn)
.await
@@ -148,7 +148,7 @@ mod storage {
.into_report()
.change_context(errors::StorageError::KVError)?;
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
let query = this
.update(&conn, payment_intent)
.await
@@ -223,7 +223,7 @@ mod storage {
&self,
new: PaymentIntentNew,
) -> CustomResult<PaymentIntent, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
new.insert_diesel(&conn).await
}
@@ -232,7 +232,7 @@ mod storage {
this: PaymentIntent,
payment_intent: PaymentIntentUpdate,
) -> CustomResult<PaymentIntent, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, payment_intent).await
}
@@ -241,7 +241,7 @@ mod storage {
payment_id: &str,
merchant_id: &str,
) -> CustomResult<PaymentIntent, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id).await
}
@@ -250,7 +250,7 @@ mod storage {
merchant_id: &str,
pc: &api::PaymentListConstraints,
) -> CustomResult<Vec<PaymentIntent>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentIntent::filter_by_constraints(&conn, merchant_id, pc).await
}
}
diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs
index a7287c5b701..4df25ff7071 100644
--- a/crates/router/src/db/payment_method.rs
+++ b/crates/router/src/db/payment_method.rs
@@ -36,7 +36,7 @@ impl PaymentMethodInterface for super::Store {
&self,
payment_method_id: &str,
) -> CustomResult<PaymentMethod, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentMethod::find_by_payment_method_id(&conn, payment_method_id).await
}
@@ -44,7 +44,7 @@ impl PaymentMethodInterface for super::Store {
&self,
m: PaymentMethodNew,
) -> CustomResult<PaymentMethod, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
m.insert(&conn).await
}
@@ -53,7 +53,7 @@ impl PaymentMethodInterface for super::Store {
customer_id: &str,
merchant_id: &str,
) -> CustomResult<Vec<PaymentMethod>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentMethod::find_by_customer_id_merchant_id(&conn, customer_id, merchant_id).await
}
@@ -62,7 +62,7 @@ impl PaymentMethodInterface for super::Store {
merchant_id: &str,
payment_method_id: &str,
) -> CustomResult<PaymentMethod, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
PaymentMethod::delete_by_merchant_id_payment_method_id(
&conn,
merchant_id,
diff --git a/crates/router/src/db/process_tracker.rs b/crates/router/src/db/process_tracker.rs
index ffc639c76db..cb4cda90643 100644
--- a/crates/router/src/db/process_tracker.rs
+++ b/crates/router/src/db/process_tracker.rs
@@ -57,7 +57,7 @@ impl ProcessTrackerInterface for super::Store {
&self,
id: &str,
) -> CustomResult<Option<ProcessTracker>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
ProcessTracker::find_process_by_id(&conn, id).await
}
@@ -66,7 +66,7 @@ impl ProcessTrackerInterface for super::Store {
ids: Vec<String>,
schedule_time: PrimitiveDateTime,
) -> CustomResult<usize, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
ProcessTracker::reinitialize_limbo_processes(&conn, ids, schedule_time).await
}
@@ -77,7 +77,7 @@ impl ProcessTrackerInterface for super::Store {
status: enums::ProcessTrackerStatus,
limit: Option<i64>,
) -> CustomResult<Vec<ProcessTracker>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
ProcessTracker::find_processes_by_time_status(
&conn,
time_lower_limit,
@@ -92,7 +92,7 @@ impl ProcessTrackerInterface for super::Store {
&self,
new: ProcessTrackerNew,
) -> CustomResult<ProcessTracker, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
new.insert_process(&conn).await
}
@@ -101,7 +101,7 @@ impl ProcessTrackerInterface for super::Store {
this: ProcessTracker,
process: ProcessTrackerUpdate,
) -> CustomResult<ProcessTracker, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, process).await
}
@@ -110,7 +110,7 @@ impl ProcessTrackerInterface for super::Store {
this: ProcessTracker,
process: ProcessTrackerUpdate,
) -> CustomResult<ProcessTracker, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, process).await
}
@@ -119,7 +119,7 @@ impl ProcessTrackerInterface for super::Store {
task_ids: Vec<String>,
task_update: ProcessTrackerUpdate,
) -> CustomResult<Vec<ProcessTracker>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
ProcessTracker::update_process_status_by_ids(&conn, task_ids, task_update).await
}
}
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index 821a589a62c..9b03b5a3ff4 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -56,13 +56,13 @@ impl RefundInterface for super::Store {
internal_reference_id: &str,
merchant_id: &str,
) -> CustomResult<Refund, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Refund::find_by_internal_reference_id_merchant_id(&conn, internal_reference_id, merchant_id)
.await
}
async fn insert_refund(&self, new: RefundNew) -> CustomResult<Refund, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
new.insert(&conn).await
}
async fn find_refund_by_merchant_id_transaction_id(
@@ -70,7 +70,7 @@ impl RefundInterface for super::Store {
merchant_id: &str,
txn_id: &str,
) -> CustomResult<Vec<Refund>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Refund::find_by_merchant_id_transaction_id(&conn, merchant_id, txn_id).await
}
@@ -79,7 +79,7 @@ impl RefundInterface for super::Store {
this: Refund,
refund: RefundUpdate,
) -> CustomResult<Refund, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
this.update(&conn, refund).await
}
@@ -88,7 +88,7 @@ impl RefundInterface for super::Store {
merchant_id: &str,
refund_id: &str,
) -> CustomResult<Refund, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Refund::find_by_merchant_id_refund_id(&conn, merchant_id, refund_id).await
}
@@ -98,7 +98,7 @@ impl RefundInterface for super::Store {
// merchant_id: &str,
// refund_id: &str,
// ) -> CustomResult<Refund, errors::StorageError> {
- // let conn = pg_connection(&self.master_pool.conn).await;
+ // let conn = pg_connection(&self.master_pool).await;
// Refund::find_by_payment_id_merchant_id_refund_id(&conn, payment_id, merchant_id, refund_id)
// .await
// }
@@ -108,7 +108,7 @@ impl RefundInterface for super::Store {
payment_id: &str,
merchant_id: &str,
) -> CustomResult<Vec<Refund>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
Refund::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id).await
}
}
diff --git a/crates/router/src/db/temp_card.rs b/crates/router/src/db/temp_card.rs
index c9b21870fd4..e5e6849a025 100644
--- a/crates/router/src/db/temp_card.rs
+++ b/crates/router/src/db/temp_card.rs
@@ -34,7 +34,7 @@ impl TempCardInterface for super::Store {
&self,
address: TempCardNew,
) -> CustomResult<TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
address.insert_diesel(&conn).await
}
@@ -42,7 +42,7 @@ impl TempCardInterface for super::Store {
&self,
transaction_id: &str,
) -> CustomResult<Option<TempCard>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
TempCard::find_by_transaction_id(&conn, transaction_id).await
}
@@ -50,7 +50,7 @@ impl TempCardInterface for super::Store {
&self,
card: TempCard,
) -> CustomResult<TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
TempCard::insert_with_token(card, &conn).await
}
@@ -58,7 +58,7 @@ impl TempCardInterface for super::Store {
&self,
token: &i32,
) -> CustomResult<TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool.conn).await;
+ let conn = pg_connection(&self.master_pool).await;
TempCard::find_by_token(&conn, token).await
}
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index a7923e6eeee..554c8e1ce5c 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1,5 +1,3 @@
-use std::sync::Arc;
-
use actix_web::{web, Scope};
use super::{
@@ -8,8 +6,7 @@ use super::{
};
use crate::{
configs::settings::Settings,
- connection,
- db::{MockDb, SqlDb, StorageImpl, StorageInterface},
+ db::{MockDb, StorageImpl, StorageInterface},
services::Store,
};
@@ -24,28 +21,9 @@ impl AppState {
pub async fn with_storage(conf: Settings, storage_impl: StorageImpl) -> AppState {
let testable = storage_impl == StorageImpl::DieselPostgresqlTest;
let store: Box<dyn StorageInterface> = match storage_impl {
- StorageImpl::DieselPostgresql | StorageImpl::DieselPostgresqlTest => Box::new(Store {
- master_pool: if testable {
- SqlDb::test(&conf.master_database).await
- } else {
- SqlDb::new(&conf.master_database).await
- },
- #[cfg(feature = "olap")]
- replica_pool: if testable {
- SqlDb::test(&conf.replica_database).await
- } else {
- SqlDb::new(&conf.replica_database).await
- },
- // FIXME: from my understanding, this creates a single connection
- // for the entire lifetime of the server. This doesn't survive disconnects
- // from redis. Consider using connection pool.
- redis_conn: Arc::new(connection::redis_connection(&conf).await),
- #[cfg(feature = "kv_store")]
- config: crate::services::StoreConfig {
- drainer_stream_name: conf.drainer.stream_name.clone(),
- drainer_num_partitions: conf.drainer.num_partitions,
- },
- }),
+ StorageImpl::DieselPostgresql | StorageImpl::DieselPostgresqlTest => {
+ Box::new(Store::new(&conf, testable).await)
+ }
StorageImpl::Mock => Box::new(MockDb::new(&conf).await),
};
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index a60dbe08ef1..085336b71c8 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -5,12 +5,13 @@ pub mod logger;
use std::sync::Arc;
pub use self::{api::*, encryption::*};
+use crate::connection::{diesel_make_pg_pool, PgPool};
#[derive(Clone)]
pub struct Store {
- pub master_pool: crate::db::SqlDb,
+ pub master_pool: PgPool,
#[cfg(feature = "olap")]
- pub replica_pool: crate::db::SqlDb,
+ pub replica_pool: PgPool,
pub redis_conn: Arc<redis_interface::RedisConnectionPool>,
#[cfg(feature = "kv_store")]
pub(crate) config: StoreConfig,
@@ -24,11 +25,11 @@ pub(crate) struct StoreConfig {
}
impl Store {
- pub async fn new(config: &crate::configs::settings::Settings) -> Self {
+ pub async fn new(config: &crate::configs::settings::Settings, test_transaction: bool) -> Self {
Self {
- master_pool: crate::db::SqlDb::new(&config.master_database).await,
+ master_pool: diesel_make_pg_pool(&config.master_database, test_transaction).await,
#[cfg(feature = "olap")]
- replica_pool: crate::db::SqlDb::new(&config.replica_database).await,
+ replica_pool: diesel_make_pg_pool(&config.replica_database, test_transaction).await,
redis_conn: Arc::new(crate::connection::redis_connection(config).await),
#[cfg(feature = "kv_store")]
config: StoreConfig {
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index f3dde843d95..b2bb0bc5590 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -268,6 +268,8 @@ mod tests {
}
#[actix_rt::test]
+ /// Example of unit test
+ /// Kind of test: state-based testing
async fn test_find_payment_attempt() {
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
@@ -303,6 +305,8 @@ mod tests {
}
#[actix_rt::test]
+ /// Example of unit test
+ /// Kind of test: state-based testing
async fn test_payment_attempt_mandate_field() {
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
diff --git a/crates/router/src/utils/ext_traits.rs b/crates/router/src/utils/ext_traits.rs
index 569507c2165..6426879a030 100644
--- a/crates/router/src/utils/ext_traits.rs
+++ b/crates/router/src/utils/ext_traits.rs
@@ -208,12 +208,14 @@ mod tests {
proptest::proptest! {
/// Example of unit test
+ /// Kind of test: output-based testing
#[test]
fn proptest_valid_fake_email(email in ValidEmail) {
prop_assert!(validate_email(&email).is_ok());
}
/// Example of unit test
+ /// Kind of test: output-based testing
#[test]
fn proptest_invalid_data_email(email in "\\PC*") {
prop_assert!(validate_email(&email).is_err());
diff --git a/crates/router/tests/integration_demo.rs b/crates/router/tests/integration_demo.rs
index d05e6197606..d838f8e798f 100644
--- a/crates/router/tests/integration_demo.rs
+++ b/crates/router/tests/integration_demo.rs
@@ -6,9 +6,10 @@ mod auth {
}
use auth::ConnectorAuthentication;
-use utils::{mk_service, ApiKey, AppClient, LegacyAppClient, MerchantId, PaymentId, Status};
+use utils::{mk_service, ApiKey, AppClient, MerchantId, PaymentId, Status};
/// Example of unit test
+/// Kind of test: output-based testing
/// 1) Create Merchant account
#[actix_web::test]
async fn create_merchant_account() {
@@ -25,6 +26,7 @@ async fn create_merchant_account() {
}
/// Example of unit test
+/// Kind of test: communication-based testing
/// ```pseudocode
/// mk_service =
/// app_state <- AppState(StorageImpl::Mock) // Instantiate a mock database to simulate real world SQL database.
@@ -91,6 +93,7 @@ async fn partial_refund() {
}
/// Example of unit test
+/// Kind of test: communication-based testing
/// ```pseudocode
/// mk_service =
/// app_state <- AppState(StorageImpl::Mock) // Instantiate a mock database to simulate real world SQL database.
@@ -157,93 +160,3 @@ async fn exceed_refund() {
"Refund amount exceeds the payment amount."
);
}
-
-#[actix_web::test]
-#[ignore]
-async fn legacy_partial_refund() {
- legacy_setup().await;
-
- let authentication = ConnectorAuthentication::new();
- let dummy_client = LegacyAppClient::dummy();
- let admin_client = dummy_client.admin("test_admin");
-
- let hlist_pat![merchant_id, api_key] = admin_client
- .create_merchant_account::<HList![MerchantId, ApiKey]>(None)
- .await;
-
- let _connector = admin_client
- .create_connector::<serde_json::Value>(
- &merchant_id,
- "stripe",
- &authentication.checkout.unwrap().api_key,
- )
- .await;
-
- let user_client = dummy_client.user(&api_key);
- let hlist_pat![payment_id] = user_client
- .create_payment::<HList![PaymentId]>(100, 100)
- .await;
-
- let hlist_pat![status] = user_client
- .create_refund::<HList![Status]>(&payment_id, 50)
- .await;
- assert_eq!(&*status, "succeeded");
-
- let hlist_pat![status] = user_client
- .create_refund::<HList![Status]>(&payment_id, 50)
- .await;
- assert_eq!(&*status, "succeeded");
-}
-
-async fn legacy_setup() {
- utils::setup().await;
-}
-
-#[actix_web::test]
-#[ignore]
-async fn legacy_exceed_refund() {
- legacy_setup().await;
-
- let authentication = ConnectorAuthentication::new();
- let dummy_client = LegacyAppClient::dummy();
- let admin_client = dummy_client.admin("test_admin");
-
- let hlist_pat![merchant_id, api_key] = admin_client
- .create_merchant_account::<HList![MerchantId, ApiKey]>(None)
- .await;
-
- let _connector = admin_client
- .create_connector::<serde_json::Value>(
- &merchant_id,
- "stripe",
- &authentication.checkout.unwrap().api_key,
- )
- .await;
-
- let user_client = dummy_client.user(&api_key);
- let hlist_pat![payment_id] = user_client
- .create_payment::<HList![PaymentId]>(100, 100)
- .await;
-
- let hlist_pat![status] = user_client
- .create_refund::<HList![Status]>(&payment_id, 50)
- .await;
- assert_eq!(&*status, "succeeded");
-
- let message = user_client
- .create_refund::<serde_json::Value>(&payment_id, 100)
- .await;
- assert_eq!(
- message["error"]["message"],
- "Refund amount exceeds the payment amount."
- );
-}
-
-#[actix_web::test]
-#[ignore]
-async fn legacy_health_check() {
- legacy_setup().await;
-
- let dummy_client = LegacyAppClient::dummy();
- assert_eq!(dummy_client.health().await, "health is good");
-}
diff --git a/crates/router/tests/utils.rs b/crates/router/tests/utils.rs
index 93a7f4b50ca..fd0ec34c636 100644
--- a/crates/router/tests/utils.rs
+++ b/crates/router/tests/utils.rs
@@ -5,7 +5,6 @@ use actix_web::{
test::{call_and_read_body_json, TestRequest},
};
use derive_deref::Deref;
-use reqwest::{Client, RequestBuilder};
use router::{configs::settings::Settings, routes::AppState, start_server};
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::{json, Value};
@@ -58,134 +57,6 @@ pub struct User {
authkey: String,
}
-pub struct LegacyAppClient<T> {
- client: Client,
- state: T,
-}
-
-impl LegacyAppClient<Guest> {
- pub fn dummy() -> LegacyAppClient<Guest> {
- LegacyAppClient {
- client: Client::new(),
- state: Guest,
- }
- }
-}
-
-impl<T> LegacyAppClient<T> {
- pub fn admin(&self, authkey: &str) -> LegacyAppClient<Admin> {
- LegacyAppClient {
- client: self.client.clone(),
- state: Admin {
- authkey: authkey.to_string(),
- },
- }
- }
-
- pub fn url(&self, path: &str) -> String {
- if path.starts_with('/') {
- format!("http://localhost:8080{}", path)
- } else {
- format!("http://localhost:8080/{}", path)
- }
- }
-
- pub fn get(&self, path: impl AsRef<str>) -> RequestBuilder {
- self.client.get(self.url(path.as_ref()))
- }
-
- pub fn post(&self, path: impl AsRef<str>) -> RequestBuilder {
- self.client.post(self.url(path.as_ref()))
- }
-
- pub fn user(&self, authkey: &str) -> LegacyAppClient<User> {
- LegacyAppClient {
- client: self.client.clone(),
- state: User {
- authkey: authkey.to_string(),
- },
- }
- }
-
- pub async fn health(&self) -> String {
- self.get("health")
- .send()
- .await
- .unwrap()
- .text()
- .await
- .unwrap()
- }
-}
-
-impl LegacyAppClient<Admin> {
- #[track_caller]
- pub async fn create_merchant_account<T: DeserializeOwned>(
- &self,
- merchant_id: impl Into<Option<String>>,
- ) -> T {
- self.post("accounts")
- .header("api-key", &self.state.authkey)
- .json(&mk_merchant_account(merchant_id.into()))
- .send()
- .await
- .unwrap()
- .json::<T>()
- .await
- .unwrap()
- }
-
- #[track_caller]
- pub async fn create_connector<T: DeserializeOwned>(
- &self,
- merchant_id: &str,
- connector_name: &str,
- api_key: &str,
- ) -> T {
- self.post(format!("account/{merchant_id}/connectors"))
- .header("api-key", &self.state.authkey)
- .json(&mk_connector(connector_name, api_key))
- .send()
- .await
- .unwrap()
- .json::<T>()
- .await
- .unwrap()
- }
-}
-
-impl LegacyAppClient<User> {
- #[track_caller]
- pub async fn create_payment<T: DeserializeOwned>(
- &self,
- amount: i32,
- amount_to_capture: i32,
- ) -> T {
- self.post("payments")
- .header("api-key", &self.state.authkey)
- .json(&mk_payment(amount, amount_to_capture))
- .send()
- .await
- .unwrap()
- .json::<T>()
- .await
- .unwrap()
- }
-
- #[track_caller]
- pub async fn create_refund<T: DeserializeOwned>(&self, payment_id: &str, amount: usize) -> T {
- self.post("refunds")
- .header("api-key", &self.state.authkey)
- .json(&mk_refund(payment_id, amount))
- .send()
- .await
- .unwrap()
- .json::<T>()
- .await
- .unwrap()
- }
-}
-
#[allow(dead_code)]
pub struct AppClient<T> {
state: T,
|
refactor
|
remove `SqlDb`, cleaning (#67)
|
7513423631ddf0fe86ef656ec6cad76d82c807bc
|
2024-03-12 19:03:02
|
DEEPANSHU BANSAL
|
fix(core): [REFUNDS] Fix Not Supported Connector Error (#4045)
| false
|
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index 1f82132a45f..d9b4e190137 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -160,6 +160,12 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
}
.into()
}
+ errors::ConnectorError::NotSupported { message, connector } => {
+ errors::ApiErrorResponse::NotSupported {
+ message: format!("{message} is not supported by {connector}"),
+ }
+ .into()
+ }
errors::ConnectorError::FailedToObtainIntegrationUrl
| errors::ConnectorError::RequestEncodingFailed
| errors::ConnectorError::RequestEncodingFailedWithReason(_)
@@ -178,7 +184,6 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
| errors::ConnectorError::FailedToObtainCertificate
| errors::ConnectorError::NoConnectorMetaData
| errors::ConnectorError::FailedToObtainCertificateKey
- | errors::ConnectorError::NotSupported { .. }
| errors::ConnectorError::FlowNotSupported { .. }
| errors::ConnectorError::CaptureMethodNotSupported
| errors::ConnectorError::MissingConnectorMandateID
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 62d34b13069..06af7773f68 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -219,6 +219,16 @@ pub async fn trigger_refund_to_gateway(
updated_by: storage_scheme.to_string(),
})
}
+ errors::ConnectorError::NotSupported { message, connector } => {
+ Some(storage::RefundUpdate::ErrorUpdate {
+ refund_status: Some(enums::RefundStatus::Failure),
+ refund_error_message: Some(format!(
+ "{message} is not supported by {connector}"
+ )),
+ refund_error_code: Some("NOT_SUPPORTED".to_string()),
+ updated_by: storage_scheme.to_string(),
+ })
+ }
_ => None,
});
// Update the refund status as failure if connector_error is NotImplemented
|
fix
|
[REFUNDS] Fix Not Supported Connector Error (#4045)
|
5809408cf9f53d6e62e5dc0a47d6adbf9bb3a4c5
|
2023-01-11 12:47:52
|
Narayan Bhat
|
feat(session): ability to request session token for specific wallets (#280)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 9eb1c8428e1..dadd17f914d 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -509,6 +509,15 @@ pub enum Connector {
Worldpay,
}
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum SupportedWallets {
+ Paypal,
+ ApplePay,
+ Klarna,
+ Gpay,
+}
+
impl From<AttemptStatus> for IntentStatus {
fn from(s: AttemptStatus) -> Self {
match s {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 14816b0ada5..f8e348045cd 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -751,15 +751,6 @@ pub struct PaymentsRetrieveRequest {
pub connector: Option<String>,
}
-#[derive(Debug, serde::Deserialize, Clone)]
-#[serde(rename_all = "snake_case")]
-pub enum SupportedWallets {
- Paypal,
- ApplePay,
- Klarna,
- Gpay,
-}
-
#[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone)]
pub struct OrderDetails {
pub product_name: String,
@@ -777,6 +768,7 @@ pub struct Metadata {
pub struct PaymentsSessionRequest {
pub payment_id: String,
pub client_secret: String,
+ pub wallets: Vec<api_enums::SupportedWallets>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index eebffc5670c..c826503328f 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -47,14 +47,12 @@ pub async fn payment_intents_create(
&req,
create_payment_req,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentCreate,
req,
api::AuthFlow::Merchant,
- connector,
payments::CallConnectorAction::Trigger,
)
},
@@ -102,7 +100,6 @@ pub async fn payment_intents_retrieve(
payments::PaymentStatus,
payload,
auth_flow,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -155,14 +152,12 @@ pub async fn payment_intents_update(
&req,
payload,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentUpdate,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
},
@@ -217,14 +212,12 @@ pub async fn payment_intents_confirm(
&req,
payload,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentConfirm,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
},
@@ -274,7 +267,6 @@ pub async fn payment_intents_capture(
payments::PaymentCapture,
payload,
api::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -329,7 +321,6 @@ pub async fn payment_intents_cancel(
payments::PaymentCancel,
req,
auth_flow,
- None,
payments::CallConnectorAction::Trigger,
)
},
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 29f0b79453a..a8debf945dd 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -44,14 +44,12 @@ pub async fn setup_intents_create(
&req,
create_payment_req,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentCreate,
req,
api::AuthFlow::Merchant,
- connector,
payments::CallConnectorAction::Trigger,
)
},
@@ -99,7 +97,6 @@ pub async fn setup_intents_retrieve(
payments::PaymentStatus,
payload,
auth_flow,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -149,14 +146,12 @@ pub async fn setup_intents_update(
&req,
payload,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentUpdate,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
},
@@ -207,14 +202,12 @@ pub async fn setup_intents_confirm(
&req,
payload,
|state, merchant_account, req| {
- let connector = req.connector;
payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
state,
merchant_account,
payments::PaymentConfirm,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
},
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 566b5b8b69e..6bb4407ae1f 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -28,8 +28,7 @@ use crate::{
scheduler::utils as pt_utils,
services,
types::{
- self,
- api::{self, enums as api_enums},
+ self, api,
storage::{self, enums as storage_enums},
transformers::ForeignInto,
},
@@ -42,7 +41,6 @@ pub async fn payments_operation_core<F, Req, Op, FData>(
merchant_account: storage::MerchantAccount,
operation: Op,
req: Req,
- use_connector: Option<api_enums::Connector>,
call_connector_action: CallConnectorAction,
) -> RouterResult<(PaymentData<F>, Req, Option<storage::Customer>)>
where
@@ -100,7 +98,7 @@ where
let connector_details = operation
.to_domain()?
- .get_connector(&merchant_account, state, use_connector)
+ .get_connector(&merchant_account, state, &req)
.await?;
if let api::ConnectorCallType::Single(ref connector) = connector_details {
@@ -163,7 +161,6 @@ pub async fn payments_core<F, Res, Req, Op, FData>(
operation: Op,
req: Req,
auth_flow: services::AuthFlow,
- use_connector: Option<api_enums::Connector>,
call_connector_action: CallConnectorAction,
) -> RouterResponse<Res>
where
@@ -188,7 +185,6 @@ where
merchant_account,
operation.clone(),
req,
- use_connector,
call_connector_action,
)
.await?;
@@ -276,7 +272,6 @@ pub async fn payments_response_for_redirection_flows<'a>(
PaymentStatus,
req,
services::api::AuthFlow::Merchant,
- None,
flow_type,
)
.await
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 33000465ea0..02e9b723a8a 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -26,8 +26,7 @@ use crate::{
db::StorageInterface,
routes::AppState,
types::{
- self,
- api::{self, enums as api_enums},
+ self, api,
storage::{self, enums},
PaymentsResponseData,
},
@@ -125,7 +124,7 @@ pub trait Domain<F: Clone, R>: Send + Sync {
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ request: &R,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse>;
}
@@ -192,9 +191,9 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsRetrieveRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
#[instrument(skip_all)]
@@ -258,9 +257,9 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsCaptureRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
@@ -312,8 +311,8 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsCancelRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 93033649b61..d52d899cb93 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -16,7 +16,7 @@ use crate::{
routes::AppState,
types::{
self,
- api::{self, enums as api_enums, PaymentIdTypeExt},
+ api::{self, PaymentIdTypeExt},
storage::{self, enums},
transformers::ForeignInto,
},
@@ -254,9 +254,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentConfirm {
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ request: &api::PaymentsRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, request.connector).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 5c8b8168953..b1036f15195 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 crate::{
routes::AppState,
types::{
self,
- api::{self, enums as api_enums, PaymentIdTypeExt},
+ api::{self, PaymentIdTypeExt},
storage::{
self,
enums::{self, IntentStatus},
@@ -256,9 +256,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentCreate {
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ request: &api::PaymentsRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, request.connector).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_method_validate.rs b/crates/router/src/core/payments/operations/payment_method_validate.rs
index cb7c9276b35..0e7f1edcd92 100644
--- a/crates/router/src/core/payments/operations/payment_method_validate.rs
+++ b/crates/router/src/core/payments/operations/payment_method_validate.rs
@@ -252,9 +252,9 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::VerifyRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 2ce4b169762..95fc06246a1 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -1,4 +1,4 @@
-use std::marker::PhantomData;
+use std::{collections::HashSet, marker::PhantomData};
use async_trait::async_trait;
use common_utils::ext_traits::ValueExt;
@@ -268,7 +268,7 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- _request_connector: Option<api_enums::Connector>,
+ request: &api::PaymentsSessionRequest,
) -> RouterResult<api::ConnectorCallType> {
let connectors = &state.conf.connectors;
let db = &state.store;
@@ -287,10 +287,10 @@ where
supported_connectors.contains(&connector_account.connector_name)
})
.map(|filtered_connector| filtered_connector.connector_name.clone())
- .collect::<Vec<String>>();
+ .collect::<HashSet<String>>();
// Parse the payment methods enabled to check if the merchant has enabled gpay ( wallet )
- // through that connector this parsing from Value to payment method is costly and has to be done for every connector
+ // through that connector. This parsing from serde_json::Value to payment method is costly and has to be done for every connector
// for sure looks like an area of optimization
let session_token_from_metadata_connectors = connector_accounts
.iter()
@@ -310,29 +310,58 @@ where
})
})
.map(|filtered_connector| filtered_connector.connector_name.clone())
- .collect::<Vec<String>>();
-
- let mut connectors_data = Vec::with_capacity(
- normal_connector_names.len() + session_token_from_metadata_connectors.len(),
- );
-
- for connector_name in normal_connector_names {
- let connector_data = api::ConnectorData::get_connector_by_name(
- connectors,
- &connector_name,
- api::GetToken::Connector,
- )?;
- connectors_data.push(connector_data);
- }
-
- for connector_name in session_token_from_metadata_connectors {
- let connector_data = api::ConnectorData::get_connector_by_name(
- connectors,
- &connector_name,
- api::GetToken::Metadata,
- )?;
- connectors_data.push(connector_data);
- }
+ .collect::<HashSet<String>>();
+
+ let given_wallets = request.wallets.clone();
+
+ let connectors_data = if !given_wallets.is_empty() {
+ // Create connectors for provided wallets
+ let mut connectors_data = Vec::with_capacity(supported_connectors.len());
+ for wallet in given_wallets {
+ let (connector_name, connector_type) = match wallet {
+ api_enums::SupportedWallets::Gpay => ("adyen", api::GetToken::Metadata),
+ api_enums::SupportedWallets::ApplePay => ("applepay", api::GetToken::Connector),
+ api_enums::SupportedWallets::Paypal => ("braintree", api::GetToken::Connector),
+ api_enums::SupportedWallets::Klarna => ("klarna", api::GetToken::Connector),
+ };
+
+ // Check if merchant has enabled the required merchant connector account
+ if session_token_from_metadata_connectors.contains(connector_name)
+ || normal_connector_names.contains(connector_name)
+ {
+ connectors_data.push(api::ConnectorData::get_connector_by_name(
+ connectors,
+ connector_name,
+ connector_type,
+ )?);
+ }
+ }
+ connectors_data
+ } else {
+ // Create connectors for all enabled wallets
+ let mut connectors_data = Vec::with_capacity(
+ normal_connector_names.len() + session_token_from_metadata_connectors.len(),
+ );
+
+ for connector_name in normal_connector_names {
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ connectors,
+ &connector_name,
+ api::GetToken::Connector,
+ )?;
+ connectors_data.push(connector_data);
+ }
+
+ for connector_name in session_token_from_metadata_connectors {
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ connectors,
+ &connector_name,
+ api::GetToken::Metadata,
+ )?;
+ connectors_data.push(connector_data);
+ }
+ connectors_data
+ };
Ok(api::ConnectorCallType::Multiple(connectors_data))
}
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 76d710aadaf..eb5049ab0c9 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -16,7 +16,7 @@ use crate::{
pii::Secret,
routes::AppState,
types::{
- api::{self, enums as api_enums, PaymentIdTypeExt},
+ api::{self, PaymentIdTypeExt},
storage::{self, enums},
transformers::ForeignInto,
},
@@ -252,8 +252,8 @@ where
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsStartRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index aa514323f14..5efac250b77 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -14,7 +14,7 @@ use crate::{
db::StorageInterface,
routes::AppState,
types::{
- api::{self, enums as api_enums},
+ api,
storage::{self, enums},
transformers::ForeignInto,
},
@@ -100,9 +100,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentStatus {
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 1d496b53b41..8b63c831d6a 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -16,7 +16,7 @@ use crate::{
db::StorageInterface,
routes::AppState,
types::{
- api::{self, enums as api_enums, PaymentIdTypeExt},
+ api::{self, PaymentIdTypeExt},
storage::{self, enums},
transformers::ForeignInto,
},
@@ -271,9 +271,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentUpdate {
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
- request_connector: Option<api_enums::Connector>,
+ _request: &api::PaymentsRequest,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
- helpers::get_connector_default(merchant_account, state, request_connector).await
+ helpers::get_connector_default(merchant_account, state, None).await
}
}
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 81c70624d48..e94e7c7d818 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -52,7 +52,6 @@ async fn payments_incoming_webhook_flow(
param: None,
},
services::AuthFlow::Merchant,
- None,
consume_or_trigger_flow,
)
.await
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 3954c1ea9c0..baf80cfd6a2 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -63,7 +63,6 @@ pub async fn payments_start(
payments::operations::PaymentStart,
req,
api::AuthFlow::Client,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -103,7 +102,6 @@ pub async fn payments_retrieve(
payments::PaymentStatus,
req,
api::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -219,7 +217,6 @@ pub async fn payments_capture(
payments::PaymentCapture,
payload,
api::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -253,7 +250,6 @@ pub async fn payments_connector_session(
payments::PaymentSession,
payload,
api::AuthFlow::Client,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -317,7 +313,6 @@ pub async fn payments_cancel(
payments::PaymentCancel,
req,
api::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
},
@@ -366,7 +361,6 @@ where
// the operation are flow agnostic, and the flow is only required in the post_update_tracker
// Thus the flow can be generated just before calling the connector instead of explicitly passing it here.
- let connector = req.connector;
match req.amount.as_ref() {
Some(api_types::Amount::Value(_)) | None => payments::payments_core::<
api_types::Authorize,
@@ -380,7 +374,6 @@ where
operation,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
.await,
@@ -392,7 +385,6 @@ where
operation,
req,
auth_flow,
- connector,
payments::CallConnectorAction::Trigger,
)
.await
diff --git a/crates/router/src/scheduler/workflows/payment_sync.rs b/crates/router/src/scheduler/workflows/payment_sync.rs
index 6f63d738af9..5f0ca733eb1 100644
--- a/crates/router/src/scheduler/workflows/payment_sync.rs
+++ b/crates/router/src/scheduler/workflows/payment_sync.rs
@@ -41,7 +41,6 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow {
merchant_account.clone(),
operations::PaymentStatus,
tracking_data.clone(),
- None,
payment_flows::CallConnectorAction::Trigger,
)
.await?;
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 5927d7ae80c..4f69bf069cf 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -355,7 +355,6 @@ async fn payments_create_core() {
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
.await
@@ -513,7 +512,6 @@ async fn payments_create_core_adyen_no_redirect() {
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
.await
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 618433ff9e1..49dc7d6d79a 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -106,7 +106,6 @@ async fn payments_create_core() {
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
.await
@@ -267,7 +266,6 @@ async fn payments_create_core_adyen_no_redirect() {
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
- None,
payments::CallConnectorAction::Trigger,
)
.await
|
feat
|
ability to request session token for specific wallets (#280)
|
208d619409ee03b7115b7c6268457df12149bee1
|
2023-08-01 10:51:26
|
chikke srujan
|
fix(connector): [Stripe] change payment_method name Wechatpay to wechatpayqr (#1813)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index fd2e9e6c607..18ab2573c85 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1030,8 +1030,6 @@ pub enum WalletData {
TouchNGoRedirect(Box<TouchNGoRedirection>),
/// The wallet data for WeChat Pay Redirection
WeChatPayRedirect(Box<WeChatPayRedirection>),
- /// The wallet data for WeChat Pay
- WeChatPay(Box<WeChatPay>),
/// The wallet data for WeChat Pay Display QrCode
WeChatPayQr(Box<WeChatPayQr>),
}
diff --git a/crates/router/src/connector/dummyconnector/transformers.rs b/crates/router/src/connector/dummyconnector/transformers.rs
index f7081c870af..dc707bde42c 100644
--- a/crates/router/src/connector/dummyconnector/transformers.rs
+++ b/crates/router/src/connector/dummyconnector/transformers.rs
@@ -111,7 +111,7 @@ impl TryFrom<api_models::payments::WalletData> for DummyConnectorWallet {
match value {
api_models::payments::WalletData::GooglePayRedirect(_) => Ok(Self::GooglePay),
api_models::payments::WalletData::PaypalRedirect(_) => Ok(Self::Paypal),
- api_models::payments::WalletData::WeChatPay(_) => Ok(Self::WeChatPay),
+ api_models::payments::WalletData::WeChatPayRedirect(_) => Ok(Self::WeChatPay),
api_models::payments::WalletData::MbWayRedirect(_) => Ok(Self::MbWay),
api_models::payments::WalletData::AliPayRedirect(_) => Ok(Self::AliPay),
api_models::payments::WalletData::AliPayHkRedirect(_) => Ok(Self::AliPayHK),
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 48669b58a39..b6c09106463 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1128,7 +1128,7 @@ fn create_stripe_payment_method(
None,
StripeBillingAddress::default(),
)),
- payments::WalletData::WeChatPay(_) => Ok((
+ payments::WalletData::WeChatPayQr(_) => Ok((
StripePaymentMethodData::Wallet(StripeWallet::WechatpayPayment(WechatpayPayment {
client: WechatClient::Web,
payment_method_data_type: StripePaymentMethodType::Wechatpay,
@@ -2846,7 +2846,7 @@ impl
Ok(Self::Wallet(wallet_info))
}
- payments::WalletData::WeChatPayRedirect(_) => {
+ payments::WalletData::WeChatPayQr(_) => {
let wallet_info = StripeWallet::WechatpayPayment(WechatpayPayment {
client: WechatClient::Web,
payment_method_data_type: StripePaymentMethodType::Wechatpay,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index bebf9d9bbf8..4ba849ab7ae 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -10261,17 +10261,6 @@
}
}
},
- {
- "type": "object",
- "required": [
- "we_chat_pay"
- ],
- "properties": {
- "we_chat_pay": {
- "$ref": "#/components/schemas/WeChatPay"
- }
- }
- },
{
"type": "object",
"required": [
|
fix
|
[Stripe] change payment_method name Wechatpay to wechatpayqr (#1813)
|
014c2d5f555633bc04baca9b4a8c30b9c3534350
|
2024-02-08 05:48:27
|
github-actions
|
chore(version): 2024.02.08.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac6d7f0ae56..043c68104f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,35 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.02.08.0
+
+### Features
+
+- **core:**
+ - Routes to toggle blocklist ([#3568](https://github.com/juspay/hyperswitch/pull/3568)) ([`fbe84b2`](https://github.com/juspay/hyperswitch/commit/fbe84b2a334cfb744ae4f27b1eadc892c7f9b164))
+ - Decide flow based on setup_future_usage ([#3569](https://github.com/juspay/hyperswitch/pull/3569)) ([`ef302dd`](https://github.com/juspay/hyperswitch/commit/ef302dd3983674c9df47812d3c398a7e7b423257))
+ - Add config for update_mandate_flow ([#3542](https://github.com/juspay/hyperswitch/pull/3542)) ([`14c0a2b`](https://github.com/juspay/hyperswitch/commit/14c0a2b03f34ae4359ee6a3918b76466eda25320))
+- **payouts:** Add Wallet to Payouts ([#3502](https://github.com/juspay/hyperswitch/pull/3502)) ([`3af6aaf`](https://github.com/juspay/hyperswitch/commit/3af6aaf28e92780679eb0314eb3e95803b9c3113))
+
+### Bug Fixes
+
+- **payouts:** Saved payment methods list for bank details ([#3507](https://github.com/juspay/hyperswitch/pull/3507)) ([`a15e7ae`](https://github.com/juspay/hyperswitch/commit/a15e7ae9b156659e61de752ca94b6f43932d9de5))
+- **router:** Added validation check to number of workers in config ([#3533](https://github.com/juspay/hyperswitch/pull/3533)) ([`c0e31ed`](https://github.com/juspay/hyperswitch/commit/c0e31ed1df6cd1f17727c9ebf9d308ede02f2228))
+
+### Refactors
+
+- **connector:** [Adyen] Status mapping based on Payment method Type ([#3567](https://github.com/juspay/hyperswitch/pull/3567)) ([`ab6b5ab`](https://github.com/juspay/hyperswitch/commit/ab6b5ab7b4cc95ec4f691eda865ed64472cb1f4a))
+- **users:** Change list roles api to also send inactive merchants ([#3583](https://github.com/juspay/hyperswitch/pull/3583)) ([`cef1643`](https://github.com/juspay/hyperswitch/commit/cef1643af54f128e68abbf4cdc9654df3b9a69e5))
+- [Noon] add new field max_amount to mandate request ([#3481](https://github.com/juspay/hyperswitch/pull/3481)) ([`926d084`](https://github.com/juspay/hyperswitch/commit/926d084e44ed6f7c83e94e60ea9da35167e499b0))
+
+### Miscellaneous Tasks
+
+- **postman:** Update Postman collection files ([`f10b65e`](https://github.com/juspay/hyperswitch/commit/f10b65e88ee5b0fc929a717eacdbbf2fc1f0848b))
+
+**Full Changelog:** [`2024.02.07.0...2024.02.08.0`](https://github.com/juspay/hyperswitch/compare/2024.02.07.0...2024.02.08.0)
+
+- - -
+
## 2024.02.07.0
### Features
|
chore
|
2024.02.08.0
|
dd7b10a8bdad4c509a4fbae429f3abd21a5d6758
|
2024-05-01 16:10:02
|
Hrithikesh
|
chore: make client certificate and private key secret across codebase (#4490)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index bd19443d002..d730fa8c859 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3894,8 +3894,10 @@ pub struct PaymentRequestMetadata {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct SessionTokenInfo {
- pub certificate: String,
- pub certificate_keys: String,
+ #[schema(value_type = String)]
+ pub certificate: Secret<String>,
+ #[schema(value_type = String)]
+ pub certificate_keys: Secret<String>,
pub merchant_identifier: String,
pub display_name: String,
pub initiative: String,
diff --git a/crates/common_utils/src/request.rs b/crates/common_utils/src/request.rs
index 47f280bc577..264179fc603 100644
--- a/crates/common_utils/src/request.rs
+++ b/crates/common_utils/src/request.rs
@@ -35,8 +35,8 @@ pub struct Request {
pub url: String,
pub headers: Headers,
pub method: Method,
- pub certificate: Option<String>,
- pub certificate_key: Option<String>,
+ pub certificate: Option<Secret<String>>,
+ pub certificate_key: Option<Secret<String>>,
pub body: Option<RequestContent>,
}
@@ -96,11 +96,11 @@ impl Request {
self.headers.insert((String::from(header), value));
}
- pub fn add_certificate(&mut self, certificate: Option<String>) {
+ pub fn add_certificate(&mut self, certificate: Option<Secret<String>>) {
self.certificate = certificate;
}
- pub fn add_certificate_key(&mut self, certificate_key: Option<String>) {
+ pub fn add_certificate_key(&mut self, certificate_key: Option<Secret<String>>) {
self.certificate = certificate_key;
}
}
@@ -110,8 +110,8 @@ pub struct RequestBuilder {
pub url: String,
pub headers: Headers,
pub method: Method,
- pub certificate: Option<String>,
- pub certificate_key: Option<String>,
+ pub certificate: Option<Secret<String>>,
+ pub certificate_key: Option<Secret<String>>,
pub body: Option<RequestContent>,
}
@@ -157,12 +157,12 @@ impl RequestBuilder {
self
}
- pub fn add_certificate(mut self, certificate: Option<String>) -> Self {
+ pub fn add_certificate(mut self, certificate: Option<Secret<String>>) -> Self {
self.certificate = certificate;
self
}
- pub fn add_certificate_key(mut self, certificate_key: Option<String>) -> Self {
+ pub fn add_certificate_key(mut self, certificate_key: Option<Secret<String>>) -> Self {
self.certificate_key = certificate_key;
self
}
diff --git a/crates/router/src/connector/netcetera.rs b/crates/router/src/connector/netcetera.rs
index 40df0050f47..71072a046de 100644
--- a/crates/router/src/connector/netcetera.rs
+++ b/crates/router/src/connector/netcetera.rs
@@ -5,7 +5,6 @@ use std::fmt::Debug;
use common_utils::{ext_traits::ByteSliceExt, request::RequestContent};
use error_stack::ResultExt;
-use masking::ExposeInterface;
use transformers as netcetera;
use crate::{
@@ -297,8 +296,8 @@ impl
self, req, connectors,
)?,
)
- .add_certificate(Some(netcetera_auth_type.certificate.expose()))
- .add_certificate_key(Some(netcetera_auth_type.private_key.expose()))
+ .add_certificate(Some(netcetera_auth_type.certificate))
+ .add_certificate_key(Some(netcetera_auth_type.private_key))
.build(),
))
}
@@ -407,8 +406,8 @@ impl
self, req, connectors,
)?,
)
- .add_certificate(Some(netcetera_auth_type.certificate.expose()))
- .add_certificate_key(Some(netcetera_auth_type.private_key.expose()))
+ .add_certificate(Some(netcetera_auth_type.certificate))
+ .add_certificate_key(Some(netcetera_auth_type.private_key))
.build(),
))
}
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 3d21aa732de..66e0f144807 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -111,8 +111,8 @@ fn get_applepay_metadata(
fn build_apple_pay_session_request(
state: &routes::AppState,
request: payment_types::ApplepaySessionRequest,
- apple_pay_merchant_cert: String,
- apple_pay_merchant_cert_key: String,
+ apple_pay_merchant_cert: masking::Secret<String>,
+ apple_pay_merchant_cert_key: masking::Secret<String>,
) -> RouterResult<services::Request> {
let mut url = state.conf.connectors.applepay.base_url.to_owned();
url.push_str("paymentservices/paymentSession");
@@ -188,16 +188,14 @@ async fn create_applepay_session_token(
.applepay_decrypt_keys
.get_inner()
.apple_pay_merchant_cert
- .clone()
- .expose();
+ .clone();
let apple_pay_merchant_cert_key = state
.conf
.applepay_decrypt_keys
.get_inner()
.apple_pay_merchant_cert_key
- .clone()
- .expose();
+ .clone();
(
payment_request_data,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index ff69749405a..45816b875c7 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -66,15 +66,15 @@ use crate::{
};
pub fn create_identity_from_certificate_and_key(
- encoded_certificate: String,
- encoded_certificate_key: String,
+ encoded_certificate: masking::Secret<String>,
+ encoded_certificate_key: masking::Secret<String>,
) -> Result<reqwest::Identity, error_stack::Report<errors::ApiClientError>> {
let decoded_certificate = BASE64_ENGINE
- .decode(encoded_certificate)
+ .decode(encoded_certificate.expose())
.change_context(errors::ApiClientError::CertificateDecodeFailed)?;
let decoded_certificate_key = BASE64_ENGINE
- .decode(encoded_certificate_key)
+ .decode(encoded_certificate_key.expose())
.change_context(errors::ApiClientError::CertificateDecodeFailed)?;
let certificate = String::from_utf8(decoded_certificate)
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index 3f738df5920..8782126b0b6 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -22,8 +22,8 @@ pub async fn verify_merchant_creds_for_applepay(
.common_merchant_identifier
.clone()
.expose();
- let cert_data = applepay_merchant_configs.merchant_cert.clone().expose();
- let key_data = applepay_merchant_configs.merchant_cert_key.clone().expose();
+ let cert_data = applepay_merchant_configs.merchant_cert.clone();
+ let key_data = applepay_merchant_configs.merchant_cert_key.clone();
let applepay_endpoint = &applepay_merchant_configs.applepay_endpoint;
let request_body = verifications::ApplepayMerchantVerificationConfigs {
diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs
index 816269c086f..09b4d25d0b6 100644
--- a/crates/router/src/services/api/client.rs
+++ b/crates/router/src/services/api/client.rs
@@ -83,8 +83,8 @@ fn get_base_client(
pub(super) fn create_client(
proxy_config: &Proxy,
should_bypass_proxy: bool,
- client_certificate: Option<String>,
- client_certificate_key: Option<String>,
+ client_certificate: Option<masking::Secret<String>>,
+ client_certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<reqwest::Client, ApiClientError> {
match (client_certificate, client_certificate_key) {
(Some(encoded_certificate), Some(encoded_certificate_key)) => {
@@ -154,8 +154,8 @@ where
&self,
method: Method,
url: String,
- certificate: Option<String>,
- certificate_key: Option<String>,
+ certificate: Option<masking::Secret<String>>,
+ certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<Box<dyn RequestBuilder>, ApiClientError>;
async fn send_request(
@@ -223,8 +223,8 @@ impl ProxyClient {
pub fn get_reqwest_client(
&self,
base_url: String,
- client_certificate: Option<String>,
- client_certificate_key: Option<String>,
+ client_certificate: Option<masking::Secret<String>>,
+ client_certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<reqwest::Client, ApiClientError> {
match (client_certificate, client_certificate_key) {
(Some(certificate), Some(certificate_key)) => {
@@ -323,8 +323,8 @@ impl ApiClient for ProxyClient {
&self,
method: Method,
url: String,
- certificate: Option<String>,
- certificate_key: Option<String>,
+ certificate: Option<masking::Secret<String>>,
+ certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<Box<dyn RequestBuilder>, ApiClientError> {
let client_builder = self
.get_reqwest_client(url.clone(), certificate, certificate_key)
@@ -378,8 +378,8 @@ impl ApiClient for MockApiClient {
&self,
_method: Method,
_url: String,
- _certificate: Option<String>,
- _certificate_key: Option<String>,
+ _certificate: Option<masking::Secret<String>>,
+ _certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<Box<dyn RequestBuilder>, ApiClientError> {
// [#2066]: Add Mock implementation for ApiClient
Err(ApiClientError::UnexpectedState.into())
|
chore
|
make client certificate and private key secret across codebase (#4490)
|
d000847b938952de6ff9c2e01bdd06b4ede60e69
|
2024-02-22 15:26:12
|
AkshayaFoiger
|
refactor(connectors): [Bluesnap] PII data masking (#3714)
| false
|
diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs
index 63ca7750303..201ddc221fc 100644
--- a/crates/router/src/connector/bluesnap/transformers.rs
+++ b/crates/router/src/connector/bluesnap/transformers.rs
@@ -591,7 +591,7 @@ pub struct BluesnapCompletePaymentsRequest {
amount: String,
currency: enums::Currency,
card_transaction_type: BluesnapTxnType,
- pf_token: String,
+ pf_token: Secret<String>,
three_d_secure: Option<BluesnapThreeDSecureInfo>,
transaction_fraud_info: Option<TransactionFraudInfo>,
card_holder_info: Option<BluesnapCardHolderInfo>,
@@ -627,7 +627,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
meta_data: Vec::<RequestMetadata>::foreign_from(metadata.peek().to_owned()),
});
- let pf_token = item
+ let token = item
.router_data
.request
.redirect_response
@@ -673,7 +673,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
item.router_data.request.get_email()?,
)?,
merchant_transaction_id: Some(item.router_data.connector_request_reference_id.clone()),
- pf_token,
+ pf_token: Secret::new(token),
transaction_meta_data,
})
}
|
refactor
|
[Bluesnap] PII data masking (#3714)
|
44b1f4949ea06d59480670ccfa02446fa7713d13
|
2023-11-30 12:57:38
|
Sudheer konagalla
|
fix(router): [Dlocal] connector transaction id fix (#2872)
| false
|
diff --git a/crates/router/src/connector/dlocal/transformers.rs b/crates/router/src/connector/dlocal/transformers.rs
index a9033e53d66..f7cfa6a868b 100644
--- a/crates/router/src/connector/dlocal/transformers.rs
+++ b/crates/router/src/connector/dlocal/transformers.rs
@@ -303,7 +303,7 @@ pub struct DlocalPaymentsResponse {
status: DlocalPaymentStatus,
id: String,
three_dsecure: Option<ThreeDSecureResData>,
- order_id: String,
+ order_id: Option<String>,
}
impl<F, T>
@@ -323,12 +323,12 @@ impl<F, T>
});
let response = types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.order_id.clone()),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: Some(item.response.order_id.clone()),
+ connector_response_reference_id: item.response.order_id.clone(),
};
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
@@ -342,7 +342,7 @@ impl<F, T>
pub struct DlocalPaymentsSyncResponse {
status: DlocalPaymentStatus,
id: String,
- order_id: String,
+ order_id: Option<String>,
}
impl<F, T>
@@ -362,14 +362,12 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.order_id.clone(),
- ),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: Some(item.response.order_id.clone()),
+ connector_response_reference_id: item.response.order_id.clone(),
}),
..item.data
})
@@ -380,7 +378,7 @@ impl<F, T>
pub struct DlocalPaymentsCaptureResponse {
status: DlocalPaymentStatus,
id: String,
- order_id: String,
+ order_id: Option<String>,
}
impl<F, T>
@@ -400,14 +398,12 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.order_id.clone(),
- ),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: Some(item.response.order_id.clone()),
+ connector_response_reference_id: item.response.order_id.clone(),
}),
..item.data
})
|
fix
|
[Dlocal] connector transaction id fix (#2872)
|
3a225b2118c52f7b28a40a87bbcd8b126b01eeef
|
2023-06-16 14:36:21
|
SamraatBansal
|
feat(connector): [Zen] add google pay redirect flow support (#1454)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index e743e9a853c..173b795efa3 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -816,6 +816,8 @@ pub enum WalletData {
ApplePayRedirect(Box<ApplePayRedirectData>),
/// The wallet data for Google pay
GooglePay(GooglePayWalletData),
+ /// Wallet data for google pay redirect flow
+ GooglePayRedirect(Box<GooglePayRedirectData>),
MbWayRedirect(Box<MbWayRedirection>),
/// The wallet data for MobilePay redirect
MobilePayRedirect(Box<MobilePayRedirection>),
@@ -844,6 +846,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 GooglePayRedirectData {}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPayRedirection {}
diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rs
index e6429bde561..6b2d3658287 100644
--- a/crates/router/src/connector/zen.rs
+++ b/crates/router/src/connector/zen.rs
@@ -164,9 +164,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
let mut headers = self.build_headers(req, connectors)?;
let api_headers = match req.request.payment_method_data {
- api_models::payments::PaymentMethodData::Wallet(
- api_models::payments::WalletData::ApplePayRedirect(_),
- ) => None,
+ api_models::payments::PaymentMethodData::Wallet(_) => None,
_ => Some(Self::get_default_header()),
};
if let Some(api_header) = api_headers {
@@ -185,9 +183,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let endpoint = match &req.request.payment_method_data {
- api_models::payments::PaymentMethodData::Wallet(
- api_models::payments::WalletData::ApplePayRedirect(_),
- ) => {
+ api_models::payments::PaymentMethodData::Wallet(_) => {
let base_url = connectors
.zen
.secondary_base_url
diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs
index 22ca65fb685..fa11f67f202 100644
--- a/crates/router/src/connector/zen/transformers.rs
+++ b/crates/router/src/connector/zen/transformers.rs
@@ -1,4 +1,4 @@
-use api_models::payments::{ApplePayRedirectData, Card, GooglePayWalletData};
+use api_models::payments::Card;
use cards::CardNumber;
use common_utils::{ext_traits::ValueExt, pii};
use error_stack::ResultExt;
@@ -116,7 +116,6 @@ pub struct ZenBrowserDetails {
#[serde(rename_all = "snake_case")]
pub enum ZenPaymentTypes {
Onetime,
- ExternalPaymentToken,
}
#[derive(Debug, Serialize)]
@@ -138,11 +137,12 @@ pub struct ZenItemObject {
#[derive(Debug, Serialize, Deserialize)]
pub struct SessionObject {
- pub apple_pay: Option<ApplePaySessionData>,
+ pub apple_pay: Option<WalletSessionData>,
+ pub google_pay: Option<WalletSessionData>,
}
#[derive(Debug, Serialize, Deserialize)]
-pub struct ApplePaySessionData {
+pub struct WalletSessionData {
pub terminal_uuid: Option<String>,
pub pay_wall_secret: Option<String>,
}
@@ -181,6 +181,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, &Card)> for ZenPaymentsReques
}
}
+/*
impl TryFrom<(&types::PaymentsAuthorizeRouterData, &GooglePayWalletData)> for ZenPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -213,7 +214,8 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, &GooglePayWalletData)> for Ze
})))
}
}
-
+*/
+/*
impl
TryFrom<(
&types::PaymentsAuthorizeRouterData,
@@ -257,10 +259,67 @@ impl
Ok(Self::CheckoutRequest(Box::new(checkout_request)))
}
}
+*/
+
+impl
+ TryFrom<(
+ &types::PaymentsAuthorizeRouterData,
+ &api_models::payments::WalletData,
+ )> for ZenPaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, wallet_data): (
+ &types::PaymentsAuthorizeRouterData,
+ &api_models::payments::WalletData,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let amount = utils::to_currency_base_unit(item.request.amount, item.request.currency)?;
+ let connector_meta = item.get_connector_meta()?;
+ let session: SessionObject = connector_meta
+ .parse_value("SessionObject")
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ let (specified_payment_channel, session_data) = match wallet_data {
+ api_models::payments::WalletData::ApplePayRedirect(_) => (
+ ZenPaymentChannels::PclApplepay,
+ session
+ .apple_pay
+ .ok_or(errors::ConnectorError::RequestEncodingFailed)?,
+ ),
+ api_models::payments::WalletData::GooglePayRedirect(_) => (
+ ZenPaymentChannels::PclGooglepay,
+ session
+ .google_pay
+ .ok_or(errors::ConnectorError::RequestEncodingFailed)?,
+ ),
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "payment method".to_string(),
+ ))?,
+ };
+ let terminal_uuid = session_data
+ .terminal_uuid
+ .clone()
+ .ok_or(errors::ConnectorError::RequestEncodingFailed)?;
+ let mut checkout_request = CheckoutRequest {
+ merchant_transaction_id: item.attempt_id.clone(),
+ specified_payment_channel,
+ currency: item.request.currency,
+ custom_ipn_url: item.request.get_webhook_url()?,
+ items: get_item_object(item, amount.clone())?,
+ amount,
+ terminal_uuid: Secret::new(terminal_uuid),
+ signature: None,
+ url_redirect: item.request.get_return_url()?,
+ };
+ checkout_request.signature =
+ Some(get_checkout_signature(&checkout_request, &session_data)?);
+ Ok(Self::CheckoutRequest(Box::new(checkout_request)))
+ }
+}
fn get_checkout_signature(
checkout_request: &CheckoutRequest,
- session: &ApplePaySessionData,
+ session: &WalletSessionData,
) -> Result<Secret<String>, error_stack::Report<errors::ConnectorError>> {
let pay_wall_secret = session
.pay_wall_secret
@@ -426,17 +485,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for ZenPaymentsRequest {
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
match &item.request.payment_method_data {
api_models::payments::PaymentMethodData::Card(card) => Self::try_from((item, card)),
- api_models::payments::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- api_models::payments::WalletData::ApplePayRedirect(apple_pay_redirect_data) => {
- Self::try_from((item, apple_pay_redirect_data))
- }
- api_models::payments::WalletData::GooglePay(gpay_redirect_data) => {
- Self::try_from((item, gpay_redirect_data))
- }
- _ => Err(errors::ConnectorError::NotImplemented(
- "payment method".to_string(),
- ))?,
- },
+ api_models::payments::PaymentMethodData::Wallet(wallet_data) => {
+ Self::try_from((item, wallet_data))
+ }
_ => Err(errors::ConnectorError::NotImplemented(
"payment method".to_string(),
))?,
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 7f1241817a8..1ae4cce0334 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -231,6 +231,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ReceiverDetails,
api_models::payments::AchTransfer,
api_models::payments::ApplePayRedirectData,
+ api_models::payments::GooglePayRedirectData,
api_models::payments::SepaBankTransferInstructions,
api_models::payments::BacsBankTransferInstructions,
api_models::payments::RedirectResponse,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 7a87d11a242..59cdc11ae41 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -3982,6 +3982,9 @@
}
}
},
+ "GooglePayRedirectData": {
+ "type": "object"
+ },
"GooglePayWalletData": {
"type": "object",
"required": [
@@ -7898,6 +7901,17 @@
}
}
},
+ {
+ "type": "object",
+ "required": [
+ "google_pay_redirect"
+ ],
+ "properties": {
+ "apple_pay_redirect": {
+ "$ref": "#/components/schemas/GooglePayRedirectData"
+ }
+ }
+ },
{
"type": "object",
"required": [
|
feat
|
[Zen] add google pay redirect flow support (#1454)
|
9a201ae698c2cf52e617660f82d5bf1df2e797ae
|
2023-11-17 17:48:42
|
Shankar Singh C
|
fix(router): add rust locker url in proxy_bypass_urls (#2902)
| false
|
diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs
index 8eb6ab72f98..cc7353dcda6 100644
--- a/crates/router/src/services/api/client.rs
+++ b/crates/router/src/services/api/client.rs
@@ -110,11 +110,15 @@ pub(super) fn create_client(
pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> {
let locker_host = locker.host.to_owned();
+ let locker_host_rs = locker.host_rs.to_owned();
let basilisk_host = locker.basilisk_host.to_owned();
vec![
format!("{locker_host}/cards/add"),
format!("{locker_host}/cards/retrieve"),
format!("{locker_host}/cards/delete"),
+ format!("{locker_host_rs}/cards/add"),
+ format!("{locker_host_rs}/cards/retrieve"),
+ format!("{locker_host_rs}/cards/delete"),
format!("{locker_host}/card/addCard"),
format!("{locker_host}/card/getCard"),
format!("{locker_host}/card/deleteCard"),
|
fix
|
add rust locker url in proxy_bypass_urls (#2902)
|
04a5e3823671d389bb6370570d7424a9e1d30759
|
2025-02-04 01:38:08
|
Shankar Singh C
|
fix(samsung_pay): populate `payment_method_data` in the payment response (#7095)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 236c0af3a38..b315800b08c 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -21493,8 +21493,7 @@
"type": "object",
"required": [
"last4",
- "card_network",
- "type"
+ "card_network"
],
"properties": {
"last4": {
@@ -21507,7 +21506,8 @@
},
"type": {
"type": "string",
- "description": "The type of payment method"
+ "description": "The type of payment method",
+ "nullable": true
}
}
},
@@ -21864,6 +21864,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/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 9b840f53138..0aa2c898fc6 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -26102,8 +26102,7 @@
"type": "object",
"required": [
"last4",
- "card_network",
- "type"
+ "card_network"
],
"properties": {
"last4": {
@@ -26116,7 +26115,8 @@
},
"type": {
"type": "string",
- "description": "The type of payment method"
+ "description": "The type of payment method",
+ "nullable": true
}
}
},
@@ -26473,6 +26473,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 2c0a09bf8f0..2c8723857a8 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 6e85db98430..3833d316be6 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),
|
fix
|
populate `payment_method_data` in the payment response (#7095)
|
5a81b50ae20760ce3c281719e0853c0f60f23734
|
2024-06-12 05:44:53
|
github-actions
|
chore(version): 2024.06.12.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f024d5ba05b..9a3d485672f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.06.12.0
+
+### Features
+
+- **connector:**
+ - [Multisafepay] Add support for Ideal and Giropay ([#4398](https://github.com/juspay/hyperswitch/pull/4398)) ([`b01bbba`](https://github.com/juspay/hyperswitch/commit/b01bbba6ff9ea9acec6a83ad0dde327a377d9f6e))
+ - Implement auth and post auth flows for gpayments ([#4746](https://github.com/juspay/hyperswitch/pull/4746)) ([`d93f65f`](https://github.com/juspay/hyperswitch/commit/d93f65fd95a73b75d93290ac23ea4f73f22e6a7e))
+- **metrics:** Add support for gauge metrics and include IMC metrics ([#4939](https://github.com/juspay/hyperswitch/pull/4939)) ([`42cd769`](https://github.com/juspay/hyperswitch/commit/42cd769407f4a30e50d5b9826677a4dd310d97f4))
+
+### Bug Fixes
+
+- Add validation for connector authentication type during mca create and update operation ([#4932](https://github.com/juspay/hyperswitch/pull/4932)) ([`9f2476b`](https://github.com/juspay/hyperswitch/commit/9f2476b99a06e18f1a9a3f5d6d17f2659361616d))
+
+### Refactors
+
+- **conditional_configs:** Refactor conditional_configs to use Moka Cache instead of Static Cache ([#4814](https://github.com/juspay/hyperswitch/pull/4814)) ([`4d0c893`](https://github.com/juspay/hyperswitch/commit/4d0c89362a598dff87ec98b3e68d425cdfeef566))
+- **connector:**
+ - Changed amount to minor Unit for stripe ([#4786](https://github.com/juspay/hyperswitch/pull/4786)) ([`b705757`](https://github.com/juspay/hyperswitch/commit/b705757be37a9803b964ef94d04c664c0f1e102d))
+ - [Mifinity] Add dynamic fields for Mifinity Wallet ([#4943](https://github.com/juspay/hyperswitch/pull/4943)) ([`a949676`](https://github.com/juspay/hyperswitch/commit/a949676f8b9cdaac1975004e9984052cf5c3985e))
+- **cypress:** Fix payouts not running ([#4904](https://github.com/juspay/hyperswitch/pull/4904)) ([`bbcf034`](https://github.com/juspay/hyperswitch/commit/bbcf0340cac7b6ef854d6a99a370f948394cd09c))
+- Wrap the encryption and file storage interface client in appstate with `Arc` as opposed to `Box` ([#4949](https://github.com/juspay/hyperswitch/pull/4949)) ([`88cf904`](https://github.com/juspay/hyperswitch/commit/88cf904f5b01d890c25ff7fe22d25c634ec5a785))
+
+### Miscellaneous Tasks
+
+- **euclid_wasm:** Update apple pay metadata ([#4930](https://github.com/juspay/hyperswitch/pull/4930)) ([`7b293ff`](https://github.com/juspay/hyperswitch/commit/7b293ff785e2cdc323eae13c1342d9e65067402f))
+
+**Full Changelog:** [`2024.06.11.0...2024.06.12.0`](https://github.com/juspay/hyperswitch/compare/2024.06.11.0...2024.06.12.0)
+
+- - -
+
## 2024.06.11.0
### Features
|
chore
|
2024.06.12.0
|
7ddfbf51c3c3db99041e3d175a9100a60a339fe8
|
2024-07-31 21:11:39
|
Kashif
|
fix(payment_link): move redirection fn to global scope for open links (#5494)
| false
|
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 4d14af1577c..6269b3546af 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
@@ -68,15 +68,15 @@ function initializeSDK() {
setTimeout(() => {
document.body.removeChild(shimmer);
}, 500);
+}
- /**
- * Use - redirect to /payment_link/status
- */
- function redirectToStatus() {
- var arr = window.location.pathname.split("/");
- arr.splice(0, 2);
- arr.unshift("status");
- arr.unshift("payment_link");
- window.location.href = window.location.origin + "/" + arr.join("/");
- }
+/**
+ * Use - redirect to /payment_link/status
+ */
+function redirectToStatus() {
+ var arr = window.location.pathname.split("/");
+ arr.splice(0, 2);
+ arr.unshift("status");
+ arr.unshift("payment_link");
+ window.location.href = window.location.origin + "/" + arr.join("/");
}
|
fix
|
move redirection fn to global scope for open links (#5494)
|
833da1c3c5a0f006a689b05554c547205774c823
|
2025-03-12 10:25:57
|
Narayan Bhat
|
fix(payment_methods): payment method type not being stored in payment method (#7411)
| false
|
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index efc987ec3de..f9a6f9a9eb9 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -920,7 +920,7 @@ pub async fn create_payment_method_core(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to generate GlobalPaymentMethodId")?;
- let mut payment_method = create_payment_method_for_intent(
+ let payment_method = create_payment_method_for_intent(
state,
req.metadata.clone(),
&customer_id,
@@ -970,9 +970,6 @@ pub async fn create_payment_method_core(
let (response, payment_method) = match vaulting_result {
Ok((vaulting_resp, fingerprint_id)) => {
- payment_method.set_payment_method_type(req.payment_method_type);
- payment_method.set_payment_method_subtype(req.payment_method_subtype);
-
let pm_update = create_pm_additional_data_update(
Some(&payment_method_data),
state,
@@ -982,6 +979,8 @@ pub async fn create_payment_method_core(
&payment_method,
None,
network_tokenization_resp,
+ Some(req.payment_method_type),
+ Some(req.payment_method_subtype),
)
.await
.attach_printable("Unable to create Payment method data")?;
@@ -1552,6 +1551,8 @@ pub async fn create_pm_additional_data_update(
payment_method: &domain::PaymentMethod,
connector_token_details: Option<payment_methods::ConnectorTokenDetails>,
nt_data: Option<NetworkTokenPaymentMethodDetails>,
+ 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
.map(
@@ -1591,9 +1592,8 @@ pub async fn create_pm_additional_data_update(
let pm_update = storage::PaymentMethodUpdate::GenericUpdate {
status: Some(enums::PaymentMethodStatus::Active),
locker_id: vault_id,
- // Payment method type remains the same, only card details are updated
- payment_method_type_v2: None,
- payment_method_subtype: None,
+ payment_method_type_v2: payment_method_type,
+ payment_method_subtype,
payment_method_data: encrypted_payment_method_data,
network_token_requestor_reference_id: nt_data
.clone()
@@ -1903,6 +1903,8 @@ pub async fn update_payment_method_core(
&payment_method,
request.connector_token_details,
None,
+ None,
+ None,
)
.await
.attach_printable("Unable to create Payment method data")?;
|
fix
|
payment method type not being stored in payment method (#7411)
|
673b8691e092e145ba211050db4f5c7e021a0ce2
|
2024-10-24 17:54:59
|
Debarati Ghatak
|
feat(connector): [Novalnet] Integrate wallets Paypal and Googlepay (#6370)
| false
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 180aadffde3..ba6d3cb2b43 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -2260,12 +2260,35 @@ type="Text"
payment_method_type = "CartesBancaires"
[[novalnet.debit]]
payment_method_type = "UnionPay"
+[[novalnet.wallet]]
+ payment_method_type = "google_pay"
+[[novalnet.wallet]]
+ payment_method_type = "paypal"
[novalnet.connector_auth.SignatureKey]
api_key="Product Activation Key"
key1="Payment Access Key"
api_secret="Tariff ID"
[novalnet.connector_webhook_details]
merchant_secret="Source verification key"
+placeholder="Enter Payment Access Key"
+[[novalnet.metadata.google_pay]]
+name="merchant_name"
+label="Google Pay Merchant Name"
+placeholder="Enter Google Pay Merchant Name"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="merchant_id"
+label="Google Pay Merchant Id"
+placeholder="Enter Google Pay Merchant Id"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="gateway_merchant_id"
+label="Google Pay Merchant Key"
+placeholder="Enter Google Pay Merchant Key"
+required=true
+type="Text"
[nuvei]
[[nuvei.credit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index c7849fcc227..0e7ffe782f1 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1782,12 +1782,35 @@ merchant_secret="Source verification key"
payment_method_type = "CartesBancaires"
[[novalnet.debit]]
payment_method_type = "UnionPay"
+[[novalnet.wallet]]
+ payment_method_type = "google_pay"
+[[novalnet.wallet]]
+ payment_method_type = "paypal"
[novalnet.connector_auth.SignatureKey]
api_key="Product Activation Key"
key1="Payment Access Key"
api_secret="Tariff ID"
[novalnet.connector_webhook_details]
merchant_secret="Source verification key"
+placeholder="Enter Payment Access Key"
+[[novalnet.metadata.google_pay]]
+name="merchant_name"
+label="Google Pay Merchant Name"
+placeholder="Enter Google Pay Merchant Name"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="merchant_id"
+label="Google Pay Merchant Id"
+placeholder="Enter Google Pay Merchant Id"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="gateway_merchant_id"
+label="Google Pay Merchant Key"
+placeholder="Enter Google Pay Merchant Key"
+required=true
+type="Text"
[nuvei]
[[nuvei.credit]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 2a753008e81..8f8ec9bc1c1 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -2256,12 +2256,35 @@ type="Text"
payment_method_type = "CartesBancaires"
[[novalnet.debit]]
payment_method_type = "UnionPay"
+[[novalnet.wallet]]
+ payment_method_type = "google_pay"
+[[novalnet.wallet]]
+ payment_method_type = "paypal"
[novalnet.connector_auth.SignatureKey]
api_key="Product Activation Key"
key1="Payment Access Key"
api_secret="Tariff ID"
[novalnet.connector_webhook_details]
merchant_secret="Source verification key"
+placeholder="Enter Payment Access Key"
+[[novalnet.metadata.google_pay]]
+name="merchant_name"
+label="Google Pay Merchant Name"
+placeholder="Enter Google Pay Merchant Name"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="merchant_id"
+label="Google Pay Merchant Id"
+placeholder="Enter Google Pay Merchant Id"
+required=true
+type="Text"
+[[novalnet.metadata.google_pay]]
+name="gateway_merchant_id"
+label="Google Pay Merchant Key"
+placeholder="Enter Google Pay Merchant Key"
+required=true
+type="Text"
[nuvei]
[[nuvei.credit]]
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index 36fe04fdab1..acb3013dbaa 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -195,8 +195,11 @@ impl ConnectorValidation for Novalnet {
pm_type: Option<enums::PaymentMethodType>,
pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
- let mandate_supported_pmd: HashSet<PaymentMethodDataType> =
- HashSet::from([PaymentMethodDataType::Card]);
+ let mandate_supported_pmd: HashSet<PaymentMethodDataType> = HashSet::from([
+ PaymentMethodDataType::Card,
+ PaymentMethodDataType::GooglePay,
+ PaymentMethodDataType::PaypalRedirect,
+ ]);
utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 3c635f88cd4..ab209a4db05 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -12,7 +12,7 @@ use common_utils::{
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
+ payment_method_data::{PaymentMethodData, WalletData as WalletDataPaymentMethod},
router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::{PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, ResponseId},
@@ -55,6 +55,8 @@ impl<T> From<(StringMinorUnit, T)> for NovalnetRouterData<T> {
#[derive(Debug, Copy, Serialize, Deserialize, Clone)]
pub enum NovalNetPaymentTypes {
CREDITCARD,
+ PAYPAL,
+ GOOGLEPAY,
}
#[derive(Default, Debug, Serialize, Clone)]
@@ -96,10 +98,16 @@ pub struct NovalnetMandate {
token: Secret<String>,
}
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct NovalnetGooglePay {
+ wallet_data: Secret<String>,
+}
+
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(untagged)]
pub enum NovalNetPaymentData {
- PaymentCard(NovalnetCard),
+ Card(NovalnetCard),
+ GooglePay(NovalnetGooglePay),
MandatePayment(NovalnetMandate),
}
@@ -115,7 +123,7 @@ pub struct NovalnetPaymentsRequestTransaction {
amount: StringMinorUnit,
currency: common_enums::Currency,
order_no: String,
- payment_data: NovalNetPaymentData,
+ payment_data: Option<NovalNetPaymentData>,
hook_url: Option<String>,
return_url: Option<String>,
error_return_url: Option<String>,
@@ -131,6 +139,50 @@ pub struct NovalnetPaymentsRequest {
custom: NovalnetCustom,
}
+impl TryFrom<&api_enums::PaymentMethodType> for NovalNetPaymentTypes {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &api_enums::PaymentMethodType) -> Result<Self, Self::Error> {
+ match item {
+ api_enums::PaymentMethodType::Credit => Ok(Self::CREDITCARD),
+ api_enums::PaymentMethodType::Debit
+ | api_enums::PaymentMethodType::Klarna
+ | api_enums::PaymentMethodType::BancontactCard
+ | api_enums::PaymentMethodType::Blik
+ | api_enums::PaymentMethodType::Eps
+ | api_enums::PaymentMethodType::Giropay
+ | api_enums::PaymentMethodType::Ideal
+ | api_enums::PaymentMethodType::OnlineBankingCzechRepublic
+ | api_enums::PaymentMethodType::OnlineBankingFinland
+ | api_enums::PaymentMethodType::OnlineBankingPoland
+ | api_enums::PaymentMethodType::OnlineBankingSlovakia
+ | api_enums::PaymentMethodType::Sofort
+ | api_enums::PaymentMethodType::Trustly => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Novalnet"),
+ ))?
+ }
+ api_enums::PaymentMethodType::GooglePay => Ok(Self::GOOGLEPAY),
+ api_enums::PaymentMethodType::AliPay
+ | api_enums::PaymentMethodType::ApplePay
+ | api_enums::PaymentMethodType::AliPayHk
+ | api_enums::PaymentMethodType::MbWay
+ | api_enums::PaymentMethodType::MobilePay
+ | api_enums::PaymentMethodType::WeChatPay
+ | api_enums::PaymentMethodType::SamsungPay
+ | api_enums::PaymentMethodType::Affirm
+ | api_enums::PaymentMethodType::AfterpayClearpay
+ | api_enums::PaymentMethodType::PayBright
+ | api_enums::PaymentMethodType::Walley => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Novalnet"),
+ ))?,
+ api_enums::PaymentMethodType::Paypal => Ok(Self::PAYPAL),
+ _ => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Novalnet"),
+ ))?,
+ }
+ }
+}
+
impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -182,6 +234,12 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
.unwrap_or(consts::DEFAULT_LOCALE.to_string().to_string());
let custom = NovalnetCustom { lang };
let hook_url = item.router_data.request.get_webhook_url()?;
+ let return_url = item.router_data.request.get_return_url()?;
+ let create_token = if item.router_data.request.is_mandate_payment() {
+ Some(1)
+ } else {
+ None
+ };
match item
.router_data
@@ -192,19 +250,13 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
{
None => match item.router_data.request.payment_method_data {
PaymentMethodData::Card(ref req_card) => {
- let novalnet_card = NovalNetPaymentData::PaymentCard(NovalnetCard {
+ let novalnet_card = NovalNetPaymentData::Card(NovalnetCard {
card_number: req_card.card_number.clone(),
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: item.router_data.get_billing_full_name()?,
});
- let create_token = if item.router_data.request.is_mandate_payment() {
- Some(1)
- } else {
- None
- };
- let return_url = item.router_data.request.get_return_url()?;
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
@@ -215,7 +267,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
hook_url: Some(hook_url),
return_url: Some(return_url.clone()),
error_return_url: Some(return_url.clone()),
- payment_data: novalnet_card,
+ payment_data: Some(novalnet_card),
enforce_3d,
create_token,
};
@@ -227,6 +279,95 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
custom,
})
}
+
+ PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
+ WalletDataPaymentMethod::GooglePay(ref req_wallet) => {
+ let novalnet_google_pay: NovalNetPaymentData =
+ NovalNetPaymentData::GooglePay(NovalnetGooglePay {
+ wallet_data: Secret::new(
+ req_wallet.tokenization_data.token.clone(),
+ ),
+ });
+
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::GOOGLEPAY,
+ amount: item.amount.clone(),
+ currency: item.router_data.request.currency,
+ order_no: item.router_data.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: None,
+ error_return_url: None,
+ payment_data: Some(novalnet_google_pay),
+ enforce_3d: None,
+ create_token,
+ };
+
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+ WalletDataPaymentMethod::ApplePay(_)
+ | WalletDataPaymentMethod::AliPayQr(_)
+ | WalletDataPaymentMethod::AliPayRedirect(_)
+ | WalletDataPaymentMethod::AliPayHkRedirect(_)
+ | WalletDataPaymentMethod::MomoRedirect(_)
+ | WalletDataPaymentMethod::KakaoPayRedirect(_)
+ | WalletDataPaymentMethod::GoPayRedirect(_)
+ | WalletDataPaymentMethod::GcashRedirect(_)
+ | WalletDataPaymentMethod::ApplePayRedirect(_)
+ | WalletDataPaymentMethod::ApplePayThirdPartySdk(_)
+ | WalletDataPaymentMethod::DanaRedirect {}
+ | WalletDataPaymentMethod::GooglePayRedirect(_)
+ | WalletDataPaymentMethod::GooglePayThirdPartySdk(_)
+ | WalletDataPaymentMethod::MbWayRedirect(_)
+ | WalletDataPaymentMethod::MobilePayRedirect(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("novalnet"),
+ )
+ .into())
+ }
+ WalletDataPaymentMethod::PaypalRedirect(_) => {
+ let transaction = NovalnetPaymentsRequestTransaction {
+ test_mode,
+ payment_type: NovalNetPaymentTypes::PAYPAL,
+ amount: item.amount.clone(),
+ currency: item.router_data.request.currency,
+ order_no: item.router_data.connector_request_reference_id.clone(),
+ hook_url: Some(hook_url),
+ return_url: Some(return_url.clone()),
+ error_return_url: Some(return_url.clone()),
+ payment_data: None,
+ enforce_3d: None,
+ create_token,
+ };
+ Ok(Self {
+ merchant,
+ transaction,
+ customer,
+ custom,
+ })
+ }
+ WalletDataPaymentMethod::PaypalSdk(_)
+ | WalletDataPaymentMethod::Paze(_)
+ | WalletDataPaymentMethod::SamsungPay(_)
+ | WalletDataPaymentMethod::TwintRedirect {}
+ | WalletDataPaymentMethod::VippsRedirect {}
+ | WalletDataPaymentMethod::TouchNGoRedirect(_)
+ | WalletDataPaymentMethod::WeChatPayRedirect(_)
+ | WalletDataPaymentMethod::CashappQr(_)
+ | WalletDataPaymentMethod::SwishQr(_)
+ | WalletDataPaymentMethod::WeChatPayQr(_)
+ | WalletDataPaymentMethod::Mifinity(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("novalnet"),
+ )
+ .into())
+ }
+ },
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("novalnet"),
)
@@ -243,16 +384,21 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
token: Secret::new(connector_mandate_id),
});
+ let payment_type = match item.router_data.request.payment_method_type {
+ Some(pm_type) => NovalNetPaymentTypes::try_from(&pm_type)?,
+ None => NovalNetPaymentTypes::CREDITCARD,
+ };
+
let transaction = NovalnetPaymentsRequestTransaction {
test_mode,
- payment_type: NovalNetPaymentTypes::CREDITCARD,
+ payment_type,
amount: item.amount.clone(),
currency: item.router_data.request.currency,
order_no: item.router_data.connector_request_reference_id.clone(),
hook_url: Some(hook_url),
return_url: None,
error_return_url: None,
- payment_data: novalnet_mandate_data,
+ payment_data: Some(novalnet_mandate_data),
enforce_3d,
create_token: None,
};
@@ -378,6 +524,24 @@ pub fn get_error_response(result: ResultData, status_code: u16) -> ErrorResponse
}
}
+impl NovalnetPaymentsResponseTransactionData {
+ pub fn get_token(transaction_data: Option<&Self>) -> Option<String> {
+ if let Some(data) = transaction_data {
+ match &data.payment_data {
+ Some(NovalnetResponsePaymentData::Card(card_data)) => {
+ card_data.token.clone().map(|token| token.expose())
+ }
+ Some(NovalnetResponsePaymentData::Paypal(paypal_data)) => {
+ paypal_data.token.clone().map(|token| token.expose())
+ }
+ None => None,
+ }
+ } else {
+ None
+ }
+ }
+}
+
impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
@@ -402,12 +566,20 @@ impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsRe
.transaction
.clone()
.and_then(|data| data.tid.map(|tid| tid.expose().to_string()));
+
+ let mandate_reference_id = NovalnetPaymentsResponseTransactionData::get_token(
+ item.response.transaction.clone().as_ref(),
+ );
+
let transaction_status = item
.response
.transaction
+ .as_ref()
.and_then(|transaction_data| transaction_data.status)
.unwrap_or(if redirection_data.is_some() {
NovalnetTransactionStatus::Progress
+ } else if mandate_reference_id.is_some() {
+ NovalnetTransactionStatus::OnHold
} else {
NovalnetTransactionStatus::Pending
});
@@ -423,7 +595,13 @@ impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsRe
.map(ResponseId::ConnectorTransactionId)
.unwrap_or(ResponseId::NoResponseId),
redirection_data,
- mandate_reference: None,
+ mandate_reference: mandate_reference_id.as_ref().map(|id| {
+ MandateReference {
+ connector_mandate_id: Some(id.clone()),
+ payment_method_id: None,
+ mandate_metadata: None,
+ }
+ }),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: transaction_id.clone(),
@@ -502,7 +680,8 @@ pub struct NovalnetSyncResponseTransactionData {
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(untagged)]
pub enum NovalnetResponsePaymentData {
- PaymentCard(NovalnetResponseCard),
+ Card(NovalnetResponseCard),
+ Paypal(NovalnetResponsePaypal),
}
#[derive(Serialize, Deserialize, Clone, Debug)]
@@ -514,7 +693,14 @@ pub struct NovalnetResponseCard {
pub card_number: Secret<String>,
pub cc_3d: Option<Secret<u8>>,
pub last_four: Option<Secret<String>>,
- pub token: Option<String>,
+ pub token: Option<Secret<String>>,
+}
+
+#[derive(Serialize, Deserialize, Clone, Debug)]
+pub struct NovalnetResponsePaypal {
+ pub paypal_account: Option<Email>,
+ pub paypal_transaction_id: Option<Secret<String>>,
+ pub token: Option<Secret<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -760,11 +946,15 @@ impl TryFrom<&PaymentsSyncRouterData> for NovalnetSyncRequest {
impl NovalnetSyncResponseTransactionData {
pub fn get_token(transaction_data: Option<&Self>) -> Option<String> {
- if let Some(payment_data) =
- transaction_data.and_then(|transaction_data| transaction_data.payment_data.clone())
- {
- match &payment_data {
- NovalnetResponsePaymentData::PaymentCard(card_data) => card_data.token.clone(),
+ if let Some(data) = transaction_data {
+ match &data.payment_data {
+ Some(NovalnetResponsePaymentData::Card(card_data)) => {
+ card_data.token.clone().map(|token| token.expose())
+ }
+ Some(NovalnetResponsePaymentData::Paypal(paypal_data)) => {
+ paypal_data.token.clone().map(|token| token.expose())
+ }
+ None => None,
}
} else {
None
|
feat
|
[Novalnet] Integrate wallets Paypal and Googlepay (#6370)
|
901b88ab8065459cf9f9d8b2ac27f378449afc4a
|
2024-06-04 18:13:56
|
Pa1NarK
|
fix(cypress): fix `redirectionHandler` from failing to compile (#4846)
| false
|
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
index 9436f334068..d3228396fc7 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
@@ -8,7 +8,22 @@ const globalState = new State({
connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),
});
-const connectorId = globalState.get("connectorId");
+const connectorName = normalise(globalState.get("connectorId"));
+
+function normalise(input) {
+ const exceptions = {
+ bankofamerica: "Bank of America",
+ cybersource: "Cybersource",
+ paypal: "Paypal",
+ // Add more known exceptions here
+ };
+
+ if (exceptions[input.toLowerCase()]) {
+ return exceptions[input.toLowerCase()];
+ } else {
+ return input;
+ }
+}
const successfulNo3DSCardDetails = {
card_number: "4111111111111111",
@@ -42,7 +57,7 @@ const getDefaultExchange = () => ({
body: {
error: {
type: "invalid_request",
- message: `Selected payment method through ${connectorId} is not implemented`,
+ message: `Selected payment method through ${connectorName} is not implemented`,
code: "IR_00",
},
},
diff --git a/cypress-tests/cypress/support/redirectionhandler.js b/cypress-tests/cypress/support/redirectionHandler.js
similarity index 100%
rename from cypress-tests/cypress/support/redirectionhandler.js
rename to cypress-tests/cypress/support/redirectionHandler.js
diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json
index 91a7cc32f35..10bda21a9bb 100644
--- a/cypress-tests/package-lock.json
+++ b/cypress-tests/package-lock.json
@@ -9,7 +9,8 @@
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
- "cypress": "^13.7.3"
+ "cypress": "^13.10.0",
+ "jsqr": "^1.4.0"
}
},
"node_modules/@colors/colors": {
@@ -17,6 +18,7 @@
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
"dev": true,
+ "license": "MIT",
"optional": true,
"engines": {
"node": ">=0.1.90"
@@ -27,6 +29,7 @@
"resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz",
"integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
@@ -56,6 +59,7 @@
"resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz",
"integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"debug": "^3.1.0",
"lodash.once": "^4.1.1"
@@ -66,15 +70,17 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/@types/node": {
- "version": "20.12.7",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz",
- "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",
+ "version": "20.14.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.1.tgz",
+ "integrity": "sha512-T2MzSGEu+ysB/FkWfqmhV3PLyQlowdptmmgD20C6QxsS8Fmv5SjpZ1ayXaEC0S21/h5UJ9iA6W/5vSNU5l00OA==",
"dev": true,
+ "license": "MIT",
"optional": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -84,19 +90,22 @@
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz",
"integrity": "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/@types/sizzle": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz",
"integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/@types/yauzl": {
"version": "2.10.3",
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",
"integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==",
"dev": true,
+ "license": "MIT",
"optional": true,
"dependencies": {
"@types/node": "*"
@@ -107,6 +116,7 @@
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
"integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"clean-stack": "^2.0.0",
"indent-string": "^4.0.0"
@@ -120,6 +130,7 @@
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -129,6 +140,7 @@
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
"integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"type-fest": "^0.21.3"
},
@@ -144,6 +156,7 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -153,6 +166,7 @@
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
},
@@ -181,13 +195,15 @@
"type": "consulting",
"url": "https://feross.org/support"
}
- ]
+ ],
+ "license": "MIT"
},
"node_modules/asn1": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"safer-buffer": "~2.1.0"
}
@@ -197,6 +213,7 @@
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=0.8"
}
@@ -206,6 +223,7 @@
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -214,19 +232,22 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz",
"integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/at-least-node": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
"dev": true,
+ "license": "ISC",
"engines": {
"node": ">= 4.0.0"
}
@@ -236,15 +257,17 @@
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
"node": "*"
}
},
"node_modules/aws4": {
- "version": "1.12.0",
- "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
- "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==",
- "dev": true
+ "version": "1.13.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.0.tgz",
+ "integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==",
+ "dev": true,
+ "license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
@@ -264,13 +287,15 @@
"type": "consulting",
"url": "https://feross.org/support"
}
- ]
+ ],
+ "license": "MIT"
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
"tweetnacl": "^0.14.3"
}
@@ -279,13 +304,15 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz",
"integrity": "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==",
- "dev": true
+ "dev": true,
+ "license": "Apache-2.0"
},
"node_modules/bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/buffer": {
"version": "5.7.1",
@@ -306,6 +333,7 @@
"url": "https://feross.org/support"
}
],
+ "license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.1.13"
@@ -316,6 +344,7 @@
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": "*"
}
@@ -325,6 +354,7 @@
"resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz",
"integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -334,6 +364,7 @@
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
@@ -352,13 +383,15 @@
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
- "dev": true
+ "dev": true,
+ "license": "Apache-2.0"
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
@@ -375,6 +408,7 @@
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
@@ -387,6 +421,7 @@
"resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz",
"integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.8.0"
}
@@ -402,6 +437,7 @@
"url": "https://github.com/sponsors/sibiraj-s"
}
],
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -411,6 +447,7 @@
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
"integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -420,6 +457,7 @@
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"restore-cursor": "^3.1.0"
},
@@ -428,10 +466,11 @@
}
},
"node_modules/cli-table3": {
- "version": "0.6.4",
- "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz",
- "integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==",
+ "version": "0.6.5",
+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
+ "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"string-width": "^4.2.0"
},
@@ -447,6 +486,7 @@
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz",
"integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"slice-ansi": "^3.0.0",
"string-width": "^4.2.0"
@@ -463,6 +503,7 @@
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
},
@@ -474,19 +515,22 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/colorette": {
"version": "2.0.20",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
@@ -499,6 +543,7 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 6"
}
@@ -508,6 +553,7 @@
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz",
"integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=4.0.0"
}
@@ -516,13 +562,15 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
@@ -533,11 +581,12 @@
}
},
"node_modules/cypress": {
- "version": "13.7.3",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.3.tgz",
- "integrity": "sha512-uoecY6FTCAuIEqLUYkTrxamDBjMHTYak/1O7jtgwboHiTnS1NaMOoR08KcTrbRZFCBvYOiS4tEkQRmsV+xcrag==",
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.10.0.tgz",
+ "integrity": "sha512-tOhwRlurVOQbMduX+KonoMeQILs2cwR3yHGGENoFvvSoLUBHmJ8b9/n21gFSDqjlOJ+SRVcwuh+fG/JDsHsT6Q==",
"dev": true,
"hasInstallScript": true,
+ "license": "MIT",
"dependencies": {
"@cypress/request": "^3.0.0",
"@cypress/xvfb": "^1.2.4",
@@ -594,6 +643,7 @@
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0"
},
@@ -602,16 +652,18 @@
}
},
"node_modules/dayjs": {
- "version": "1.11.10",
- "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
- "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==",
- "dev": true
+ "version": "1.11.11",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz",
+ "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==",
+ "dev": true,
+ "license": "MIT"
},
"node_modules/debug": {
- "version": "4.3.4",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
- "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "version": "4.3.5",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
+ "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ms": "2.1.2"
},
@@ -629,6 +681,7 @@
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
@@ -646,6 +699,7 @@
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=0.4.0"
}
@@ -655,6 +709,7 @@
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
@@ -664,13 +719,15 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"once": "^1.4.0"
}
@@ -680,6 +737,7 @@
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz",
"integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-colors": "^4.1.1",
"strip-ansi": "^6.0.1"
@@ -693,6 +751,7 @@
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"get-intrinsic": "^1.2.4"
},
@@ -705,6 +764,7 @@
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
}
@@ -714,6 +774,7 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=0.8.0"
}
@@ -722,13 +783,15 @@
"version": "6.4.7",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
"integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/execa": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
"integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.0",
"get-stream": "^5.0.0",
@@ -752,6 +815,7 @@
"resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz",
"integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"pify": "^2.2.0"
},
@@ -763,13 +827,15 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/extract-zip": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
"debug": "^4.1.1",
"get-stream": "^5.1.0",
@@ -792,13 +858,15 @@
"dev": true,
"engines": [
"node >=0.6.0"
- ]
+ ],
+ "license": "MIT"
},
"node_modules/fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"pend": "~1.2.0"
}
@@ -808,6 +876,7 @@
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
"integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"escape-string-regexp": "^1.0.5"
},
@@ -823,6 +892,7 @@
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
"node": "*"
}
@@ -832,6 +902,7 @@
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
@@ -846,6 +917,7 @@
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0",
@@ -861,6 +933,7 @@
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
+ "license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -870,6 +943,7 @@
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
@@ -889,6 +963,7 @@
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"pump": "^3.0.0"
},
@@ -904,6 +979,7 @@
"resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz",
"integrity": "sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"async": "^3.2.0"
}
@@ -913,6 +989,7 @@
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0"
}
@@ -922,6 +999,7 @@
"resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz",
"integrity": "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ini": "2.0.0"
},
@@ -937,6 +1015,7 @@
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"get-intrinsic": "^1.1.3"
},
@@ -948,13 +1027,15 @@
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
- "dev": true
+ "dev": true,
+ "license": "ISC"
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -964,6 +1045,7 @@
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0"
},
@@ -976,6 +1058,7 @@
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
},
@@ -988,6 +1071,7 @@
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
},
@@ -1000,6 +1084,7 @@
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
@@ -1012,6 +1097,7 @@
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz",
"integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0",
"jsprim": "^2.0.2",
@@ -1026,6 +1112,7 @@
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
}
@@ -1048,13 +1135,15 @@
"type": "consulting",
"url": "https://feross.org/support"
}
- ]
+ ],
+ "license": "BSD-3-Clause"
},
"node_modules/indent-string": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1064,6 +1153,7 @@
"resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz",
"integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==",
"dev": true,
+ "license": "ISC",
"engines": {
"node": ">=10"
}
@@ -1073,6 +1163,7 @@
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz",
"integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ci-info": "^3.2.0"
},
@@ -1085,6 +1176,7 @@
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1094,6 +1186,7 @@
"resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz",
"integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"global-dirs": "^3.0.0",
"is-path-inside": "^3.0.2"
@@ -1110,6 +1203,7 @@
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1119,6 +1213,7 @@
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
},
@@ -1130,13 +1225,15 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/is-unicode-supported": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=10"
},
@@ -1148,37 +1245,43 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
- "dev": true
+ "dev": true,
+ "license": "ISC"
},
"node_modules/isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
- "dev": true
+ "dev": true,
+ "license": "(AFL-2.1 OR BSD-3-Clause)"
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
- "dev": true
+ "dev": true,
+ "license": "ISC"
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"universalify": "^2.0.0"
},
@@ -1194,6 +1297,7 @@
"engines": [
"node >=0.6.0"
],
+ "license": "MIT",
"dependencies": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
@@ -1201,11 +1305,19 @@
"verror": "1.10.0"
}
},
+ "node_modules/jsqr": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/jsqr/-/jsqr-1.4.0.tgz",
+ "integrity": "sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
"node_modules/lazy-ass": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz",
"integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": "> 0.8"
}
@@ -1215,6 +1327,7 @@
"resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz",
"integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"cli-truncate": "^2.1.0",
"colorette": "^2.0.16",
@@ -1241,19 +1354,22 @@
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/lodash.once": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/log-symbols": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"chalk": "^4.1.0",
"is-unicode-supported": "^0.1.0"
@@ -1270,6 +1386,7 @@
"resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz",
"integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-escapes": "^4.3.0",
"cli-cursor": "^3.1.0",
@@ -1288,6 +1405,7 @@
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
"integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
@@ -1305,6 +1423,7 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@@ -1314,29 +1433,19 @@
"node": ">=8"
}
},
- "node_modules/lru-cache": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
- "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
- "dev": true,
- "dependencies": {
- "yallist": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
@@ -1346,6 +1455,7 @@
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
@@ -1358,6 +1468,7 @@
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -1367,6 +1478,7 @@
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
+ "license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -1375,13 +1487,15 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"path-key": "^3.0.0"
},
@@ -1394,6 +1508,7 @@
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
"dev": true,
+ "license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -1403,6 +1518,7 @@
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
+ "license": "ISC",
"dependencies": {
"wrappy": "1"
}
@@ -1412,6 +1528,7 @@
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"mimic-fn": "^2.1.0"
},
@@ -1426,13 +1543,15 @@
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz",
"integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/p-map": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
"integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"aggregate-error": "^3.0.0"
},
@@ -1448,6 +1567,7 @@
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1456,19 +1576,22 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=0.10.0"
}
@@ -1478,6 +1601,7 @@
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
"integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
},
@@ -1490,6 +1614,7 @@
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 0.6.0"
}
@@ -1498,19 +1623,22 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
"integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/psl": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
@@ -1521,6 +1649,7 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -1530,6 +1659,7 @@
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz",
"integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.0.4"
},
@@ -1544,13 +1674,15 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/request-progress": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz",
"integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"throttleit": "^1.0.0"
}
@@ -1559,13 +1691,15 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/restore-cursor": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"onetime": "^5.1.0",
"signal-exit": "^3.0.2"
@@ -1578,13 +1712,15 @@
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz",
"integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
"tslib": "^2.1.0"
}
@@ -1607,22 +1743,22 @@
"type": "consulting",
"url": "https://feross.org/support"
}
- ]
+ ],
+ "license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/semver": {
- "version": "7.6.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
- "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
+ "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
"dev": true,
- "dependencies": {
- "lru-cache": "^6.0.0"
- },
+ "license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
@@ -1635,6 +1771,7 @@
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
@@ -1652,6 +1789,7 @@
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
@@ -1664,6 +1802,7 @@
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1673,6 +1812,7 @@
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
"integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"call-bind": "^1.0.7",
"es-errors": "^1.3.0",
@@ -1690,13 +1830,15 @@
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
- "dev": true
+ "dev": true,
+ "license": "ISC"
},
"node_modules/slice-ansi": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz",
"integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
@@ -1711,6 +1853,7 @@
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
"integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
@@ -1736,6 +1879,7 @@
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
@@ -1750,6 +1894,7 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
@@ -1762,6 +1907,7 @@
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -1771,6 +1917,7 @@
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
@@ -1786,6 +1933,7 @@
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.1.tgz",
"integrity": "sha512-vDZpf9Chs9mAdfY046mcPt8fg5QSZr37hEH4TXYBnDF+izxgrbRGUAAaBvIk/fJm9aOFCGFd1EsNg5AZCbnQCQ==",
"dev": true,
+ "license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
@@ -1794,22 +1942,25 @@
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/tmp": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz",
"integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=14.14"
}
},
"node_modules/tough-cookie": {
- "version": "4.1.3",
- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
- "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
+ "version": "4.1.4",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz",
+ "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
"psl": "^1.1.33",
"punycode": "^2.1.1",
@@ -1825,6 +1976,7 @@
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 4.0.0"
}
@@ -1833,13 +1985,15 @@
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
- "dev": true
+ "dev": true,
+ "license": "0BSD"
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
"safe-buffer": "^5.0.1"
},
@@ -1851,13 +2005,15 @@
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
- "dev": true
+ "dev": true,
+ "license": "Unlicense"
},
"node_modules/type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
"dev": true,
+ "license": "(MIT OR CC0-1.0)",
"engines": {
"node": ">=10"
},
@@ -1870,6 +2026,7 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true,
+ "license": "MIT",
"optional": true
},
"node_modules/universalify": {
@@ -1877,6 +2034,7 @@
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">= 10.0.0"
}
@@ -1886,6 +2044,7 @@
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=8"
}
@@ -1895,6 +2054,7 @@
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
@@ -1905,6 +2065,7 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"dev": true,
+ "license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
@@ -1917,6 +2078,7 @@
"engines": [
"node >=0.6.0"
],
+ "license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
@@ -1928,6 +2090,7 @@
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
+ "license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
@@ -1943,6 +2106,7 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@@ -1959,19 +2123,15 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
- "dev": true
- },
- "node_modules/yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
+ "dev": true,
+ "license": "ISC"
},
"node_modules/yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"buffer-crc32": "~0.2.3",
"fd-slicer": "~1.1.0"
diff --git a/cypress-tests/package.json b/cypress-tests/package.json
index b6602ece459..4bb7e415343 100644
--- a/cypress-tests/package.json
+++ b/cypress-tests/package.json
@@ -12,7 +12,8 @@
},
"author": "",
"license": "ISC",
- "dependencies": {
+ "devDependencies": {
+ "cypress": "^13.10.0",
"jsqr": "^1.4.0"
}
}
|
fix
|
fix `redirectionHandler` from failing to compile (#4846)
|
b1b0500035d75fbcc2e741e02f6afa68724ce970
|
2023-01-20 18:25:52
|
Narayan Bhat
|
feat(globalpay): implement access token creation (#408)
| false
|
diff --git a/crates/common_utils/src/crypto.rs b/crates/common_utils/src/crypto.rs
index 493e2b73c7c..da21a317c59 100644
--- a/crates/common_utils/src/crypto.rs
+++ b/crates/common_utils/src/crypto.rs
@@ -215,6 +215,23 @@ impl DecodeMessage for GcmAes256 {
}
}
+/// Secure Hash Algorithm 512
+#[derive(Debug)]
+pub struct Sha512;
+
+/// Trait for generating a digest for SHA
+pub trait GenerateDigest {
+ /// takes a message and creates a digest for it
+ fn generate_digest(&self, message: &[u8]) -> CustomResult<Vec<u8>, errors::CryptoError>;
+}
+
+impl GenerateDigest for Sha512 {
+ fn generate_digest(&self, message: &[u8]) -> CustomResult<Vec<u8>, errors::CryptoError> {
+ let digest = ring::digest::digest(&ring::digest::SHA512, message);
+ Ok(digest.as_ref().to_vec())
+ }
+}
+
#[cfg(test)]
mod crypto_tests {
#![allow(clippy::expect_used)]
diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rs
index 9e132d5695b..6d2b2be63a5 100644
--- a/crates/router/src/connector/globalpay.rs
+++ b/crates/router/src/connector/globalpay.rs
@@ -7,8 +7,11 @@ use std::fmt::Debug;
use error_stack::{IntoReport, ResultExt};
use self::{
- requests::GlobalpayPaymentsRequest, response::GlobalpayPaymentsResponse,
- transformers as globalpay,
+ requests::{GlobalpayPaymentsRequest, GlobalpayRefreshTokenRequest},
+ response::{
+ GlobalpayPaymentsResponse, GlobalpayRefreshTokenErrorResponse,
+ GlobalpayRefreshTokenResponse,
+ },
};
use crate::{
configs::settings,
@@ -38,16 +41,22 @@ where
req: &types::RouterData<Flow, Request, Response>,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
- let mut headers = vec![
+ let access_token = req
+ .access_token
+ .clone()
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ Ok(vec![
(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string(),
),
("X-GP-Version".to_string(), "2021-03-22".to_string()),
- ];
- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- headers.append(&mut api_key);
- Ok(headers)
+ (
+ headers::AUTHORIZATION.to_string(),
+ format!("Bearer {}", access_token.token),
+ ),
+ ])
}
}
@@ -66,19 +75,16 @@ impl ConnectorCommon for Globalpay {
fn get_auth_header(
&self,
- auth_type: &types::ConnectorAuthType,
+ _auth_type: &types::ConnectorAuthType,
) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
- let auth: globalpay::GlobalpayAuthType = auth_type
- .try_into()
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])
+ Ok(vec![])
}
fn build_error_response(
&self,
res: types::Response,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: globalpay::GlobalpayErrorResponse = res
+ let response: transformers::GlobalpayErrorResponse = res
.response
.parse_struct("Globalpay ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -97,6 +103,94 @@ impl api::ConnectorAccessToken for Globalpay {}
impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
for Globalpay
{
+ fn get_headers(
+ &self,
+ _req: &types::RefreshTokenRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ Ok(vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ types::RefreshTokenType::get_content_type(self).to_string(),
+ ),
+ ("X-GP-Version".to_string(), "2021-03-22".to_string()),
+ ])
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::RefreshTokenRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}{}", self.base_url(connectors), "accesstoken"))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::RefreshTokenRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::RefreshTokenType::get_url(self, req, connectors)?)
+ .headers(types::RefreshTokenType::get_headers(self, req, connectors)?)
+ .body(types::RefreshTokenType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefreshTokenRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let req_obj = GlobalpayRefreshTokenRequest::try_from(req)?;
+ let globalpay_req =
+ utils::Encode::<GlobalpayPaymentsRequest>::encode_to_string_of_json(&req_obj)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(globalpay_req))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefreshTokenRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::RefreshTokenRouterData, errors::ConnectorError> {
+ logger::debug!(globalpaypayments_raw_refresh_token_response=?res);
+ let response: GlobalpayRefreshTokenResponse = res
+ .response
+ .parse_struct("Globalpay PaymentsResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ }
+ .try_into()
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: GlobalpayRefreshTokenErrorResponse = res
+ .response
+ .parse_struct("Globalpay ErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.error_code,
+ message: response.detailed_error_description,
+ reason: None,
+ })
+ }
}
impl api::Payment for Globalpay {}
diff --git a/crates/router/src/connector/globalpay/requests.rs b/crates/router/src/connector/globalpay/requests.rs
index 3ccd8ff7661..dd4c2f3c3d1 100644
--- a/crates/router/src/connector/globalpay/requests.rs
+++ b/crates/router/src/connector/globalpay/requests.rs
@@ -72,6 +72,14 @@ pub struct GlobalpayPaymentsRequest {
pub user_reference: Option<String>,
}
+#[derive(Debug, Serialize)]
+pub struct GlobalpayRefreshTokenRequest {
+ pub app_id: String,
+ pub nonce: String,
+ pub secret: String,
+ pub grant_type: String,
+}
+
#[derive(Debug, Serialize, Deserialize)]
pub struct CurrencyConversion {
/// A unique identifier generated by Global Payments to identify the currency conversion. It
diff --git a/crates/router/src/connector/globalpay/response.rs b/crates/router/src/connector/globalpay/response.rs
index 32064add8a0..495a7e6be56 100644
--- a/crates/router/src/connector/globalpay/response.rs
+++ b/crates/router/src/connector/globalpay/response.rs
@@ -68,6 +68,18 @@ pub struct Action {
pub action_type: Option<String>,
}
+#[derive(Debug, Deserialize)]
+pub struct GlobalpayRefreshTokenResponse {
+ pub token: String,
+ pub seconds_to_expire: i64,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct GlobalpayRefreshTokenErrorResponse {
+ pub error_code: String,
+ pub detailed_error_description: String,
+}
+
/// Information relating to a currency conversion.
#[derive(Debug, Serialize, Deserialize)]
pub struct CurrencyConversion {
diff --git a/crates/router/src/connector/globalpay/transformers.rs b/crates/router/src/connector/globalpay/transformers.rs
index abc3a79957b..467ab5eb445 100644
--- a/crates/router/src/connector/globalpay/transformers.rs
+++ b/crates/router/src/connector/globalpay/transformers.rs
@@ -1,8 +1,11 @@
+use common_utils::crypto::{self, GenerateDigest};
+use error_stack::ResultExt;
+use rand::distributions::DistString;
use serde::{Deserialize, Serialize};
use super::{
- requests::{self, GlobalpayPaymentsRequest},
- response::{GlobalpayPaymentStatus, GlobalpayPaymentsResponse},
+ requests::{self, GlobalpayPaymentsRequest, GlobalpayRefreshTokenRequest},
+ response::{GlobalpayPaymentStatus, GlobalpayPaymentsResponse, GlobalpayRefreshTokenResponse},
};
use crate::{
connector::utils::{self, CardData, PaymentsRequestData},
@@ -69,21 +72,60 @@ impl TryFrom<&types::PaymentsCancelRouterData> for GlobalpayPaymentsRequest {
}
pub struct GlobalpayAuthType {
- pub api_key: String,
+ pub app_id: String,
+ pub key: String,
}
impl TryFrom<&types::ConnectorAuthType> for GlobalpayAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_string(),
+ types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ app_id: key1.to_string(),
+ key: api_key.to_string(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
+impl TryFrom<GlobalpayRefreshTokenResponse> for types::AccessToken {
+ type Error = error_stack::Report<errors::ParsingError>;
+
+ fn try_from(item: GlobalpayRefreshTokenResponse) -> Result<Self, Self::Error> {
+ Ok(Self {
+ token: item.token,
+ expires: item.seconds_to_expire,
+ })
+ }
+}
+
+impl TryFrom<&types::RefreshTokenRouterData> for GlobalpayRefreshTokenRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(item: &types::RefreshTokenRouterData) -> Result<Self, Self::Error> {
+ let globalpay_auth = GlobalpayAuthType::try_from(&item.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)
+ .attach_printable("Could not convert connector_auth to globalpay_auth")?;
+
+ let nonce = rand::distributions::Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
+ let nonce_with_api_key = format!("{}{}", nonce, globalpay_auth.key);
+ let secret_vec = crypto::Sha512
+ .generate_digest(nonce_with_api_key.as_bytes())
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("error creating request nonce")?;
+
+ let secret = hex::encode(secret_vec);
+
+ Ok(Self {
+ app_id: globalpay_auth.app_id,
+ nonce,
+ secret,
+ grant_type: "client_credentials".to_string(),
+ })
+ }
+}
+
impl From<GlobalpayPaymentStatus> for enums::AttemptStatus {
fn from(item: GlobalpayPaymentStatus) -> Self {
match item {
@@ -134,6 +176,24 @@ impl<F, T>
}
}
+impl<F, T>
+ TryFrom<types::ResponseRouterData<F, GlobalpayRefreshTokenResponse, T, types::AccessToken>>
+ for types::RouterData<F, T, types::AccessToken>
+{
+ type Error = error_stack::Report<errors::ParsingError>;
+ fn try_from(
+ item: types::ResponseRouterData<F, GlobalpayRefreshTokenResponse, T, types::AccessToken>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(types::AccessToken {
+ token: item.response.token,
+ expires: item.response.seconds_to_expire,
+ }),
+ ..item.data
+ })
+ }
+}
+
impl<F> TryFrom<&types::RefundsRouterData<F>> for requests::GlobalpayRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 52c4e756f39..2a57d796682 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -59,11 +59,15 @@ pub type PaymentsSessionType =
dyn services::ConnectorIntegration<api::Session, PaymentsSessionData, PaymentsResponseData>;
pub type PaymentsVoidType =
dyn services::ConnectorIntegration<api::Void, PaymentsCancelData, PaymentsResponseData>;
+
pub type RefundExecuteType =
dyn services::ConnectorIntegration<api::Execute, RefundsData, RefundsResponseData>;
pub type RefundSyncType =
dyn services::ConnectorIntegration<api::RSync, RefundsData, RefundsResponseData>;
+pub type RefreshTokenType =
+ dyn services::ConnectorIntegration<api::AccessTokenAuth, AccessTokenRequestData, AccessToken>;
+
pub type VerifyRouterData = RouterData<api::Verify, VerifyRequestData, PaymentsResponseData>;
#[derive(Debug, Clone)]
|
feat
|
implement access token creation (#408)
|
8246f4e9c336152ca79e916375cd11618af4d90a
|
2023-09-06 20:50:56
|
Prajjwal Kumar
|
refactor(router): changed auth of verify_apple_pay from mid to jwt (#2094)
| false
|
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index b4293681971..1de08031705 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -14,10 +14,8 @@ pub async fn apple_pay_merchant_registration(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<verifications::ApplepayMerchantVerificationRequest>,
- path: web::Path<String>,
) -> impl Responder {
let flow = Flow::Verification;
- let merchant_id = path.into_inner();
api::server_wrap(
flow,
state.get_ref(),
@@ -26,7 +24,7 @@ pub async fn apple_pay_merchant_registration(
|state, _, body| {
verification::verify_merchant_creds_for_applepay(state, &req, body, &state.conf.kms)
},
- &auth::MerchantIdAuth(merchant_id.clone()),
+ auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
)
.await
}
|
refactor
|
changed auth of verify_apple_pay from mid to jwt (#2094)
|
751f9e5ba214d8a39b160e0dde9e2505e50a73a4
|
2023-12-05 19:28:44
|
github-actions
|
chore(version): v1.96.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3cd968293c4..e87adeea935 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,28 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.96.0 (2023-12-05)
+
+### Features
+
+- **connector_onboarding:** Add Connector onboarding APIs ([#3050](https://github.com/juspay/hyperswitch/pull/3050)) ([`7bd6e05`](https://github.com/juspay/hyperswitch/commit/7bd6e05c0c05ebae9b82a6f410e61ca4409d088b))
+- **pm_list:** Add required fields for bancontact_card for Mollie, Adyen and Stripe ([#3035](https://github.com/juspay/hyperswitch/pull/3035)) ([`792e642`](https://github.com/juspay/hyperswitch/commit/792e642ad58f90bae3ddcea5e6cbc70e948d8e28))
+- **user:** Add email apis and new enums for metadata ([#3053](https://github.com/juspay/hyperswitch/pull/3053)) ([`1c3d260`](https://github.com/juspay/hyperswitch/commit/1c3d260dc3e18fbf6cbd5122122a6c73dceb39a3))
+- Implement FRM flows ([#2968](https://github.com/juspay/hyperswitch/pull/2968)) ([`055d838`](https://github.com/juspay/hyperswitch/commit/055d8383671f6b466297c177bcc770618c7da96a))
+
+### Bug Fixes
+
+- Remove redundant call to populate_payment_data function ([#3054](https://github.com/juspay/hyperswitch/pull/3054)) ([`53df543`](https://github.com/juspay/hyperswitch/commit/53df543b7f1407a758232025b7de0fb527be8e86))
+
+### Documentation
+
+- **test_utils:** Update postman docs ([#3055](https://github.com/juspay/hyperswitch/pull/3055)) ([`8b7a7aa`](https://github.com/juspay/hyperswitch/commit/8b7a7aa6494ff669e1f8bcc92a5160e422d6b26e))
+
+**Full Changelog:** [`v1.95.0...v1.96.0`](https://github.com/juspay/hyperswitch/compare/v1.95.0...v1.96.0)
+
+- - -
+
+
## 1.95.0 (2023-12-05)
### Features
|
chore
|
v1.96.0
|
96c5efea2b0edc032d7199046650e7b00a276c5e
|
2023-06-14 18:37:17
|
Nishant Joshi
|
feat(response-log): add logging to the response (#1433)
| false
|
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index d24daeaec14..4ed2ce9d7a4 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -604,6 +604,7 @@ where
T: Debug,
U: auth::AuthInfo,
A: AppStateInfo,
+ ApplicationResponse<Q>: Debug,
CustomResult<ApplicationResponse<Q>, E>:
ReportSwitchExt<ApplicationResponse<Q>, api_models::errors::types::ApiErrorResponse>,
{
@@ -620,7 +621,10 @@ where
&flow,
)
.await
- {
+ .map(|response| {
+ logger::info!(api_response =? response);
+ response
+ }) {
Ok(ApplicationResponse::Json(response)) => match serde_json::to_string(&response) {
Ok(res) => http_response_json(res),
Err(_) => http_response_err(
|
feat
|
add logging to the response (#1433)
|
9ae10dc4d050f3aa705c72b27e676cdcb0e379c4
|
2024-03-14 15:56:35
|
Chethan Rao
|
refactor(payment_methods): enable country currency filter for cards (#4056)
| false
|
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 60abf0701a5..75f192f606b 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2356,15 +2356,27 @@ fn filter_pm_based_on_config<'a>(
.or_else(|| config.0.get("default"))
.and_then(|inner| match payment_method_type {
api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit => {
+ let country_currency_filter = inner
+ .0
+ .get(&settings::PaymentMethodFilterKey::PaymentMethodType(
+ *payment_method_type,
+ ))
+ .map(|value| global_country_currency_filter(value, country, currency));
+
card_network_filter(country, currency, card_network, inner);
- payment_attempt
+ let capture_method_filter = payment_attempt
.and_then(|inner| inner.capture_method)
.and_then(|capture_method| {
(capture_method == storage_enums::CaptureMethod::Manual).then(|| {
filter_pm_based_on_capture_method_used(inner, payment_method_type)
})
- })
+ });
+
+ Some(
+ country_currency_filter.unwrap_or(true)
+ && capture_method_filter.unwrap_or(true),
+ )
}
payment_method_type => inner
.0
|
refactor
|
enable country currency filter for cards (#4056)
|
acd153042062dd14d5e6e266fdc73d82b78213fe
|
2024-10-25 16:26:45
|
Nabeel Hussain M N
|
feat(connector): [PayU] Use connector_request_reference_id (#6360)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
index 0b2b7030528..4ebc09a0023 100644
--- a/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
@@ -34,6 +34,7 @@ pub struct PayuPaymentsRequest {
description: String,
pay_methods: PayuPaymentMethod,
continue_url: Option<String>,
+ ext_order_id: Option<String>,
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -133,6 +134,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
.to_string(),
),
merchant_pos_id: auth_type.merchant_pos_id,
+ ext_order_id: Some(item.connector_request_reference_id.clone()),
total_amount: item.request.amount,
currency_code: item.request.currency,
description: item.description.clone().ok_or(
|
feat
|
[PayU] Use connector_request_reference_id (#6360)
|
6e94a5636462a8071e69f072ec058c6068e5d1f7
|
2024-04-03 22:59:47
|
Prajjwal Kumar
|
refactor(core): locker call made synchronous for updation of pm_id (#4289)
| false
|
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index 8984c1caeeb..6c236729de4 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -347,7 +347,7 @@ pub enum PaymentAttemptUpdate {
connector: Option<String>,
connector_transaction_id: Option<String>,
authentication_type: Option<storage_enums::AuthenticationType>,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
mandate_id: Option<String>,
connector_metadata: Option<serde_json::Value>,
payment_token: Option<String>,
@@ -367,7 +367,7 @@ pub enum PaymentAttemptUpdate {
status: storage_enums::AttemptStatus,
connector: Option<String>,
connector_transaction_id: Option<String>,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
error_code: Option<Option<String>>,
error_message: Option<Option<String>>,
error_reason: Option<Option<String>>,
@@ -403,7 +403,7 @@ pub enum PaymentAttemptUpdate {
},
PreprocessingUpdate {
status: storage_enums::AttemptStatus,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
connector_metadata: Option<serde_json::Value>,
preprocessing_step_id: Option<String>,
connector_transaction_id: Option<String>,
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 77fd21165d7..6ad21eab12b 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -254,7 +254,7 @@ pub enum PaymentAttemptUpdate {
connector: Option<String>,
connector_transaction_id: Option<String>,
authentication_type: Option<storage_enums::AuthenticationType>,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
mandate_id: Option<String>,
connector_metadata: Option<serde_json::Value>,
payment_token: Option<String>,
@@ -274,7 +274,7 @@ pub enum PaymentAttemptUpdate {
status: storage_enums::AttemptStatus,
connector: Option<String>,
connector_transaction_id: Option<String>,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
error_code: Option<Option<String>>,
error_message: Option<Option<String>>,
error_reason: Option<Option<String>>,
@@ -310,7 +310,7 @@ pub enum PaymentAttemptUpdate {
},
PreprocessingUpdate {
status: storage_enums::AttemptStatus,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
connector_metadata: Option<serde_json::Value>,
preprocessing_step_id: Option<String>,
connector_transaction_id: Option<String>,
@@ -350,7 +350,7 @@ pub struct PaymentAttemptUpdateInternal {
authentication_type: Option<storage_enums::AuthenticationType>,
payment_method: Option<storage_enums::PaymentMethod>,
error_message: Option<Option<String>>,
- payment_method_id: Option<Option<String>>,
+ payment_method_id: Option<String>,
cancellation_reason: Option<String>,
modified_at: Option<PrimitiveDateTime>,
mandate_id: Option<String>,
@@ -459,7 +459,7 @@ impl PaymentAttemptUpdate {
authentication_type: authentication_type.or(source.authentication_type),
payment_method: payment_method.or(source.payment_method),
error_message: error_message.unwrap_or(source.error_message),
- payment_method_id: payment_method_id.unwrap_or(source.payment_method_id),
+ payment_method_id: payment_method_id.or(source.payment_method_id),
cancellation_reason: cancellation_reason.or(source.cancellation_reason),
modified_at: common_utils::date_time::now(),
mandate_id: mandate_id.or(source.mandate_id),
@@ -605,7 +605,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id,
payment_method_billing_address_id,
fingerprint_id,
- payment_method_id: payment_method_id.map(Some),
+ payment_method_id,
..Default::default()
},
PaymentAttemptUpdate::VoidUpdate {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 87c93af6635..e7ec99f61b6 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2136,7 +2136,9 @@ where
)
.await?;
payment_data.payment_method_data = payment_method_data;
- payment_data.payment_attempt.payment_method_id = pm_id;
+ if let Some(payment_method_id) = pm_id {
+ payment_data.payment_attempt.payment_method_id = Some(payment_method_id);
+ }
payment_data
} else {
payment_data
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index bc43839fdcb..a5132e4a346 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use error_stack;
-use router_env::tracing::Instrument;
+// use router_env::tracing::Instrument;
use super::{ConstructFlowSpecificData, Feature};
use crate::{
core::{
@@ -118,43 +118,65 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
)
.await?)
} else {
- let connector = connector.clone();
let response = resp.clone();
- let maybe_customer = maybe_customer.clone();
- let merchant_account = merchant_account.clone();
- let key_store = key_store.clone();
- let state = state.clone();
logger::info!("Call to save_payment_method in locker");
- let _task_handle = tokio::spawn(
- async move {
- logger::info!("Starting async call to save_payment_method in locker");
-
- let result = Box::pin(tokenization::save_payment_method(
- &state,
- &connector,
- response,
- &maybe_customer,
- &merchant_account,
- self.request.payment_method_type,
- &key_store,
- Some(resp.request.amount),
- Some(resp.request.currency),
- ))
- .await;
-
- if let Err(err) = result {
- logger::error!(
- "Asynchronously saving card in locker failed : {:?}",
- err
- );
- }
+
+ let pm = Box::pin(tokenization::save_payment_method(
+ state,
+ connector,
+ response,
+ maybe_customer,
+ merchant_account,
+ self.request.payment_method_type,
+ key_store,
+ Some(resp.request.amount),
+ Some(resp.request.currency),
+ ))
+ .await;
+
+ match pm {
+ Ok((payment_method_id, payment_method_status)) => {
+ resp.payment_method_id = payment_method_id.clone();
+ resp.payment_method_status = payment_method_status;
}
- .in_current_span(),
- );
+ Err(_) => logger::error!("Save pm to locker failed"),
+ }
Ok(resp)
}
+
+ // Async locker code (Commenting out the code for near future refactors)
+ // logger::info!("Call to save_payment_method in locker");
+ // let _task_handle = tokio::spawn(
+ // async move {
+ // logger::info!("Starting async call to save_payment_method in locker");
+ //
+ // let result = Box::pin(tokenization::save_payment_method(
+ // &state,
+ // &connector,
+ // response,
+ // &maybe_customer,
+ // &merchant_account,
+ // self.request.payment_method_type,
+ // &key_store,
+ // Some(resp.request.amount),
+ // Some(resp.request.currency),
+ // ))
+ // .await;
+ //
+ // if let Err(err) = result {
+ // logger::error!(
+ // "Asynchronously saving card in locker failed : {:?}",
+ // err
+ // );
+ // }
+ // }
+ // .in_current_span(),
+ // );
+ //
+ // Ok(resp)
+ // }
} else {
Ok(self.clone())
}
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 6cb19a29a1d..66f35e63b2c 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -587,7 +587,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let payment_attempt_update =
storage::PaymentAttemptUpdate::PreprocessingUpdate {
status: updated_attempt_status,
- payment_method_id: Some(router_data.payment_method_id),
+ payment_method_id: router_data.payment_method_id,
connector_metadata,
preprocessing_step_id,
connector_transaction_id,
@@ -676,7 +676,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
amount_capturable: router_data
.request
.get_amount_capturable(&payment_data, updated_attempt_status),
- payment_method_id: Some(payment_method_id),
+ payment_method_id,
mandate_id: payment_data
.mandate_id
.clone()
@@ -715,7 +715,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
status: updated_attempt_status,
connector: None,
connector_transaction_id,
- payment_method_id: Some(router_data.payment_method_id),
+ payment_method_id: router_data.payment_method_id,
error_code: Some(reason.clone().map(|cd| cd.code)),
error_message: Some(reason.clone().map(|cd| cd.message)),
error_reason: Some(reason.map(|cd| cd.message)),
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 09400bb750b..3eeecdba3a8 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -376,7 +376,7 @@ where
.connector_response_reference_id
.clone(),
authentication_type: None,
- payment_method_id: Some(router_data.payment_method_id),
+ payment_method_id: router_data.payment_method_id,
mandate_id: payment_data
.mandate_id
.clone()
|
refactor
|
locker call made synchronous for updation of pm_id (#4289)
|
21a3a2ea8ada838c67b0e5871f01d09bd5a8b9ed
|
2024-05-30 16:27:12
|
Sarthak Soni
|
fix(routing): Added routing validation for payments req (#4762)
| false
|
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index aa2cf09cb6a..edda62d79f7 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1336,6 +1336,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentConfir
.clone()
.ok_or(report!(errors::ApiErrorResponse::PaymentNotFound))?;
+ let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
+ .routing
+ .clone()
+ .map(|val| val.parse_value("RoutingAlgorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid straight through routing rules format".to_string(),
+ })
+ .attach_printable("Invalid straight through routing rules format")?;
+
Ok((
Box::new(self),
operations::ValidateResult {
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 4d4444a2802..9a4e8789058 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -735,6 +735,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentCreate
)?;
}
+ let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
+ .routing
+ .clone()
+ .map(|val| val.parse_value("RoutingAlgorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid straight through routing rules format".to_string(),
+ })
+ .attach_printable("Invalid straight through routing rules format")?;
+
Ok((
Box::new(self),
operations::ValidateResult {
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 494ab0f2eec..e44dc0c1f2c 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -782,6 +782,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentUpdate
&request.mandate_id,
)?;
+ let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
+ .routing
+ .clone()
+ .map(|val| val.parse_value("RoutingAlgorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid straight through routing rules format".to_string(),
+ })
+ .attach_printable("Invalid straight through routing rules format")?;
+
Ok((
Box::new(self),
operations::ValidateResult {
|
fix
|
Added routing validation for payments req (#4762)
|
f7d8947e48fbf1dea401d5d278a93fce87f41217
|
2023-10-05 12:47:45
|
Pa1NarK
|
ci(postman): Trustpay 3DS request fix (#2454)
| false
|
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
index acab381b5dc..7dd4aac02ce 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
@@ -30,7 +30,7 @@
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
- "authentication_type": "no_three_ds",
+ "authentication_type": "three_ds",
"billing": {
"address": {
"line1": "1467",
@@ -68,7 +68,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "4200000000000067",
+ "card_number": "5200000000000015",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "something",
|
ci
|
Trustpay 3DS request fix (#2454)
|
86c26221357e14b585f44c6ebe46962c085f6552
|
2023-12-22 20:16:58
|
DEEPANSHU BANSAL
|
fix(connector): [CYBERSOURCE] Display 2XX Failure Errors (#3201)
| false
|
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index bc4e7509519..a19dc0d3c34 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -842,13 +842,14 @@ pub enum CybersourcePaymentsResponse {
ErrorInformation(CybersourceErrorInformationResponse),
}
-#[derive(Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CybersourceClientReferenceResponse {
id: String,
status: CybersourcePaymentStatus,
client_reference_information: ClientReferenceInformation,
token_information: Option<CybersourceTokenInformation>,
+ error_information: Option<CybersourceErrorInformation>,
}
#[derive(Debug, Clone, Deserialize)]
@@ -928,6 +929,107 @@ impl<F, T>
}
}
+fn get_error_response_if_failure(
+ (info_response, status, http_code): (
+ &CybersourceClientReferenceResponse,
+ enums::AttemptStatus,
+ u16,
+ ),
+) -> Option<types::ErrorResponse> {
+ if is_payment_failure(status) {
+ let (message, reason) = match info_response.error_information.as_ref() {
+ Some(error_info) => (
+ error_info
+ .message
+ .clone()
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ error_info.reason.clone(),
+ ),
+ None => (consts::NO_ERROR_MESSAGE.to_string(), None),
+ };
+
+ Some(types::ErrorResponse {
+ code: consts::NO_ERROR_CODE.to_string(),
+ message,
+ reason,
+ status_code: http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(info_response.id.clone()),
+ })
+ } else {
+ None
+ }
+}
+
+fn is_payment_failure(status: enums::AttemptStatus) -> bool {
+ match status {
+ common_enums::AttemptStatus::AuthenticationFailed
+ | common_enums::AttemptStatus::AuthorizationFailed
+ | common_enums::AttemptStatus::CaptureFailed
+ | common_enums::AttemptStatus::VoidFailed
+ | common_enums::AttemptStatus::Failure => true,
+ common_enums::AttemptStatus::Started
+ | common_enums::AttemptStatus::RouterDeclined
+ | common_enums::AttemptStatus::AuthenticationPending
+ | common_enums::AttemptStatus::AuthenticationSuccessful
+ | common_enums::AttemptStatus::Authorized
+ | common_enums::AttemptStatus::Charged
+ | common_enums::AttemptStatus::Authorizing
+ | common_enums::AttemptStatus::CodInitiated
+ | common_enums::AttemptStatus::Voided
+ | common_enums::AttemptStatus::VoidInitiated
+ | common_enums::AttemptStatus::CaptureInitiated
+ | common_enums::AttemptStatus::AutoRefunded
+ | common_enums::AttemptStatus::PartialCharged
+ | common_enums::AttemptStatus::PartialChargedAndChargeable
+ | common_enums::AttemptStatus::Unresolved
+ | common_enums::AttemptStatus::Pending
+ | common_enums::AttemptStatus::PaymentMethodAwaited
+ | common_enums::AttemptStatus::ConfirmationAwaited
+ | common_enums::AttemptStatus::DeviceDataCollectionPending => false,
+ }
+}
+
+fn get_payment_response(
+ (info_response, status, http_code): (
+ &CybersourceClientReferenceResponse,
+ enums::AttemptStatus,
+ u16,
+ ),
+) -> Result<types::PaymentsResponseData, types::ErrorResponse> {
+ let error_response = get_error_response_if_failure((info_response, status, http_code));
+ match error_response {
+ Some(error) => Err(error),
+ None => {
+ let incremental_authorization_allowed =
+ Some(status == enums::AttemptStatus::Authorized);
+ let mandate_reference =
+ info_response
+ .token_information
+ .clone()
+ .map(|token_info| types::MandateReference {
+ connector_mandate_id: Some(token_info.instrument_identifier.id),
+ payment_method_id: None,
+ });
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()),
+ redirection_data: None,
+ mandate_reference,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(
+ info_response
+ .client_reference_information
+ .code
+ .clone()
+ .unwrap_or(info_response.id.clone()),
+ ),
+ incremental_authorization_allowed,
+ })
+ }
+ }
+}
+
impl<F>
TryFrom<
types::ResponseRouterData<
@@ -950,35 +1052,13 @@ impl<F>
match item.response {
CybersourcePaymentsResponse::ClientReferenceInformation(info_response) => {
let status = enums::AttemptStatus::foreign_from((
- info_response.status,
+ info_response.status.clone(),
item.data.request.is_auto_capture()?,
));
- let incremental_authorization_allowed =
- Some(status == enums::AttemptStatus::Authorized);
- let mandate_reference =
- info_response
- .token_information
- .map(|token_info| types::MandateReference {
- connector_mandate_id: Some(token_info.instrument_identifier.id),
- payment_method_id: None,
- });
- let connector_response_reference_id = Some(
- info_response
- .client_reference_information
- .code
- .unwrap_or(info_response.id.clone()),
- );
+ let response = get_payment_response((&info_response, status, item.http_code));
Ok(Self {
status,
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(info_response.id),
- redirection_data: None,
- mandate_reference,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id,
- incremental_authorization_allowed,
- }),
+ response,
..item.data
})
}
@@ -1010,24 +1090,12 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
CybersourcePaymentsResponse::ClientReferenceInformation(info_response) => {
- let status = enums::AttemptStatus::foreign_from((info_response.status, true));
- let connector_response_reference_id = Some(
- info_response
- .client_reference_information
- .code
- .unwrap_or(info_response.id.clone()),
- );
+ let status =
+ enums::AttemptStatus::foreign_from((info_response.status.clone(), true));
+ let response = get_payment_response((&info_response, status, item.http_code));
Ok(Self {
status,
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(info_response.id),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id,
- incremental_authorization_allowed: None,
- }),
+ response,
..item.data
})
}
@@ -1059,24 +1127,12 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
CybersourcePaymentsResponse::ClientReferenceInformation(info_response) => {
- let status = enums::AttemptStatus::foreign_from((info_response.status, false));
- let connector_response_reference_id = Some(
- info_response
- .client_reference_information
- .code
- .unwrap_or(info_response.id.clone()),
- );
+ let status =
+ enums::AttemptStatus::foreign_from((info_response.status.clone(), false));
+ let response = get_payment_response((&info_response, status, item.http_code));
Ok(Self {
status,
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(info_response.id),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id,
- incremental_authorization_allowed: None,
- }),
+ response,
..item.data
})
}
@@ -1215,9 +1271,10 @@ pub struct CybersourceApplicationInfoResponse {
id: String,
application_information: ApplicationInformation,
client_reference_information: Option<ClientReferenceInformation>,
+ error_information: Option<CybersourceErrorInformation>,
}
-#[derive(Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApplicationInformation {
status: CybersourcePaymentStatus,
@@ -1250,24 +1307,48 @@ impl<F>
));
let incremental_authorization_allowed =
Some(status == enums::AttemptStatus::Authorized);
- Ok(Self {
- status,
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- app_response.id.clone(),
+ if is_payment_failure(status) {
+ let (message, reason) = match app_response.error_information {
+ Some(error_info) => (
+ error_info
+ .message
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ error_info.reason,
),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- incremental_authorization_allowed,
- connector_response_reference_id: app_response
- .client_reference_information
- .map(|cref| cref.code)
- .unwrap_or(Some(app_response.id)),
- }),
- ..item.data
- })
+ None => (consts::NO_ERROR_MESSAGE.to_string(), None),
+ };
+ Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: consts::NO_ERROR_CODE.to_string(),
+ message,
+ reason,
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(app_response.id),
+ }),
+ status: enums::AttemptStatus::Failure,
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ app_response.id.clone(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: app_response
+ .client_reference_information
+ .map(|cref| cref.code)
+ .unwrap_or(Some(app_response.id)),
+ incremental_authorization_allowed,
+ }),
+ ..item.data
+ })
+ }
}
CybersourceTransactionResponse::ErrorInformation(error_response) => Ok(Self {
status: item.data.status,
|
fix
|
[CYBERSOURCE] Display 2XX Failure Errors (#3201)
|
a9a1ded77e2ba0cc7fa9763ce2da4bb0852d82af
|
2025-01-23 06:00:08
|
github-actions
|
chore(version): 2025.01.23.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f8246d67ed0..f8594f6be28 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,24 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2025.01.23.0
+
+### Features
+
+- **connector:** [ADYEN ] Consume transaction id for PaymentsPreProcessing error ([#7061](https://github.com/juspay/hyperswitch/pull/7061)) ([`199d176`](https://github.com/juspay/hyperswitch/commit/199d1764488f234accab3bfecef9645ee9486057))
+
+### Refactors
+
+- [CYBERSOURCE, BANKOFAMERICA, WELLSFARGO] Move code to crate hyperswitch_connectors ([#6908](https://github.com/juspay/hyperswitch/pull/6908)) ([`be01896`](https://github.com/juspay/hyperswitch/commit/be018963c6696c3f494bdd45825ebc61ba1bbc82))
+
+### Miscellaneous Tasks
+
+- Enable 128-column-tables feature for diesel crate ([#6857](https://github.com/juspay/hyperswitch/pull/6857)) ([`eaf450b`](https://github.com/juspay/hyperswitch/commit/eaf450b91109c21e1091f7936cab009e8e6e2abb))
+
+**Full Changelog:** [`2025.01.22.0...2025.01.23.0`](https://github.com/juspay/hyperswitch/compare/2025.01.22.0...2025.01.23.0)
+
+- - -
+
## 2025.01.22.0
### Features
|
chore
|
2025.01.23.0
|
218fc5f285d73e0f6ff9761cd8b74f13ce0ca1c3
|
2024-02-18 13:31:12
|
likhinbopanna
|
ci(postman): Cybersource collection fix (#3689)
| false
|
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Mandate Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Payments - Confirm/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12-Zero auth mandates/Recurring Payments - Create/response.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/.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-Incremental auth/Incremental Authorization/.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-Incremental auth/Incremental Authorization/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Incremental Authorization/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-Incremental auth/Incremental Authorization/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-Incremental auth/Incremental Authorization/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-Incremental auth/Payments - Capture/.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-Incremental auth/Payments - Capture/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Capture/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-Incremental auth/Payments - Capture/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-Incremental auth/Payments - Capture/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-Incremental auth/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-Incremental auth/Payments - Create/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Create/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/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-Incremental auth/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-Incremental auth/Payments - Create/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-Incremental auth/Payments - Retrieve/.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-Incremental auth/Payments - Retrieve/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Payments - Retrieve/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-Incremental auth/Payments - Retrieve/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-Incremental auth/Payments - Retrieve/response.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/Scenario13-Incremental auth/Refunds - Create/.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/Scenario13-Incremental auth/Refunds - Create/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Create/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/Scenario13-Incremental auth/Refunds - Create/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/Scenario13-Incremental auth/Refunds - Create/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/Scenario13-Incremental auth/Refunds - Retrieve/.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/Scenario13-Incremental auth/Refunds - Retrieve/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13-Incremental auth/Refunds - Retrieve/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/Scenario13-Incremental auth/Refunds - Retrieve/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/Scenario13-Incremental auth/Refunds - Retrieve/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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/.meta.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-Incremental auth for mandates/Incremental Authorization/.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-Incremental auth for mandates/Incremental Authorization/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Incremental Authorization/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-Incremental auth for mandates/Incremental Authorization/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-Incremental auth for mandates/Incremental Authorization/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-Incremental auth for mandates/Payments - Capture/.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-Incremental auth for mandates/Payments - Capture/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Capture/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-Incremental auth for mandates/Payments - Capture/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-Incremental auth for mandates/Payments - Capture/response.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/Scenario14-Incremental auth for mandates/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/Scenario14-Incremental auth for mandates/Payments - Create/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - 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/Scenario14-Incremental auth for mandates/Payments - Create/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-Incremental auth for 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-Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14-Incremental auth for mandates/Payments - Retrieve/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-Incremental auth for mandates/Payments - Retrieve/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-Incremental auth for mandates/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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/.meta.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-Incremental auth with partial capture/Incremental Authorization/.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-Incremental auth with partial capture/Incremental Authorization/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Incremental Authorization/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-Incremental auth with partial capture/Incremental Authorization/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-Incremental auth with partial capture/Incremental Authorization/response.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/Scenario15-Incremental auth with partial capture/Payments - Capture/.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/Scenario15-Incremental auth with partial capture/Payments - Capture/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Capture/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/Scenario15-Incremental auth with partial capture/Payments - Capture/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/Scenario15-Incremental auth with partial capture/Payments - Capture/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/Scenario15-Incremental auth with partial capture/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/Scenario15-Incremental auth with partial capture/Payments - Create/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Create/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/Scenario15-Incremental auth with partial capture/Payments - Create/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/Scenario15-Incremental auth with partial capture/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/Scenario15-Incremental auth with partial capture/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/Scenario15-Incremental auth with partial capture/Payments - Retrieve/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Payments - Retrieve/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/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/Scenario15-Incremental auth with partial capture/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/Scenario15-Incremental auth with partial capture/Payments - Retrieve/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/Scenario15-Incremental auth with partial capture/Refunds - Create/.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/Scenario15-Incremental auth with partial capture/Refunds - Create/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Create/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - 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/Scenario15-Incremental auth with partial capture/Refunds - 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/Scenario15-Incremental auth with partial capture/Refunds - Create/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/Scenario15-Incremental auth with partial capture/Refunds - 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/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/event.test.js
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
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/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/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/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/Scenario15-Incremental auth with partial capture/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17-Revoke mandates/.meta.json
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/Scenario17-Revoke mandates/.meta.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/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/.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/Happy Cases/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-Revoke mandates/List - Mandates-copy/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/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/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/Happy Cases/Scenario17-Revoke mandates/List - Mandates-copy/response.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/Happy Cases/Scenario17-Revoke mandates/List - Mandates/.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/Happy Cases/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-Revoke mandates/List - Mandates/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/Happy Cases/Scenario17-Revoke mandates/List - Mandates/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/Happy Cases/Scenario17-Revoke mandates/List - Mandates/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/Happy Cases/Scenario17-Revoke mandates/Payments - Create/.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/Happy Cases/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-Revoke 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/Happy Cases/Scenario17-Revoke 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/Happy Cases/Scenario17-Revoke mandates/Payments - Create/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/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/.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/Happy Cases/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-Revoke 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/Happy Cases/Scenario17-Revoke 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/Happy Cases/Scenario17-Revoke mandates/Payments - Retrieve/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/Happy Cases/Scenario17-Revoke 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/Happy Cases/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-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/Scenario17-Revoke mandates/Revoke - Mandates/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/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/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/Happy Cases/Scenario17-Revoke mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10-Manual multiple capture/.meta.json
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/Scenario10-Manual multiple capture/.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/Scenario10-Manual multiple capture/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/Scenario10-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/Scenario10-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/Scenario10-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/Scenario10-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/Scenario10-Manual multiple capture/Payments - Create/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/Scenario10-Manual multiple capture/Payments - Create/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/Scenario10-Manual multiple capture/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates-copy/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13-Revoke for revoked mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14-Recurring payment for revoked mandates/Revoke - Mandates/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-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/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-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/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-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/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15-Setup_future_usage is off_session for normal payments/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- 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/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-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/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- 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/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16-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/Scenario17- Setup_future_usage is null for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Confirm/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/request.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/response.json
rename to postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17-Setup_future_usage is null for normal payments/Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/event.prerequest.js b/postman/collection-dir/cybersource/event.prerequest.js
index baeff37e44b..e69de29bb2d 100644
--- a/postman/collection-dir/cybersource/event.prerequest.js
+++ b/postman/collection-dir/cybersource/event.prerequest.js
@@ -1,4 +0,0 @@
-pm.request.headers.add({
- key: 'x-feature',
- value: 'router_custom'
-});
|
ci
|
Cybersource collection fix (#3689)
|
feb228cee0e31a10eb2dc0fba99854dae6cf457f
|
2023-02-06 17:53:37
|
Sanchith Hegde
|
feat(generics): allow specifying optional offset and order clauses for `generic_filter()` (#502)
| false
|
diff --git a/crates/storage_models/src/query/generics.rs b/crates/storage_models/src/query/generics.rs
index 44ef5877ada..d9311997af0 100644
--- a/crates/storage_models/src/query/generics.rs
+++ b/crates/storage_models/src/query/generics.rs
@@ -5,6 +5,7 @@ use diesel::{
associations::HasTable,
debug_query,
dsl::{Find, Limit},
+ helper_types::{Filter, IntoBoxed},
insertable::CanInsertInSingleQuery,
pg::{Pg, PgConnection},
query_builder::{
@@ -12,11 +13,11 @@ use diesel::{
QueryId, UpdateStatement,
},
query_dsl::{
- methods::{FilterDsl, FindDsl, LimitDsl},
+ methods::{BoxedDsl, FilterDsl, FindDsl, LimitDsl, OffsetDsl, OrderDsl},
LoadQuery, RunQueryDsl,
},
result::Error as DieselError,
- Insertable, QuerySource, Table,
+ Expression, Insertable, QueryDsl, QuerySource, Table,
};
use error_stack::{report, IntoReport, ResultExt};
use router_env::{instrument, logger, tracing};
@@ -60,11 +61,11 @@ pub async fn generic_update<T, V, P>(
) -> StorageResult<usize>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- V: AsChangeset<Target = <<T as FilterDsl<P>>::Output as HasTable>::Table> + Debug,
- <T as FilterDsl<P>>::Output: IntoUpdateTarget,
+ V: AsChangeset<Target = <Filter<T, P> as HasTable>::Table> + Debug,
+ Filter<T, P>: IntoUpdateTarget,
UpdateStatement<
- <<T as FilterDsl<P>>::Output as HasTable>::Table,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause,
+ <Filter<T, P> as HasTable>::Table,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause,
<V as AsChangeset>::Changeset,
>: AsQuery + QueryFragment<Pg> + QueryId + Send + 'static,
{
@@ -89,20 +90,20 @@ pub async fn generic_update_with_results<T, V, P, R>(
) -> StorageResult<Vec<R>>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- V: AsChangeset<Target = <<T as FilterDsl<P>>::Output as HasTable>::Table> + Debug + 'static,
- <T as FilterDsl<P>>::Output: IntoUpdateTarget + 'static,
+ V: AsChangeset<Target = <Filter<T, P> as HasTable>::Table> + Debug + 'static,
+ Filter<T, P>: IntoUpdateTarget + 'static,
UpdateStatement<
- <<T as FilterDsl<P>>::Output as HasTable>::Table,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause,
+ <Filter<T, P> as HasTable>::Table,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause,
<V as AsChangeset>::Changeset,
>: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + Clone,
R: Send + 'static,
// For cloning query (UpdateStatement)
- <<T as FilterDsl<P>>::Output as HasTable>::Table: Clone,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause: Clone,
+ <Filter<T, P> as HasTable>::Table: Clone,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause: Clone,
<V as AsChangeset>::Changeset: Clone,
- <<<T as FilterDsl<P>>::Output as HasTable>::Table as QuerySource>::FromClause: Clone,
+ <<Filter<T, P> as HasTable>::Table as QuerySource>::FromClause: Clone,
{
let debug_values = format!("{values:?}");
@@ -134,20 +135,20 @@ pub async fn generic_update_with_unique_predicate_get_result<T, V, P, R>(
) -> StorageResult<R>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- V: AsChangeset<Target = <<T as FilterDsl<P>>::Output as HasTable>::Table> + Debug + 'static,
- <T as FilterDsl<P>>::Output: IntoUpdateTarget + 'static,
+ V: AsChangeset<Target = <Filter<T, P> as HasTable>::Table> + Debug + 'static,
+ Filter<T, P>: IntoUpdateTarget + 'static,
UpdateStatement<
- <<T as FilterDsl<P>>::Output as HasTable>::Table,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause,
+ <Filter<T, P> as HasTable>::Table,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause,
<V as AsChangeset>::Changeset,
>: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send,
R: Send + 'static,
// For cloning query (UpdateStatement)
- <<T as FilterDsl<P>>::Output as HasTable>::Table: Clone,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause: Clone,
+ <Filter<T, P> as HasTable>::Table: Clone,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause: Clone,
<V as AsChangeset>::Changeset: Clone,
- <<<T as FilterDsl<P>>::Output as HasTable>::Table as QuerySource>::FromClause: Clone,
+ <<Filter<T, P> as HasTable>::Table as QuerySource>::FromClause: Clone,
{
generic_update_with_results::<<T as HasTable>::Table, _, _, _>(conn, predicate, values)
.await
@@ -172,12 +173,11 @@ pub async fn generic_update_by_id<T, V, Pk, R>(
) -> StorageResult<R>
where
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
- V: AsChangeset<Target = <<T as FindDsl<Pk>>::Output as HasTable>::Table> + Debug,
- <T as FindDsl<Pk>>::Output:
- IntoUpdateTarget + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
+ V: AsChangeset<Target = <Find<T, Pk> as HasTable>::Table> + Debug,
+ Find<T, Pk>: IntoUpdateTarget + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
UpdateStatement<
- <<T as FindDsl<Pk>>::Output as HasTable>::Table,
- <<T as FindDsl<Pk>>::Output as IntoUpdateTarget>::WhereClause,
+ <Find<T, Pk> as HasTable>::Table,
+ <Find<T, Pk> as IntoUpdateTarget>::WhereClause,
<V as AsChangeset>::Changeset,
>: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
Find<T, Pk>: LimitDsl,
@@ -186,10 +186,10 @@ where
Pk: Clone + Debug,
// For cloning query (UpdateStatement)
- <<T as FindDsl<Pk>>::Output as HasTable>::Table: Clone,
- <<T as FindDsl<Pk>>::Output as IntoUpdateTarget>::WhereClause: Clone,
+ <Find<T, Pk> as HasTable>::Table: Clone,
+ <Find<T, Pk> as IntoUpdateTarget>::WhereClause: Clone,
<V as AsChangeset>::Changeset: Clone,
- <<<T as FindDsl<Pk>>::Output as HasTable>::Table as QuerySource>::FromClause: Clone,
+ <<Find<T, Pk> as HasTable>::Table as QuerySource>::FromClause: Clone,
{
let debug_values = format!("{values:?}");
@@ -217,10 +217,10 @@ where
pub async fn generic_delete<T, P>(conn: &PgPooledConn, predicate: P) -> StorageResult<bool>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output: IntoUpdateTarget,
+ Filter<T, P>: IntoUpdateTarget,
DeleteStatement<
- <<T as FilterDsl<P>>::Output as HasTable>::Table,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause,
+ <Filter<T, P> as HasTable>::Table,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause,
>: AsQuery + QueryFragment<Pg> + QueryId + Send + 'static,
{
let query = diesel::delete(<T as HasTable>::table().filter(predicate));
@@ -251,10 +251,10 @@ pub async fn generic_delete_one_with_result<T, P, R>(
) -> StorageResult<R>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output: IntoUpdateTarget,
+ Filter<T, P>: IntoUpdateTarget,
DeleteStatement<
- <<T as FilterDsl<P>>::Output as HasTable>::Table,
- <<T as FilterDsl<P>>::Output as IntoUpdateTarget>::WhereClause,
+ <Filter<T, P> as HasTable>::Table,
+ <Filter<T, P> as IntoUpdateTarget>::WhereClause,
>: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
R: Send + Clone + 'static,
{
@@ -279,8 +279,7 @@ where
async fn generic_find_by_id_core<T, Pk, R>(conn: &PgPooledConn, id: Pk) -> StorageResult<R>
where
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
- <T as FindDsl<Pk>>::Output: QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
- Find<T, Pk>: LimitDsl,
+ Find<T, Pk>: LimitDsl + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
Limit<Find<T, Pk>>: LoadQuery<'static, PgConnection, R>,
Pk: Clone + Debug,
R: Send + 'static,
@@ -304,8 +303,7 @@ where
pub async fn generic_find_by_id<T, Pk, R>(conn: &PgPooledConn, id: Pk) -> StorageResult<R>
where
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
- <T as FindDsl<Pk>>::Output: QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
- Find<T, Pk>: LimitDsl,
+ Find<T, Pk>: LimitDsl + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
Limit<Find<T, Pk>>: LoadQuery<'static, PgConnection, R>,
Pk: Clone + Debug,
R: Send + 'static,
@@ -321,9 +319,7 @@ pub async fn generic_find_by_id_optional<T, Pk, R>(
where
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
<T as HasTable>::Table: FindDsl<Pk>,
- <<T as HasTable>::Table as FindDsl<Pk>>::Output: RunQueryDsl<PgConnection> + Send + 'static,
- <T as FindDsl<Pk>>::Output: QueryFragment<Pg>,
- Find<T, Pk>: LimitDsl,
+ Find<T, Pk>: LimitDsl + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
Limit<Find<T, Pk>>: LoadQuery<'static, PgConnection, R>,
Pk: Clone + Debug,
R: Send + 'static,
@@ -335,8 +331,7 @@ where
async fn generic_find_one_core<T, P, R>(conn: &PgPooledConn, predicate: P) -> StorageResult<R>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output:
- LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
+ Filter<T, P>: LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
R: Send + 'static,
{
let query = <T as HasTable>::table().filter(predicate);
@@ -359,8 +354,7 @@ where
pub async fn generic_find_one<T, P, R>(conn: &PgPooledConn, predicate: P) -> StorageResult<R>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output:
- LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
+ Filter<T, P>: LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
R: Send + 'static,
{
generic_find_one_core::<T, _, _>(conn, predicate).await
@@ -373,44 +367,55 @@ pub async fn generic_find_one_optional<T, P, R>(
) -> StorageResult<Option<R>>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output:
- LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
+ Filter<T, P>: LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
R: Send + 'static,
{
to_optional(generic_find_one_core::<T, _, _>(conn, predicate).await)
}
#[instrument(level = "DEBUG", skip_all)]
-pub async fn generic_filter<T, P, R>(
+pub async fn generic_filter<T, P, O, R>(
conn: &PgPooledConn,
predicate: P,
limit: Option<i64>,
+ offset: Option<i64>,
+ order: Option<O>,
) -> StorageResult<Vec<R>>
where
- T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
- <T as FilterDsl<P>>::Output: LoadQuery<'static, PgConnection, R> + QueryFragment<Pg>,
- <T as FilterDsl<P>>::Output: LimitDsl + Send + 'static,
- <<T as FilterDsl<P>>::Output as LimitDsl>::Output:
- LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send,
+ T: HasTable<Table = T> + Table + BoxedDsl<'static, Pg> + 'static,
+ IntoBoxed<'static, T, Pg>: FilterDsl<P, Output = IntoBoxed<'static, T, Pg>>
+ + LimitDsl<Output = IntoBoxed<'static, T, Pg>>
+ + OffsetDsl<Output = IntoBoxed<'static, T, Pg>>
+ + OrderDsl<O, Output = IntoBoxed<'static, T, Pg>>
+ + LoadQuery<'static, PgConnection, R>
+ + QueryFragment<Pg>
+ + Send,
+ O: Expression,
R: Send + 'static,
{
- let query = <T as HasTable>::table().filter(predicate);
+ let mut query = T::table().into_boxed();
+ query = query.filter(predicate);
- match limit {
- Some(limit) => {
- let query = query.limit(limit);
- logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
- query.get_results_async(conn)
- }
- None => {
- logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
- query.get_results_async(conn)
- }
+ if let Some(limit) = limit {
+ query = query.limit(limit);
+ }
+
+ if let Some(offset) = offset {
+ query = query.offset(offset);
+ }
+
+ if let Some(order) = order {
+ query = query.order(order);
}
- .await
- .into_report()
- .change_context(errors::DatabaseError::NotFound)
- .attach_printable_lazy(|| "Error filtering records by predicate")
+
+ logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
+
+ query
+ .get_results_async(conn)
+ .await
+ .into_report()
+ .change_context(errors::DatabaseError::NotFound)
+ .attach_printable_lazy(|| "Error filtering records by predicate")
}
fn to_optional<T>(arg: StorageResult<T>) -> StorageResult<Option<T>> {
diff --git a/crates/storage_models/src/query/mandate.rs b/crates/storage_models/src/query/mandate.rs
index 531362e4533..32bbb91f518 100644
--- a/crates/storage_models/src/query/mandate.rs
+++ b/crates/storage_models/src/query/mandate.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use error_stack::report;
use router_env::{instrument, tracing};
@@ -32,12 +32,19 @@ impl Mandate {
merchant_id: &str,
customer_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::customer_id.eq(customer_id.to_owned())),
None,
+ None,
+ None,
)
.await
}
diff --git a/crates/storage_models/src/query/merchant_connector_account.rs b/crates/storage_models/src/query/merchant_connector_account.rs
index e541316ded0..6f6b12c1c29 100644
--- a/crates/storage_models/src/query/merchant_connector_account.rs
+++ b/crates/storage_models/src/query/merchant_connector_account.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use router_env::{instrument, tracing};
use super::generics;
@@ -90,10 +90,17 @@ impl MerchantConnectorAccount {
conn: &PgPooledConn,
merchant_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
+ None,
+ None,
)
.await
}
diff --git a/crates/storage_models/src/query/payment_attempt.rs b/crates/storage_models/src/query/payment_attempt.rs
index 4758d9209dc..4f057781ff9 100644
--- a/crates/storage_models/src/query/payment_attempt.rs
+++ b/crates/storage_models/src/query/payment_attempt.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use error_stack::IntoReport;
use router_env::{instrument, tracing};
@@ -98,13 +98,20 @@ impl PaymentAttempt {
merchant_id: &str,
) -> StorageResult<Self> {
// perform ordering on the application level instead of database level
- generics::generic_filter::<<Self as HasTable>::Table, _, Self>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ Self,
+ >(
conn,
dsl::payment_id
.eq(payment_id.to_owned())
.and(dsl::merchant_id.eq(merchant_id.to_owned()))
.and(dsl::status.eq(enums::AttemptStatus::Charged)),
None,
+ None,
+ None,
)
.await?
.into_iter()
diff --git a/crates/storage_models/src/query/payment_method.rs b/crates/storage_models/src/query/payment_method.rs
index 33fdf2d85bf..8213a886ab6 100644
--- a/crates/storage_models/src/query/payment_method.rs
+++ b/crates/storage_models/src/query/payment_method.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use router_env::{instrument, tracing};
use super::generics;
@@ -60,10 +60,17 @@ impl PaymentMethod {
conn: &PgPooledConn,
merchant_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
+ None,
+ None,
)
.await
}
@@ -74,12 +81,19 @@ impl PaymentMethod {
customer_id: &str,
merchant_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::customer_id
.eq(customer_id.to_owned())
.and(dsl::merchant_id.eq(merchant_id.to_owned())),
None,
+ None,
+ None,
)
.await
}
diff --git a/crates/storage_models/src/query/process_tracker.rs b/crates/storage_models/src/query/process_tracker.rs
index a6855cb53df..74f23ac0bf7 100644
--- a/crates/storage_models/src/query/process_tracker.rs
+++ b/crates/storage_models/src/query/process_tracker.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use router_env::{instrument, tracing};
use time::PrimitiveDateTime;
@@ -72,12 +72,19 @@ impl ProcessTracker {
status: enums::ProcessTrackerStatus,
limit: Option<i64>,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::schedule_time
.between(time_lower_limit, time_upper_limit)
.and(dsl::status.eq(status)),
limit,
+ None,
+ None,
)
.await
}
@@ -90,13 +97,20 @@ impl ProcessTracker {
runner: &str,
limit: usize,
) -> StorageResult<Vec<Self>> {
- let mut x: Vec<Self> = generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ let mut x: Vec<Self> = generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::schedule_time
.between(time_lower_limit, time_upper_limit)
.and(dsl::status.eq(enums::ProcessTrackerStatus::ProcessStarted))
.and(dsl::runner.eq(runner.to_owned())),
None,
+ None,
+ None,
)
.await?;
x.sort_by(|a, b| a.schedule_time.cmp(&b.schedule_time));
diff --git a/crates/storage_models/src/query/refund.rs b/crates/storage_models/src/query/refund.rs
index 492d5236753..c6239b278ae 100644
--- a/crates/storage_models/src/query/refund.rs
+++ b/crates/storage_models/src/query/refund.rs
@@ -1,4 +1,4 @@
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use router_env::{instrument, tracing};
use super::generics;
@@ -78,12 +78,19 @@ impl Refund {
merchant_id: &str,
connector_transaction_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::connector_transaction_id.eq(connector_transaction_id.to_owned())),
None,
+ None,
+ None,
)
.await
}
@@ -94,12 +101,19 @@ impl Refund {
payment_id: &str,
merchant_id: &str,
) -> StorageResult<Vec<Self>> {
- generics::generic_filter::<<Self as HasTable>::Table, _, _>(
+ generics::generic_filter::<
+ <Self as HasTable>::Table,
+ _,
+ <<Self as HasTable>::Table as Table>::PrimaryKey,
+ _,
+ >(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
None,
+ None,
+ None,
)
.await
}
|
feat
|
allow specifying optional offset and order clauses for `generic_filter()` (#502)
|
f3fb59ce7448f91b74d0be4a75d82e282f075a66
|
2024-07-03 05:45:23
|
github-actions
|
chore(version): 2024.07.03.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 338cc251f02..7bf81a70889 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,33 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.07.03.0
+
+### Features
+
+- **router:**
+ - Collect billing details from wallet connector based on the `collect_billing_details_from_wallet_connector` field ([#5065](https://github.com/juspay/hyperswitch/pull/5065)) ([`ee9190b`](https://github.com/juspay/hyperswitch/commit/ee9190bf4f29699a2878bc89d7a83cd77a3ce472))
+ - Add refunds manual-update api ([#5094](https://github.com/juspay/hyperswitch/pull/5094)) ([`9bc7801`](https://github.com/juspay/hyperswitch/commit/9bc780151c8ff1874d971bf8c79ae53cb6c477d8))
+
+### Bug Fixes
+
+- **auth_methods:** Add checks for duplicate `auth_method` in create API ([#5161](https://github.com/juspay/hyperswitch/pull/5161)) ([`045e974`](https://github.com/juspay/hyperswitch/commit/045e9742bd1d8985847eab47f6a38e1f750c09de))
+- **event:** Updated the ApiEventMetric ([#5126](https://github.com/juspay/hyperswitch/pull/5126)) ([`1bb2ae8`](https://github.com/juspay/hyperswitch/commit/1bb2ae8423786449e4d53ace08aa94f872cc73f2))
+- **router:**
+ - [CYBS] make payment status optional ([#5165](https://github.com/juspay/hyperswitch/pull/5165)) ([`e3470a2`](https://github.com/juspay/hyperswitch/commit/e3470a240d84e2971c5194f0aa2022eae04c0943))
+ - Update last used when the customer acceptance is passed in the recurring payment ([#5116](https://github.com/juspay/hyperswitch/pull/5116)) ([`b2e0caf`](https://github.com/juspay/hyperswitch/commit/b2e0caf6d9a33239f9819b077d3cd7dd444e60bd))
+- Realtime user analytics ([#5129](https://github.com/juspay/hyperswitch/pull/5129)) ([`5d86002`](https://github.com/juspay/hyperswitch/commit/5d86002ce7f182c9c3d478cd5eb6a43ce63f1398))
+
+### Refactors
+
+- **payment_link:** Logs payment links logs coverage ([#4918](https://github.com/juspay/hyperswitch/pull/4918)) ([`618ec41`](https://github.com/juspay/hyperswitch/commit/618ec41aff0470347ab9818066b210c458cc2d43))
+- **router:** Changed payment method token TTL to api contract based config from const value ([#5115](https://github.com/juspay/hyperswitch/pull/5115)) ([`3bbdfb5`](https://github.com/juspay/hyperswitch/commit/3bbdfb5a1c76b9b0a1139e739a5e13867b98ca27))
+- Use hashmap deserializer for generic_link options ([#5157](https://github.com/juspay/hyperswitch/pull/5157)) ([`a343f69`](https://github.com/juspay/hyperswitch/commit/a343f69dc4889c37857d41cb7da1f23445ea7ccf))
+
+**Full Changelog:** [`2024.07.02.0...2024.07.03.0`](https://github.com/juspay/hyperswitch/compare/2024.07.02.0...2024.07.03.0)
+
+- - -
+
## 2024.07.02.0
### Features
|
chore
|
2024.07.03.0
|
f513c8e4daa95a6ceb89ce616e3d55058708fb2a
|
2024-07-03 18:17:52
|
Sarthak Soni
|
feat(pm_auth): Added balance check for PM auth bank account (#5054)
| false
|
diff --git a/crates/pm_auth/src/connector/plaid/transformers.rs b/crates/pm_auth/src/connector/plaid/transformers.rs
index 9d903914483..8ce5aca7b83 100644
--- a/crates/pm_auth/src/connector/plaid/transformers.rs
+++ b/crates/pm_auth/src/connector/plaid/transformers.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use common_enums::{PaymentMethod, PaymentMethodType};
-use common_utils::id_type;
+use common_utils::{id_type, types as util_types};
use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -120,7 +120,7 @@ pub struct PlaidBankAccountCredentialsRequest {
options: Option<BankAccountCredentialsOptions>,
}
-#[derive(Debug, Deserialize, Eq, PartialEq)]
+#[derive(Debug, Deserialize, PartialEq)]
pub struct PlaidBankAccountCredentialsResponse {
pub accounts: Vec<PlaidBankAccountCredentialsAccounts>,
@@ -135,19 +135,20 @@ pub struct BankAccountCredentialsOptions {
account_ids: Vec<String>,
}
-#[derive(Debug, Deserialize, Eq, PartialEq)]
+#[derive(Debug, Deserialize, PartialEq)]
pub struct PlaidBankAccountCredentialsAccounts {
pub account_id: String,
pub name: String,
pub subtype: Option<String>,
+ pub balances: Option<PlaidBankAccountCredentialsBalances>,
}
-#[derive(Debug, Deserialize, Eq, PartialEq)]
+#[derive(Debug, Deserialize, PartialEq)]
pub struct PlaidBankAccountCredentialsBalances {
- pub available: Option<i32>,
- pub current: Option<i32>,
- pub limit: Option<i32>,
+ pub available: Option<util_types::FloatMajorUnit>,
+ pub current: Option<util_types::FloatMajorUnit>,
+ pub limit: Option<util_types::FloatMajorUnit>,
pub iso_currency_code: Option<String>,
pub unofficial_currency_code: Option<String>,
pub last_updated_datetime: Option<String>,
@@ -242,16 +243,27 @@ impl<F, T>
let mut id_to_subtype = HashMap::new();
accounts_info.into_iter().for_each(|acc| {
- id_to_subtype.insert(acc.account_id, (acc.subtype, acc.name));
+ id_to_subtype.insert(
+ acc.account_id,
+ (
+ acc.subtype,
+ acc.name,
+ acc.balances.and_then(|balance| balance.available),
+ ),
+ );
});
account_numbers.ach.into_iter().for_each(|ach| {
- let (acc_type, acc_name) =
- if let Some((_type, name)) = id_to_subtype.get(&ach.account_id) {
- (_type.to_owned(), Some(name.clone()))
- } else {
- (None, None)
- };
+ let (acc_type, acc_name, available_balance) = if let Some((
+ _type,
+ name,
+ available_balance,
+ )) = id_to_subtype.get(&ach.account_id)
+ {
+ (_type.to_owned(), Some(name.clone()), *available_balance)
+ } else {
+ (None, None, None)
+ };
let account_details =
types::PaymentMethodTypeDetails::Ach(types::BankAccountDetailsAch {
@@ -266,17 +278,19 @@ impl<F, T>
payment_method: PaymentMethod::BankDebit,
account_id: ach.account_id.into(),
account_type: acc_type,
+ balance: available_balance,
};
bank_account_vec.push(bank_details_new);
});
account_numbers.bacs.into_iter().for_each(|bacs| {
- let (acc_type, acc_name) =
- if let Some((_type, name)) = id_to_subtype.get(&bacs.account_id) {
- (_type.to_owned(), Some(name.clone()))
+ let (acc_type, acc_name, available_balance) =
+ if let Some((_type, name, available_balance)) = id_to_subtype.get(&bacs.account_id)
+ {
+ (_type.to_owned(), Some(name.clone()), *available_balance)
} else {
- (None, None)
+ (None, None, None)
};
let account_details =
@@ -292,17 +306,19 @@ impl<F, T>
payment_method: PaymentMethod::BankDebit,
account_id: bacs.account_id.into(),
account_type: acc_type,
+ balance: available_balance,
};
bank_account_vec.push(bank_details_new);
});
account_numbers.international.into_iter().for_each(|sepa| {
- let (acc_type, acc_name) =
- if let Some((_type, name)) = id_to_subtype.get(&sepa.account_id) {
- (_type.to_owned(), Some(name.clone()))
+ let (acc_type, acc_name, available_balance) =
+ if let Some((_type, name, available_balance)) = id_to_subtype.get(&sepa.account_id)
+ {
+ (_type.to_owned(), Some(name.clone()), *available_balance)
} else {
- (None, None)
+ (None, None, None)
};
let account_details =
@@ -318,6 +334,7 @@ impl<F, T>
payment_method: PaymentMethod::BankDebit,
account_id: sepa.account_id.into(),
account_type: acc_type,
+ balance: available_balance,
};
bank_account_vec.push(bank_details_new);
diff --git a/crates/pm_auth/src/types.rs b/crates/pm_auth/src/types.rs
index f2a848c2f60..2537cdc6a36 100644
--- a/crates/pm_auth/src/types.rs
+++ b/crates/pm_auth/src/types.rs
@@ -4,7 +4,7 @@ use std::marker::PhantomData;
use api::auth_service::{BankAccountCredentials, ExchangeToken, LinkToken};
use common_enums::{PaymentMethod, PaymentMethodType};
-use common_utils::id_type;
+use common_utils::{id_type, types};
use masking::Secret;
#[derive(Debug, Clone)]
pub struct PaymentAuthRouterData<F, Request, Response> {
@@ -78,6 +78,7 @@ pub struct BankAccountDetails {
pub payment_method: PaymentMethod,
pub account_id: Secret<String>,
pub account_type: Option<String>,
+ pub balance: Option<types::FloatMajorUnit>,
}
#[derive(Debug, Clone)]
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 1523ac18cb5..e58e16cc631 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2023,7 +2023,10 @@ pub async fn list_payment_methods(
.await
.transpose()?;
- let mut pmt_to_auth_connector = HashMap::new();
+ let mut pmt_to_auth_connector: HashMap<
+ enums::PaymentMethod,
+ HashMap<enums::PaymentMethodType, String>,
+ > = HashMap::new();
if let Some((payment_attempt, payment_intent)) =
payment_attempt.as_ref().zip(payment_intent.as_ref())
@@ -2197,24 +2200,35 @@ pub async fn list_payment_methods(
None
});
- let matched_config = match pm_auth_config {
- Some(config) => {
- let internal_config = config
- .enabled_payment_methods
- .iter()
- .find(|config| config.payment_method_type == *payment_method_type)
- .cloned();
-
- internal_config
- }
- None => None,
+ if let Some(config) = pm_auth_config {
+ config
+ .enabled_payment_methods
+ .iter()
+ .for_each(|inner_config| {
+ if inner_config.payment_method_type == *payment_method_type {
+ let pm = pmt_to_auth_connector
+ .get(&inner_config.payment_method)
+ .cloned();
+
+ let inner_map = if let Some(mut inner_map) = pm {
+ inner_map.insert(
+ *payment_method_type,
+ inner_config.connector_name.clone(),
+ );
+ inner_map
+ } else {
+ HashMap::from([(
+ *payment_method_type,
+ inner_config.connector_name.clone(),
+ )])
+ };
+
+ pmt_to_auth_connector
+ .insert(inner_config.payment_method, inner_map);
+ val.push(inner_config.clone());
+ }
+ });
};
-
- if let Some(config) = matched_config {
- pmt_to_auth_connector
- .insert(*payment_method_type, config.connector_name.clone());
- val.push(config);
- }
}
}
@@ -2524,7 +2538,8 @@ pub async fn list_payment_methods(
.cloned(),
surcharge_details: None,
pm_auth_connector: pmt_to_auth_connector
- .get(payment_method_types_hm.0)
+ .get(key.0)
+ .and_then(|pm_map| pm_map.get(payment_method_types_hm.0))
.cloned(),
})
}
@@ -2561,7 +2576,8 @@ pub async fn list_payment_methods(
.cloned(),
surcharge_details: None,
pm_auth_connector: pmt_to_auth_connector
- .get(payment_method_types_hm.0)
+ .get(key.0)
+ .and_then(|pm_map| pm_map.get(payment_method_types_hm.0))
.cloned(),
})
}
@@ -2592,7 +2608,10 @@ pub async fn list_payment_methods(
.and_then(|inner_hm| inner_hm.get(key.0))
.cloned(),
surcharge_details: None,
- pm_auth_connector: pmt_to_auth_connector.get(&payment_method_type).cloned(),
+ pm_auth_connector: pmt_to_auth_connector
+ .get(&enums::PaymentMethod::BankRedirect)
+ .and_then(|pm_map| pm_map.get(key.0))
+ .cloned(),
}
})
}
@@ -2625,7 +2644,10 @@ pub async fn list_payment_methods(
.and_then(|inner_hm| inner_hm.get(key.0))
.cloned(),
surcharge_details: None,
- pm_auth_connector: pmt_to_auth_connector.get(&payment_method_type).cloned(),
+ pm_auth_connector: pmt_to_auth_connector
+ .get(&enums::PaymentMethod::BankDebit)
+ .and_then(|pm_map| pm_map.get(key.0))
+ .cloned(),
}
})
}
@@ -2658,7 +2680,10 @@ pub async fn list_payment_methods(
.and_then(|inner_hm| inner_hm.get(key.0))
.cloned(),
surcharge_details: None,
- pm_auth_connector: pmt_to_auth_connector.get(&payment_method_type).cloned(),
+ pm_auth_connector: pmt_to_auth_connector
+ .get(&enums::PaymentMethod::BankTransfer)
+ .and_then(|pm_map| pm_map.get(key.0))
+ .cloned(),
}
})
}
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index e78c2153bb7..508b9e8ef8b 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -15,6 +15,7 @@ use common_utils::{
crypto::{HmacSha256, SignMessage},
ext_traits::AsyncExt,
generate_id,
+ types::{self as util_types, AmountConvertor},
};
use error_stack::ResultExt;
use helpers::PaymentAuthConnectorDataExt;
@@ -66,6 +67,19 @@ pub async fn create_link_token(
let pm_auth_key = format!("pm_auth_{}", payload.payment_id);
+ redis_conn
+ .exists::<Vec<u8>>(&pm_auth_key)
+ .await
+ .change_context(ApiErrorResponse::InvalidRequestData {
+ message: "Incorrect payment_id provided in request".to_string(),
+ })
+ .attach_printable("Corresponding pm_auth_key does not exist in redis")?
+ .then_some(())
+ .ok_or(ApiErrorResponse::InvalidRequestData {
+ message: "Incorrect payment_id provided in request".to_string(),
+ })
+ .attach_printable("Corresponding pm_auth_key does not exist in redis")?;
+
let pm_auth_configs = redis_conn
.get_and_deserialize_key::<Vec<api_models::pm_auth::PaymentMethodAuthConnectorChoice>>(
pm_auth_key.as_str(),
@@ -637,6 +651,19 @@ async fn get_selected_config_from_redis(
let pm_auth_key = format!("pm_auth_{}", payload.payment_id);
+ redis_conn
+ .exists::<Vec<u8>>(&pm_auth_key)
+ .await
+ .change_context(ApiErrorResponse::InvalidRequestData {
+ message: "Incorrect payment_id provided in request".to_string(),
+ })
+ .attach_printable("Corresponding pm_auth_key does not exist in redis")?
+ .then_some(())
+ .ok_or(ApiErrorResponse::InvalidRequestData {
+ message: "Incorrect payment_id provided in request".to_string(),
+ })
+ .attach_printable("Corresponding pm_auth_key does not exist in redis")?;
+
let pm_auth_configs = redis_conn
.get_and_deserialize_key::<Vec<api_models::pm_auth::PaymentMethodAuthConnectorChoice>>(
pm_auth_key.as_str(),
@@ -720,6 +747,21 @@ pub async fn retrieve_payment_method_from_auth_service(
.ok_or(ApiErrorResponse::InternalServerError)
.attach_printable("Bank account details not found")?;
+ if let (Some(balance), Some(currency)) = (bank_account.balance, payment_intent.currency) {
+ let required_conversion = util_types::FloatMajorUnitForConnector;
+ let converted_amount = required_conversion
+ .convert_back(balance, currency)
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not convert FloatMajorUnit to MinorUnit")?;
+
+ if converted_amount < payment_intent.amount {
+ return Err((ApiErrorResponse::PreconditionFailed {
+ message: "selected bank account has insufficient balance".to_string(),
+ })
+ .into());
+ }
+ }
+
let mut bank_type = None;
if let Some(account_type) = bank_account.account_type.clone() {
bank_type = common_enums::BankType::from_str(account_type.as_str())
|
feat
|
Added balance check for PM auth bank account (#5054)
|
da1f604bb86293b9897d5eb2a0242afb36956efa
|
2024-07-15 18:07:18
|
GORAKHNATH YADAV
|
docs: Updating Error codes in API-ref (#5296)
| false
|
diff --git a/api-reference/essentials/error_codes.mdx b/api-reference/essentials/error_codes.mdx
index f3f9981292f..2f633e9cffe 100644
--- a/api-reference/essentials/error_codes.mdx
+++ b/api-reference/essentials/error_codes.mdx
@@ -9,6 +9,7 @@ Hyperswitch uses Error codes, types, and messages to communicate errors during A
| IR | Invalid Request Error | Error caused due to invalid fields and values in API request |
| CE | Connector Error | Errors originating from connector’s end |
| HE | Hyperswitch Error | Errors originating from Hyperswitch’s end |
+| WE | Webhook Error | Errors related to Webhooks |
| Error Codes | HTTP Status codes | Error Type | Error message | Error Handling |
| ----------- | ------------------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -22,39 +23,55 @@ Hyperswitch uses Error codes, types, and messages to communicate errors during A
| IR_07 | 400 | invalid_request_error | Invalid value provided: “field_name” | Provide a valid value for the required fields in the expected format. Refer to our API documentation |
| IR_08 | 400 | invalid_request_error | Client secret was not provided | Provide the client secret received in payments/create API response |
| IR_09 | 400 | invalid_request_error | The client_secret provided does not match the client_secret associated with the Payment | Provide the same client secret received in payments/create API response for the corresponding payment |
-| IR_10 | 400 | invalid_request_error | Customer has an existing mandate/subscription | Cancel the active mandates/subscriptions for the customer before proceeding to delete the customer data |
+| IR_10 | 400 | invalid_request_error | Customer has an existing mandate/subscription | Cancel the active mandates/subscriptions for the customer before proceeding to delete the customer data |
| IR_11 | 400 | invalid_request_error | Customer has already been redacted | Customer has already been redacted. No action required |
-| IR_12 | 400 | invalid_request_error | Reached the maximum refund attempts | Maximum refund attempts reached for this payment. Please contact Hyperswitch support for attempting more refunds for the same payment |
+| IR_12 | 400 | invalid_request_error | Reached the maximum refund attempts | Maximum refund attempts reached for this payment. Please contact Hyperswitch support for attempting more refunds for the same payment |
| IR_13 | 400 | invalid_request_error | Refund amount exceeds the payment amount | Please verify and pass a refund amount equal to or less than the payment amount |
| IR_14 | 400 | invalid_request_error | This Payment could not be “current_flow” because it has a “field_name” of “current_value”. The expected state is “states” | Please verify the status of the payment and make sure that you are performing an action that is allowed for the current status of the payment |
| IR_15 | 400 | invalid_request_error | Invalid Ephemeral Key for the customer | Please pass the right Ephemeral key for the customer |
| IR_16 | 400 | invalid_request_error | “message” | Typically used when information involving multiple fields or previously provided information doesn’t satisfy a condition. Refer to our API documentation for required fields and format |
-| IR_17 | 401 | invalid_request_error | Access forbidden, an invalid JWT token was used | Please provide a valid JWT token to access the APIs |
+| IR_17 | 401 | invalid_request_error | Access forbidden, an invalid JWT token was used | Provide a valid JWT token to access the APIs |
+| IR_18 | 401 | invalid_request_error | "message" | The user is not authorised to update the customer, Contact Org. Admin for the appropriate access. |
+| IR_19 | 400 | invalid_request_error | "message" | Please check and retry with correct details. Refer to our API documentation |
+| IR_20 | 400 | invalid_request_error | "flow" not supported by the "connector" | Requested flow is not supported for this Connector. |
+| IR_21 | 400 | invalid_request_error | Missing required params | Please add the required params in the request. Refer to our API documentation |
+| IR_22 | 403 | invalid_request_error | Access forbidden. Not authorized to access this "resource" | Contact Org. Admin for the appropriate access. |
+| IR_23 | 400 | invalid_request_error | "message" | Use a supported file provider. Refer to our API documentation |
+| IR_24 | 422 | processing_error | Invalid "wallet_name" wallet token | Share the correct wallet token. |
+| IR_25 | 400 | invalid_request_error | Cannot delete the default payment method | Check if the Payment method is activated. Refer to Control centre to check this. |
+| IR_26 | 400 | invalid_request_error | Invalid Cookie | Recheck the site setting for the cookies. |
+| IR_27 | 404 | invalid_request_error | Extended card info does not exist | Recheck the card info shared in the request. |
+| IR_28 | 400 | invalid_request_error | "message" | Use a valid currency. Refer to our API documentation |
+| IR_29 | 422 | invalid_request_error | "message" | The data format is invalid for this request. Refer to our API documentation |
+| IR_30 | 400 | invalid_request_error | Merchant connector account is configured with invalid config | Correct the config for merchant connector account |
+| IR_31 | 400 | invalid_request_error | Card with the provided iin does not exist | Check the IIN (Issuer Identification Number) and ensure it is correct. |
+| IR_32 | 400 | invalid_request_error | The provided card IIN length is invalid, please provide an iin with 6 or 8 digits | Provide a valid IIN with either 6 or 8 digits. |
+| IR_33 | 400 | invalid_request_error | File not found / valid in the request | Ensure the required file is included in the request and is valid. Refer to our API documentation |
+| IR_34 | 400 | invalid_request_error | Dispute id not found in the request | Ensure that a valid dispute ID is included in the request. |
+| IR_35 | 400 | invalid_request_error | File purpose not found in the request or is invalid | Specify a valid file purpose in the request. |
+| IR_36 | 400 | invalid_request_error | File content type not found / valid | Ensure the file content type is specified and is valid. |
+| IR_37 | 404 | invalid_request_error | "message" | Check the request for the resource being accessed and ensure it exists. |
+| IR_38 | 400 | invalid_request_error | "message" | Check for any duplicate entries in the request and correct them. |
+| IR_39 | 400 | invalid_request_error | required payment method is not configured or configured incorrectly for all configured connectors | Verify that the required payment method is correctly configured for all connectors in use. |
| CE_00 | Status codes shared by the connectors | connector_error | “message” | The error code and message passed from the connectors. Refer to the respective connector’s documentation for more information on the error |
-| CE_01 | 400 | processing_error | Payment failed during authorization with the connector. Retry payment | Retry the payment again as payment failed at the connector during authorization |
-| CE_02 | 400 | processing_error | Payment failed during authentication with the connector. Retry payment | Retry the payment again as payment failed at the connector during authentication |
-| CE_03 | 400 | processing_error | Capture attempt failed while processing with the connector | Capture failed for the payment at the connector. Please retry the payment |
+| CE_01 | 400 | processing_error | Payment failed during authorization with the connector. Retry payment | Retry the payment again as payment failed at the connector during authorization |
+| CE_02 | 400 | processing_error | Payment failed during authentication with the connector. Retry payment | Retry the payment again as payment failed at the connector during authentication |
+| CE_03 | 400 | processing_error | Capture attempt failed while processing with the connector | Capture failed for the payment at the connector. Please retry the payment |
| CE_04 | 400 | processing_error | The card data is invalid | Invalid card data passed. Please pass valid card data |
| CE_05 | 400 | processing_error | The card has expired | Card expired. Please pass valid card data |
-| CE_06 | 400 | processing_error | Refund failed while processing with the connector. Retry refund | Refund failed to process at the connector. Please retry refund |
-| CE_07 | 400 | processing_error | Verification failed while processing with the connector. Retry operation | Retry the operation again as verification failed at the connector |
-| HE_00 | 500 | server_not_available | Something went wrong | Please retry the operation. If the error still persists, please reach out to Hyperswitch support |
-| HE_01 | 400 | duplicate_request | Duplicate refund request. Refund already attempted with the refund ID | Please verify the refund id and no action required if the refund is already attempted |
-| HE_01 | 400 | duplicate_request | Duplicate mandate request. Mandate already attempted with the Mandate ID | Please verify the mandate id and no action required if the mandate is already created |
-| HE_01 | 400 | duplicate_request | The merchant account with the specified details already exists in our records | Please verify the merchant account details and no action required if the merchant account is already created |
-| HE_01 | 400 | duplicate_request | The merchant connector account with the specified details already exists in our records | Please verify the merchant connector account details and no action required if the merchant connector account is already created |
-| HE_01 | 400 | duplicate_request | The payment method with the specified details already exists in our records | Please verify the mandate id and no action required if the mandate is already created |
-| HE_02 | 400 | object_not_found | Refund does not exist in our records | Please verify the refund details and enter valid details |
-| HE_02 | 400 | object_not_found | Customer does not exist in our records | Please verify the customer details and enter valid details |
-| HE_02 | 400 | object_not_found | Payment does not exist in our records | Please verify the payment details and enter valid details |
-| HE_02 | 400 | object_not_found | Payment method does not exist in our records | Please verify the payment method details and enter valid details |
-| HE_02 | 400 | object_not_found | Merchant account does not exist in our records | Please verify the merchant account details and enter valid details |
-| HE_02 | 400 | object_not_found | Merchant connector account does not exist in our records | Please verify the merchant connector details and enter valid details |
-| HE_02 | 400 | object_not_found | Resource ID does not exist in our records | Please verify the resource ID and enter valid details |
-| HE_02 | 400 | object_not_found | Mandate does not exist in our records | Please verify the mandate details and enter valid details |
-| HE_03 | 400 | validation_error | Refunds not possible through Hyperswitch. Please raise Refunds through the “connector” dashboard | Please raise refunds request from the respective connector’s dashboard as the connectors don’t provide a Refunds API for Hyperswitch to process |
-| HE_03 | 400 | validation_error | Mandate Validation Failed | Please verify the mandate details again and enter valid details |
-| HE_04 | 400 | validation_error | The payment has not succeeded yet. Please pass a successful payment to initiate refund | Please verify the request parameters and retry the payment. If the error still persists, please reach out to Hyperswitch support |
-| HE_04 | 400 | object_not_found | Successful payment not found for the given payment id | Please verify the payment details and status as you can attempt refunds only for payments with success status |
-| HE_04 | 400 | object_not_found | The connector provided in the request is incorrect or not available | Please verify your connector configuration and provide a valid connector that is enabled for your account |
-| HE_04 | 400 | object_not_found | Address does not exist in our records | Please verify the address details and pass valid address details |
+| CE_06 | 400 | processing_error | Refund failed while processing with the connector. Retry refund | Refund failed to process at the connector. Please retry refund |
+| CE_07 | 400 | processing_error | Verification failed while processing with the connector. Retry operation | Retry the operation again as verification failed at the connector |
+| CE_08 | 400 | processing_error | Dispute operation failed while processing with connector. Retry operation | Retry the operation again as dispute failed at the connector |
+| CE_09 | 400 | invalid_request_error | Payout validation failed | Retry the operation again with correct Payout details. |
+| HE_00 | 422,500 | server_not_available | Resource not available right now, Please try again later. | Please Wait for a few moments and try again. If the error still persists, please reach out to Hyperswitch support |
+| HE_01 | 400,422 | duplicate_request | Requested operation(Customer, Payments, Merchants, Refunds etc.) for these identifier already exists. | Please verify the Details(Customer, Payments, Merchants, Refunds, as applicable on the basis of request) and enter valid details. |
+| HE_02 | 404 | object_not_found | Requested object(Customer, Payments, Merchants, Refunds etc.) does not exist in our records | Please verify the Details(Customer, Payments, Merchants, Refunds, as applicable on the basis of request) and enter valid details. |
+| HE_03 | 500 | validation_error | Validation Failed for the requested operation with the given details. | Please verify the details again and enter valid details |
+| HE_04 | 404 | object_not_found | Requested object(Customer, Payments, Merchants, Refunds etc.) does not exist in our records | Please verify the Details(Customer, Payments, Merchants, Refunds, as applicable on the basis of request) and enter valid details. |
+| HE_05 | 500 | processing_error | Missing or invalid tenant details. | Please verify the tenant Details and try again. |
+| WE_01 | 400 | invalid_request_error | Failed to authenticate the webhook | Please verify the authentication credentials and try again. |
+| WE_02 | 400 | invalid_request_error | Bad request received in webhook | Check the request parameters and format, then try again. |
+| WE_03 | 500 | router_error | There was some issue processing the webhook | Please try again later. If the issue persists, contact Hyperswitch support. |
+| WE_04 | 404 | object_not_found | Webhook resource not found | Ensure the webhook URL is correct and the resource exists. |
+| WE_05 | 400 | invalid_request_error | Unable to process the webhook body | Ensure the webhook body is correctly formatted and try again. |
+| WE_06 | 400 | invalid_request_error | Merchant Secret set by merchant for webhook source verification is invalid | Verify the Merchant Secret, then try again. |
\ No newline at end of file
|
docs
|
Updating Error codes in API-ref (#5296)
|
f79c12d4f78ac622300e56f7159ca72d65a4ac0d
|
2024-05-17 05:44:25
|
github-actions
|
chore(version): 2024.05.17.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae5b12e5ce1..a3bf7c5e24c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.05.17.0
+
+### Bug Fixes
+
+- **core:** Use `realip_remote_addr` function to extract ip address ([#4653](https://github.com/juspay/hyperswitch/pull/4653)) ([`8427b60`](https://github.com/juspay/hyperswitch/commit/8427b60a1851f2d9d2f141f28eb122d42f680736))
+- **recon:** Make recon status optional in merchant account ([#4654](https://github.com/juspay/hyperswitch/pull/4654)) ([`84cb2bc`](https://github.com/juspay/hyperswitch/commit/84cb2bcb6bbb82f54315c82c7421a222d2e37bc6))
+
+### Refactors
+
+- **access_token:** Handle network delays with expiry of access token ([#4617](https://github.com/juspay/hyperswitch/pull/4617)) ([`0d45f85`](https://github.com/juspay/hyperswitch/commit/0d45f854a2cc18cc421a3d449a6dc2c830ef9dd5))
+- **cards,router:** Remove duplicated card number interface ([#4404](https://github.com/juspay/hyperswitch/pull/4404)) ([`27ae437`](https://github.com/juspay/hyperswitch/commit/27ae437a88492bf5b17ad2fbf4a083891602c07a))
+
+### Miscellaneous Tasks
+
+- Add deprecated flag to soon to be deprecated fields in payment request and response ([#4261](https://github.com/juspay/hyperswitch/pull/4261)) ([`9ac5d70`](https://github.com/juspay/hyperswitch/commit/9ac5d70e2ed0a036b5f2bfe7488f218b83fce7c3))
+
+**Full Changelog:** [`2024.05.16.1...2024.05.17.0`](https://github.com/juspay/hyperswitch/compare/2024.05.16.1...2024.05.17.0)
+
+- - -
+
## 2024.05.16.1
### Features
|
chore
|
2024.05.17.0
|
b3772272678dd9e93b7afc7958b3344cbfe64708
|
2024-10-16 15:03:59
|
Neeraj
|
docs: simplify README (#6306)
| false
|
diff --git a/README.md b/README.md
index 3814ac925ad..e8dd2f31674 100644
--- a/README.md
+++ b/README.md
@@ -10,15 +10,11 @@ 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="#for-enterprises">For Enterprises</a> •
- <a href="#for-contributors">For Contributors</a> •
<a href="#quick-setup">Quick Setup</a> •
<a href="/docs/try_local_system.md">Local Setup Guide (Hyperswitch App Server)</a> •
- <a href="#fast-integration-for-stripe-users">Fast Integration for Stripe Users</a> •
<a href="https://api-reference.hyperswitch.io/introduction"> API Docs </a>
<br>
- <a href="#supported-features">Supported Features</a> •
- <a href="#community">Community</a> •
+ <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>
@@ -50,53 +46,39 @@ The single API to access payment ecosystems across 130+ countries</div>
<hr>
<img src="./docs/imgs/switch.png" />
-Hyperswitch is a community-led, open payments switch to enable access to the best payments infrastructure for every digital business.
+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.
-Using Hyperswitch, you can:
+Here are the components of Hyperswitch that deliver the whole solution:
-- ⬇️ **Reduce dependency** on a single processor like Stripe or Braintree
-- 🧑💻 **Reduce Dev effort** by 90% to add & maintain integrations
-- 🚀 **Improve success rates** with seamless failover and auto-retries
-- 💸 **Reduce processing fees** with smart routing
-- 🎨 **Customize payment flows** with full visibility and control
-- 🌐 **Increase business reach** with local/alternate payment methods
+* [Hyperswitch Backend](https://github.com/juspay/hyperswitch): Powering Payment Processing
-<br>
-<img src="./docs/imgs/hyperswitch-product.png" alt="Hyperswitch-Product" width="50%"/>
+* [SDK (Frontend)](https://github.com/juspay/hyperswitch-web): Simplifying Integration and Powering the UI
-<a href="https://app.hyperswitch.io/">
- <h2 id="try-a-payment">⚡️ Try a Payment</h2>
-</a>
+* [Control Centre](https://github.com/juspay/hyperswitch-control-center): Managing Operations with Ease
-To quickly experience the ease that Hyperswitch provides while handling the payment, you can signup on [hyperswitch-control-center][dashboard-link], and try a payment.
+Jump in and contribute to these repositories to help improve and expand Hyperswitch!
-Congratulations 🎉 on making your first payment with Hyperswitch.
+<br>
+<img src="./docs/imgs/hyperswitch-product.png" alt="Hyperswitch-Product" width="50%"/>
-<a href="#Get Started with Hyperswitch">
- <h2 id="get-started-with-hyperswitch">Get Started with Hyperswitch</h2>
+<a href="#Quick Setup">
+ <h2 id="quick-setup">⚡️ Quick Setup</h2>
</a>
-### [For Enterprises][docs-link-for-enterprise]
- Hyperswitch helps enterprises in -
- - Improving profitability
- - Increasing conversion rates
- - Lowering payment costs
- - Streamlining payment operations
-
- Hyperswitch has ample features for businesses of all domains and sizes. [**Check out our offerings**][website-link].
+### Docker Compose
-### [For Contributors][contributing-guidelines]
-
- Hyperswitch is an open-source project that aims to make digital payments accessible to people across the globe like a basic utility. With the vision of developing Hyperswitch as the **Linux of Payments**, we seek support from developers worldwide.
+You can run Hyperswitch on your system using Docker Compose after cloning this repository:
- Utilise the following resources to quickstart your journey with Hyperswitch -
- - [Guide for contributors][contributing-guidelines]
- - [Developer Docs][docs-link-for-developers]
- - [Learning Resources][learning-resources]
+```shell
+git clone --depth 1 --branch latest https://github.com/juspay/hyperswitch
+cd hyperswitch
+docker compose up -d
+```
-<a href="#Quick Setup">
- <h2 id="quick-setup">⚡️ Quick Setup</h2>
-</a>
+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].
### One-click deployment on AWS cloud
@@ -111,21 +93,6 @@ The fastest and easiest way to try Hyperswitch is via our CDK scripts
3. Follow the instructions provided on the console to successfully deploy Hyperswitch
-### Run it on your system
-
-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
-cd hyperswitch
-docker compose up -d
-```
-
-This will start the app server, web client 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].
-
[docs-link-for-enterprise]: https://docs.hyperswitch.io/hyperswitch-cloud/quickstart
[docs-link-for-developers]: https://docs.hyperswitch.io/hyperswitch-open-source/overview
[contributing-guidelines]: docs/CONTRIBUTING.md
@@ -134,77 +101,23 @@ setup, which includes the [scheduler and monitoring services][docker-compose-sch
[learning-resources]: https://docs.hyperswitch.io/learn-more/payment-flows
[local-setup-guide]: /docs/try_local_system.md
[docker-compose-scheduler-monitoring]: /docs/try_local_system.md#running-additional-services
-<a href="#Fast-Integration-for-Stripe-Users">
- <h2 id="fast-integration-for-stripe-users">🔌 Fast Integration for Stripe Users</h2>
-</a>
-
-If you are already using Stripe, integrating with Hyperswitch is fun, fast & easy.
-Try the steps below to get a feel for how quick the setup is:
-
-1. Get API keys from our [dashboard].
-2. Follow the instructions detailed on our
- [documentation page][migrate-from-stripe].
-[dashboard]: https://app.hyperswitch.io/register
-[migrate-from-stripe]: https://hyperswitch.io/docs/migrateFromStripe
-
-<a href="#Supported-Features">
- <h2 id="supported-features">✅ Supported Features</h2>
+<a href="https://app.hyperswitch.io/">
+ <h2 id="try-a-payment">⚡️ Try a Payment</h2>
</a>
-### 🌟 Supported Payment Processors and Methods
+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!
-As of Aug 2024, Hyperswitch supports 50+ payment processors and multiple global payment methods.
-In addition, we are continuously integrating new processors based on their reach and community requests.
-Our target is to support 100+ processors by H2 2024.
-You can find the latest list of payment processors, supported methods, and features [here][supported-connectors-and-features].
-
-[supported-connectors-and-features]: https://hyperswitch.io/pm-list
-
-### 🌟 Hosted Version
-
-In addition to all the features of the open-source product, our hosted version
-provides features and support to manage your payment infrastructure, compliance,
-analytics, and operations end-to-end:
-
-- **System Performance & Reliability**
-
- - Scalable to support 50000 tps
- - System uptime of up to 99.99%
- - Deployment with very low latency
- - Hosting option with AWS or GCP
-
-- **Value Added Services**
-
- - Compliance Support, incl. PCI, GDPR, Card Vault etc
- - Customise the integration or payment experience
- - Control Center with elaborate analytics and reporting
- - Integration with Risk Management Solutions
- - Integration with other platforms like Subscription, E-commerce, Accounting,
- etc.
-
-- **Enterprise Support**
-
- - 24x7 Email / On-call Support
- - Dedicated Relationship Manager
- - Custom dashboards with deep analytics, alerts, and reporting
- - Expert team to consult and improve business metrics
-
-You can [try the hosted version in our sandbox][dashboard].
+<a href="#community-contributions">
+ <h2 id="community-contributions">✅ Community & Contributions</h2>
+</a>
-<!--
-## Documentation
+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.
-Please refer to the following documentation pages:
+Our [Contribution Guide](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md) describes how to contribute to the codebase and Docs.
-- Getting Started Guide [Link]
-- API Reference [Link]
-- Payments Fundamentals [Link]
-- Installation Support [Link]
-- Router Architecture [Link]
- -->
+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)
-<!-- ### Sub-Crates -->
<a href="#Join-us-in-building-Hyperswitch">
<h2 id="join-us-in-building-hyperswitch">💪 Join us in building Hyperswitch</h2>
@@ -236,61 +149,7 @@ reusable core and let companies build and customise it as per their specific req
Security and Performance SLAs.
5. Maximise Value Creation: For developers, customers & partners.
-### 🤍 Contributing
-
-This project is being created and maintained by [Juspay](https://juspay.in),
-South Asia's largest payments orchestrator/switch, processing more than 50
-Million transactions per day. The solution has 1Mn+ lines of Haskell code built
-over ten years.
-Hyperswitch leverages our experience in building large-scale, enterprise-grade &
-frictionless payment solutions.
-It is built afresh for the global markets as an open-source product in Rust.
-We are long-term committed to building and making it useful for the community.
-
-The product roadmap is open for the community's feedback.
-We shall evolve a prioritisation process that is open and community-driven.
-We welcome contributions from the community. Please read through our
-[contributing guidelines](/docs/CONTRIBUTING.md).
-Included are directions for opening issues, coding standards, and notes on
-development.
-
-- We appreciate all types of contributions: code, documentation, demo creation, or some new way you want to contribute to us.
- We will reward every contribution with a Hyperswitch branded t-shirt.
-- 🦀 **Important note for Rust developers**: We aim for contributions from the community across a broad range of tracks.
- Hence, we have prioritised simplicity and code readability over purely idiomatic code.
- For example, some of the code in core functions (e.g., `payments_core`) is written to be more readable than pure-idiomatic.
-
-<a href="#Community">
- <h2 id="community">👥 Community</h2>
-</a>
-
-Get updates on Hyperswitch development and chat with the community:
-
-- [Discord server][discord] for questions related to contributing to hyperswitch, questions about the architecture, components, etc.
-- [Slack workspace][slack] for questions related to integrating hyperswitch, integrating a connector in hyperswitch, etc.
-- [GitHub Discussions][github-discussions] to drop feature requests or suggest anything payments-related you need for your stack.
-
-[discord]: https://discord.gg/wJZ7DVW8mm
-[slack]: https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg
-[github-discussions]: https://github.com/juspay/hyperswitch/discussions
-
-<div style="display: flex; justify-content: center;">
- <div style="margin-right:10px">
- <a href="https://www.producthunt.com/posts/hyperswitch-2?utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-hyperswitch-2" target="_blank">
- <img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=375220&theme=light&period=weekly" alt="Hyperswitch - Fast, reliable, and affordable open source payments switch | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
- </a>
- </div>
- <div style="margin-right:10px">
- <a href="https://www.producthunt.com/posts/hyperswitch-2?utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-hyperswitch-2" target="_blank">
- <img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=375220&theme=light&period=weekly&topic_id=267" alt="Hyperswitch - Fast, reliable, and affordable open source payments switch | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
- </a>
- </div>
- <div style="margin-right:10px">
- <a href="https://www.producthunt.com/posts/hyperswitch-2?utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-hyperswitch-2" target="_blank">
- <img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=375220&theme=light&period=weekly&topic_id=93" alt="Hyperswitch - Fast, reliable, and affordable open source payments switch | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
- </a>
- </div>
-</div>
+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>
|
docs
|
simplify README (#6306)
|
6890e9029d90bfd518ba23979a0bd507853dc983
|
2023-12-20 18:41:45
|
github-actions
|
test(postman): update postman collection files
| false
|
diff --git a/postman/collection-json/prophetpay.postman_collection.json b/postman/collection-json/prophetpay.postman_collection.json
new file mode 100644
index 00000000000..bd946301f55
--- /dev/null
+++ b/postman/collection-json/prophetpay.postman_collection.json
@@ -0,0 +1,1418 @@
+{
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);",
+ "}",
+ "",
+ "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "item": [
+ {
+ "name": "Health check",
+ "item": [
+ {
+ "name": "New Request",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Flow Testcases",
+ "item": [
+ {
+ "name": "QuickStart",
+ "item": [
+ {
+ "name": "Merchant Account - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id",
+ "if (jsonData?.merchant_id) {",
+ " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);",
+ " console.log(",
+ " \"- use {{merchant_id}} as collection variable for value\",",
+ " jsonData.merchant_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key",
+ "if (jsonData?.publishable_key) {",
+ " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);",
+ " console.log(",
+ " \"- use {{publishable_key}} as collection variable for value\",",
+ " jsonData.publishable_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"merchant_id\":\"postman_merchant_GHAction_{{$guid}}\",\"locker_id\":\"m0010\",\"merchant_name\":\"NewAge Retailer\",\"merchant_details\":{\"primary_contact_person\":\"John Test\",\"primary_email\":\"[email protected]\",\"primary_phone\":\"sunt laborum\",\"secondary_contact_person\":\"John Test2\",\"secondary_email\":\"[email protected]\",\"secondary_phone\":\"cillum do dolor id\",\"website\":\"www.example.com\",\"about_business\":\"Online Retail with a wide selection of organic products for North America\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"return_url\":\"https://duck.com\",\"webhook_details\":{\"webhook_version\":\"1.0.1\",\"webhook_username\":\"ekart_retail\",\"webhook_password\":\"password_ekart@123\",\"payment_created_enabled\":true,\"payment_succeeded_enabled\":true,\"payment_failed_enabled\":true},\"sub_merchants_enabled\":false,\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"},\"primary_business_details\":[{\"country\":\"US\",\"business\":\"default\"}]}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+ },
+ "response": []
+ },
+ {
+ "name": "API Key - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id",
+ "if (jsonData?.key_id) {",
+ " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);",
+ " console.log(",
+ " \"- use {{api_key_id}} as collection variable for value\",",
+ " jsonData.key_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Payment Connector - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",",
+ " function () {",
+ " pm.response.to.be.success;",
+ " },",
+ ");",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id",
+ "if (jsonData?.merchant_connector_id) {",
+ " pm.collectionVariables.set(",
+ " \"merchant_connector_id\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ " console.log(",
+ " \"- use {{merchant_connector_id}} as collection variable for value\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"prophetpay\",\"connector_account_details\":{\"auth_type\":\"SignatureKey\",\"api_key\":\"{{connector_api_key}}\",\"api_secret\":\"{{connector_api_secret}}\",\"key1\":\"{{connector_key1}}\"},\"business_country\":\"US\",\"business_label\":\"default\",\"test_mode\":false,\"disabled\":false,\"payment_methods_enabled\":[{\"payment_method\":\"card_redirect\",\"payment_method_types\":[{\"payment_method_type\":\"card_redirect\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// 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.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"amount_to_capture\":10000,\"business_country\":\"US\",\"customer_id\":\"not_a_rick_roll\",\"return_url\":\"https://www.google.com\",\"payment_method\":\"card_redirect\",\"payment_method_type\":\"card_redirect\",\"payment_method_data\":{\"card_redirect\":{\"card_redirect\":{}}},\"routing\":{\"type\":\"single\",\"data\":\"prophetpay\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Happy Cases",
+ "item": [
+ {
+ "name": "Scenario1-Create payment with confirm true",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":8000,\"currency\":\"USD\",\"confirm\":true,\"amount_to_capture\":8000,\"business_country\":\"US\",\"customer_id\":\"not_a_rick_roll\",\"return_url\":\"https://www.google.com\",\"payment_method\":\"card_redirect\",\"payment_method_type\":\"card_redirect\",\"payment_method_data\":{\"card_redirect\":{\"card_redirect\":{}}},\"routing\":{\"type\":\"single\",\"data\":\"prophetpay\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario2-Create payment with confirm false",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":8000,\"currency\":\"USD\",\"confirm\":false,\"amount_to_capture\":8000,\"business_country\":\"US\",\"customer_id\":\"not_a_rick_roll\",\"return_url\":\"https://www.google.com\",\"routing\":{\"type\":\"single\",\"data\":\"prophetpay\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Confirm",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"payment_method\":\"card_redirect\",\"payment_method_type\":\"card_redirect\",\"payment_method_data\":{\"card_redirect\":{\"card_redirect\":{}}},\"client_secret\":\"{{client_secret}}\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "info": {
+ "_postman_id": "a553df38-fa33-4522-b029-1cd32821730e",
+ "name": "Prophetpay Postman Collection",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "24206034"
+ },
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
|
test
|
update postman collection files
|
9f47f2070216eb8c64db14eae555073a507cc634
|
2023-05-16 16:21:14
|
Swangi Kumari
|
feat(connector): [Adyen] implement BACS Direct Debits for Adyen (#1159)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 1e2bb95d9ca..fa44ab63ab7 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -524,6 +524,9 @@ pub enum BankDebitData {
/// Sort code for Bacs payment method
#[schema(value_type = String, example = "108800")]
sort_code: Secret<String>,
+ /// holder name for bank debit
+ #[schema(value_type = String, example = "A. Schneider")]
+ bank_account_holder_name: Option<Secret<String>>,
},
}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index ec1ba217fe3..e6bd6fa808d 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -282,6 +282,7 @@ pub enum AdyenPaymentMethod<'a> {
AchDirectDebit(Box<AchDirectDebitData>),
#[serde(rename = "sepadirectdebit")]
SepaDirectDebit(Box<SepaDirectDebitData>),
+ BacsDirectDebit(Box<BacsDirectDebitData>),
}
#[derive(Debug, Clone, Serialize)]
@@ -303,6 +304,16 @@ pub struct SepaDirectDebitData {
iban_number: Secret<String>,
}
+#[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 MandateData {
@@ -676,6 +687,8 @@ pub enum PaymentType {
#[serde(rename = "ach")]
AchDirectDebit,
SepaDirectDebit,
+ #[serde(rename = "directdebit_GB")]
+ BacsDirectDebit,
}
pub struct AdyenTestBankNames<'a>(&'a str);
@@ -982,6 +995,23 @@ impl<'a> TryFrom<&api_models::payments::BankDebitData> for AdyenPaymentMethod<'a
iban_number: iban.clone(),
},
))),
+ payments::BankDebitData::BacsBankDebit {
+ account_number,
+ sort_code,
+ bank_account_holder_name,
+ ..
+ } => Ok(AdyenPaymentMethod::BacsDirectDebit(Box::new(
+ BacsDirectDebitData {
+ payment_type: PaymentType::BacsDirectDebit,
+ bank_account_number: account_number.clone(),
+ bank_location_id: sort_code.clone(),
+ holder_name: bank_account_holder_name.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "bank_account_holder_name",
+ },
+ )?,
+ },
+ ))),
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 457d42925ec..511404c8105 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -827,6 +827,7 @@ fn get_bank_debit_data(
billing_details,
account_number,
sort_code,
+ ..
} => {
let bacs_data = BankDebitData::Bacs {
account_number: account_number.to_owned(),
|
feat
|
[Adyen] implement BACS Direct Debits for Adyen (#1159)
|
aa001b4579a6be022b46eb0cc3e65c52ec9d10bb
|
2024-03-04 20:21:38
|
cb-alfredjoseph
|
fix(router): [nuvei] Nuvei recurring MIT fix and mandatory details fix (#3602)
| false
|
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 13d522b86cc..eef33616cea 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -20,7 +20,7 @@ use crate::{
consts,
core::errors,
services,
- types::{self, api, storage::enums, transformers::ForeignTryFrom},
+ types::{self, api, storage::enums, transformers::ForeignTryFrom, BrowserInformation},
utils::OptionExt,
};
@@ -75,6 +75,7 @@ pub struct NuveiPaymentsRequest {
pub transaction_type: TransactionType,
pub is_rebilling: Option<String>,
pub payment_option: PaymentOption,
+ pub device_details: Option<DeviceDetails>,
pub checksum: String,
pub billing_address: Option<BillingAddress>,
pub related_transaction_id: Option<String>,
@@ -135,7 +136,6 @@ pub struct PaymentOption {
pub card: Option<Card>,
pub redirect_url: Option<Url>,
pub user_payment_option_id: Option<String>,
- pub device_details: Option<DeviceDetails>,
pub alternative_payment_method: Option<AlternativePaymentMethod>,
pub billing_address: Option<BillingAddress>,
}
@@ -315,7 +315,7 @@ pub struct V2AdditionalParams {
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DeviceDetails {
- pub ip_address: String,
+ pub ip_address: Secret<String, pii::IpAddress>,
}
impl From<enums::CaptureMethod> for TransactionType {
@@ -749,6 +749,7 @@ impl<F>
let item = data.0;
let request_data = match item.request.payment_method_data.clone() {
api::PaymentMethodData::Card(card) => get_card_info(item, &card),
+ api::PaymentMethodData::MandatePayment => Self::try_from(item),
api::PaymentMethodData::Wallet(wallet) => match wallet {
payments::WalletData::GooglePay(gpay_data) => Self::try_from(gpay_data),
payments::WalletData::ApplePay(apple_pay_data) => Ok(Self::from(apple_pay_data)),
@@ -848,7 +849,6 @@ impl<F>
payments::PaymentMethodData::BankDebit(_)
| payments::PaymentMethodData::BankTransfer(_)
| payments::PaymentMethodData::Crypto(_)
- | payments::PaymentMethodData::MandatePayment
| payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_)
| payments::PaymentMethodData::Voucher(_)
@@ -877,6 +877,7 @@ impl<F>
related_transaction_id: request_data.related_transaction_id,
payment_option: request_data.payment_option,
billing_address: request_data.billing_address,
+ device_details: request_data.device_details,
url_details: Some(UrlDetails {
success_url: return_url.clone(),
failure_url: return_url.clone(),
@@ -891,104 +892,110 @@ fn get_card_info<F>(
item: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
card_details: &payments::Card,
) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
- let browser_info = item.request.get_browser_info()?;
+ let browser_information = item.request.browser_info.clone();
let related_transaction_id = if item.is_three_ds() {
item.request.related_transaction_id.clone()
} else {
None
};
- let connector_mandate_id = &item.request.connector_mandate_id();
- if connector_mandate_id.is_some() {
- Ok(NuveiPaymentsRequest {
- related_transaction_id,
- is_rebilling: Some("1".to_string()), // In case of second installment, rebilling should be 1
- user_token_id: Some(item.request.get_email()?),
- payment_option: PaymentOption {
- user_payment_option_id: connector_mandate_id.clone(),
- ..Default::default()
- },
- ..Default::default()
- })
- } else {
- let (is_rebilling, additional_params, user_token_id) =
- match item.request.setup_mandate_details.clone() {
- Some(mandate_data) => {
- let details = match mandate_data
- .mandate_type
- .get_required_value("mandate_type")
- .change_context(errors::ConnectorError::MissingRequiredField {
- field_name: "mandate_type",
- })? {
- MandateDataType::SingleUse(details) => details,
- MandateDataType::MultiUse(details) => {
- details.ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "mandate_data.mandate_type.multi_use",
- })?
- }
- };
- let mandate_meta: NuveiMandateMeta = utils::to_connector_meta_from_secret(
- Some(details.get_metadata().ok_or_else(utils::missing_field_err(
- "mandate_data.mandate_type.{multi_use|single_use}.metadata",
- ))?),
- )?;
- (
- Some("0".to_string()), // In case of first installment, rebilling should be 0
- Some(V2AdditionalParams {
- rebill_expiry: Some(
- details
- .get_end_date(date_time::DateFormat::YYYYMMDD)
- .change_context(errors::ConnectorError::DateFormattingFailed)?
- .ok_or_else(utils::missing_field_err(
- "mandate_data.mandate_type.{multi_use|single_use}.end_date",
- ))?,
- ),
- rebill_frequency: Some(mandate_meta.frequency),
- challenge_window_size: None,
- }),
- Some(item.request.get_email()?),
- )
- }
- _ => (None, None, None),
- };
- let three_d = if item.is_three_ds() {
- Some(ThreeD {
- browser_details: Some(BrowserDetails {
- accept_header: browser_info.get_accept_header()?,
- ip: browser_info.get_ip_address()?,
- java_enabled: browser_info.get_java_enabled()?.to_string().to_uppercase(),
- java_script_enabled: browser_info
- .get_java_script_enabled()?
- .to_string()
- .to_uppercase(),
- language: browser_info.get_language()?,
- screen_height: browser_info.get_screen_height()?,
- screen_width: browser_info.get_screen_width()?,
- color_depth: browser_info.get_color_depth()?,
- user_agent: browser_info.get_user_agent()?,
- time_zone: browser_info.get_time_zone()?,
- }),
- v2_additional_params: additional_params,
- notification_url: item.request.complete_authorize_url.clone(),
- merchant_url: item.return_url.clone(),
- platform_type: Some(PlatformType::Browser),
- method_completion_ind: Some(MethodCompletion::Unavailable),
- ..Default::default()
- })
- } else {
- None
- };
- Ok(NuveiPaymentsRequest {
- related_transaction_id,
- is_rebilling,
- user_token_id,
- payment_option: PaymentOption::from(NuveiCardDetails {
- card: card_details.clone(),
- three_d,
+ let address = item.get_billing_address_details_as_optional();
+
+ let billing_address = match address {
+ Some(address) => Some(BillingAddress {
+ first_name: Some(address.get_first_name()?.clone()),
+ last_name: Some(address.get_last_name()?.clone()),
+ email: item.request.get_email()?,
+ country: item.get_billing_country()?,
+ }),
+ None => None,
+ };
+ let (is_rebilling, additional_params, user_token_id) =
+ match item.request.setup_mandate_details.clone() {
+ Some(mandate_data) => {
+ let details = match mandate_data
+ .mandate_type
+ .get_required_value("mandate_type")
+ .change_context(errors::ConnectorError::MissingRequiredField {
+ field_name: "mandate_type",
+ })? {
+ MandateDataType::SingleUse(details) => details,
+ MandateDataType::MultiUse(details) => {
+ details.ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "mandate_data.mandate_type.multi_use",
+ })?
+ }
+ };
+ let mandate_meta: NuveiMandateMeta = utils::to_connector_meta_from_secret(Some(
+ details.get_metadata().ok_or_else(utils::missing_field_err(
+ "mandate_data.mandate_type.{multi_use|single_use}.metadata",
+ ))?,
+ ))?;
+ (
+ Some("0".to_string()), // In case of first installment, rebilling should be 0
+ Some(V2AdditionalParams {
+ rebill_expiry: Some(
+ details
+ .get_end_date(date_time::DateFormat::YYYYMMDD)
+ .change_context(errors::ConnectorError::DateFormattingFailed)?
+ .ok_or_else(utils::missing_field_err(
+ "mandate_data.mandate_type.{multi_use|single_use}.end_date",
+ ))?,
+ ),
+ rebill_frequency: Some(mandate_meta.frequency),
+ challenge_window_size: None,
+ }),
+ Some(item.request.get_email()?),
+ )
+ }
+ _ => (None, None, None),
+ };
+ let three_d = if item.is_three_ds() {
+ let browser_details = match &browser_information {
+ Some(browser_info) => Some(BrowserDetails {
+ accept_header: browser_info.get_accept_header()?,
+ ip: browser_info.get_ip_address()?,
+ java_enabled: browser_info.get_java_enabled()?.to_string().to_uppercase(),
+ java_script_enabled: browser_info
+ .get_java_script_enabled()?
+ .to_string()
+ .to_uppercase(),
+ language: browser_info.get_language()?,
+ screen_height: browser_info.get_screen_height()?,
+ screen_width: browser_info.get_screen_width()?,
+ color_depth: browser_info.get_color_depth()?,
+ user_agent: browser_info.get_user_agent()?,
+ time_zone: browser_info.get_time_zone()?,
}),
+ None => None,
+ };
+ Some(ThreeD {
+ browser_details,
+ v2_additional_params: additional_params,
+ notification_url: item.request.complete_authorize_url.clone(),
+ merchant_url: item.return_url.clone(),
+ platform_type: Some(PlatformType::Browser),
+ method_completion_ind: Some(MethodCompletion::Unavailable),
..Default::default()
})
- }
+ } else {
+ None
+ };
+
+ Ok(NuveiPaymentsRequest {
+ related_transaction_id,
+ is_rebilling,
+ user_token_id,
+ device_details: Option::<DeviceDetails>::foreign_try_from(
+ &item.request.browser_info.clone(),
+ )?,
+ payment_option: PaymentOption::from(NuveiCardDetails {
+ card: card_details.clone(),
+ three_d,
+ }),
+ billing_address,
+ ..Default::default()
+ })
}
impl From<NuveiCardDetails> for PaymentOption {
fn from(card_details: NuveiCardDetails) -> Self {
@@ -1535,6 +1542,51 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, NuveiPaymentsResponse>
}
}
+impl<F> TryFrom<&types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>>
+ for NuveiPaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ data: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ {
+ let item = data;
+ let connector_mandate_id = &item.request.connector_mandate_id();
+ let related_transaction_id = if item.is_three_ds() {
+ item.request.related_transaction_id.clone()
+ } else {
+ None
+ };
+ Ok(Self {
+ related_transaction_id,
+ device_details: Option::<DeviceDetails>::foreign_try_from(
+ &item.request.browser_info.clone(),
+ )?,
+ is_rebilling: Some("1".to_string()), // In case of second installment, rebilling should be 1
+ user_token_id: Some(item.request.get_email()?),
+ payment_option: PaymentOption {
+ user_payment_option_id: connector_mandate_id.clone(),
+ ..Default::default()
+ },
+ ..Default::default()
+ })
+ }
+ }
+}
+
+impl ForeignTryFrom<&Option<BrowserInformation>> for Option<DeviceDetails> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn foreign_try_from(browser_info: &Option<BrowserInformation>) -> Result<Self, Self::Error> {
+ let device_details = match browser_info {
+ Some(browser_info) => Some(DeviceDetails {
+ ip_address: browser_info.get_ip_address()?,
+ }),
+ None => None,
+ };
+ Ok(device_details)
+ }
+}
+
fn get_refund_response(
response: NuveiPaymentsResponse,
http_code: u16,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index fde9195143e..996e06adfc4 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -86,6 +86,7 @@ pub trait RouterData {
fn get_payout_method_data(&self) -> Result<api::PayoutMethodData, Error>;
#[cfg(feature = "payouts")]
fn get_quote_id(&self) -> Result<String, Error>;
+ fn get_billing_address_details_as_optional(&self) -> Option<api::AddressDetails>;
}
pub trait PaymentResponseRouterData {
@@ -182,6 +183,14 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
.ok_or_else(missing_field_err("billing.address"))
}
+ fn get_billing_address_details_as_optional(&self) -> Option<api::AddressDetails> {
+ self.address
+ .billing
+ .as_ref()
+ .and_then(|a| a.address.as_ref())
+ .cloned()
+ }
+
fn get_billing_address_with_phone_number(&self) -> Result<&api::Address, Error> {
self.address
.billing
|
fix
|
[nuvei] Nuvei recurring MIT fix and mandatory details fix (#3602)
|
7bd6e05c0c05ebae9b82a6f410e61ca4409d088b
|
2023-12-05 15:29:10
|
Mani Chandra
|
feat(connector_onboarding): Add Connector onboarding APIs (#3050)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index d935a4e7f20..fad4da3e7c3 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -477,3 +477,9 @@ connection_timeout = 10 # Timeout for database connection in seconds
[kv_config]
# TTL for KV in seconds
ttl = 900
+
+[paypal_onboarding]
+client_id = "paypal_client_id" # Client ID for PayPal onboarding
+client_secret = "paypal_secret_key" # Secret key for PayPal onboarding
+partner_id = "paypal_partner_id" # Partner ID for PayPal onboarding
+enabled = true # Switch to enable or disable PayPal onboarding
diff --git a/config/development.toml b/config/development.toml
index fa5fddb0d60..2eb8b00b9c0 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -504,4 +504,10 @@ port = 5432
dbname = "hyperswitch_db"
pool_size = 5
connection_timeout = 10
-queue_strategy = "Fifo"
\ No newline at end of file
+queue_strategy = "Fifo"
+
+[connector_onboarding.paypal]
+client_id = ""
+client_secret = ""
+partner_id = ""
+enabled = true
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 4d50600e1bf..de90f3c70ab 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -362,3 +362,9 @@ queue_strategy = "Fifo"
[kv_config]
ttl = 900 # 15 * 60 seconds
+
+[connector_onboarding.paypal]
+client_id = ""
+client_secret = ""
+partner_id = ""
+enabled = true
diff --git a/crates/api_models/src/connector_onboarding.rs b/crates/api_models/src/connector_onboarding.rs
new file mode 100644
index 00000000000..759d3cb97f1
--- /dev/null
+++ b/crates/api_models/src/connector_onboarding.rs
@@ -0,0 +1,54 @@
+use super::{admin, enums};
+
+#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
+pub struct ActionUrlRequest {
+ pub connector: enums::Connector,
+ pub connector_id: String,
+ pub return_url: String,
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum ActionUrlResponse {
+ PayPal(PayPalActionUrlResponse),
+}
+
+#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
+pub struct OnboardingSyncRequest {
+ pub profile_id: String,
+ pub connector_id: String,
+ pub connector: enums::Connector,
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+pub struct PayPalActionUrlResponse {
+ pub action_url: String,
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum OnboardingStatus {
+ PayPal(PayPalOnboardingStatus),
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum PayPalOnboardingStatus {
+ AccountNotFound,
+ PaymentsNotReceivable,
+ PpcpCustomDenied,
+ MorePermissionsNeeded,
+ EmailNotVerified,
+ Success(PayPalOnboardingDone),
+ ConnectorIntegrated(admin::MerchantConnectorResponse),
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+pub struct PayPalOnboardingDone {
+ pub payer_id: String,
+}
+
+#[derive(serde::Serialize, Debug, Clone)]
+pub struct PayPalIntegrationDone {
+ pub connector_id: String,
+}
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index ac7cdeb83d9..457d3fde05b 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -1,3 +1,4 @@
+pub mod connector_onboarding;
pub mod customer;
pub mod gsm;
mod locker_migration;
diff --git a/crates/api_models/src/events/connector_onboarding.rs b/crates/api_models/src/events/connector_onboarding.rs
new file mode 100644
index 00000000000..998dc384d62
--- /dev/null
+++ b/crates/api_models/src/events/connector_onboarding.rs
@@ -0,0 +1,12 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::connector_onboarding::{
+ ActionUrlRequest, ActionUrlResponse, OnboardingStatus, OnboardingSyncRequest,
+};
+
+common_utils::impl_misc_api_event_type!(
+ ActionUrlRequest,
+ ActionUrlResponse,
+ OnboardingSyncRequest,
+ OnboardingStatus
+);
diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index 056888839a5..ce3c11d9c2f 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -5,6 +5,7 @@ pub mod api_keys;
pub mod bank_accounts;
pub mod cards_info;
pub mod conditional_configs;
+pub mod connector_onboarding;
pub mod currency;
pub mod customers;
pub mod disputes;
diff --git a/crates/router/src/configs/kms.rs b/crates/router/src/configs/kms.rs
index 37f2d15774a..bf6ee44d28b 100644
--- a/crates/router/src/configs/kms.rs
+++ b/crates/router/src/configs/kms.rs
@@ -69,3 +69,36 @@ impl KmsDecrypt for settings::Database {
})
}
}
+
+#[cfg(feature = "olap")]
+#[async_trait::async_trait]
+impl KmsDecrypt for settings::PayPalOnboarding {
+ type Output = Self;
+
+ async fn decrypt_inner(
+ mut self,
+ kms_client: &KmsClient,
+ ) -> CustomResult<Self::Output, KmsError> {
+ self.client_id = kms_client.decrypt(self.client_id.expose()).await?.into();
+ self.client_secret = kms_client
+ .decrypt(self.client_secret.expose())
+ .await?
+ .into();
+ self.partner_id = kms_client.decrypt(self.partner_id.expose()).await?.into();
+ Ok(self)
+ }
+}
+
+#[cfg(feature = "olap")]
+#[async_trait::async_trait]
+impl KmsDecrypt for settings::ConnectorOnboarding {
+ type Output = Self;
+
+ async fn decrypt_inner(
+ mut self,
+ kms_client: &KmsClient,
+ ) -> CustomResult<Self::Output, KmsError> {
+ self.paypal = self.paypal.decrypt_inner(kms_client).await?;
+ Ok(self)
+ }
+}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index f2d962b0abe..68af91d0661 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -116,6 +116,8 @@ pub struct Settings {
#[cfg(feature = "olap")]
pub report_download_config: ReportConfig,
pub events: EventsConfig,
+ #[cfg(feature = "olap")]
+ pub connector_onboarding: ConnectorOnboarding,
}
#[derive(Debug, Deserialize, Clone)]
@@ -884,3 +886,18 @@ impl<'de> Deserialize<'de> for LockSettings {
})
}
}
+
+#[cfg(feature = "olap")]
+#[derive(Debug, Deserialize, Clone, Default)]
+pub struct ConnectorOnboarding {
+ pub paypal: PayPalOnboarding,
+}
+
+#[cfg(feature = "olap")]
+#[derive(Debug, Deserialize, Clone, Default)]
+pub struct PayPalOnboarding {
+ pub client_id: masking::Secret<String>,
+ pub client_secret: masking::Secret<String>,
+ pub partner_id: masking::Secret<String>,
+ pub enabled: bool,
+}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 08de9cf8038..6a167be48da 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -5,6 +5,8 @@ pub mod cache;
pub mod cards_info;
pub mod conditional_config;
pub mod configs;
+#[cfg(feature = "olap")]
+pub mod connector_onboarding;
#[cfg(any(feature = "olap", feature = "oltp"))]
pub mod currency;
pub mod customers;
diff --git a/crates/router/src/core/connector_onboarding.rs b/crates/router/src/core/connector_onboarding.rs
new file mode 100644
index 00000000000..e48026edc2d
--- /dev/null
+++ b/crates/router/src/core/connector_onboarding.rs
@@ -0,0 +1,96 @@
+use api_models::{connector_onboarding as api, enums};
+use error_stack::ResultExt;
+use masking::Secret;
+
+use crate::{
+ core::errors::{ApiErrorResponse, RouterResponse, RouterResult},
+ services::{authentication as auth, ApplicationResponse},
+ types::{self as oss_types},
+ utils::connector_onboarding as utils,
+ AppState,
+};
+
+pub mod paypal;
+
+#[async_trait::async_trait]
+pub trait AccessToken {
+ async fn access_token(state: &AppState) -> RouterResult<oss_types::AccessToken>;
+}
+
+pub async fn get_action_url(
+ state: AppState,
+ request: api::ActionUrlRequest,
+) -> RouterResponse<api::ActionUrlResponse> {
+ let connector_onboarding_conf = state.conf.connector_onboarding.clone();
+ let is_enabled = utils::is_enabled(request.connector, &connector_onboarding_conf);
+
+ match (is_enabled, request.connector) {
+ (Some(true), enums::Connector::Paypal) => {
+ let action_url = Box::pin(paypal::get_action_url_from_paypal(
+ state,
+ request.connector_id,
+ request.return_url,
+ ))
+ .await?;
+ Ok(ApplicationResponse::Json(api::ActionUrlResponse::PayPal(
+ api::PayPalActionUrlResponse { action_url },
+ )))
+ }
+ _ => Err(ApiErrorResponse::FlowNotSupported {
+ flow: "Connector onboarding".to_string(),
+ connector: request.connector.to_string(),
+ }
+ .into()),
+ }
+}
+
+pub async fn sync_onboarding_status(
+ state: AppState,
+ user_from_token: auth::UserFromToken,
+ request: api::OnboardingSyncRequest,
+) -> RouterResponse<api::OnboardingStatus> {
+ let merchant_account = user_from_token
+ .get_merchant_account(state.clone())
+ .await
+ .change_context(ApiErrorResponse::MerchantAccountNotFound)?;
+ let connector_onboarding_conf = state.conf.connector_onboarding.clone();
+ let is_enabled = utils::is_enabled(request.connector, &connector_onboarding_conf);
+
+ match (is_enabled, request.connector) {
+ (Some(true), enums::Connector::Paypal) => {
+ let status = Box::pin(paypal::sync_merchant_onboarding_status(
+ state.clone(),
+ request.connector_id.clone(),
+ ))
+ .await?;
+ if let api::OnboardingStatus::PayPal(api::PayPalOnboardingStatus::Success(
+ ref inner_data,
+ )) = status
+ {
+ let connector_onboarding_conf = state.conf.connector_onboarding.clone();
+ let auth_details = oss_types::ConnectorAuthType::SignatureKey {
+ api_key: connector_onboarding_conf.paypal.client_secret,
+ key1: connector_onboarding_conf.paypal.client_id,
+ api_secret: Secret::new(inner_data.payer_id.clone()),
+ };
+ let some_data = paypal::update_mca(
+ &state,
+ &merchant_account,
+ request.connector_id.to_owned(),
+ auth_details,
+ )
+ .await?;
+
+ return Ok(ApplicationResponse::Json(api::OnboardingStatus::PayPal(
+ api::PayPalOnboardingStatus::ConnectorIntegrated(some_data),
+ )));
+ }
+ Ok(ApplicationResponse::Json(status))
+ }
+ _ => Err(ApiErrorResponse::FlowNotSupported {
+ flow: "Connector onboarding".to_string(),
+ connector: request.connector.to_string(),
+ }
+ .into()),
+ }
+}
diff --git a/crates/router/src/core/connector_onboarding/paypal.rs b/crates/router/src/core/connector_onboarding/paypal.rs
new file mode 100644
index 00000000000..30aa69067b5
--- /dev/null
+++ b/crates/router/src/core/connector_onboarding/paypal.rs
@@ -0,0 +1,174 @@
+use api_models::{admin::MerchantConnectorUpdate, connector_onboarding as api};
+use common_utils::ext_traits::Encode;
+use error_stack::{IntoReport, ResultExt};
+use masking::{ExposeInterface, PeekInterface, Secret};
+
+use crate::{
+ core::{
+ admin,
+ errors::{ApiErrorResponse, RouterResult},
+ },
+ services::{send_request, ApplicationResponse, Request},
+ types::{self as oss_types, api as oss_api_types, api::connector_onboarding as types},
+ utils::connector_onboarding as utils,
+ AppState,
+};
+
+fn build_referral_url(state: AppState) -> String {
+ format!(
+ "{}v2/customer/partner-referrals",
+ state.conf.connectors.paypal.base_url
+ )
+}
+
+async fn build_referral_request(
+ state: AppState,
+ connector_id: String,
+ return_url: String,
+) -> RouterResult<Request> {
+ let access_token = utils::paypal::generate_access_token(state.clone()).await?;
+ let request_body = types::paypal::PartnerReferralRequest::new(connector_id, return_url);
+
+ utils::paypal::build_paypal_post_request(
+ build_referral_url(state),
+ request_body,
+ access_token.token.expose(),
+ )
+}
+
+pub async fn get_action_url_from_paypal(
+ state: AppState,
+ connector_id: String,
+ return_url: String,
+) -> RouterResult<String> {
+ let referral_request = Box::pin(build_referral_request(
+ state.clone(),
+ connector_id,
+ return_url,
+ ))
+ .await?;
+ let referral_response = send_request(&state, referral_request, None)
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to send request to paypal referrals")?;
+
+ let parsed_response: types::paypal::PartnerReferralResponse = referral_response
+ .json()
+ .await
+ .into_report()
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse paypal response")?;
+
+ parsed_response.extract_action_url()
+}
+
+fn merchant_onboarding_status_url(state: AppState, tracking_id: String) -> String {
+ let partner_id = state.conf.connector_onboarding.paypal.partner_id.to_owned();
+ format!(
+ "{}v1/customer/partners/{}/merchant-integrations?tracking_id={}",
+ state.conf.connectors.paypal.base_url,
+ partner_id.expose(),
+ tracking_id
+ )
+}
+
+pub async fn sync_merchant_onboarding_status(
+ state: AppState,
+ tracking_id: String,
+) -> RouterResult<api::OnboardingStatus> {
+ let access_token = utils::paypal::generate_access_token(state.clone()).await?;
+
+ let Some(seller_status_response) =
+ find_paypal_merchant_by_tracking_id(state.clone(), tracking_id, &access_token).await?
+ else {
+ return Ok(api::OnboardingStatus::PayPal(
+ api::PayPalOnboardingStatus::AccountNotFound,
+ ));
+ };
+
+ let merchant_details_url = seller_status_response
+ .extract_merchant_details_url(&state.conf.connectors.paypal.base_url)?;
+
+ let merchant_details_request =
+ utils::paypal::build_paypal_get_request(merchant_details_url, access_token.token.expose())?;
+
+ let merchant_details_response = send_request(&state, merchant_details_request, None)
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to send request to paypal merchant details")?;
+
+ let parsed_response: types::paypal::SellerStatusDetailsResponse = merchant_details_response
+ .json()
+ .await
+ .into_report()
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse paypal merchant details response")?;
+
+ let eligibity = parsed_response.get_eligibility_status().await?;
+ Ok(api::OnboardingStatus::PayPal(eligibity))
+}
+
+async fn find_paypal_merchant_by_tracking_id(
+ state: AppState,
+ tracking_id: String,
+ access_token: &oss_types::AccessToken,
+) -> RouterResult<Option<types::paypal::SellerStatusResponse>> {
+ let seller_status_request = utils::paypal::build_paypal_get_request(
+ merchant_onboarding_status_url(state.clone(), tracking_id),
+ access_token.token.peek().to_string(),
+ )?;
+ let seller_status_response = send_request(&state, seller_status_request, None)
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to send request to paypal onboarding status")?;
+
+ if seller_status_response.status().is_success() {
+ return Ok(Some(
+ seller_status_response
+ .json()
+ .await
+ .into_report()
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse paypal onboarding status response")?,
+ ));
+ }
+ Ok(None)
+}
+
+pub async fn update_mca(
+ state: &AppState,
+ merchant_account: &oss_types::domain::MerchantAccount,
+ connector_id: String,
+ auth_details: oss_types::ConnectorAuthType,
+) -> RouterResult<oss_api_types::MerchantConnectorResponse> {
+ let connector_auth_json =
+ Encode::<oss_types::ConnectorAuthType>::encode_to_value(&auth_details)
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Error while deserializing connector_account_details")?;
+
+ let request = MerchantConnectorUpdate {
+ connector_type: common_enums::ConnectorType::PaymentProcessor,
+ connector_account_details: Some(Secret::new(connector_auth_json)),
+ disabled: Some(false),
+ status: Some(common_enums::ConnectorStatus::Active),
+ test_mode: None,
+ connector_label: None,
+ payment_methods_enabled: None,
+ metadata: None,
+ frm_configs: None,
+ connector_webhook_details: None,
+ pm_auth_config: None,
+ };
+ let mca_response = admin::update_payment_connector(
+ state.clone(),
+ &merchant_account.merchant_id,
+ &connector_id,
+ request,
+ )
+ .await?;
+
+ match mca_response {
+ ApplicationResponse::Json(mca_data) => Ok(mca_data),
+ _ => Err(ApiErrorResponse::InternalServerError.into()),
+ }
+}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index fb8be963674..3b4c7ce9b7d 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -147,6 +147,7 @@ pub fn mk_app(
.service(routes::Gsm::server(state.clone()))
.service(routes::PaymentLink::server(state.clone()))
.service(routes::User::server(state.clone()))
+ .service(routes::ConnectorOnboarding::server(state.clone()))
}
#[cfg(all(feature = "olap", feature = "kms"))]
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index b19ef5d7016..9b3006692d3 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -4,6 +4,8 @@ pub mod app;
pub mod cache;
pub mod cards_info;
pub mod configs;
+#[cfg(feature = "olap")]
+pub mod connector_onboarding;
#[cfg(any(feature = "olap", feature = "oltp"))]
pub mod currency;
pub mod customers;
@@ -47,9 +49,9 @@ pub use self::app::Routing;
#[cfg(all(feature = "olap", feature = "kms"))]
pub use self::app::Verify;
pub use self::app::{
- ApiKeys, AppState, BusinessProfile, Cache, Cards, Configs, Customers, Disputes, EphemeralKey,
- Files, Gsm, Health, LockerMigrate, Mandates, MerchantAccount, MerchantConnectorAccount,
- PaymentLink, PaymentMethods, Payments, Refunds, User, Webhooks,
+ ApiKeys, AppState, BusinessProfile, Cache, Cards, Configs, ConnectorOnboarding, Customers,
+ Disputes, EphemeralKey, Files, Gsm, Health, LockerMigrate, Mandates, MerchantAccount,
+ MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Refunds, User, Webhooks,
};
#[cfg(feature = "stripe")]
pub use super::compatibility::stripe::StripeApis;
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index acf98c658a7..9739d18864b 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -26,8 +26,8 @@ use super::routing as cloud_routing;
use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_verified_domains};
#[cfg(feature = "olap")]
use super::{
- admin::*, api_keys::*, disputes::*, files::*, gsm::*, locker_migration, payment_link::*,
- user::*, user_role::*,
+ admin::*, api_keys::*, connector_onboarding::*, disputes::*, files::*, gsm::*,
+ locker_migration, payment_link::*, user::*, user_role::*,
};
use super::{cache::*, health::*};
#[cfg(any(feature = "olap", feature = "oltp"))]
@@ -185,6 +185,16 @@ impl AppState {
}
};
+ #[cfg(all(feature = "kms", feature = "olap"))]
+ #[allow(clippy::expect_used)]
+ {
+ conf.connector_onboarding = conf
+ .connector_onboarding
+ .decrypt_inner(kms_client)
+ .await
+ .expect("Failed to decrypt connector onboarding credentials");
+ }
+
#[cfg(feature = "olap")]
let pool = crate::analytics::AnalyticsProvider::from_conf(&conf.analytics).await;
@@ -888,3 +898,15 @@ impl LockerMigrate {
)
}
}
+
+pub struct ConnectorOnboarding;
+
+#[cfg(feature = "olap")]
+impl ConnectorOnboarding {
+ pub fn server(state: AppState) -> Scope {
+ web::scope("/connector_onboarding")
+ .app_data(web::Data::new(state))
+ .service(web::resource("/action_url").route(web::post().to(get_action_url)))
+ .service(web::resource("/sync").route(web::post().to(sync_onboarding_status)))
+ }
+}
diff --git a/crates/router/src/routes/connector_onboarding.rs b/crates/router/src/routes/connector_onboarding.rs
new file mode 100644
index 00000000000..b7c39b3c1d2
--- /dev/null
+++ b/crates/router/src/routes/connector_onboarding.rs
@@ -0,0 +1,47 @@
+use actix_web::{web, HttpRequest, HttpResponse};
+use api_models::connector_onboarding as api_types;
+use router_env::Flow;
+
+use super::AppState;
+use crate::{
+ core::{api_locking, connector_onboarding as core},
+ services::{api, authentication as auth, authorization::permissions::Permission},
+};
+
+pub async fn get_action_url(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<api_types::ActionUrlRequest>,
+) -> HttpResponse {
+ let flow = Flow::GetActionUrl;
+ let req_payload = json_payload.into_inner();
+ Box::pin(api::server_wrap(
+ flow.clone(),
+ state,
+ &http_req,
+ req_payload.clone(),
+ |state, _: auth::UserFromToken, req| core::get_action_url(state, req),
+ &auth::JWTAuth(Permission::MerchantAccountWrite),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn sync_onboarding_status(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<api_types::OnboardingSyncRequest>,
+) -> HttpResponse {
+ let flow = Flow::SyncOnboardingStatus;
+ let req_payload = json_payload.into_inner();
+ Box::pin(api::server_wrap(
+ flow.clone(),
+ state,
+ &http_req,
+ req_payload.clone(),
+ core::sync_onboarding_status,
+ &auth::JWTAuth(Permission::MerchantAccountWrite),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 0c850922fff..dcae11f58b7 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -28,6 +28,7 @@ pub enum ApiIdentifier {
Gsm,
User,
UserRole,
+ ConnectorOnboarding,
}
impl From<Flow> for ApiIdentifier {
@@ -171,6 +172,8 @@ impl From<Flow> for ApiIdentifier {
Flow::ListRoles | Flow::GetRole | Flow::UpdateUserRole | Flow::GetAuthorizationInfo => {
Self::UserRole
}
+
+ Flow::GetActionUrl | Flow::SyncOnboardingStatus => Self::ConnectorOnboarding,
}
}
}
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index c74608ea20a..0ec158199ce 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -1,6 +1,8 @@
pub mod admin;
pub mod api_keys;
pub mod configs;
+#[cfg(feature = "olap")]
+pub mod connector_onboarding;
pub mod customers;
pub mod disputes;
pub mod enums;
diff --git a/crates/router/src/types/api/connector_onboarding.rs b/crates/router/src/types/api/connector_onboarding.rs
new file mode 100644
index 00000000000..5b1d581a20e
--- /dev/null
+++ b/crates/router/src/types/api/connector_onboarding.rs
@@ -0,0 +1 @@
+pub mod paypal;
diff --git a/crates/router/src/types/api/connector_onboarding/paypal.rs b/crates/router/src/types/api/connector_onboarding/paypal.rs
new file mode 100644
index 00000000000..0cc026d4d7a
--- /dev/null
+++ b/crates/router/src/types/api/connector_onboarding/paypal.rs
@@ -0,0 +1,247 @@
+use api_models::connector_onboarding as api;
+use error_stack::{IntoReport, ResultExt};
+
+use crate::core::errors::{ApiErrorResponse, RouterResult};
+
+#[derive(serde::Deserialize, Debug)]
+pub struct HateoasLink {
+ pub href: String,
+ pub rel: String,
+ pub method: String,
+}
+
+#[derive(serde::Deserialize, Debug)]
+pub struct PartnerReferralResponse {
+ pub links: Vec<HateoasLink>,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerReferralRequest {
+ pub tracking_id: String,
+ pub operations: Vec<PartnerReferralOperations>,
+ pub products: Vec<PayPalProducts>,
+ pub capabilities: Vec<PayPalCapabilities>,
+ pub partner_config_override: PartnerConfigOverride,
+ pub legal_consents: Vec<LegalConsent>,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayPalProducts {
+ Ppcp,
+ AdvancedVaulting,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayPalCapabilities {
+ PaypalWalletVaultingAdvanced,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerReferralOperations {
+ pub operation: PayPalReferralOperationType,
+ pub api_integration_preference: PartnerReferralIntegrationPreference,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayPalReferralOperationType {
+ ApiIntegration,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerReferralIntegrationPreference {
+ pub rest_api_integration: PartnerReferralRestApiIntegration,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerReferralRestApiIntegration {
+ pub integration_method: IntegrationMethod,
+ pub integration_type: PayPalIntegrationType,
+ pub third_party_details: PartnerReferralThirdPartyDetails,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum IntegrationMethod {
+ Paypal,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayPalIntegrationType {
+ ThirdParty,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerReferralThirdPartyDetails {
+ pub features: Vec<PayPalFeatures>,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayPalFeatures {
+ Payment,
+ Refund,
+ Vault,
+ AccessMerchantInformation,
+ BillingAgreement,
+ ReadSellerDispute,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct PartnerConfigOverride {
+ pub partner_logo_url: String,
+ pub return_url: String,
+}
+
+#[derive(serde::Serialize, Debug)]
+pub struct LegalConsent {
+ #[serde(rename = "type")]
+ pub consent_type: LegalConsentType,
+ pub granted: bool,
+}
+
+#[derive(serde::Serialize, Debug)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum LegalConsentType {
+ ShareDataConsent,
+}
+
+impl PartnerReferralRequest {
+ pub fn new(tracking_id: String, return_url: String) -> Self {
+ Self {
+ tracking_id,
+ operations: vec![PartnerReferralOperations {
+ operation: PayPalReferralOperationType::ApiIntegration,
+ api_integration_preference: PartnerReferralIntegrationPreference {
+ rest_api_integration: PartnerReferralRestApiIntegration {
+ integration_method: IntegrationMethod::Paypal,
+ integration_type: PayPalIntegrationType::ThirdParty,
+ third_party_details: PartnerReferralThirdPartyDetails {
+ features: vec![
+ PayPalFeatures::Payment,
+ PayPalFeatures::Refund,
+ PayPalFeatures::Vault,
+ PayPalFeatures::AccessMerchantInformation,
+ PayPalFeatures::BillingAgreement,
+ PayPalFeatures::ReadSellerDispute,
+ ],
+ },
+ },
+ },
+ }],
+ products: vec![PayPalProducts::Ppcp, PayPalProducts::AdvancedVaulting],
+ capabilities: vec![PayPalCapabilities::PaypalWalletVaultingAdvanced],
+ partner_config_override: PartnerConfigOverride {
+ partner_logo_url: "https://hyperswitch.io/img/websiteIcon.svg".to_string(),
+ return_url,
+ },
+ legal_consents: vec![LegalConsent {
+ consent_type: LegalConsentType::ShareDataConsent,
+ granted: true,
+ }],
+ }
+ }
+}
+
+#[derive(serde::Deserialize, Debug)]
+pub struct SellerStatusResponse {
+ pub merchant_id: String,
+ pub links: Vec<HateoasLink>,
+}
+
+#[derive(serde::Deserialize, Debug)]
+pub struct SellerStatusDetailsResponse {
+ pub merchant_id: String,
+ pub primary_email_confirmed: bool,
+ pub payments_receivable: bool,
+ pub products: Vec<SellerStatusProducts>,
+}
+
+#[derive(serde::Deserialize, Debug)]
+pub struct SellerStatusProducts {
+ pub name: String,
+ pub vetting_status: Option<VettingStatus>,
+}
+
+#[derive(serde::Deserialize, Debug, Clone)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum VettingStatus {
+ NeedMoreData,
+ Subscribed,
+ Denied,
+}
+
+impl SellerStatusResponse {
+ pub fn extract_merchant_details_url(self, paypal_base_url: &str) -> RouterResult<String> {
+ self.links
+ .get(0)
+ .and_then(|link| link.href.strip_prefix('/'))
+ .map(|link| format!("{}{}", paypal_base_url, link))
+ .ok_or(ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Merchant details not received in onboarding status")
+ }
+}
+
+impl SellerStatusDetailsResponse {
+ pub fn check_payments_receivable(&self) -> Option<api::PayPalOnboardingStatus> {
+ if !self.payments_receivable {
+ return Some(api::PayPalOnboardingStatus::PaymentsNotReceivable);
+ }
+ None
+ }
+
+ pub fn check_ppcp_custom_status(&self) -> Option<api::PayPalOnboardingStatus> {
+ match self.get_ppcp_custom_status() {
+ Some(VettingStatus::Denied) => Some(api::PayPalOnboardingStatus::PpcpCustomDenied),
+ Some(VettingStatus::Subscribed) => None,
+ _ => Some(api::PayPalOnboardingStatus::MorePermissionsNeeded),
+ }
+ }
+
+ fn check_email_confirmation(&self) -> Option<api::PayPalOnboardingStatus> {
+ if !self.primary_email_confirmed {
+ return Some(api::PayPalOnboardingStatus::EmailNotVerified);
+ }
+ None
+ }
+
+ pub async fn get_eligibility_status(&self) -> RouterResult<api::PayPalOnboardingStatus> {
+ Ok(self
+ .check_payments_receivable()
+ .or(self.check_email_confirmation())
+ .or(self.check_ppcp_custom_status())
+ .unwrap_or(api::PayPalOnboardingStatus::Success(
+ api::PayPalOnboardingDone {
+ payer_id: self.get_payer_id(),
+ },
+ )))
+ }
+
+ fn get_ppcp_custom_status(&self) -> Option<VettingStatus> {
+ self.products
+ .iter()
+ .find(|product| product.name == "PPCP_CUSTOM")
+ .and_then(|ppcp_custom| ppcp_custom.vetting_status.clone())
+ }
+
+ fn get_payer_id(&self) -> String {
+ self.merchant_id.to_string()
+ }
+}
+
+impl PartnerReferralResponse {
+ pub fn extract_action_url(self) -> RouterResult<String> {
+ Ok(self
+ .links
+ .into_iter()
+ .find(|hateoas_link| hateoas_link.rel == "action_url")
+ .ok_or(ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Failed to get action_url from paypal response")?
+ .href)
+ }
+}
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index f1590342e17..42116e1ecbf 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -1,3 +1,5 @@
+#[cfg(feature = "olap")]
+pub mod connector_onboarding;
pub mod currency;
pub mod custom_serde;
pub mod db_utils;
diff --git a/crates/router/src/utils/connector_onboarding.rs b/crates/router/src/utils/connector_onboarding.rs
new file mode 100644
index 00000000000..e8afcd68a46
--- /dev/null
+++ b/crates/router/src/utils/connector_onboarding.rs
@@ -0,0 +1,36 @@
+use crate::{
+ core::errors::{api_error_response::NotImplementedMessage, ApiErrorResponse, RouterResult},
+ routes::app::settings,
+ types::{self, api::enums},
+};
+
+pub mod paypal;
+
+pub fn get_connector_auth(
+ connector: enums::Connector,
+ connector_data: &settings::ConnectorOnboarding,
+) -> RouterResult<types::ConnectorAuthType> {
+ match connector {
+ enums::Connector::Paypal => Ok(types::ConnectorAuthType::BodyKey {
+ api_key: connector_data.paypal.client_secret.clone(),
+ key1: connector_data.paypal.client_id.clone(),
+ }),
+ _ => Err(ApiErrorResponse::NotImplemented {
+ message: NotImplementedMessage::Reason(format!(
+ "Onboarding is not implemented for {}",
+ connector
+ )),
+ }
+ .into()),
+ }
+}
+
+pub fn is_enabled(
+ connector: types::Connector,
+ conf: &settings::ConnectorOnboarding,
+) -> Option<bool> {
+ match connector {
+ enums::Connector::Paypal => Some(conf.paypal.enabled),
+ _ => None,
+ }
+}
diff --git a/crates/router/src/utils/connector_onboarding/paypal.rs b/crates/router/src/utils/connector_onboarding/paypal.rs
new file mode 100644
index 00000000000..c803775be07
--- /dev/null
+++ b/crates/router/src/utils/connector_onboarding/paypal.rs
@@ -0,0 +1,89 @@
+use common_utils::{
+ ext_traits::Encode,
+ request::{Method, Request, RequestBuilder},
+};
+use error_stack::{IntoReport, ResultExt};
+use http::header;
+use serde_json::json;
+
+use crate::{
+ connector,
+ core::errors::{ApiErrorResponse, RouterResult},
+ routes::AppState,
+ types,
+ types::api::{
+ enums,
+ verify_connector::{self as verify_connector_types, VerifyConnector},
+ },
+ utils::verify_connector as verify_connector_utils,
+};
+
+pub async fn generate_access_token(state: AppState) -> RouterResult<types::AccessToken> {
+ let connector = enums::Connector::Paypal;
+ let boxed_connector = types::api::ConnectorData::convert_connector(
+ &state.conf.connectors,
+ connector.to_string().as_str(),
+ )?;
+ let connector_auth = super::get_connector_auth(connector, &state.conf.connector_onboarding)?;
+
+ connector::Paypal::get_access_token(
+ &state,
+ verify_connector_types::VerifyConnectorData {
+ connector: *boxed_connector,
+ connector_auth,
+ card_details: verify_connector_utils::get_test_card_details(connector)?
+ .ok_or(ApiErrorResponse::FlowNotSupported {
+ flow: "Connector onboarding".to_string(),
+ connector: connector.to_string(),
+ })
+ .into_report()?,
+ },
+ )
+ .await?
+ .ok_or(ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("Error occurred while retrieving access token")
+}
+
+pub fn build_paypal_post_request<T>(
+ url: String,
+ body: T,
+ access_token: String,
+) -> RouterResult<Request>
+where
+ T: serde::Serialize,
+{
+ let body = types::RequestBody::log_and_get_request_body(
+ &json!(body),
+ Encode::<serde_json::Value>::encode_to_string_of_json,
+ )
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to build request body")?;
+
+ Ok(RequestBuilder::new()
+ .method(Method::Post)
+ .url(&url)
+ .attach_default_headers()
+ .header(
+ header::AUTHORIZATION.to_string().as_str(),
+ format!("Bearer {}", access_token).as_str(),
+ )
+ .header(
+ header::CONTENT_TYPE.to_string().as_str(),
+ "application/json",
+ )
+ .body(Some(body))
+ .build())
+}
+
+pub fn build_paypal_get_request(url: String, access_token: String) -> RouterResult<Request> {
+ Ok(RequestBuilder::new()
+ .method(Method::Get)
+ .url(&url)
+ .attach_default_headers()
+ .header(
+ header::AUTHORIZATION.to_string().as_str(),
+ format!("Bearer {}", access_token).as_str(),
+ )
+ .build())
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index d35090551de..4948bdd575b 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -301,6 +301,10 @@ pub enum Flow {
InviteUser,
/// Incremental Authorization flow
PaymentsIncrementalAuthorization,
+ /// Get action URL for connector onboarding
+ GetActionUrl,
+ /// Sync connector onboarding status
+ SyncOnboardingStatus,
}
///
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index bec1074b99d..2159d2d7994 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -262,3 +262,9 @@ connection_timeout = 10
[kv_config]
ttl = 300 # 5 * 60 seconds
+
+[connector_onboarding.paypal]
+client_id = ""
+client_secret = ""
+partner_id = ""
+enabled = true
|
feat
|
Add Connector onboarding APIs (#3050)
|
0d047e08f9c3679f4a7e8711b5a50486589ce0b0
|
2023-04-13 14:14:42
|
Sangamesh Kulkarni
|
refactor(Tokenization): remove ConnectorCallType from tokenization call (#862)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index e5bffe72e18..e2a9fb705e3 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1302,7 +1302,7 @@ pub struct GpayMetaData {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpaySessionTokenData {
- #[serde(rename = "gpay")]
+ #[serde(rename = "google_pay")]
pub data: GpayMetaData,
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 2f501f0c6c0..b8c0ecced8b 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -101,14 +101,9 @@ where
)
.await?;
- let (payment_data, tokenization_action) = get_connector_tokenization_action(
- state,
- &operation,
- connector.as_ref(),
- payment_data,
- &validate_result,
- )
- .await?;
+ let (payment_data, tokenization_action) =
+ get_connector_tokenization_action(state, &operation, payment_data, &validate_result)
+ .await?;
let (operation, mut payment_data) = operation
.to_update_tracker()?
@@ -584,15 +579,6 @@ where
Ok(payment_data)
}
-fn get_connector_from_connector_type(
- connector_details: Option<&api::ConnectorCallType>,
-) -> Option<String> {
- connector_details.and_then(|connector_call_type| match connector_call_type {
- api::ConnectorCallType::Single(data) => Some(data.connector_name.to_string()),
- _ => None,
- })
-}
-
fn is_payment_method_tokenization_enabled_for_connector(
state: &AppState,
connector_name: &str,
@@ -656,98 +642,78 @@ pub enum TokenizationAction {
pub async fn get_connector_tokenization_action<F, Req>(
state: &AppState,
operation: &BoxedOperation<'_, F, Req>,
- connector_details: Option<&api::ConnectorCallType>,
mut payment_data: PaymentData<F>,
validate_result: &operations::ValidateResult<'_>,
) -> RouterResult<(PaymentData<F>, TokenizationAction)>
where
F: Send + Clone,
{
- let payment_data_and_tokenization_action =
- match get_connector_from_connector_type(connector_details) {
- Some(connector) => {
- if is_operation_confirm(&operation) {
- let payment_method = &payment_data
- .payment_attempt
- .payment_method
- .get_required_value("payment_method")?;
-
- let is_connector_tokenization_enabled =
- is_payment_method_tokenization_enabled_for_connector(
- state,
- &connector,
- payment_method,
- )?;
-
- let payment_method_action = decide_payment_method_tokenize_action(
- state,
- &connector,
- payment_method,
- payment_data.token.as_ref(),
- is_connector_tokenization_enabled,
- )
- .await;
-
- let connector_tokenization_action = match payment_method_action {
- TokenizationAction::TokenizeInRouter => {
- let (_operation, payment_method_data) = operation
- .to_domain()?
- .make_pm_data(
- state,
- &mut payment_data,
- validate_result.storage_scheme,
- )
- .await?;
-
- payment_data.payment_method_data = payment_method_data;
- TokenizationAction::SkipConnectorTokenization
- }
-
- TokenizationAction::TokenizeInConnector => {
- TokenizationAction::TokenizeInConnector
- }
- TokenizationAction::TokenizeInConnectorAndRouter => {
- let (_operation, payment_method_data) = operation
- .to_domain()?
- .make_pm_data(
- state,
- &mut payment_data,
- validate_result.storage_scheme,
- )
- .await?;
-
- payment_data.payment_method_data = payment_method_data;
- TokenizationAction::TokenizeInConnector
- }
- TokenizationAction::ConnectorToken(token) => {
- payment_data.pm_token = Some(token);
- TokenizationAction::SkipConnectorTokenization
- }
- TokenizationAction::SkipConnectorTokenization => {
- TokenizationAction::SkipConnectorTokenization
- }
- };
- (payment_data, connector_tokenization_action)
- } else {
+ let connector = payment_data.payment_attempt.connector.to_owned();
+
+ let payment_data_and_tokenization_action = match connector {
+ Some(connector) if is_operation_confirm(&operation) => {
+ let payment_method = &payment_data
+ .payment_attempt
+ .payment_method
+ .get_required_value("payment_method")?;
+
+ let is_connector_tokenization_enabled =
+ is_payment_method_tokenization_enabled_for_connector(
+ state,
+ &connector,
+ payment_method,
+ )?;
+
+ let payment_method_action = decide_payment_method_tokenize_action(
+ state,
+ &connector,
+ payment_method,
+ payment_data.token.as_ref(),
+ is_connector_tokenization_enabled,
+ )
+ .await;
+
+ let connector_tokenization_action = match payment_method_action {
+ TokenizationAction::TokenizeInRouter => {
let (_operation, payment_method_data) = operation
.to_domain()?
.make_pm_data(state, &mut payment_data, validate_result.storage_scheme)
.await?;
payment_data.payment_method_data = payment_method_data;
- (payment_data, TokenizationAction::SkipConnectorTokenization)
+ TokenizationAction::SkipConnectorTokenization
}
- }
- None => {
- let (_operation, payment_method_data) = operation
- .to_domain()?
- .make_pm_data(state, &mut payment_data, validate_result.storage_scheme)
- .await?;
-
- payment_data.payment_method_data = payment_method_data;
- (payment_data, TokenizationAction::SkipConnectorTokenization)
- }
- };
+
+ TokenizationAction::TokenizeInConnector => TokenizationAction::TokenizeInConnector,
+ TokenizationAction::TokenizeInConnectorAndRouter => {
+ let (_operation, payment_method_data) = operation
+ .to_domain()?
+ .make_pm_data(state, &mut payment_data, validate_result.storage_scheme)
+ .await?;
+
+ payment_data.payment_method_data = payment_method_data;
+ TokenizationAction::TokenizeInConnector
+ }
+ TokenizationAction::ConnectorToken(token) => {
+ payment_data.pm_token = Some(token);
+ TokenizationAction::SkipConnectorTokenization
+ }
+ TokenizationAction::SkipConnectorTokenization => {
+ TokenizationAction::SkipConnectorTokenization
+ }
+ };
+ (payment_data, connector_tokenization_action)
+ }
+ _ => {
+ let (_operation, payment_method_data) = operation
+ .to_domain()?
+ .make_pm_data(state, &mut payment_data, validate_result.storage_scheme)
+ .await?;
+
+ payment_data.payment_method_data = payment_method_data;
+ (payment_data, TokenizationAction::SkipConnectorTokenization)
+ }
+ };
Ok(payment_data_and_tokenization_action)
}
|
refactor
|
remove ConnectorCallType from tokenization call (#862)
|
465114796349c219336aa8016e72356013871c96
|
2024-08-20 21:46:21
|
Swangi Kumari
|
refactor(core): make p24 billing_details optional (#5638)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cf8200d6779..4727c205688 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -1900,9 +1900,6 @@
"properties": {
"przelewy24": {
"type": "object",
- "required": [
- "billing_details"
- ],
"properties": {
"bank_name": {
"allOf": [
@@ -1913,7 +1910,12 @@
"nullable": true
},
"billing_details": {
- "$ref": "#/components/schemas/BankRedirectBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankRedirectBilling"
+ }
+ ],
+ "nullable": true
}
}
}
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index c479abc8d93..a91f64daa8a 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -6378,9 +6378,6 @@
"properties": {
"przelewy24": {
"type": "object",
- "required": [
- "billing_details"
- ],
"properties": {
"bank_name": {
"allOf": [
@@ -6391,7 +6388,12 @@
"nullable": true
},
"billing_details": {
- "$ref": "#/components/schemas/BankRedirectBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankRedirectBilling"
+ }
+ ],
+ "nullable": true
}
}
}
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 88c915f0e73..10db6a3c9d1 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2128,7 +2128,7 @@ pub enum BankRedirectData {
bank_name: Option<common_enums::BankNames>,
// The billing details for bank redirect
- billing_details: BankRedirectBilling,
+ billing_details: Option<BankRedirectBilling>,
},
Sofort {
/// The billing details for bank redirection
@@ -2263,7 +2263,7 @@ impl GetAddressFromPaymentMethodData for BankRedirectData {
}
Self::Przelewy24 {
billing_details, ..
- } => get_billing_address_inner(Some(billing_details), None, None),
+ } => get_billing_address_inner(billing_details.as_ref(), None, None),
Self::Trustly { country } => get_billing_address_inner(None, Some(country), None),
Self::OnlineBankingFpx { .. }
| Self::LocalBankRedirect {}
|
refactor
|
make p24 billing_details optional (#5638)
|
a9c0d0c55492c14a4a10283ffd8deae04c8ea853
|
2024-02-05 16:18:55
|
Hrithikesh
|
fix: return currency in payment methods list response (#3516)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 173272e25d8..0540d470a94 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -641,6 +641,10 @@ pub struct PaymentMethodListResponse {
#[schema(example = "https://www.google.com")]
pub redirect_url: Option<String>,
+ /// currency of the Payment to be done
+ #[schema(example = "USD")]
+ pub currency: Option<api_enums::Currency>,
+
/// Information about the payment method
#[schema(value_type = Vec<PaymentMethodList>,example = json!(
[
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 4bc0490e7d1..ea0df633204 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1803,6 +1803,7 @@ pub async fn list_payment_methods(
payment_method_types: bank_transfer_payment_method_types,
});
}
+ let currency = payment_intent.as_ref().and_then(|pi| pi.currency);
let merchant_surcharge_configs =
if let Some((payment_attempt, payment_intent, business_profile)) = payment_attempt
.as_ref()
@@ -1865,6 +1866,7 @@ pub async fn list_payment_methods(
show_surcharge_breakup_screen: merchant_surcharge_configs
.show_surcharge_breakup_screen
.unwrap_or_default(),
+ currency,
},
))
}
|
fix
|
return currency in payment methods list response (#3516)
|
3fba38a06daeccbd7023e508028de9f793ba7713
|
2024-01-22 05:51:11
|
github-actions
|
chore(version): 2024.01.22.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d59aac3f7fa..51d650f3fb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.01.22.0
+
+### Features
+
+- **user_roles:** Add accept invitation API and `UserJWTAuth` ([#3365](https://github.com/juspay/hyperswitch/pull/3365)) ([`a47372a`](https://github.com/juspay/hyperswitch/commit/a47372a451b60defda35fa212565b889ed5b2d2b))
+
+### Documentation
+
+- Add link to api docs ([#3405](https://github.com/juspay/hyperswitch/pull/3405)) ([`4e1e78e`](https://github.com/juspay/hyperswitch/commit/4e1e78ecd962f4b34fa04f611f03e8e6f6e1bd7c))
+
+**Full Changelog:** [`2024.01.19.1...2024.01.22.0`](https://github.com/juspay/hyperswitch/compare/2024.01.19.1...2024.01.22.0)
+
+- - -
+
## 2024.01.19.1
### Bug Fixes
|
chore
|
2024.01.22.0
|
e48202e0a06fa4d61a2637f57830ffa4aae1335d
|
2023-06-14 18:38:54
|
AkshayaFoiger
|
refactor(fix): [Stripe] Fix bug in Stripe (#1412)
| false
|
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 3d89e8b4aee..04d0c3884e9 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -1858,20 +1858,13 @@ impl services::ConnectorRedirectResponse for Stripe {
crate::logger::debug!(stripe_redirect_response=?query);
- Ok(query
- .redirect_status
- .map_or(
- payments::CallConnectorAction::Trigger,
- |status| match status {
- transformers::StripePaymentStatus::Failed => {
- payments::CallConnectorAction::Trigger
- }
- _ => payments::CallConnectorAction::StatusUpdate {
- status: enums::AttemptStatus::from(status),
- error_code: None,
- error_message: None,
- },
- },
- ))
+ Ok(query.redirect_status.map_or(
+ payments::CallConnectorAction::StatusUpdate {
+ status: enums::AttemptStatus::Pending,
+ error_code: None,
+ error_message: None,
+ },
+ |_| payments::CallConnectorAction::Trigger,
+ ))
}
}
|
refactor
|
[Stripe] Fix bug in Stripe (#1412)
|
ba0a1e95b72c0acf5bde81d424aa8fe220c40a22
|
2024-06-04 13:02:15
|
chikke srujan
|
fix(connector): [Adyen]add required fields for afterpay clearpay (#4858)
| false
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 138fef0cdf3..0d40e81c4ad 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -127,8 +127,6 @@ merchant_secret="Source verification key"
payment_method_type = "eps"
[[adyen.bank_redirect]]
payment_method_type = "blik"
-[[adyen.bank_redirect]]
- payment_method_type = "przelewy24"
[[adyen.bank_redirect]]
payment_method_type = "trustly"
[[adyen.bank_redirect]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 7236863745d..a71933870a5 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -127,8 +127,6 @@ merchant_secret="Source verification key"
payment_method_type = "eps"
[[adyen.bank_redirect]]
payment_method_type = "blik"
-[[adyen.bank_redirect]]
- payment_method_type = "przelewy24"
[[adyen.bank_redirect]]
payment_method_type = "trustly"
[[adyen.bank_redirect]]
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index c989e4c04c0..7177488cb3c 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -8110,6 +8110,100 @@ impl Default for super::settings::RequiredFields {
]),
common : HashMap::new(),
}
+ ),
+ (
+ enums::Connector::Adyen,
+ RequiredFieldFinal {
+ mandate : HashMap::new(),
+ non_mandate: 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.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line2".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.line2".to_string(),
+ display_name: "line2".to_string(),
+ field_type: enums::FieldType::UserAddressLine2,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.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![
+ "GB".to_string(),
+ ]
+ },
+ 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,
+ }
+ ),
+ ]),
+ common : HashMap::new(),
+ }
)
]),
},
|
fix
|
[Adyen]add required fields for afterpay clearpay (#4858)
|
2f65459d9e340e87cc94a38e5eae12a0c3ca1849
|
2023-01-06 13:48:50
|
Sanchith Hegde
|
docs: add detailed docs for trying sandbox and locally (#306)
| false
|
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index d7c73bab816..88856aa111f 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -8,7 +8,6 @@ contrib/ @juspay/orca-maintainers
.github/ @juspay/orca-maintainers
.gitignore @juspay/orca-maintainers
Makefile @juspay/orca-maintainers
-keys.conf @juspay/orca-maintainers
crates/ @juspay/orca-framework
diff --git a/INSTALL_linux.md b/INSTALL_linux.md
deleted file mode 100644
index 591accc4cce..00000000000
--- a/INSTALL_linux.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# How do I get set up?
-
-Below are steps to get setup on debian. You'll need `sudo` privileges.
-
-Use your favorite package manager for your favorite linux flavor.
-
-## Prerequisites
-
-* Install Dependencies
-
- * Install [rust]((https://www.rust-lang.org/)) using [rustup](https://rustup.rs/). (Checkout [rustup](https://rustup.rs/) for other ways to install). We'll use stable rust.
-
- ```bash
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- ```
-
- verify that rust compiler is successfully installed
-
- ```bash
- rustc --version
- ```
-
- * Setup your favorite editor to use rust-analyzer or equivalent to improve the IDE experience.
- * Install and start postgres service.
-
- ```bash
- sudo apt update
- sudo apt install postgresql postgresql-contrib
- # When installation is complete the postgreSQL service should start automatically
- ```
-
- You can download and install PostgreSQL for your system by following the instructions on [the official website of PostgreSQL](https://www.postgresql.org/download/).
-
- * Install and start redis service.
-
- ```bash
- sudo apt install redis-server
- ```
-
- You can download and install Redis for your system by following the instructions on [the official website of Redis](https://redis.io/docs/getting-started/installation/).
-
- * Install the diesel CLI
-
- ```bash
- # may require libpq which may be missing
- # sudo apt install libpq-dev
- cargo install diesel_cli --no-default-features --features "postgres"
- ```
-
-## Configuration and setup
-
-### Database setup
-
-Setup the necessary user/database using psql commands.
-
-```bash
-export DB_USER=<your username>
-export DB_PASS=<your password>
-export DB_NAME=<your db name>
-sudo -u postgres psql -e -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;"
-sudo -u postgres psql -e -c "CREATE DATABASE $DB_NAME;"
-```
-
-Clone the repo and switch to the application directory.
-
-run migration using below commands. This will create the required db schema and populate some sample data to get your started.
-
-```bash
-diesel migration --database-url postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME run
-```
-
-Use the above database credentials in the configuration file. (`Development.toml`)
-Configuration has been detailed in the following section.
-
-### Orca config
-
-The config files are present under the `config/` folder under the main application directory.
-You can use the appropriate config file for your setup.
-
-* Dev/Local: [Development.toml](config/Development.toml)
-* Sandbox/Staging: [Sandbox.toml](config/Sandbox.toml)
-* Production: [Production.toml](config/Production.toml)
-
-Refer to [config.example.toml](config/config.example.toml) for all the available configuration options.
-Refer to [Development.toml](config/Development.toml) for the recommended defaults for local development.
-
-## Testing the application
-
-Use `cargo` to run the application
-
-```bash
-cargo run
-```
-
-Test Juspay Router APIs using the [Postman collection](postman/collection.postman.json) pointing to your test server.
-
-### How to run tests
-
-The application contains many unit tests and Integration test. you can run them through cargo
-
-```bash
-cargo test
-```
-
-### Errors
-
-None reported
diff --git a/INSTALL_macos.md b/INSTALL_macos.md
deleted file mode 100644
index 40f1095ba3a..00000000000
--- a/INSTALL_macos.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# How do I get set up?
-
-Below are steps to get setup on MacOS using `Brew`. But use your favorite package manager.
-
-## Prequisites
-
-We'll use [Brew](https://brew.sh/) on MacOS for simplicity.
-
-* Install Dependencies
- * Install [rust]((https://www.rust-lang.org/)) using [rustup](https://rustup.rs/). (Checkout [rustup](https://rustup.rs/) for other ways to install). We'll use stable rust.
-
- ```bash
- brew install rustup
- rustup-init
- ```
-
- verify that rust compiler is successfully installed
-
- ```bash
- rustc --version
- ```
-
- * Setup your favorite editor to use rust-analyzer or equivalent to improve the IDE experience.
- * Install and start postgres service.
-
- ```bash
- brew install postgresql@14
- brew services start postgresql@14
- # You may need to create the `postgres` user if not already added.
- createuser -s postgres
- ```
-
- * Install and start redis service.
-
- ```bash
- brew install redis
- brew services start redis
- ```
-
- * Install the diesel CLI
-
- ```bash
- cargo install diesel_cli --no-default-features --features "postgres"
- ```
-
-## Configuration and setup
-
-### Database setup
-
-Setup the necessary user/database using psql commands.
-
-```bash
-export DB_USER=<your username>
-export DB_PASS=<your password>
-export DB_NAME=<your db name>
-psql -e -U postgres -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;"
-psql -e -U postgres -c "CREATE DATABASE $DB_NAME"
-```
-
-Clone the repo and switch to the application directory.
-
-run migration using below commands. This will create the required db schema and populate some sample data to get your started.
-
-```bash
-diesel migration --database-url postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME run
-```
-
-Use the above database credentials in the configuration file. (`Development.toml`)
-Configuration has been detailed in the following section.
-
-### Orca config
-
-The config files are present under the `config/` folder under the main application directory.
-You can use the appropriate config file for your environment.
-
-* Dev/Local: [Development.toml](config/Development.toml)
-* Sandbox/Staging: [Sandbox.toml](config/Sandbox.toml)
-* Production: [Production.toml](config/Production.toml)
-
-Refer to [config.example.toml](config/config.example.toml) for all the available configuration options.
-Refer to [Development.toml](config/Development.toml) for the recommended defaults for local development.
-
-## Testing the application
-
-Use `cargo` to run the application
-
-```bash
-cargo run
-```
-
-Test Juspay Router APIs using the [Postman collection](postman/collection.postman.json) pointing to your test server.
-
-### How to run tests
-
-The application contains many unit tests and Integration test. you can run them through cargo
-
-```bash
-cargo test
-```
-
-### Errors
-
-* Compiling fails due to `libpq` missing (`-lpq` error during linking stage).
- * This implies the postgres isn't properly installed or not exposed in PATH correctly. You can workaround by installing libpq and exporting `PQ_LIB_DIR` as below. But this will lead to unnecessary re-compile of pq/diesel.
-
- ```bash
- # If library itself isn't present, then
- brew install libpq
- export PQ_LIB_DIR="$(brew --prefix libpq)/lib"
- # persist in your startup file
- echo "PQ_LIB_DIR=$(brew --prefix libpq)/lib" >> ~/.zshrc
- ```
diff --git a/README.md b/README.md
index 15de63b263b..fff9affd730 100644
--- a/README.md
+++ b/README.md
@@ -39,144 +39,21 @@ _Orca is wire-compatible with top processors like Stripe making it easy to integ
### Try It Out
-**Step 1:** Use [**Orca Sandbox**](https://orca-test-app.netlify.app/) to create your account and test payments.
-Please save the API key for the next step.
+You have two options to try out Orca:
-**Step 2:** Import our [**Postman Collection**](https://www.getpostman.com/collections/63d0d419ce1d1140fc9f) using the link below.
-(Please use the API key auth type.)
-
-```text
-https://www.getpostman.com/collections/63d0d419ce1d1140fc9f
-```
-
-### Installation Options
-
-**Option 1:** Self-hosting with **Docker Image**.
-_(This option is coming soon!!)_
-
-**Option 2:** Setup dev environment using **Docker Compose**:
-
-1. [Install Docker Compose](https://docs.docker.com/compose/install/).
-
-2. Clone the repository:
-
- ```bash
- git clone https://github.com/juspay/orca.git
- ```
-
- You might need to create a [Personal Access Token (PAT)](https://docs.github.com/en/[email protected]/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) if you are prompted to authenticate.
- Use the generated PAT as the password.
-
-3. [Optional] Configure your settings in [docker_compose.toml](./config/docker_compose.toml)
-
-4. Run the application and create an account:
-
- 1. Build and run Orca using Docker Compose:
-
- ```bash
- docker compose up -d
- ```
-
- 2. Run database migrations:
-
- ```bash
- docker compose run orca-server bash -c "cargo install diesel_cli && diesel migration --database-url postgres://db_user:db_pass@pg:5432/orca_db run"
- ```
-
- 3. Verify that the Orca server is up by checking your local server health:
-
- ```bash
- curl --location --request GET 'http://localhost:8080/health'
- ```
-
- 4. Create your Merchant Account and get your account information:
-
- ```bash
- bash ./scripts/create_merchant_account.sh
- ```
-
-#### Configure & Test
-
-5. Configure & test using your API key:
-
- 1. Add your Connector API keys in [`keys.conf`](./keys.conf) file.
- You can fetch API keys from the Connector's Dashboard (say Stripe/Adyen/Checkout dashboard).
-
- 2. Configure the connector in your dev environment:
-
- ```bash
- bash ./scripts/create_connector_account.sh <connector_name> <your Orca merchant_id>
- ```
-
- Use the Orca merchant ID generated from the previous step.
-
- 3. Run a health check for your local server:
-
- ```bash
- curl --location --request GET 'http://localhost:8080/health'
- ```
-
- 4. Update the below command with your Orca API key and perform a test transaction.
- Refer our [Postman collection](https://www.getpostman.com/collections/63d0d419ce1d1140fc9f) to test more features (refunds, customers, payment methods etc.,)
-
- ```bash
- export API_KEY="<your api-key>"
- curl --location --request POST "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,
- "return_url": "https://juspay.io",
- "payment_method": "card",
- "payment_method_data": {
- "card": {
- "card_number": "4000056655665556",
- "card_exp_month": "10",
- "card_exp_year": "25",
- "card_holder_name": "John Doe",
- "card_cvc": "123"
- }
- }
- }'
- ```
-
-**Option 3:** Local setup:
-
-a. [For MacOS](/INSTALL_macos.md)
-
-b. [For Linux](/INSTALL_linux.md)
-
-<!-- 4. Install with **Setup Script**
-
- a. Clone the repository
- ```
- git clone https://github.com/juspay/orca.git
- ```
-
- b. Execute script
- ```
- install orca.sh
- ```
-
- b. Create your Merchant Account
- ```
- create_merchant_account.sh
- ```
-
- c. [Configure & Test](#configure--test-the-setup) the setup using the api-key generated in Step 2 -->
+1. [Try out our sandbox environment](/docs/try_sandbox.md): Requires the least
+ effort and does not involve setting up anything on your system.
+2. [Try out Orca on your local system](/docs/try_local_system.md): Requires
+ comparatively more effort as it involves setting up dependencies on your
+ system.
### Fast Integration for Stripe Users
If you are already using Stripe, integrating with Orca is fun, fast & easy.
Try the steps below to get a feel for how quick the setup is:
-1. Download Stripe's [demo app](https://stripe.com/docs/payments/quickstart)
-2. Change server and client SDK dependencies in your app
-3. Change API keys in your App
-4. [Configure & Test](#configure--test)
+1. Get API keys from our [dashboard](https://orca-dahboard.netlify.app).
+2. Follow the instructions detailed on our [documentation page](https://hyperswitch.io/docs).
## Supported Features
diff --git a/docs/try_local_system.md b/docs/try_local_system.md
new file mode 100644
index 00000000000..833b95f82a6
--- /dev/null
+++ b/docs/try_local_system.md
@@ -0,0 +1,410 @@
+# Try out hyperswitch on your system
+
+**NOTE:**
+This guide is aimed at users and developers who wish to set up hyperswitch on
+their local systems and requires quite some time and effort.
+If you'd prefer trying out hyperswitch quickly without the hassle of setting up
+all dependencies, you can [try out hyperswitch sandbox environment][try-sandbox].
+
+There are two options to set up hyperswitch on your system:
+
+1. Use Docker Compose
+2. Set up a Rust environment and other dependencies on your system
+
+Check the Table Of Contents to jump to the relevant section.
+
+[try-sandbox]: ./try_sandbox.md
+
+**Table Of Contents:**
+
+- [Set up hyperswitch using Docker Compose](#set-up-hyperswitch-using-docker-compose)
+- [Set up a Rust environment and other dependencies](#set-up-a-rust-environment-and-other-dependencies)
+ - [Set up dependencies on Ubuntu-based systems](#set-up-dependencies-on-ubuntu-based-systems)
+ - [Set up dependencies on MacOS](#set-up-dependencies-on-macos)
+ - [Set up the database](#set-up-the-database)
+ - [Configure the application](#configure-the-application)
+ - [Run the application](#run-the-application)
+- [Try out our APIs](#try-out-our-apis)
+ - [Set up your merchant account](#set-up-your-merchant-account)
+ - [Set up a payment connector account](#set-up-a-payment-connector-account)
+ - [Create a Payment](#create-a-payment)
+ - [Create a Refund](#create-a-refund)
+
+## Set up hyperswitch using Docker Compose
+
+1. Install [Docker Compose][docker-compose-install].
+2. Clone the repository and switch to the project directory:
+
+ ```shell
+ git clone https://github.com/juspay/hyperswitch
+ cd hyperswitch
+ ```
+
+3. (Optional) Configure the application using the
+ [`config/docker_compose.toml`][docker-compose-config] file.
+ The provided configuration should work as is.
+ If you do update the `docker_compose.toml` file, ensure to also update the
+ corresponding values in the [`docker-compose.yml`][docker-compose-yml] file.
+4. Start all the services using Docker Compose:
+
+ ```shell
+ docker compose up -d
+ ```
+
+5. Run database migrations:
+
+ ```shell
+ docker compose run orca-server bash -c \
+ "cargo install diesel_cli && \
+ diesel migration --database-url postgres://db_user:db_pass@pg:5432/orca_db run"
+ ```
+
+6. Verify that the server is up and running by hitting the health endpoint:
+
+ ```shell
+ curl --head --request GET 'http://localhost:8080/health'
+ ```
+
+ If the command returned a `200 OK` status code, proceed with
+ [trying out our APIs](#try-out-our-apis).
+
+[docker-compose-install]: https://docs.docker.com/compose/install/
+[docker-compose-config]: /config/docker_compose.toml
+[docker-compose-yml]: /docker-compose.yml
+
+## Set up a Rust environment and other dependencies
+
+### Set up dependencies on Ubuntu-based systems
+
+This section of the guide provides instructions to install dependencies on
+Ubuntu-based systems.
+If you're running another Linux distribution, install the corresponding packages
+for your distribution and follow along.
+
+1. Install the stable Rust toolchain using `rustup`:
+
+ ```shell
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+ ```
+
+ When prompted, proceed with the `default` profile, which installs the stable
+ toolchain.
+
+ Optionally, verify that the Rust compiler and `cargo` are successfully
+ installed:
+
+ ```shell
+ rustc --version
+ ```
+
+ _Be careful when running shell scripts downloaded from the Internet.
+ We only suggest running this script as there seems to be no `rustup` package
+ available in the Ubuntu package repository._
+
+2. Install PostgreSQL and start the `postgresql` systemd service:
+
+ ```shell
+ sudo apt update
+ sudo apt install postgresql postgresql-contrib libpq-dev
+ systemctl start postgresql.service
+ ```
+
+ If you're running any other distribution than Ubuntu, you can follow the
+ installation instructions on the
+ [PostgreSQL documentation website][postgresql-install] to set up PostgreSQL
+ on your system.
+
+3. Install Redis and start the `redis` systemd service:
+
+ ```shell
+ sudo apt install redis-server
+ systemctl start redis.service
+ ```
+
+ If you're running a distribution other than Ubuntu, you can follow the
+ installation instructions on the [Redis website][redis-install] to set up
+ Redis on your system.
+
+4. Install `diesel_cli` using `cargo`:
+
+ ```shell
+ cargo install diesel_cli --no-default-features --features "postgres"
+ ```
+
+Once you're done with setting up the dependencies, proceed with
+[setting up the database](#set-up-the-database).
+
+[postgresql-install]: https://www.postgresql.org/download/
+[redis-install]: https://redis.io/docs/getting-started/installation/
+
+### Set up dependencies on MacOS
+
+We'll be using [Homebrew][homebrew] in this section of the guide.
+You can opt to use your favorite package manager instead.
+
+1. Install the stable Rust toolchain using `rustup`:
+
+ ```shell
+ brew install rustup-init
+ rustup-init
+ ```
+
+ When prompted, proceed with the `default` profile, which installs the stable
+ toolchain.
+
+ Optionally, verify that the Rust compiler and `cargo` are successfully
+ installed:
+
+ ```shell
+ rustc --version
+ ```
+
+2. Install PostgreSQL and start the `postgresql` service:
+
+ ```shell
+ brew install postgresql@14
+ brew services start postgresql@14
+ ```
+
+ If a `postgres` database user was not already created, you may have to create
+ one:
+
+ ```shell
+ createuser -s postgres
+ ```
+
+3. Install Redis and start the `redis` service:
+
+ ```shell
+ brew install redis
+ brew services start redis
+ ```
+
+4. Install `diesel_cli` using `cargo`:
+
+ ```shell
+ cargo install diesel_cli --no-default-features --features "postgres"
+ ```
+
+ If linking `diesel_cli` fails due to missing `libpq` (if the error message is
+ along the lines of `cannot find -lpq`), you may also have to install `libpq`
+ and reinstall `diesel_cli`:
+
+ ```shell
+ brew install libpq
+ export PQ_LIB_DIR="$(brew --prefix libpq)/lib"
+
+ cargo install diesel_cli --no-default-features --features "postgres"
+ ```
+
+ You may also choose to persist the value of `PQ_LIB_DIR` in your shell
+ startup file like so:
+
+ ```shell
+ echo 'PQ_LIB_DIR="$(brew --prefix libpq)/lib"' >> ~/.zshrc
+ ```
+
+Once you're done with setting up the dependencies, proceed with
+[setting up the database](#set-up-the-database).
+
+[homebrew]: https://brew.sh/
+
+### Set up the database
+
+1. Create the database and database users, modifying the database user
+ credentials and database name as required.
+
+ ```shell
+ export DB_USER="db_user"
+ export DB_PASS="db_pass"
+ export DB_NAME="orca_db"
+ ```
+
+ On Ubuntu-based systems:
+
+ ```shell
+ sudo -u postgres psql -e -c \
+ "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;"
+ sudo -u postgres psql -e -c \
+ "CREATE DATABASE $DB_NAME;"
+ ```
+
+ On MacOS:
+
+ ```shell
+ psql -e -U postgres -c \
+ "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;"
+ psql -e -U postgres -c \
+ "CREATE DATABASE $DB_NAME"
+ ```
+
+2. Clone the repository and switch to the project directory:
+
+ ```shell
+ git clone https://github.com/juspay/hyperswitch
+ cd hyperswitch
+ ```
+
+3. Run database migrations using `diesel_cli`:
+
+ ```shell
+ diesel migration --database-url postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME run
+ ```
+
+Once you're done with setting up the database, proceed with
+[configuring the application](#configure-the-application).
+
+### Configure the application
+
+The application configuration files are present under the
+[`config`][config-directory] directory.
+
+The configuration file read varies with the environment:
+
+- Development: [`config/Development.toml`][config-development]
+- Sandbox: `config/Sandbox.toml`
+- Production: `config/Production.toml`
+
+Refer to [`config.example.toml`][config-example] for all the available
+configuration options.
+Refer to [`Development.toml`][config-development] for the recommended defaults for
+local development.
+
+Ensure to update the [`Development.toml`][config-development] file if you opted
+to use different database credentials as compared to the sample ones included in
+this guide.
+
+Once you're done with configuring the application, proceed with
+[running the application](#run-the-application).
+
+[config-directory]: /config
+[config-development]: /config/Development.toml
+[config-example]: /config/config.example.toml
+[config-docker-compose]: /config/docker_compose.toml
+
+### Run the application
+
+1. Compile and run the application using `cargo`:
+
+ ```shell
+ cargo run
+ ```
+
+2. Verify that the server is up and running by hitting the health endpoint:
+
+ ```shell
+ curl --head --request GET 'http://localhost:8080/health'
+ ```
+
+ If the command returned a `200 OK` status code, proceed with
+ [trying out our APIs](#try-out-our-apis).
+
+## Try out our APIs
+
+### Set up your merchant account
+
+1. Sign up or sign in to [Postman][postman].
+2. Open our [Postman collection][postman-collection] and switch to the
+ ["Variables" tab][variables].
+ Add the admin API key you configured in the application configuration under
+ the "current value" column for the `admin_api_key` variable.
+
+ 1. If you're running Docker Compose, you can find the configuration file at
+ [`config/docker_compose.toml`][config-docker-compose], search for
+ `admin_api_key` to find the admin API key.
+ 2. If you set up the dependencies locally, you can find the configuration
+ file at [`config/Development.toml`][config-development], search for
+ `admin_api_key` to find the admin API key
+
+3. Open the ["Quick Start" folder][quick-start] in the collection.
+4. Open the ["Merchant Account - Create"][merchant-account-create] request,
+ switch to the "Body" tab and update any request parameters as required.
+
+ - If you want to use a different priority order for choosing a payment
+ connector other than the provided default, update the
+ `connectors_pecking_order` field present in the `custom_routing_rules`
+ field to your liking.
+
+ Click on the "Send" button to create a merchant account.
+ You should obtain a response containing most of the data included in the
+ request, along with some additional fields.
+ Store the merchant ID, API key and publishable key returned in the response
+ securely.
+
+5. Open the ["Variables" tab][variables] in the
+ [Postman collection][postman-collection] and add the following variables:
+
+ 1. Add the API key you obtained in the previous step under the "current value"
+ column for the `api_key` variable.
+ 2. Add the merchant ID you obtained in the previous step under the "current
+ value" column for the `merchant_id` variable.
+
+### Set up a payment connector account
+
+1. Sign up on the payment connector's (say Stripe, Adyen, etc.) dashboard and
+ store your connector API key (and any other necessary secrets) securely.
+2. Open the ["Payment Connector - Create"][payment-connector-create] request,
+ switch to the "Body" tab and update any request parameters as required.
+
+ - Pay special attention to the `connector_name` and
+ `connector_account_details` fields and update them.
+
+ Click on the "Send" button to create a payment connector account.
+ You should obtain a response containing most of the data included in the
+ request, along with some additional fields.
+
+3. Follow the above steps if you'd like to add more payment connector accounts.
+
+### Create a Payment
+
+Ensure that you have
+[set up your merchant account](#set-up-your-merchant-account) and
+[set up at least one payment connector account](#set-up-a-payment-connector-account)
+before trying to create a payment.
+
+1. Open the ["Payments - Create"][payments-create] request, switch to the "Body"
+ tab and update any request parameters as required.
+ Click on the "Send" button to create a payment.
+ If all goes well and you had provided the correct connector credentials, the
+ payment should be created successfully.
+ You should see the `status` field of the response body having a value of
+ `succeeded` in this case.
+
+ - If the `status` of the payment created was `requires_confirmation`, set
+ `confirm` to `true` in the request body and send the request again.
+
+2. Open the ["Payments - Retrieve"][payments-retrieve] request and click on the
+ "Send" button (without modifying anything).
+ This should return the payment object for the payment created in Step 2.
+
+### Create a Refund
+
+1. Open the ["Refunds - Create"][refunds-create] request in the
+ ["Quick Start" folder][quick-start] folder and switch to the "Body" tab.
+ Update the amount to be refunded, if required, and click on the "Send" button.
+ This should create a refund against the last payment made for the specified
+ amount.
+ Check the `status` field of the response body to verify that the refund
+ hasn't failed.
+2. Open the ["Refunds - Retrieve"][refunds-retrieve] request and switch to the
+ "Params" tab.
+ Set the `id` path variable in the "Path Variables" table to the `refund_id`
+ value returned in the response during the previous step.
+ This should return the refund object for the refund created in the previous
+ step.
+
+That's it!
+Hope you got a hang of our APIs.
+To explore more of our APIs, please check the remaining folders in the
+[Postman collection][postman-collection].
+
+[postman]: https://www.postman.com
+[postman-collection]: https://www.postman.com/hyperswitch/workspace/hyperswitch/collection/25176183-e36f8e3d-078c-4067-a273-f456b6b724ed
+[variables]: https://www.postman.com/hyperswitch/workspace/hyperswitch/collection/25176183-e36f8e3d-078c-4067-a273-f456b6b724ed?tab=variables
+[quick-start]: https://www.postman.com/hyperswitch/workspace/hyperswitch/folder/25176183-0103918c-6611-459b-9faf-354dee8e4437
+[merchant-account-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-00124712-4dff-43d8-afb2-b99cdac1511d
+[payment-connector-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-f9509d03-bb1b-4d86-bb63-1658da7f1be5
+[payments-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-9b4ad6a8-fbdd-4919-8505-c75c83bdf9d6
+[payments-retrieve]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-11995c9b-8a34-4afd-a6ce-e8645693929b
+[refunds-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-5b15d068-db9e-48a5-9ee9-3a70c0aac944
+[refunds-retrieve]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-c50c32af-5ceb-4ab6-aca7-85f6b32df9d3
diff --git a/docs/try_sandbox.md b/docs/try_sandbox.md
new file mode 100644
index 00000000000..49f7e8fb65a
--- /dev/null
+++ b/docs/try_sandbox.md
@@ -0,0 +1,78 @@
+# Try out hyperswitch sandbox environment
+
+**Table Of Contents:**
+
+- [Set up your accounts](#set-up-your-accounts)
+- [Try out our APIs](#try-out-our-apis)
+ - [Create a payment](#create-a-payment)
+ - [Create a refund](#create-a-refund)
+
+## Set up your accounts
+
+1. Sign up on the payment connector's (say Stripe, Adyen, etc.) dashboard and
+ store your connector API key (and any other necessary secrets) securely.
+2. Sign up on our [dashboard][dashboard].
+3. Create a merchant account on our dashboard and generate your API keys.
+ Ensure to save the merchant ID, API key and publishable key displayed on the
+ dashboard securely.
+4. Configure the merchant return URL and the webhooks URL, which will be used
+ on completion of payments and for sending webhooks, respectively.
+5. Create a payments connector account by selecting a payment connector among
+ the options displayed and fill in the connector credentials you obtained in
+ Step 1.
+6. Sign up or sign in to [Postman][postman].
+7. Open our [Postman collection][postman-collection] and switch to the
+ ["Variables" tab][variables].
+ Add the API key received in Step 3 under the "current value" column for the
+ `api_key` variable.
+
+## Try out our APIs
+
+### Create a payment
+
+1. Open the ["Quick Start" folder][quick-start] in the collection.
+2. Open the ["Payments - Create"][payments-create] request, switch to the "Body"
+ tab and update any request parameters as required.
+ Click on the "Send" button to create a payment.
+ If all goes well and you had provided the correct connector credentials, the
+ payment should be created successfully.
+ You should see the `status` field of the response body having a value of
+ `succeeded` in this case.
+
+ - If the `status` of the payment created was `requires_confirmation`, set
+ `confirm` to `true` in the request body and send the request again.
+
+3. Open the ["Payments - Retrieve"][payments-retrieve] request and click on the
+ "Send" button (without modifying anything).
+ This should return the payment object for the payment created in Step 2.
+
+### Create a refund
+
+1. Open the ["Refunds - Create"][refunds-create] request in the
+ ["Quick Start" folder][quick-start] folder and switch to the "Body" tab.
+ Update the amount to be refunded, if required, and click on the "Send" button.
+ This should create a refund against the last payment made for the specified
+ amount.
+ Check the `status` field of the response body to verify that the refund
+ hasn't failed.
+2. Open the ["Refunds - Retrieve"][refunds-retrieve] request and switch to the
+ "Params" tab.
+ Set the `id` path variable in the "Path Variables" table to the `refund_id`
+ value returned in the response during the previous step.
+ This should return the refund object for the refund created in the previous
+ step.
+
+That's it!
+Hope you got a hang of our APIs.
+To explore more of our APIs, please check the remaining folders in the
+[Postman collection][postman-collection].
+
+[dashboard]: https://orca-dahboard.netlify.app
+[postman]: https://www.postman.com
+[postman-collection]: https://www.postman.com/hyperswitch/workspace/hyperswitch/collection/25176183-e36f8e3d-078c-4067-a273-f456b6b724ed
+[variables]: https://www.postman.com/hyperswitch/workspace/hyperswitch/collection/25176183-e36f8e3d-078c-4067-a273-f456b6b724ed?tab=variables
+[quick-start]: https://www.postman.com/hyperswitch/workspace/hyperswitch/folder/25176183-0103918c-6611-459b-9faf-354dee8e4437
+[payments-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-9b4ad6a8-fbdd-4919-8505-c75c83bdf9d6
+[payments-retrieve]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-11995c9b-8a34-4afd-a6ce-e8645693929b
+[refunds-create]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-5b15d068-db9e-48a5-9ee9-3a70c0aac944
+[refunds-retrieve]: https://www.postman.com/hyperswitch/workspace/hyperswitch/request/25176183-c50c32af-5ceb-4ab6-aca7-85f6b32df9d3
diff --git a/keys.conf b/keys.conf
deleted file mode 100644
index 772aca35eeb..00000000000
--- a/keys.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-# For the connector you wish to configure (Say STRIPE,ADYEN,CHECKOUT) please configure the credentials in below format
-# For connectors that needs two keys you have to fill the first key in api_key and second key in key1 (Refer the adyen configuration below)
-# Sample Stripe Configuration
-# api_key: <Your stripe sandbox api key comes here>
-#
-# Sample Adyen Configuration
-# api_key: <Your API key>
-# key1: <Your Merchant Account ID>
-
-stripe_api_key: <API-KEY>
-
-checkout_api_key: <API-KEY>
-checkout_key1: <ADDITONAL-KEY>
-
-authorizedotnet_api_key: <API-KEY>
-authorizedotnet_key1: <ADDITONAL-KEY>
-
-adyen_api_key: <API-KEY>
-adyen_key1: <ADDITONAL-KEY>
-
-aci_api_key: <API-KEY>
-aci_key1: <ADDITONAL-KEY>
-
-braintree_api_key: <API-KEY>
-braintree_key1: <ADDITIONAL-KEY>
\ No newline at end of file
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 38addff3b89..31d02d185d1 100644
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -9,13 +9,12 @@ if [[ -z "$pg" ]]; then
fi
cd $SCRIPT/..
rm -rf $conn/$pg $conn/$pg.rs
-git checkout $conn.rs $src/types/api.rs scripts/create_connector_account.sh $src/configs/settings.rs
+git checkout $conn.rs $src/types/api.rs $src/configs/settings.rs
sed -i'' -e "s/pub use self::{/pub mod ${pg};\n\npub use self::{/" $conn.rs
sed -i'' -e "s/};/${pg}::${pgc},\n};/" $conn.rs
sed -i'' -e "s/_ => Err/\"${pg}\" => Ok(Box::new(\&connector::${pgc})),\n\t\t\t_ => Err/" $src/types/api.rs
-sed -i'' -e "s/*) echo \"This connector/${pg}) required_connector=\"${pg}\";;\n\t\t*) echo \"This connector/" scripts/create_connector_account.sh
sed -i'' -e "s/pub supported: SupportedConnectors,/pub supported: SupportedConnectors,\n\tpub ${pg}: ConnectorParams,/" $src/configs/settings.rs
-rm $conn.rs-e $src/types/api.rs-e scripts/create_connector_account.sh-e $src/configs/settings.rs-e
+rm $conn.rs-e $src/types/api.rs-e $src/configs/settings.rs-e
cd $conn/
cargo gen-pg $pg
mv $pg/mod.rs $pg.rs
diff --git a/scripts/create_connector_account.sh b/scripts/create_connector_account.sh
deleted file mode 100644
index c03a3a44269..00000000000
--- a/scripts/create_connector_account.sh
+++ /dev/null
@@ -1,222 +0,0 @@
-connector=$(echo -e "$1" | awk '{print tolower($0)}')
-merchant_id="$2"
-
-required_connector="stripe"
-
-help() {
- echo -e "Usage: create_connector.sh <connector-name> <merchant_id>"
- exit 2
-}
-
-if [ -z "$connector" ]; then
- echo "Please provide a connector"
- help
-fi
-
-if [ -z "$merchant_id" ]; then
- echo "Please provide a merchant_id"
- help
-fi
-
-read_keys() {
- local api_key=$(echo -e "${required_connector}_api_key")
- local key=$(echo -e "${required_connector}_key1")
- local key1=$(grep "^$api_key" keys.conf | awk -F: '{ split($0, array, ":"); print array[2]}'| xargs)
- local key2=$(grep "^$key" keys.conf | awk -F: '{ split($0, array, ":"); print array[2]}'| xargs)
-
- if [[ "$required_connector" == "stripe" ]]; then
- local json="\"auth_type\": \"HeaderKey\", \"api_key\": \"$key1\""
- echo "$json"
- else
- local json="\"auth_type\": \"BodyKey\", \"api_key\": \"$key1\", \"key1\": \"$key2\""
- echo "$json"
- fi
-}
-
-case "$connector" in
- stripe) required_connector="stripe";;
- checkout) required_connector="checkout";;
- authorizedotnet) required_connector="authorizedotnet";;
- aci) required_connector="aci";;
- adyen) required_connector="adyen";;
- braintree) required_connector="braintree";;
- shift4) required_connector="shift4";;
- *) echo "This connector is not supported" 1>&2;exit 1;;
-esac
-
-keys="$(read_keys)"
-
-json=$(echo '{
- "connector_type": "fiz_operations",
- "connector_name": "'$required_connector'",
- "connector_account_details": {
- '$keys'
- },
- "test_mode": false,
- "disabled": false,
- "payment_methods_enabled": [
- {
- "payment_method": "wallet",
- "payment_method_types": [
- "upi_collect",
- "upi_intent"
- ],
- "payment_method_issuers": [
- "labore magna ipsum",
- "aute"
- ],
- "payment_schemes": [
- "Discover",
- "Discover"
- ],
- "accepted_currencies": [
- "AED",
- "AED"
- ],
- "accepted_countries": [
- "in",
- "us"
- ],
- "minimum_amount": 1,
- "maximum_amount": 68607706,
- "recurring_enabled": true,
- "installment_payment_enabled": true
- }
- ],
- "metadata": {
- "city": "NY",
- "unit": "245"
- }
-}')
-
-update_merchant_account=$(echo '{
- "merchant_id": "'$merchant_id'",
- "merchant_name": "NewAge Retailer",
- "merchant_details": {
- "primary_contact_person": "John Test",
- "primary_email": "[email protected]",
- "primary_phone": "veniam aute officia ullamco esse",
- "secondary_contact_person": "John Test2",
- "secondary_email": "[email protected]",
- "secondary_phone": "proident adipisicing officia nulla",
- "website": "www.example.com",
- "about_business": "Online Retail with a wide selection of organic products for North America",
- "address": {
- "line1": "Juspay Router",
- "line2": "Koramangala",
- "line3": "Stallion",
- "city": "Bangalore",
- "state": "Karnataka",
- "zip": "560095",
- "country": "IN"
- }
- },
- "return_url": "www.example.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
- },
- "routing_algorithm": "custom",
- "custom_routing_rules": [
- {
- "payment_methods_incl": [
- "card",
- "card"
- ],
- "payment_methods_excl": [
- "card",
- "card"
- ],
- "payment_method_types_incl": [
- "credit"
- ],
- "payment_method_types_excl": [
- "credit"
- ],
- "payment_method_issuers_incl": [
- "Citibank",
- "JPMorgan"
- ],
- "payment_method_issuers_excl": [
- "Citibank",
- "JPMorgan"
- ],
- "countries_incl": [
- "US",
- "UK",
- "IN"
- ],
- "countries_excl": [
- "US",
- "UK",
- "IN"
- ],
- "currencies_incl": [
- "USD",
- "EUR"
- ],
- "currencies_excl": [
- "AED",
- "SGD"
- ],
- "metadata_filters_keys": [
- "payments.udf1",
- "payments.udf2"
- ],
- "metadata_filters_values": [
- "android",
- "Category_Electronics"
- ],
- "connectors_pecking_order": [
- "'$required_connector'"
- ],
- "connectors_traffic_weightage_key": [
- "stripe",
- "adyen",
- "brain_tree"
- ],
- "connectors_traffic_weightage_value": [
- 50,
- 30,
- 20
- ]
- },
- {
- "connectors_pecking_order": [
- "'$required_connector'"
- ],
- "connectors_traffic_weightage_key": [
- "stripe",
- "adyen",
- "brain_tree"
- ],
- "connectors_traffic_weightage_value": [
- 50,
- 30,
- 20
- ]
- }
- ],
- "metadata": {
- "city": "NY",
- "unit": "245"
- }
-}')
-
-resp=$(curl -s --location --request POST 'http://127.0.0.1:8080/account/'$merchant_id'/connectors' \
---header 'Content-Type: application/json' \
---header 'Accept: application/json' \
---header 'api-key: test_admin' \
---data-raw "$json")
-
-resp=$(curl -s --location --request POST 'http://127.0.0.1:8080/accounts/'$merchant_id'' \
---header 'Content-Type: application/json' \
---header 'Accept: application/json' \
---header 'api-key: test_admin' \
---data-raw "$update_merchant_account")
-
-echo -e "\033[1mYour Connector $connector for Merchant ID $merchant_id has been created\033[0m\n"
diff --git a/scripts/create_merchant_account.sh b/scripts/create_merchant_account.sh
deleted file mode 100644
index 38f2f7220b6..00000000000
--- a/scripts/create_merchant_account.sh
+++ /dev/null
@@ -1,178 +0,0 @@
-merchant_id="merchant_$(date +"%s")"
-
-resp=$(curl -s --location --request POST 'http://127.0.0.1:8080/accounts' \
---header 'Content-Type: application/json' \
---header 'Accept: application/json' \
---header 'api-key: test_admin' \
---data-raw '{
- "merchant_id": "'$merchant_id'",
- "merchant_name": "NewAge Retailer",
- "merchant_details": {
- "primary_contact_person": "John Test",
- "primary_email": "[email protected]",
- "primary_phone": "sunt laborum",
- "secondary_contact_person": "John Test2",
- "secondary_email": "[email protected]",
- "secondary_phone": "cillum do dolor id",
- "website": "www.example.com",
- "about_business": "Online Retail with a wide selection of organic products for North America",
- "address": {
- "line1": "Juspay Router",
- "line2": "Koramangala",
- "line3": "Stallion",
- "city": "Bangalore",
- "state": "Karnataka",
- "zip": "560095",
- "country": "IN"
- }
- },
- "return_url": "www.example.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
- },
- "routing_algorithm": "custom",
- "custom_routing_rules": [
- {
- "payment_methods_incl": [
- "card",
- "card"
- ],
- "payment_methods_excl": [
- "card",
- "card"
- ],
- "payment_method_types_incl": [
- "credit",
- "credit"
- ],
- "payment_method_types_excl": [
- "credit",
- "credit"
- ],
- "payment_method_issuers_incl": [
- "Citibank",
- "JPMorgan"
- ],
- "payment_method_issuers_excl": [
- "Citibank",
- "JPMorgan"
- ],
- "countries_incl": [
- "US",
- "UK",
- "IN"
- ],
- "countries_excl": [
- "US",
- "UK",
- "IN"
- ],
- "currencies_incl": [
- "USD",
- "EUR"
- ],
- "currencies_excl": [
- "AED",
- "SGD"
- ],
- "metadata_filters_keys": [
- "payments.udf1",
- "payments.udf2"
- ],
- "metadata_filters_values": [
- "android",
- "Category_Electronics"
- ],
- "connectors_pecking_order": [
- "checkout"
- ],
- "connectors_traffic_weightage_key": [
- "checkout"
- ],
- "connectors_traffic_weightage_value": [
- 50,
- 30,
- 20
- ]
- },
- {
- "payment_methods_incl": [
- "card",
- "card"
- ],
- "payment_methods_excl": [
- "card",
- "card"
- ],
- "payment_method_types_incl": [
- "credit",
- "credit"
- ],
- "payment_method_types_excl": [
- "credit",
- "credit"
- ],
- "payment_method_issuers_incl": [
- "Citibank",
- "JPMorgan"
- ],
- "payment_method_issuers_excl": [
- "Citibank",
- "JPMorgan"
- ],
- "countries_incl": [
- "US",
- "UK",
- "IN"
- ],
- "countries_excl": [
- "US",
- "UK",
- "IN"
- ],
- "currencies_incl": [
- "USD",
- "EUR"
- ],
- "currencies_excl": [
- "AED",
- "SGD"
- ],
- "metadata_filters_keys": [
- "payments.udf1",
- "payments.udf2"
- ],
- "metadata_filters_values": [
- "android",
- "Category_Electronics"
- ],
- "connectors_pecking_order": [
- "checkout"
- ],
- "connectors_traffic_weightage_key": [
- "checkout"
- ],
- "connectors_traffic_weightage_value": [
- 50,
- 30,
- 20
- ]
- }
- ],
- "sub_merchants_enabled": false,
- "metadata": {
- "city": "NY",
- "unit": "245"
- }
-}')
-
-
-api_key=$(echo "$resp" | grep "api_key" | awk -F: '{ gsub(/ /,"");split($0, array, ","); split(array[3],array,":");print array[2]}'| cut -d: -f2 | tr -d ' "')
-merchant_id=$(echo "$resp" | grep "merchant_id" | awk -F: '{ gsub(/ /,"");split($0, array, ","); split(array[1],array,":");print array[2]}'| cut -d: -f2 | tr -d ' "')
-echo -e "\033[1mInstructions:\n1.Use this new API key and Merchant ID to test ORCA in your dev environment (localhost:8080)\n2.Copy and securely store this new API key and Merchant ID in your system
-\033[0m\nMerchant-ID: $merchant_id\nAPI-KEY: $api_key"
|
docs
|
add detailed docs for trying sandbox and locally (#306)
|
8ae67377cca506b4d7017bfd167a5ccdb03e8707
|
2023-08-08 19:07:25
|
Sakil Mostak
|
feat(connector): [Adyen] Implement Momo Atm(Napas) in Card Redirects (#1820)
| false
|
diff --git a/.github/testcases/ui_tests.json b/.github/testcases/ui_tests.json
index f85ffa23d9d..ebf9c62244c 100644
--- a/.github/testcases/ui_tests.json
+++ b/.github/testcases/ui_tests.json
@@ -141,7 +141,7 @@
"id": "24",
"name": "Stripe Wechatpay",
"connector": "stripe",
- "request": "{\"amount\":7000,\"currency\":\"CNY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"SE\"}},\"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\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"payment_method\":\"wallet\",\"payment_method_type\":\"we_chat_pay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"wallet\":{\"we_chat_pay_redirect\":{}}}}"
+ "request": "{\"amount\":7000,\"currency\":\"CNY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"SE\"}},\"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\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"payment_method\":\"wallet\",\"payment_method_type\":\"we_chat_pay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"wallet\":{\"we_chat_pay_qr\":{}}}}"
},
"25": {
"id": 25,
@@ -567,7 +567,7 @@
"id": 95,
"name": "Stripe Canadian pre-authorized debit",
"connector": "stripe",
- "request": "{\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"setup_future_usage\":\"off_session\",\"amount\":6540,\"currency\":\"CAD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"acss\",\"payment_method_data\":{\"bank_debit\":{\"acss_bank_debit\":{\"billing_details\":{\"name\":\"Akshaya\",\"email\":\"[email protected]\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"account_number\":\"000123456789\",\"institution_number\":\"000\",\"transit_number\":\"11000\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"CAD\"}}},\"setup_future_usage\":\"off_session\",\"amount\":6540,\"currency\":\"CAD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"bank_debit\",\"payment_method_type\":\"acss\",\"payment_method_data\":{\"bank_debit\":{\"acss_bank_debit\":{\"billing_details\":{\"name\":\"Akshaya\",\"email\":\"[email protected]\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"}},\"account_number\":\"000123456789\",\"institution_number\":\"000\",\"transit_number\":\"11000\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"96": {
"id": 96,
@@ -1087,7 +1087,7 @@
},
"182": {
"id": 182,
- "name": "pay_6n1FJgdzRRcCuWvBh4j2",
+ "name": "Adyen momo payment",
"connector": "adyen_uk",
"request": "{\"amount\":6540,\"currency\":\"VND\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"wallet\",\"payment_method_type\":\"momo\",\"payment_method_data\":{\"wallet\":{\"momo_redirect\":{}}}}"
},
@@ -1135,7 +1135,7 @@
},
"190": {
"id": 190,
- "name": "pay_FZKMhvsZxthcmzD4udtY",
+ "name": "nuvei card no_3ds",
"connector": "nuvei",
"request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
@@ -1176,7 +1176,7 @@
"request": "{\"amount\":6540,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"wallet\",\"payment_method_type\":\"mb_way\",\"payment_method_data\":{\"wallet\":{\"mb_way_redirect\":{\"telephone_number\":\"+351213822199\"}}}}"
},
"197": {
- "id": 197,
+ "id": "197",
"name": "online banking poland success",
"connector": "adyen_uk",
"request": "{\"amount\":10000,\"currency\":\"PLN\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":100,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"online_banking_poland\",\"payment_method_data\":{\"bank_redirect\":{\"online_banking_poland\":{\"issuer\":\"velo_bank\"}}},\"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\"}}"
@@ -1341,7 +1341,7 @@
"id": 224,
"name": "Oxxo",
"connector": "adyen_uk",
- "request": "{\"amount\":6540,\"currency\":\"MXN\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"oxxo\",\"payment_method_data\":{\"voucher\":{\"oxxo\":{}}}}"
+ "request": "{\"amount\":6540,\"currency\":\"MXN\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"oxxo\",\"payment_method_data\":{\"voucher\":\"oxxo\"}}"
},
"225": {
"id": 225,
@@ -1363,7 +1363,7 @@
},
"229": {
"id": 229,
- "name": "pay_JbukS3WUqF6MVjTp2fe1",
+ "name": "adyen klarna redirect",
"connector": "adyen",
"request": "{\"amount\":7000,\"currency\":\"SEK\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"SE\"}},\"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\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"payment_method\":\"pay_later\",\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"klarna_redirect\":{\"billing_email\":\"[email protected]\",\"billing_country\":\"SE\"}}}}"
},
@@ -1409,13 +1409,82 @@
"connector": "adyen_uk",
"request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seven_eleven\",\"payment_method_data\":{\"voucher\":{\"seven_eleven\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
},
+ "237": {
+ "id": 237,
+ "name": "Japanese convenience stores LAWSON",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"lawson\",\"payment_method_data\":{\"voucher\":{\"lawson\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
+ },
+ "238": {
+ "id": 238,
+ "name": "Adyen Momo Atm(Napas)",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":65400,\"currency\":\"VND\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card_redirect\",\"payment_method_type\":\"momo_atm\",\"payment_method_data\":{\"card_redirect\":{\"momo_atm\":{}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"ES\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "239": {
+ "id": 239,
+ "name": "should_fail_recurring_payment_due_to_authentication",
+ "connector": "stripe",
+ "request": "{\"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\":{\"multi_use\":{\"amount\":700000000,\"currency\":\"USD\"}}},\"amount\":1000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"setup_future_usage\":\"off_session\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000002760003184\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}}}"
+ },
+ "240": {
+ "id": 240,
+ "name": "Stripe Cashapp",
+ "connector": "stripe",
+ "request": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"wallet\",\"payment_method_type\":\"cashapp\",\"payment_method_data\":{\"wallet\":{\"cashapp_qr\":{}}}}"
+ },
+ "241": {
+ "id": 241,
+ "name": "Givex",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":4100,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":4100,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"gift_card\",\"payment_method_type\":\"givex\",\"payment_method_data\":{\"gift_card\":{\"givex\":{\"number\":\"6036280000000000000\",\"cvc\":\"122222\"}}}}"
+ },
+ "242": {
+ "id": 242,
+ "name": "Card",
+ "connector": "braintree",
+ "request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"378282246310005\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"1234\"}}}"
+ },
+ "243": {
+ "id": 243,
+ "name": "Mini Stop",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"mini_stop\",\"payment_method_data\":{\"voucher\":{\"mini_stop\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
+ },
+ "244": {
+ "id": 244,
+ "name": "Family Mart",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"family_mart\",\"payment_method_data\":{\"voucher\":{\"family_mart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
+ },
+ "245": {
+ "id": 245,
+ "name": "Seicomart",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"seicomart\",\"payment_method_data\":{\"voucher\":{\"seicomart\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
+ },
+ "246": {
+ "id": 246,
+ "name": "PayEasy",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6540,\"currency\":\"JPY\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com/\",\"payment_method\":\"voucher\",\"payment_method_type\":\"pay_easy\",\"payment_method_data\":{\"voucher\":{\"pay_easy\":{\"first_name\":\"Some\",\"last_name\":\"One\",\"email\":\"[email protected]\",\"phone_number\":\"1234567890\"}}}}"
+ },
"tests_to_ignore": [
- "noon_ui::should_make_noon_3ds_payment_test",
+ "noon_ui::*",
"adyen_uk_ui::should_make_adyen_online_banking_thailand_payment_test",
"adyen_uk_ui::should_make_adyen_blik_payment_test",
+ "adyen_uk_ui::should_make_adyen_clearpay_payment_test",
+ "adyen_uk_ui::should_make_adyen_touch_n_go_payment_test",
+ "adyen_uk_ui::should_make_adyen_paypal_payment",
+ "adyen_uk_ui::should_make_adyen_paypal_payment_test",
+ "adyen_uk_ui::should_make_adyen_ebanking_fi_payment_test",
"authorizedotnet_ui::should_make_paypal_payment_test",
"multisafepay_ui::should_make_multisafepay_3ds_payment_failed_test",
"multisafepay_ui::should_make_multisafepay_3ds_payment_success_test",
- "nexinets_ui::*"
+ "nexinets_ui::*",
+ "paypal_ui::*",
+ "aci_ui::should_make_aci_trustly_payment_test",
+ "checkout_ui::should_make_3ds_payment_test",
+ "checkout_ui::should_make_frictionless_3ds_payment_test"
]
}
\ No newline at end of file
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 18e72005711..ad2859d330f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -621,6 +621,7 @@ pub struct Card {
pub enum CardRedirectData {
Knet {},
Benefit {},
+ MomoAtm {},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index b23840f7138..0e658f46927 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -912,6 +912,7 @@ pub enum PaymentMethodType {
MbWay,
MobilePay,
Momo,
+ MomoAtm,
Multibanco,
OnlineBankingThailand,
OnlineBankingCzechRepublic,
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index adfbc456064..8e1bd1cb3b9 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1572,6 +1572,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::MbWay => Self::Wallet,
PaymentMethodType::MobilePay => Self::Wallet,
PaymentMethodType::Momo => Self::Wallet,
+ PaymentMethodType::MomoAtm => Self::CardRedirect,
PaymentMethodType::Multibanco => Self::BankTransfer,
PaymentMethodType::MandiriVa => Self::BankTransfer,
PaymentMethodType::Interac => Self::BankRedirect,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 6b64c679316..5bb232fdb1a 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -398,6 +398,8 @@ pub enum AdyenPaymentMethod<'a> {
MobilePay(Box<MobilePayData>),
#[serde(rename = "momo_wallet")]
Momo(Box<MomoData>),
+ #[serde(rename = "momo_atm")]
+ MomoAtm,
#[serde(rename = "touchngo")]
TouchNGo(Box<TouchNGoData>),
OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>),
@@ -1011,6 +1013,8 @@ pub enum PaymentType {
MobilePay,
#[serde(rename = "momo_wallet")]
Momo,
+ #[serde(rename = "momo_atm")]
+ MomoAtm,
#[serde(rename = "onlineBanking_CZ")]
OnlineBankingCzechRepublic,
#[serde(rename = "ebanking_FI")]
@@ -2047,6 +2051,7 @@ impl<'a> TryFrom<&api_models::payments::CardRedirectData> for AdyenPaymentMethod
match card_redirect_data {
payments::CardRedirectData::Knet {} => Ok(AdyenPaymentMethod::Knet),
payments::CardRedirectData::Benefit {} => Ok(AdyenPaymentMethod::Benefit),
+ payments::CardRedirectData::MomoAtm {} => Ok(AdyenPaymentMethod::MomoAtm),
}
}
}
@@ -2996,6 +3001,7 @@ pub fn get_wait_screen_metadata(
| PaymentType::Kakaopay
| PaymentType::MobilePay
| PaymentType::Momo
+ | PaymentType::MomoAtm
| PaymentType::OnlineBankingCzechRepublic
| PaymentType::OnlineBankingFinland
| PaymentType::OnlineBankingPoland
@@ -3101,6 +3107,7 @@ pub fn get_present_to_shopper_metadata(
| PaymentType::Benefit
| PaymentType::MobilePay
| PaymentType::Momo
+ | PaymentType::MomoAtm
| PaymentType::OnlineBankingCzechRepublic
| PaymentType::OnlineBankingFinland
| PaymentType::OnlineBankingPoland
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index e8757527a9d..a0d0878f7bc 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -578,6 +578,7 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::MbWay
| enums::PaymentMethodType::MobilePay
| enums::PaymentMethodType::Momo
+ | enums::PaymentMethodType::MomoAtm
| enums::PaymentMethodType::Multibanco
| enums::PaymentMethodType::OnlineBankingThailand
| enums::PaymentMethodType::OnlineBankingCzechRepublic
@@ -876,6 +877,7 @@ fn infer_stripe_pay_later_type(
| enums::PaymentMethodType::MbWay
| enums::PaymentMethodType::MobilePay
| enums::PaymentMethodType::Momo
+ | enums::PaymentMethodType::MomoAtm
| enums::PaymentMethodType::Multibanco
| enums::PaymentMethodType::OnlineBankingThailand
| enums::PaymentMethodType::OnlineBankingCzechRepublic
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 7d5a190fe8e..78be0a15181 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1582,7 +1582,9 @@ pub fn validate_payment_method_type_against_payment_method(
}
api_enums::PaymentMethod::CardRedirect => matches!(
payment_method_type,
- api_enums::PaymentMethodType::Knet | api_enums::PaymentMethodType::Benefit
+ api_enums::PaymentMethodType::Knet
+ | api_enums::PaymentMethodType::Benefit
+ | api_enums::PaymentMethodType::MomoAtm
),
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index aff0556bcc2..16eac03ac18 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -241,9 +241,9 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
api_enums::PaymentMethodType::Givex | api_enums::PaymentMethodType::PaySafeCard => {
Self::GiftCard
}
- api_enums::PaymentMethodType::Benefit | api_enums::PaymentMethodType::Knet => {
- Self::CardRedirect
- }
+ api_enums::PaymentMethodType::Benefit
+ | api_enums::PaymentMethodType::Knet
+ | api_enums::PaymentMethodType::MomoAtm => Self::CardRedirect,
}
}
}
diff --git a/crates/test_utils/tests/connectors/adyen_uk_ui.rs b/crates/test_utils/tests/connectors/adyen_uk_ui.rs
index b002b330967..799bedc8a9d 100644
--- a/crates/test_utils/tests/connectors/adyen_uk_ui.rs
+++ b/crates/test_utils/tests/connectors/adyen_uk_ui.rs
@@ -634,6 +634,32 @@ async fn should_make_adyen_blik_payment(driver: WebDriver) -> Result<(), WebDriv
Ok(())
}
+async fn should_make_adyen_momo_atm_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = AdyenSeleniumTest {};
+ conn.make_redirection_payment(
+ web_driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/238"))),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Trigger(Trigger::Sleep(5)), // Delay for provider to not reject payment for botting
+ Event::Trigger(Trigger::SendKeys(
+ By::Id("card-number"),
+ "9704 0000 0000 0018",
+ )),
+ Event::Trigger(Trigger::SendKeys(By::Id("card-expire"), "03/07")),
+ Event::Trigger(Trigger::SendKeys(By::Id("card-name"), "NGUYEN VAN A")),
+ Event::Trigger(Trigger::SendKeys(By::Id("number-phone"), "987656666")),
+ Event::Trigger(Trigger::Click(By::Id("btn-pay-card"))),
+ Event::Trigger(Trigger::SendKeys(By::Id("napasOtpCode"), "otp")),
+ Event::Trigger(Trigger::Click(By::Id("napasProcessBtn1"))),
+ Event::Trigger(Trigger::Sleep(5)), // Delay to get to status page
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
#[test]
#[serial]
#[ignore]
@@ -825,3 +851,9 @@ fn should_make_adyen_online_banking_thailand_payment_test() {
fn should_make_adyen_touch_n_go_payment_test() {
tester!(should_make_adyen_touch_n_go_payment);
}
+
+#[test]
+#[serial]
+fn should_make_adyen_momo_atm_payment_test() {
+ tester!(should_make_adyen_momo_atm_payment);
+}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 2e738dd538d..a0d2ca9637c 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -3666,6 +3666,17 @@
"type": "object"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "momo_atm"
+ ],
+ "properties": {
+ "momo_atm": {
+ "type": "object"
+ }
+ }
}
]
},
@@ -7809,6 +7820,7 @@
"mb_way",
"mobile_pay",
"momo",
+ "momo_atm",
"multibanco",
"online_banking_thailand",
"online_banking_czech_republic",
|
feat
|
[Adyen] Implement Momo Atm(Napas) in Card Redirects (#1820)
|
c4fea449da9d2721acfefbdfa1a14de3459ff7eb
|
2023-01-20 00:59:54
|
Jagan
|
fix(connector): change capture status to pending when waiting for settlement (#420)
| false
|
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index 1db71ae90cd..13f292b6cdd 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -247,12 +247,14 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
.parse_struct("Cybersource PaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
logger::debug!(cybersourcepayments_create_response=?response);
- types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- }
- .try_into()
+ types::RouterData::try_from((
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ true,
+ ))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
@@ -328,12 +330,16 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
.parse_struct("Cybersource PaymentSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
logger::debug!(cybersourcepayments_create_response=?response);
- types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- }
- .try_into()
+ let is_auto_capture =
+ data.request.capture_method == Some(storage_models::enums::CaptureMethod::Automatic);
+ types::RouterData::try_from((
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ is_auto_capture,
+ ))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
@@ -412,12 +418,16 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
.parse_struct("Cybersource PaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
logger::debug!(cybersourcepayments_create_response=?response);
- types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- }
- .try_into()
+ let is_auto_capture =
+ data.request.capture_method == Some(storage_models::enums::CaptureMethod::Automatic);
+ types::RouterData::try_from((
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ is_auto_capture,
+ ))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
@@ -489,12 +499,14 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
.parse_struct("Cybersource PaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
logger::debug!(cybersourcepayments_create_response=?response);
- types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- }
- .try_into()
+ types::RouterData::try_from((
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ false,
+ ))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
@@ -641,7 +653,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
let response: cybersource::CybersourceTransactionResponse = res
.response
- .parse_struct("Cybersource PaymentSyncResponse")
+ .parse_struct("Cybersource RefundsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
logger::debug!(cybersourcepayments_create_response=?response);
types::ResponseRouterData {
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index d7dbb8a8206..32968005a06 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -280,21 +280,27 @@ pub struct CybersourceErrorInformation {
}
impl<F, T>
- TryFrom<
+ TryFrom<(
types::ResponseRouterData<F, CybersourcePaymentsResponse, T, types::PaymentsResponseData>,
- > for types::RouterData<F, T, types::PaymentsResponseData>
+ bool,
+ )> for types::RouterData<F, T, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
- item: types::ResponseRouterData<
- F,
- CybersourcePaymentsResponse,
- T,
- types::PaymentsResponseData,
- >,
+ data: (
+ types::ResponseRouterData<
+ F,
+ CybersourcePaymentsResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ bool,
+ ),
) -> Result<Self, Self::Error> {
+ let item = data.0;
+ let is_capture = data.1;
Ok(Self {
- status: item.response.status.into(),
+ status: get_payment_status(is_capture, item.response.status.into()),
response: match item.response.error_information {
Some(error) => Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(),
@@ -328,27 +334,44 @@ pub struct ApplicationInformation {
status: CybersourcePaymentStatus,
}
+fn get_payment_status(is_capture: bool, status: enums::AttemptStatus) -> enums::AttemptStatus {
+ let is_authorized = matches!(status, enums::AttemptStatus::Authorized);
+ if is_capture && is_authorized {
+ return enums::AttemptStatus::Pending;
+ }
+ status
+}
+
impl<F, T>
- TryFrom<
+ TryFrom<(
types::ResponseRouterData<
F,
CybersourceTransactionResponse,
T,
types::PaymentsResponseData,
>,
- > for types::RouterData<F, T, types::PaymentsResponseData>
+ bool,
+ )> for types::RouterData<F, T, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
- item: types::ResponseRouterData<
- F,
- CybersourceTransactionResponse,
- T,
- types::PaymentsResponseData,
- >,
+ data: (
+ types::ResponseRouterData<
+ F,
+ CybersourceTransactionResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ bool,
+ ),
) -> Result<Self, Self::Error> {
+ let item = data.0;
+ let is_capture = data.1;
Ok(Self {
- status: item.response.application_information.status.into(),
+ status: get_payment_status(
+ is_capture,
+ item.response.application_information.status.into(),
+ ),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: None,
|
fix
|
change capture status to pending when waiting for settlement (#420)
|
b097d7f5a984b32421494ea033029d01d034fab8
|
2024-12-02 14:59:35
|
Anurag Thakur
|
fix(openapi): Revert Standardise API naming scheme for V2 Dashboard Changes (#6712)
| false
|
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index bb0c547d7f1..7a8571479f4 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2003,7 +2003,7 @@ impl User {
)
.service(web::resource("/verify_email").route(web::post().to(user::verify_email)))
.service(
- web::resource("/v2/verify-email").route(web::post().to(user::verify_email)),
+ web::resource("/v2/verify_email").route(web::post().to(user::verify_email)),
)
.service(
web::resource("/verify_email_request")
@@ -2057,7 +2057,7 @@ impl User {
.route(web::post().to(user_role::accept_invitations_v2)),
)
.service(
- web::resource("/pre-auth").route(
+ web::resource("/pre_auth").route(
web::post().to(user_role::accept_invitations_pre_auth),
),
),
|
fix
|
Revert Standardise API naming scheme for V2 Dashboard Changes (#6712)
|
4403634dda41b1b7fbbe56ee6177722bcbe2e29b
|
2023-05-09 19:49:55
|
Jagan
|
feat(connector): Mandates for alternate payment methods via Adyen (#1046)
| false
|
diff --git a/config/development.toml b/config/development.toml
index ad0b5891d23..3ef6509f46f 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -229,7 +229,7 @@ stripe = { long_lived_token = false, payment_method = "wallet", payment_method_t
checkout = { long_lived_token = false, payment_method = "wallet"}
[connector_customer]
-connector_list = "bluesnap, stripe"
+connector_list = "bluesnap,stripe"
[dummy_connector]
payment_ttl = 172800
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index f1099a09da8..57a466b66c2 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -400,7 +400,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
errors::ApiErrorResponse::RefundNotPossible { connector } => Self::RefundFailed,
errors::ApiErrorResponse::RefundFailed { data } => Self::RefundFailed, // Nothing at stripe to map
- errors::ApiErrorResponse::InternalServerError => Self::InternalServerError, // not a stripe code
+ errors::ApiErrorResponse::MandateUpdateFailed
+ | errors::ApiErrorResponse::InternalServerError => Self::InternalServerError, // not a stripe code
errors::ApiErrorResponse::ExternalConnectorError {
code,
message,
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 7f47e198248..2221f5c7582 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -81,7 +81,101 @@ impl
types::PaymentsResponseData,
> for Adyen
{
- // Issue: #173
+ fn get_headers(
+ &self,
+ req: &types::VerifyRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ types::PaymentsVerifyType::get_content_type(self).to_string(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::VerifyRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}{}", self.base_url(connectors), "v68/payments"))
+ }
+ fn get_request_body(
+ &self,
+ req: &types::VerifyRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let authorize_req = types::PaymentsAuthorizeRouterData::from((
+ req,
+ types::PaymentsAuthorizeData::from(req),
+ ));
+ let connector_req = adyen::AdyenPaymentRequest::try_from(&authorize_req)?;
+ let adyen_req = utils::Encode::<adyen::AdyenPaymentRequest<'_>>::encode_to_string_of_json(
+ &connector_req,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(adyen_req))
+ }
+ fn build_request(
+ &self,
+ req: &types::VerifyRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsVerifyType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsVerifyType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::PaymentsVerifyType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+ fn handle_response(
+ &self,
+ data: &types::VerifyRouterData,
+ res: types::Response,
+ ) -> CustomResult<
+ types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ errors::ConnectorError,
+ >
+ where
+ api::Verify: Clone,
+ types::VerifyRequestData: Clone,
+ types::PaymentsResponseData: Clone,
+ {
+ let response: adyen::AdyenPaymentResponse = res
+ .response
+ .parse_struct("AdyenPaymentResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from((
+ types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ false,
+ ))
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ let response: adyen::ErrorResponse = res
+ .response
+ .parse_struct("ErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ Ok(types::ErrorResponse {
+ status_code: res.status_code,
+ code: response.error_code,
+ message: response.message,
+ reason: None,
+ })
+ }
}
impl api::PaymentSession for Adyen {}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 0d07eb72779..199ab239a3a 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -37,8 +37,8 @@ pub enum AdyenShopperInteraction {
Pos,
}
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
pub enum AdyenRecurringModel {
UnscheduledCardOnFile,
CardOnFile,
@@ -54,6 +54,8 @@ pub enum AuthType {
pub struct AdditionalData {
authorisation_type: Option<AuthType>,
manual_capture: Option<bool>,
+ pub recurring_processing_model: Option<AdyenRecurringModel>,
+ /// Enable recurring details in dashboard to receive this ID, https://docs.adyen.com/online-payments/tokenization/create-and-use-tokens#test-and-go-live
#[serde(rename = "recurring.recurringDetailReference")]
recurring_detail_reference: Option<String>,
#[serde(rename = "recurring.shopperReference")]
@@ -90,6 +92,7 @@ pub struct LineItem {
quantity: Option<u16>,
}
+#[serde_with::skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenPaymentRequest<'a> {
@@ -100,7 +103,6 @@ pub struct AdyenPaymentRequest<'a> {
return_url: String,
browser_info: Option<AdyenBrowserInfo>,
shopper_interaction: AdyenShopperInteraction,
- #[serde(skip_serializing_if = "Option::is_none")]
recurring_processing_model: Option<AdyenRecurringModel>,
additional_data: Option<AdditionalData>,
shopper_reference: Option<String>,
@@ -279,6 +281,14 @@ pub enum AdyenPaymentMethod<'a> {
WeChatPayWeb(Box<WeChatPayWebData>),
}
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MandateData {
+ #[serde(rename = "type")]
+ payment_type: PaymentType,
+ stored_payment_method_id: String,
+}
+
#[derive(Debug, Clone, Serialize)]
pub struct WeChatPayWebData {
#[serde(rename = "type")]
@@ -768,16 +778,22 @@ type RecurringDetails = (Option<AdyenRecurringModel>, Option<bool>, Option<Strin
fn get_recurring_processing_model(
item: &types::PaymentsAuthorizeRouterData,
) -> Result<RecurringDetails, Error> {
- match item.request.setup_future_usage {
- Some(storage_enums::FutureUsage::OffSession) => {
+ match (item.request.setup_future_usage, item.request.off_session) {
+ (Some(storage_enums::FutureUsage::OffSession), _) => {
let customer_id = item.get_customer_id()?;
let shopper_reference = format!("{}_{}", item.merchant_id, customer_id);
+ let store_payment_method = item.request.is_mandate_payment();
Ok((
Some(AdyenRecurringModel::UnscheduledCardOnFile),
- Some(true),
+ Some(store_payment_method),
Some(shopper_reference),
))
}
+ (_, Some(true)) => Ok((
+ Some(AdyenRecurringModel::UnscheduledCardOnFile),
+ None,
+ Some(format!("{}_{}", item.merchant_id, item.get_customer_id()?)),
+ )),
_ => Ok((None, None, None)),
}
}
@@ -812,6 +828,7 @@ fn get_additional_data(item: &types::PaymentsAuthorizeRouterData) -> Option<Addi
network_tx_reference: None,
recurring_detail_reference: None,
recurring_shopper_reference: None,
+ recurring_processing_model: Some(AdyenRecurringModel::UnscheduledCardOnFile),
}),
_ => None,
}
@@ -1163,7 +1180,6 @@ impl<'a> TryFrom<(&types::PaymentsAuthorizeRouterData, MandateReferenceId)>
})
}
}
-
impl<'a> TryFrom<(&types::PaymentsAuthorizeRouterData, &api::Card)> for AdyenPaymentRequest<'a> {
type Error = Error;
fn try_from(
diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rs
index d6636d162dd..3f7d4734b4c 100644
--- a/crates/router/src/connector/airwallex.rs
+++ b/crates/router/src/connector/airwallex.rs
@@ -288,8 +288,10 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
+ Sync
+ 'static),
> = Box::new(&Self);
- let authorize_data =
- &types::PaymentsInitRouterData::from((&router_data, router_data.request.clone()));
+ let authorize_data = &types::PaymentsInitRouterData::from((
+ &router_data.to_owned(),
+ router_data.request.clone(),
+ ));
let resp = services::execute_connector_processing_step(
app_state,
integ,
diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rs
index 576c8cece64..97f26f6c970 100644
--- a/crates/router/src/connector/nuvei.rs
+++ b/crates/router/src/connector/nuvei.rs
@@ -475,7 +475,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
+ 'static),
> = Box::new(&Self);
let authorize_data = &types::PaymentsAuthorizeSessionTokenRouterData::from((
- &router_data,
+ &router_data.to_owned(),
types::AuthorizeSessionTokenData::from(&router_data),
));
let resp = services::execute_connector_processing_step(
@@ -502,7 +502,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
+ 'static),
> = Box::new(&Self);
let init_data = &types::PaymentsInitRouterData::from((
- &router_data,
+ &router_data.to_owned(),
router_data.request.clone(),
));
let init_resp = services::execute_connector_processing_step(
diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rs
index 3f9ac055737..c189535d372 100644
--- a/crates/router/src/connector/shift4.rs
+++ b/crates/router/src/connector/shift4.rs
@@ -183,7 +183,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
+ 'static),
> = Box::new(&Self);
let init_data = &types::PaymentsInitRouterData::from((
- &router_data,
+ &router_data.to_owned(),
router_data.request.clone(),
));
let init_resp = services::execute_connector_processing_step(
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index 729ba183169..0da5cebc302 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -142,6 +142,8 @@ pub enum ApiErrorResponse {
ResourceIdNotFound,
#[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Mandate does not exist in our records")]
MandateNotFound,
+ #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Failed to update mandate")]
+ MandateUpdateFailed,
#[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "API Key does not exist in our records")]
ApiKeyNotFound,
#[error(error_type = ErrorType::ValidationError, code = "HE_03", message = "Return URL is not configured and not passed in payments request")]
@@ -246,7 +248,9 @@ impl actix_web::ResponseError for ApiErrorResponse {
| Self::PaymentUnexpectedState { .. }
| Self::MandateValidationFailed { .. } => StatusCode::BAD_REQUEST, // 400
- Self::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR, // 500
+ Self::MandateUpdateFailed | Self::InternalServerError => {
+ StatusCode::INTERNAL_SERVER_ERROR
+ } // 500
Self::DuplicateRefundRequest | Self::DuplicatePayment { .. } => StatusCode::BAD_REQUEST, // 400
Self::RefundNotFound
| Self::CustomerNotFound
@@ -402,8 +406,8 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
Self::RefundFailed { data } => AER::BadRequest(ApiError::new("CE", 6, "Refund failed while processing with connector. Retry refund", Some(Extra { data: data.clone(), ..Default::default()}))),
Self::VerificationFailed { data } => {
AER::BadRequest(ApiError::new("CE", 7, "Verification failed while processing with connector. Retry operation", Some(Extra { data: data.clone(), ..Default::default()})))
- }
- Self::InternalServerError => {
+ },
+ Self::MandateUpdateFailed | Self::InternalServerError => {
AER::InternalServerError(ApiError::new("HE", 0, "Something went wrong", None))
}
Self::DuplicateRefundRequest => AER::BadRequest(ApiError::new("HE", 1, "Duplicate refund request. Refund already attempted with the refund ID", None)),
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index 87d9e38a2c0..b4c7f10ccfd 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -123,7 +123,7 @@ impl ConnectorErrorExt for error_stack::Report<errors::ConnectorError> {
let data = match error {
errors::ConnectorError::ProcessingStepFailed(Some(bytes)) => {
let response_str = std::str::from_utf8(bytes);
- match response_str {
+ let error_response = match response_str {
Ok(s) => serde_json::from_str(s)
.map_err(|err| logger::error!(%err, "Failed to convert response to JSON"))
.ok(),
@@ -131,14 +131,20 @@ impl ConnectorErrorExt for error_stack::Report<errors::ConnectorError> {
logger::error!(%err, "Failed to convert response to UTF8 string");
None
}
+ };
+ errors::ApiErrorResponse::PaymentAuthorizationFailed {
+ data: error_response,
}
}
+ errors::ConnectorError::MissingRequiredField { field_name } => {
+ errors::ApiErrorResponse::MissingRequiredField { field_name }
+ }
_ => {
logger::error!(%error,"Verify flow failed");
- None
+ errors::ApiErrorResponse::PaymentAuthorizationFailed { data: None }
}
};
- self.change_context(errors::ApiErrorResponse::PaymentAuthorizationFailed { data })
+ self.change_context(data)
}
}
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index 02269d6707c..a5afa04d348 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -1,4 +1,4 @@
-use common_utils::ext_traits::Encode;
+use common_utils::{ext_traits::Encode, pii};
use error_stack::{report, ResultExt};
use router_env::{instrument, logger, tracing};
use storage_models::enums as storage_enums;
@@ -16,7 +16,7 @@ use crate::{
mandates::{self, MandateResponseExt},
},
storage,
- transformers::ForeignInto,
+ transformers::{ForeignInto, ForeignTryFrom},
},
utils::OptionExt,
};
@@ -62,6 +62,37 @@ pub async fn revoke_mandate(
))
}
+#[instrument(skip(db))]
+pub async fn update_connector_mandate_id(
+ db: &dyn StorageInterface,
+ merchant_account: String,
+ mandate_ids_opt: Option<api_models::payments::MandateIds>,
+ resp: Result<types::PaymentsResponseData, types::ErrorResponse>,
+) -> RouterResponse<mandates::MandateResponse> {
+ let connector_mandate_id = Option::foreign_try_from(resp)?;
+ //Ignore updation if the payment_attempt mandate_id or connector_mandate_id is not present
+ if let Some((mandate_ids, connector_id)) = mandate_ids_opt.zip(connector_mandate_id) {
+ let mandate_id = &mandate_ids.mandate_id;
+ let mandate = db
+ .find_mandate_by_merchant_id_mandate_id(&merchant_account, mandate_id)
+ .await
+ .change_context(errors::ApiErrorResponse::MandateNotFound)?;
+ // only update the connector_mandate_id if existing is none
+ if mandate.connector_mandate_id.is_none() {
+ db.update_mandate_by_merchant_id_mandate_id(
+ &merchant_account,
+ mandate_id,
+ storage::MandateUpdate::ConnectorReferenceUpdate {
+ connector_mandate_ids: Some(connector_id),
+ },
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::MandateUpdateFailed)?;
+ }
+ }
+ Ok(services::ApplicationResponse::StatusOk)
+}
+
#[instrument(skip(state))]
pub async fn get_customer_mandates(
state: &AppState,
@@ -122,7 +153,7 @@ where
},
)
.await
- .change_context(errors::ApiErrorResponse::MandateNotFound),
+ .change_context(errors::ApiErrorResponse::MandateUpdateFailed),
storage_enums::MandateType::MultiUse => state
.store
.update_mandate_by_merchant_id_mandate_id(
@@ -135,7 +166,7 @@ where
},
)
.await
- .change_context(errors::ApiErrorResponse::MandateNotFound),
+ .change_context(errors::ApiErrorResponse::MandateUpdateFailed),
}?;
metrics::SUBSEQUENT_MANDATE_PAYMENT.add(
&metrics::CONTEXT,
@@ -223,6 +254,30 @@ where
Ok(resp)
}
+impl ForeignTryFrom<Result<types::PaymentsResponseData, types::ErrorResponse>>
+ for Option<pii::SecretSerdeValue>
+{
+ type Error = error_stack::Report<errors::ApiErrorResponse>;
+ fn foreign_try_from(
+ resp: Result<types::PaymentsResponseData, types::ErrorResponse>,
+ ) -> errors::RouterResult<Self> {
+ let mandate_details = match resp {
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ mandate_reference, ..
+ }) => mandate_reference,
+ _ => None,
+ };
+
+ mandate_details
+ .map(|md| {
+ Encode::<types::MandateReference>::encode_to_value(&md)
+ .change_context(errors::ApiErrorResponse::MandateNotFound)
+ .map(masking::Secret::new)
+ })
+ .transpose()
+ }
+}
+
pub trait MandateBehaviour {
fn get_amount(&self) -> i64;
fn get_setup_future_usage(&self) -> Option<storage_models::enums::FutureUsage>;
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 6af82659fe7..e7ed3384d90 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -7,6 +7,7 @@ use super::{Operation, PostUpdateTracker};
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
+ mandate,
payments::PaymentData,
},
db::StorageInterface,
@@ -443,5 +444,14 @@ async fn payment_response_update_tracker<F: Clone, T>(
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // When connector requires redirection for mandate creation it can update the connector mandate_id during Psync
+ mandate::update_connector_mandate_id(
+ db,
+ router_data.merchant_id,
+ payment_data.mandate_id.clone(),
+ router_data.response.clone(),
+ )
+ .await?;
+
Ok(payment_data)
}
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index ec25f5995e6..78bab09e006 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -252,7 +252,12 @@ async fn get_tracker_for_sync<
currency,
amount,
email: None,
- mandate_id: None,
+ mandate_id: payment_attempt.mandate_id.clone().map(|id| {
+ api_models::payments::MandateIds {
+ mandate_id: id,
+ mandate_reference_id: None,
+ }
+ }),
setup_mandate: None,
token: None,
address: PaymentAddress {
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 04ab21228cb..7945ef1d537 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -570,6 +570,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSyncData
fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
let payment_data = additional_data.payment_data;
Ok(Self {
+ mandate_id: payment_data.mandate_id.clone(),
connector_transaction_id: match payment_data.payment_attempt.connector_transaction_id {
Some(connector_txn_id) => {
types::ResponseId::ConnectorTransactionId(connector_txn_id)
@@ -698,6 +699,15 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::VerifyRequestDat
fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
let payment_data = additional_data.payment_data;
+ let router_base_url = &additional_data.router_base_url;
+ let connector_name = &additional_data.connector_name;
+ let attempt = &payment_data.payment_attempt;
+ let router_return_url = Some(helpers::create_redirect_url(
+ router_base_url,
+ attempt,
+ connector_name,
+ payment_data.creds_identifier.as_deref(),
+ ));
Ok(Self {
currency: payment_data.currency,
confirm: true,
@@ -709,6 +719,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::VerifyRequestDat
off_session: payment_data.mandate_id.as_ref().map(|_| true),
mandate_id: payment_data.mandate_id.clone(),
setup_mandate_details: payment_data.setup_mandate,
+ router_return_url,
email: payment_data.email,
return_url: payment_data.payment_intent.return_url,
})
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 34a705d1228..d0750db413b 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -75,6 +75,8 @@ pub type RefundsResponseRouterData<F, R> =
pub type PaymentsAuthorizeType =
dyn services::ConnectorIntegration<api::Authorize, PaymentsAuthorizeData, PaymentsResponseData>;
+pub type PaymentsVerifyType =
+ dyn services::ConnectorIntegration<api::Verify, VerifyRequestData, PaymentsResponseData>;
pub type PaymentsCompleteAuthorizeType = dyn services::ConnectorIntegration<
api::CompleteAuthorize,
CompleteAuthorizeData,
@@ -270,6 +272,7 @@ pub struct PaymentsSyncData {
pub encoded_data: Option<String>,
pub capture_method: Option<storage_enums::CaptureMethod>,
pub connector_meta: Option<serde_json::Value>,
+ pub mandate_id: Option<api_models::payments::MandateIds>,
}
#[derive(Debug, Default, Clone)]
@@ -299,6 +302,7 @@ pub struct VerifyRequestData {
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub off_session: Option<bool>,
pub setup_mandate_details: Option<payments::MandateData>,
+ pub router_return_url: Option<String>,
pub email: Option<Email>,
pub return_url: Option<String>,
}
@@ -646,10 +650,39 @@ impl From<&&mut PaymentsAuthorizeRouterData> for AuthorizeSessionTokenData {
}
}
-impl<F1, F2, T1, T2> From<(&&mut RouterData<F1, T1, PaymentsResponseData>, T2)>
+impl From<&VerifyRouterData> for PaymentsAuthorizeData {
+ fn from(data: &VerifyRouterData) -> Self {
+ Self {
+ currency: data.request.currency,
+ payment_method_data: data.request.payment_method_data.clone(),
+ confirm: data.request.confirm,
+ statement_descriptor_suffix: data.request.statement_descriptor_suffix.clone(),
+ mandate_id: data.request.mandate_id.clone(),
+ setup_future_usage: data.request.setup_future_usage,
+ off_session: data.request.off_session,
+ setup_mandate_details: data.request.setup_mandate_details.clone(),
+ router_return_url: data.request.router_return_url.clone(),
+ email: data.request.email.clone(),
+ amount: 0,
+ statement_descriptor: None,
+ capture_method: None,
+ webhook_url: None,
+ complete_authorize_url: None,
+ browser_info: None,
+ order_details: None,
+ session_token: None,
+ enrolled_for_3ds: true,
+ related_transaction_id: None,
+ payment_experience: None,
+ payment_method_type: None,
+ }
+ }
+}
+
+impl<F1, F2, T1, T2> From<(&RouterData<F1, T1, PaymentsResponseData>, T2)>
for RouterData<F2, T2, PaymentsResponseData>
{
- fn from(item: (&&mut RouterData<F1, T1, PaymentsResponseData>, T2)) -> Self {
+ fn from(item: (&RouterData<F1, T1, PaymentsResponseData>, T2)) -> Self {
let data = item.0;
let request = item.1;
Self {
diff --git a/crates/router/tests/connectors/adyen_ui.rs b/crates/router/tests/connectors/adyen_ui.rs
new file mode 100644
index 00000000000..4a2b840f68f
--- /dev/null
+++ b/crates/router/tests/connectors/adyen_ui.rs
@@ -0,0 +1,104 @@
+use serial_test::serial;
+use thirtyfour::{prelude::*, WebDriver};
+
+use crate::{selenium::*, tester};
+
+struct AdyenSeleniumTest;
+
+impl SeleniumTest for AdyenSeleniumTest {}
+
+async fn should_make_adyen_gpay_payment(c: WebDriver) -> Result<(), WebDriverError> {
+ let conn = AdyenSeleniumTest {};
+ conn.make_gpay_payment(c,
+ &format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=70.00&country=US¤cy=USD"),
+ vec![
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+async fn should_make_adyen_gpay_mandate_payment(c: WebDriver) -> Result<(), WebDriverError> {
+ let conn = AdyenSeleniumTest {};
+ conn.make_gpay_payment(c,
+ &format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=70.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=7000&mandate_data[mandate_type][multi_use][currency]=USD"),
+ vec![
+ Event::Assert(Assert::IsPresent("succeeded")),
+ Event::Assert(Assert::IsPresent("Mandate ID")),
+ Event::Assert(Assert::IsPresent("man_")),// mandate id starting with man_
+ Event::Trigger(Trigger::Click(By::Id("pm-mandate-btn"))),
+ Event::Trigger(Trigger::Click(By::Id("pay-with-mandate-btn"))),
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+async fn should_make_adyen_gpay_zero_dollar_mandate_payment(
+ c: WebDriver,
+) -> Result<(), WebDriverError> {
+ let conn = AdyenSeleniumTest {};
+ conn.make_gpay_payment(c,
+ &format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=0.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=USD"),
+ vec![
+ Event::Assert(Assert::IsPresent("succeeded")),
+ Event::Assert(Assert::IsPresent("Mandate ID")),
+ Event::Assert(Assert::IsPresent("man_")),// mandate id starting with man_
+ Event::Trigger(Trigger::Click(By::Id("pm-mandate-btn"))),
+ Event::Trigger(Trigger::Click(By::Id("pay-with-mandate-btn"))),
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+async fn should_make_adyen_klarna_mandate_payment(c: WebDriver) -> Result<(), WebDriverError> {
+ let conn = AdyenSeleniumTest {};
+ conn.make_redirection_payment(c,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/klarna-redirect?amount=70.00&country=SE¤cy=SEK&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=SEK&return_url={CHEKOUT_BASE_URL}/payments"))),
+ Event::Trigger(Trigger::Click(By::Id("klarna-redirect-btn"))),
+ Event::Trigger(Trigger::SwitchFrame(By::Id("klarna-apf-iframe"))),
+ Event::Trigger(Trigger::Click(By::Id("signInWithBankId"))),
+ Event::Assert(Assert::IsPresent("Klart att betala")),
+ Event::EitherOr(Assert::IsPresent("Klart att betala"), vec![
+ Event::Trigger(Trigger::Click(By::Css("button[data-testid='confirm-and-pay']"))),
+ ],
+ vec![
+ Event::Trigger(Trigger::Click(By::Css("button[data-testid='SmoothCheckoutPopUp:skip']"))),
+ Event::Trigger(Trigger::Click(By::Css("button[data-testid='confirm-and-pay']"))),
+ ]
+ ),
+ Event::Trigger(Trigger::SwitchTab(Position::Prev)),
+ Event::Assert(Assert::IsPresent("succeeded")),
+ Event::Assert(Assert::IsPresent("Mandate ID")),
+ Event::Assert(Assert::IsPresent("man_")),// mandate id starting with man_
+ Event::Trigger(Trigger::Click(By::Id("pm-mandate-btn"))),
+ Event::Trigger(Trigger::Click(By::Id("pay-with-mandate-btn"))),
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+#[test]
+#[serial]
+fn should_make_adyen_gpay_payment_test() {
+ tester!(should_make_adyen_gpay_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_adyen_gpay_mandate_payment_test() {
+ tester!(should_make_adyen_gpay_mandate_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_adyen_gpay_zero_dollar_mandate_payment_test() {
+ tester!(should_make_adyen_gpay_zero_dollar_mandate_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_adyen_klarna_mandate_payment_test() {
+ tester!(should_make_adyen_klarna_mandate_payment);
+}
+
+// https://hs-payments-test.netlify.app/paypal-redirect?amount=70.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=USD&apikey=dev_uFpxA0r6jjbVaxHSY3X0BZLL3erDUzvg3i51abwB1Bknu3fdiPxw475DQgnByn1z
diff --git a/crates/router/tests/connectors/bambora.rs b/crates/router/tests/connectors/bambora.rs
index 83a327aaf85..b27480825db 100644
--- a/crates/router/tests/connectors/bambora.rs
+++ b/crates/router/tests/connectors/bambora.rs
@@ -97,6 +97,7 @@ async fn should_sync_authorized_payment() {
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
+ mandate_id: None,
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
@@ -209,6 +210,7 @@ async fn should_sync_auto_captured_payment() {
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
+ mandate_id: None,
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
diff --git a/crates/router/tests/connectors/forte.rs b/crates/router/tests/connectors/forte.rs
index 57fa0175000..7fdebd2eb44 100644
--- a/crates/router/tests/connectors/forte.rs
+++ b/crates/router/tests/connectors/forte.rs
@@ -149,6 +149,7 @@ async fn should_sync_authorized_payment() {
encoded_data: None,
capture_method: None,
connector_meta: None,
+ mandate_id: None,
}),
get_default_payment_info(),
)
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 95b79c6166d..6bda1098fe4 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -2,6 +2,7 @@
mod aci;
mod adyen;
+mod adyen_ui;
mod airwallex;
mod authorizedotnet;
mod bambora;
diff --git a/crates/router/tests/connectors/nexinets.rs b/crates/router/tests/connectors/nexinets.rs
index 86817c2e588..2f3641fa992 100644
--- a/crates/router/tests/connectors/nexinets.rs
+++ b/crates/router/tests/connectors/nexinets.rs
@@ -117,6 +117,7 @@ async fn should_sync_authorized_payment() {
encoded_data: None,
capture_method: None,
connector_meta,
+ mandate_id: None,
}),
None,
)
diff --git a/crates/router/tests/connectors/paypal.rs b/crates/router/tests/connectors/paypal.rs
index 15b52c9d349..ba00e06744e 100644
--- a/crates/router/tests/connectors/paypal.rs
+++ b/crates/router/tests/connectors/paypal.rs
@@ -131,6 +131,7 @@ async fn should_sync_authorized_payment() {
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
+ mandate_id: None,
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
@@ -320,6 +321,7 @@ async fn should_sync_auto_captured_payment() {
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
+ mandate_id: None,
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
diff --git a/crates/router/tests/connectors/selenium.rs b/crates/router/tests/connectors/selenium.rs
index c599965feff..fd71cc531fd 100644
--- a/crates/router/tests/connectors/selenium.rs
+++ b/crates/router/tests/connectors/selenium.rs
@@ -39,6 +39,7 @@ pub enum Assert<'a> {
Eq(Selector, &'a str),
Contains(Selector, &'a str),
IsPresent(&'a str),
+ IsPresentNow(&'a str),
}
pub static CHEKOUT_BASE_URL: &str = "https://hs-payments-test.netlify.app";
@@ -64,6 +65,9 @@ pub trait SeleniumTest {
Assert::IsPresent(text) => {
assert!(is_text_present(driver, text).await?)
}
+ Assert::IsPresentNow(text) => {
+ assert!(is_text_present_now(driver, text).await?)
+ }
},
Event::RunIf(con_event, events) => match con_event {
Assert::Contains(selector, text) => match selector {
@@ -85,6 +89,11 @@ pub trait SeleniumTest {
self.complete_actions(driver, events).await?;
}
}
+ Assert::IsPresentNow(text) => {
+ if is_text_present_now(driver, text).await.is_ok() {
+ self.complete_actions(driver, events).await?;
+ }
+ }
},
Event::EitherOr(con_event, success, failure) => match con_event {
Assert::Contains(selector, text) => match selector {
@@ -124,6 +133,17 @@ pub trait SeleniumTest {
)
.await?;
}
+ Assert::IsPresentNow(text) => {
+ self.complete_actions(
+ driver,
+ if is_text_present_now(driver, text).await.is_ok() {
+ success
+ } else {
+ failure
+ },
+ )
+ .await?;
+ }
},
Event::Trigger(trigger) => match trigger {
Trigger::Goto(url) => {
@@ -143,12 +163,14 @@ pub trait SeleniumTest {
let ele = driver.query(by).first().await?;
ele.wait_until().displayed().await?;
ele.wait_until().clickable().await?;
+ ele.wait_until().enabled().await?;
ele.click().await?;
}
Trigger::ClickNth(by, n) => {
let ele = driver.query(by).all().await?.into_iter().nth(n).unwrap();
ele.wait_until().displayed().await?;
ele.wait_until().clickable().await?;
+ ele.wait_until().enabled().await?;
ele.click().await?;
}
Trigger::Find(by) => {
@@ -226,8 +248,9 @@ pub trait SeleniumTest {
Event::Trigger(Trigger::Goto(url)),
Event::Trigger(Trigger::Click(By::Css(".gpay-button"))),
Event::Trigger(Trigger::SwitchTab(Position::Next)),
+ Event::Trigger(Trigger::Sleep(5)),
Event::RunIf(
- Assert::IsPresent("Sign in"),
+ Assert::IsPresentNow("Sign in"),
vec![
Event::Trigger(Trigger::SendKeys(By::Id("identifierId"), email)),
Event::Trigger(Trigger::ClickNth(By::Tag("button"), 2)),
@@ -248,7 +271,6 @@ pub trait SeleniumTest {
),
],
),
- Event::Trigger(Trigger::Sleep(5)),
Event::Trigger(Trigger::SwitchFrame(By::Id("sM432dIframe"))),
Event::Assert(Assert::IsPresent("Gpay Tester")),
Event::Trigger(Trigger::Click(By::ClassName("jfk-button-action"))),
@@ -295,6 +317,13 @@ pub trait SeleniumTest {
self.complete_actions(&c, pypl_actions).await
}
}
+async fn is_text_present_now(driver: &WebDriver, key: &str) -> WebDriverResult<bool> {
+ let mut xpath = "//*[contains(text(),'".to_owned();
+ xpath.push_str(key);
+ xpath.push_str("')]");
+ let result = driver.find(By::XPath(&xpath)).await?;
+ result.is_present().await
+}
async fn is_text_present(driver: &WebDriver, key: &str) -> WebDriverResult<bool> {
let mut xpath = "//*[contains(text(),'".to_owned();
xpath.push_str(key);
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index c5815819e9f..8b3f2d51090 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -557,6 +557,7 @@ impl Default for BrowserInfoType {
impl Default for PaymentSyncType {
fn default() -> Self {
let data = types::PaymentsSyncData {
+ mandate_id: None,
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
"12345".to_string(),
),
diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs
index 4130a73990c..58df15a052f 100644
--- a/crates/router/tests/connectors/zen.rs
+++ b/crates/router/tests/connectors/zen.rs
@@ -98,6 +98,7 @@ async fn should_sync_authorized_payment() {
encoded_data: None,
capture_method: None,
connector_meta: None,
+ mandate_id: None,
}),
None,
)
@@ -210,6 +211,7 @@ async fn should_sync_auto_captured_payment() {
encoded_data: None,
capture_method: Some(enums::CaptureMethod::Automatic),
connector_meta: None,
+ mandate_id: None,
}),
None,
)
|
feat
|
Mandates for alternate payment methods via Adyen (#1046)
|
3d05e50abcb92fe7e6c4472faafc03fb70920048
|
2023-05-04 19:31:33
|
Kartikeya Hegde
|
fix: impl `Drop` for `RedisConnectionPool` (#1051)
| false
|
diff --git a/crates/drainer/src/main.rs b/crates/drainer/src/main.rs
index c9a8533a43f..a8b63e14477 100644
--- a/crates/drainer/src/main.rs
+++ b/crates/drainer/src/main.rs
@@ -33,6 +33,5 @@ async fn main() -> DrainerResult<()> {
)
.await?;
- store.close().await;
Ok(())
}
diff --git a/crates/drainer/src/services.rs b/crates/drainer/src/services.rs
index 5d72d836216..fd1f6c0efff 100644
--- a/crates/drainer/src/services.rs
+++ b/crates/drainer/src/services.rs
@@ -37,13 +37,4 @@ impl Store {
// Example: {shard_5}_drainer_stream
format!("{{{}}}_{}", shard_key, self.config.drainer_stream_name,)
}
-
- #[allow(clippy::expect_used)]
- pub async fn close(mut self: Arc<Self>) {
- Arc::get_mut(&mut self)
- .and_then(|inner| Arc::get_mut(&mut inner.redis_conn))
- .expect("Redis connection pool cannot be closed")
- .close_connections()
- .await;
- }
}
diff --git a/crates/redis_interface/src/lib.rs b/crates/redis_interface/src/lib.rs
index bcf9ee1d808..3a4ffdebc5a 100644
--- a/crates/redis_interface/src/lib.rs
+++ b/crates/redis_interface/src/lib.rs
@@ -155,6 +155,13 @@ impl RedisConnectionPool {
}
}
+impl Drop for RedisConnectionPool {
+ fn drop(&mut self) {
+ let rt = tokio::runtime::Handle::current();
+ rt.block_on(self.close_connections())
+ }
+}
+
struct RedisConfig {
default_ttl: u32,
default_stream_read_count: u64,
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index f5c029a4b80..02ff2c241ef 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -39,13 +39,11 @@ async fn main() -> ApplicationResult<()> {
logger::info!("Application started [{:?}] [{:?}]", conf.server, conf.log);
#[allow(clippy::expect_used)]
- let (server, mut state) = router::start_server(conf)
+ let server = router::start_server(conf)
.await
.expect("Failed to create the server");
let _ = server.await;
- state.store.close().await;
-
Err(ApplicationError::from(std::io::Error::new(
std::io::ErrorKind::Other,
"Server shut down",
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 1418eef7b13..810a24d828a 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -21,7 +21,7 @@ async fn main() -> CustomResult<(), errors::ProcessTrackerError> {
.expect("Unable to construct application configuration");
// channel for listening to redis disconnect events
let (redis_shutdown_signal_tx, redis_shutdown_signal_rx) = oneshot::channel();
- let mut state = routes::AppState::new(conf, redis_shutdown_signal_tx).await;
+ let state = routes::AppState::new(conf, redis_shutdown_signal_tx).await;
// channel to shutdown scheduler gracefully
let (tx, rx) = mpsc::channel(1);
tokio::spawn(router::receiver_for_error(
@@ -34,8 +34,6 @@ async fn main() -> CustomResult<(), errors::ProcessTrackerError> {
start_scheduler(&state, (tx, rx)).await?;
- state.store.close().await;
-
eprintln!("Scheduler shut down");
Ok(())
}
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index e8a00809cbc..a8dadd2ab84 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -63,19 +63,10 @@ pub trait StorageInterface:
+ cards_info::CardsInfoInterface
+ 'static
{
- async fn close(&mut self) {}
}
#[async_trait::async_trait]
-impl StorageInterface for Store {
- #[allow(clippy::expect_used)]
- async fn close(&mut self) {
- std::sync::Arc::get_mut(&mut self.redis_conn)
- .expect("Redis connection pool cannot be closed")
- .close_connections()
- .await;
- }
-}
+impl StorageInterface for Store {}
#[derive(Clone)]
pub struct MockDb {
@@ -107,15 +98,7 @@ impl MockDb {
}
#[async_trait::async_trait]
-impl StorageInterface for MockDb {
- #[allow(clippy::expect_used)]
- async fn close(&mut self) {
- std::sync::Arc::get_mut(&mut self.redis)
- .expect("Redis connection pool cannot be closed")
- .close_connections()
- .await;
- }
-}
+impl StorageInterface for MockDb {}
pub async fn get_and_deserialize_key<T>(
db: &dyn StorageInterface,
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 3fb44938a19..b35e503f2aa 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -139,13 +139,11 @@ pub fn mk_app(
///
/// Unwrap used because without the value we can't start the server
#[allow(clippy::expect_used, clippy::unwrap_used)]
-pub async fn start_server(conf: settings::Settings) -> ApplicationResult<(Server, AppState)> {
+pub async fn start_server(conf: settings::Settings) -> ApplicationResult<Server> {
logger::debug!(startup_config=?conf);
let server = conf.server.clone();
let (tx, rx) = oneshot::channel();
let state = routes::AppState::new(conf, tx).await;
- // Cloning to close connections before shutdown
- let app_state = state.clone();
let request_body_limit = server.request_body_limit;
let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit))
.bind((server.host.as_str(), server.port))?
@@ -153,7 +151,7 @@ pub async fn start_server(conf: settings::Settings) -> ApplicationResult<(Server
.shutdown_timeout(server.shutdown_timeout)
.run();
tokio::spawn(receiver_for_error(rx, server.handle()));
- Ok((server, app_state))
+ Ok(server)
}
pub async fn receiver_for_error(rx: oneshot::Receiver<()>, mut server: impl Stop) {
diff --git a/crates/router/tests/utils.rs b/crates/router/tests/utils.rs
index e7c34afc31a..5181cbff18f 100644
--- a/crates/router/tests/utils.rs
+++ b/crates/router/tests/utils.rs
@@ -20,7 +20,7 @@ static SERVER: OnceCell<bool> = OnceCell::const_new();
async fn spawn_server() -> bool {
let conf = Settings::new().expect("invalid settings");
- let (server, _state) = router::start_server(conf)
+ let server = router::start_server(conf)
.await
.expect("failed to create server");
|
fix
|
impl `Drop` for `RedisConnectionPool` (#1051)
|
a8d6ce836af842c75b0a71dd80c76f52fff613ec
|
2023-02-17 18:15:45
|
Sampras Lopes
|
chore(release): port release bug fixes to main branch (#612)
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e69de29bb2d..8dce72ec6e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -0,0 +1,48 @@
+# 0.2.1 (2023-02-17)
+
+## Fixes
+- fix payment_status not updated when adding payment method ([#446])
+- Decide connector only when the payment method is confirm ([10ea4919ba07d3198a6bbe3f3d4d817a23605924](https://github.com/juspay/hyperswitch/commit/10ea4919ba07d3198a6bbe3f3d4d817a23605924))
+- Fix panics caused with empty diesel updates ([448595498114cd15158b4a78fc32d8e6dc1b67ee](https://github.com/juspay/hyperswitch/commit/448595498114cd15158b4a78fc32d8e6dc1b67ee))
+
+
+# 0.2.0 (2023-01-23) - Initial Release
+
+## Supported Connectors
+
+- [ACI](https://www.aciworldwide.com/)
+- [Adyen](https://www.adyen.com/)
+- [Authorize.net](https://www.authorize.net/)
+- [Braintree](https://www.braintreepayments.com/)
+- [Checkout.com](https://www.checkout.com/)
+- [Cybersource](https://www.cybersource.com)
+- [Fiserv](https://www.fiserv.com/)
+- [Global Payments](https://www.globalpayments.com)
+- [Klarna](https://www.klarna.com/)
+- [PayU](https://payu.in/)
+- [Rapyd](https://www.rapyd.net/)
+- [Shift4](https://www.shift4.com/)
+- [Stripe](https://stripe.com/)
+- [Wordline](https://worldline.com/)
+
+
+## Supported Payment Methods
+
+- Cards No 3DS
+- Cards 3DS*
+- [Apple Pay](https://www.apple.com/apple-pay/)*
+- [Google Pay](https://pay.google.com)*
+- [Klarna](https://www.klarna.com/)*
+- [PayPal](https://www.paypal.com/)*
+
+## Supported Payment Functionalities
+
+- Payments (Authorize/Sync/Capture/Cancel)
+- Refunds (Execute/Sync)
+- Saved Cards
+- Mandates (No 3DS)*
+- Customers
+- Merchants
+- ConnectorAccounts
+
+\*May not be supported on all connectors
\ No newline at end of file
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 18d0530bcb2..5c65854ad8d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -109,13 +109,18 @@ where
)
.await?;
- let connector_details = route_connector(
- state,
- &merchant_account,
- &mut payment_data,
- connector_details,
- )
- .await?;
+ let connector = match should_call_connector(&operation, &payment_data) {
+ true => Some(
+ route_connector(
+ state,
+ &merchant_account,
+ &mut payment_data,
+ connector_details,
+ )
+ .await?,
+ ),
+ false => None,
+ };
let (operation, mut payment_data) = operation
.to_update_tracker()?
@@ -133,7 +138,7 @@ where
.add_task_to_process_tracker(state, &payment_data.payment_attempt)
.await?;
- if should_call_connector(&operation, &payment_data) {
+ if let Some(connector_details) = connector {
payment_data = match connector_details {
api::ConnectorCallType::Single(connector) => {
call_connector_service(
|
chore
|
port release bug fixes to main branch (#612)
|
52e01769d405308b0b882647e2e824f38aeef3dc
|
2023-08-23 14:48:42
|
Prasunna Soppa
|
feat(pm_list): add card pm required field info for connectors (#1918)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 833eba4a04a..f9e282531ca 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -508,20 +508,25 @@ pub struct UnresolvedResponseReason {
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum FieldType {
+ CardNumber,
+ CardExpiryMonth,
+ CardExpiryYear,
+ CardCVC,
UserFullName,
UserEmailAddress,
UserPhoneNumber,
- UserCountry { options: Vec<String> },
+ UserCountryCode, //phone number's country code
+ UserCountry { options: Vec<String> }, //for country inside payment method data ex- bank redirect
+ UserCurrency { options: Vec<String> },
+ UserBillingName,
UserAddressline1,
UserAddressline2,
UserAddressCity,
UserAddressPincode,
UserAddressState,
- UserAddressCountry,
+ UserAddressCountry { options: Vec<String> },
UserBlikCode,
- UserBillingName,
UserBank,
- UserCurrency { options: Vec<String> },
Text,
DropDown { options: Vec<String> },
}
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index cb14b37b657..2c116ebd762 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -173,15 +173,16 @@ impl Default for Mandates {
enums::PaymentMethodType::Credit,
SupportedConnectorsForMandate {
connector_list: HashSet::from([
- enums::Connector::Stripe,
+ enums::Connector::Aci,
enums::Connector::Adyen,
enums::Connector::Authorizedotnet,
enums::Connector::Globalpay,
enums::Connector::Worldpay,
enums::Connector::Multisafepay,
- enums::Connector::Nmi,
enums::Connector::Nexinets,
enums::Connector::Noon,
+ enums::Connector::Payme,
+ enums::Connector::Stripe,
]),
},
),
@@ -189,15 +190,16 @@ impl Default for Mandates {
enums::PaymentMethodType::Debit,
SupportedConnectorsForMandate {
connector_list: HashSet::from([
- enums::Connector::Stripe,
+ enums::Connector::Aci,
enums::Connector::Adyen,
enums::Connector::Authorizedotnet,
enums::Connector::Globalpay,
enums::Connector::Worldpay,
enums::Connector::Multisafepay,
- enums::Connector::Nmi,
enums::Connector::Nexinets,
enums::Connector::Noon,
+ enums::Connector::Payme,
+ enums::Connector::Stripe,
]),
},
),
@@ -218,228 +220,1726 @@ impl Default for super::settings::RequiredFields {
ConnectorFields {
fields: HashMap::from([
(
- enums::Connector::Stripe,
+ enums::Connector::Aci,
RequiredFieldFinal {
- mandate: HashMap::from([
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.line1".to_string(),
- display_name: "billing_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.first_name".to_string(),
- display_name: "billing_first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
+ mandate: HashMap::new(),
non_mandate: HashMap::new(),
- common:HashMap::from([
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "shipping_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- ),
- (
- "shipping.phone.number".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.phone.number".to_string(),
- display_name: "shipping_phone".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
}
),
(
- enums::Connector::Cybersource,
- RequiredFieldFinal {
- mandate: HashMap::from([
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.line1".to_string(),
- display_name: "billing_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
+ enums::Connector::Adyen,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
),
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.first_name".to_string(),
- display_name: "billing_first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
- non_mandate: HashMap::new(),
- common:HashMap::from([
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "shipping_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
+ }
+ ),
+ (
+ enums::Connector::Airwallex,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
),
- (
- "shipping.phone.number".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.phone.number".to_string(),
- display_name: "shipping_phone".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
- }
+ common: HashMap::new(),
+ }
),
(
- enums::Connector::Dlocal,
- RequiredFieldFinal {
- mandate: HashMap::from([
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.line1".to_string(),
- display_name: "billing_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
+ enums::Connector::Authorizedotnet,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
),
- (
- "billing.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "billing.address.first_name".to_string(),
- display_name: "billing_first_name".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
- non_mandate: HashMap::new(),
- common:HashMap::from([
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "shipping_line1".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
+ }
+ ),
+ (
+ enums::Connector::Bambora,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ ),
+ ]
),
- (
- "shipping.phone.number".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.phone.number".to_string(),
- display_name: "shipping_phone".to_string(),
- field_type: enums::FieldType::UserFullName,
- value: None,
- }
- )
- ]),
- }
+ common: HashMap::new(),
+ }
),
(
- enums::Connector::Forte,
+ enums::Connector::Bluesnap,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
),
(
- enums::Connector::Globalpay,
+ enums::Connector::Checkout,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Coinbase,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::from(
+ [
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.first_name".to_string(),
+ display_name: "billing_first_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Cybersource,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressline1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.state".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]
+ ),
+ common:HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Dlocal,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]
+ ),
+ common:HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Fiserv,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Forte,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common:HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Globalpay,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]),
+ }
+ ),
+ (
+ enums::Connector::Iatapay,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Mollie,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Multisafepay,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressline1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line2".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line2".to_string(),
+ display_name: "line2".to_string(),
+ field_type: enums::FieldType::UserAddressline2,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]
+ ),
+ }
+ ),
+ (
+ enums::Connector::Nexinets,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ }
+ ),
+ (
+ enums::Connector::Nmi,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Noon,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
+ }
+ ),
+ (
+ enums::Connector::Payme,
+ 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "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: "billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ ),
+ ]
+ ),
+ }
+ ),
+ (
+ enums::Connector::Paypal,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Payu,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
),
(
- enums::Connector::Iatapay,
+ enums::Connector::Powertranz,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
),
(
- enums::Connector::Multisafepay,
+ enums::Connector::Rapyd,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
),
(
- enums::Connector::Noon,
+ enums::Connector::Shift4,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
- ),
- (
- enums::Connector::Opennode,
+ ),(
+ enums::Connector::Stax,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
common: HashMap::new(),
}
),
(
- enums::Connector::Payu,
+ enums::Connector::Stripe,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
- common: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
}
),
(
- enums::Connector::Rapyd,
+ enums::Connector::Trustpay,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
- common: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_holder_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_holder_name".to_string(),
+ display_name: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new()
}
),
(
- enums::Connector::Shift4,
+ enums::Connector::Tsys,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
- common: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ )
+ ]
+ ),
+ common: HashMap::new()
}
),
(
- enums::Connector::Trustpay,
+ enums::Connector::Worldline,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ 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::CardCVC,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]),
common: HashMap::new(),
}
),
(
- enums::Connector::Worldline,
+ enums::Connector::Worldpay,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ value: None,
+ }
+ )
+ ]),
common: HashMap::new(),
}
),
@@ -447,7 +1947,44 @@ impl Default for super::settings::RequiredFields {
enums::Connector::Zen,
RequiredFieldFinal {
mandate: HashMap::new(),
- non_mandate: HashMap::new(),
+ non_mandate: 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::CardNumber,
+ 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::CardExpiryMonth,
+ 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::CardExpiryYear,
+ value: None,
+ }
+ ),
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ ]),
common: HashMap::new(),
}
),
@@ -659,14 +2196,18 @@ impl Default for super::settings::RequiredFields {
( "payment_method_data.pay_later.klarna.billing_country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.pay_later.klarna.billing_country".to_string(),
- display_name: "billing_name".to_string(),
- field_type: enums::FieldType::UserAddressCountry,
+ display_name: "billing_country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
value: None,
}),
("email".to_string(),
RequiredFieldInfo {
required_field: "email".to_string(),
- display_name: "cust_email".to_string(),
+ display_name: "email".to_string(),
field_type: enums::FieldType::UserEmailAddress,
value: None,
})
@@ -705,8 +2246,7 @@ impl Default for super::settings::RequiredFields {
enums::Connector::Cryptopay,
RequiredFieldFinal {
mandate : HashMap::new(),
- non_mandate: HashMap::new(),
- common : HashMap::from([
+ non_mandate: HashMap::from([
(
"payment_method_data.crypto.pay_currency".to_string(),
RequiredFieldInfo {
@@ -736,6 +2276,7 @@ impl Default for super::settings::RequiredFields {
}
),
]),
+ common : HashMap::new(),
}
),
]),
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index d57c73010ec..0e28a1e70d5 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -5003,6 +5003,30 @@
},
"FieldType": {
"oneOf": [
+ {
+ "type": "string",
+ "enum": [
+ "card_number"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "card_expiry_month"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "card_expiry_year"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "card_c_v_c"
+ ]
+ },
{
"type": "string",
"enum": [
@@ -5021,6 +5045,12 @@
"user_phone_number"
]
},
+ {
+ "type": "string",
+ "enum": [
+ "user_country_code"
+ ]
+ },
{
"type": "object",
"required": [
@@ -5044,66 +5074,70 @@
}
},
{
- "type": "string",
- "enum": [
- "user_addressline1"
- ]
- },
- {
- "type": "string",
- "enum": [
- "user_addressline2"
- ]
- },
- {
- "type": "string",
- "enum": [
- "user_address_city"
- ]
+ "type": "object",
+ "required": [
+ "user_currency"
+ ],
+ "properties": {
+ "user_currency": {
+ "type": "object",
+ "required": [
+ "options"
+ ],
+ "properties": {
+ "options": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
},
{
"type": "string",
"enum": [
- "user_address_pincode"
+ "user_billing_name"
]
},
{
"type": "string",
"enum": [
- "user_address_state"
+ "user_addressline1"
]
},
{
"type": "string",
"enum": [
- "user_address_country"
+ "user_addressline2"
]
},
{
"type": "string",
"enum": [
- "user_blik_code"
+ "user_address_city"
]
},
{
"type": "string",
"enum": [
- "user_billing_name"
+ "user_address_pincode"
]
},
{
"type": "string",
"enum": [
- "user_bank"
+ "user_address_state"
]
},
{
"type": "object",
"required": [
- "user_currency"
+ "user_address_country"
],
"properties": {
- "user_currency": {
+ "user_address_country": {
"type": "object",
"required": [
"options"
@@ -5119,6 +5153,18 @@
}
}
},
+ {
+ "type": "string",
+ "enum": [
+ "user_blik_code"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_bank"
+ ]
+ },
{
"type": "string",
"enum": [
|
feat
|
add card pm required field info for connectors (#1918)
|
4859b6e4f348f3b7e7564c1733ed0732114edda2
|
2023-03-15 12:24:13
|
Sanchith Hegde
|
test(masking): add suitable feature gates for basic tests (#745)
| false
|
diff --git a/crates/masking/tests/basic.rs b/crates/masking/tests/basic.rs
index 53cad9bd78d..bab5c9607b8 100644
--- a/crates/masking/tests/basic.rs
+++ b/crates/masking/tests/basic.rs
@@ -1,24 +1,31 @@
#![allow(dead_code, clippy::unwrap_used, clippy::panic_in_result_fn)]
-use masking as pii;
+use masking::Secret;
+#[cfg(feature = "serde")]
+use masking::SerializableSecret;
+#[cfg(feature = "alloc")]
+use masking::ZeroizableSecret;
+#[cfg(feature = "serde")]
+use serde::Serialize;
#[test]
fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
- use pii::{Secret, SerializableSecret, ZeroizableSecret};
- use serde::Serialize;
-
- #[derive(Clone, Debug, Serialize, PartialEq, Eq)]
+ #[cfg_attr(feature = "serde", derive(Serialize))]
+ #[derive(Clone, Debug, PartialEq, Eq)]
pub struct AccountNumber(String);
+ #[cfg(feature = "alloc")]
impl ZeroizableSecret for AccountNumber {
fn zeroize(&mut self) {
self.0.zeroize();
}
}
+ #[cfg(feature = "serde")]
impl SerializableSecret for AccountNumber {}
- #[derive(Clone, Debug, Serialize, PartialEq, Eq)]
+ #[cfg_attr(feature = "serde", derive(Serialize))]
+ #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Composite {
secret_number: Secret<AccountNumber>,
not_secret: String,
@@ -41,14 +48,17 @@ fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// format
let got = format!("{composite:?}");
- let exp = "Composite { secret_number: *** basic::basic::AccountNumber ***, not_secret: \"not secret\" }";
+ let exp = r#"Composite { secret_number: *** basic::basic::AccountNumber ***, not_secret: "not secret" }"#;
assert_eq!(got, exp);
// serialize
- let got = serde_json::to_string(&composite).unwrap();
- let exp = "{\"secret_number\":\"abc\",\"not_secret\":\"not secret\"}";
- assert_eq!(got, exp);
+ #[cfg(feature = "serde")]
+ {
+ let got = serde_json::to_string(&composite).unwrap();
+ let exp = r#"{"secret_number":"abc","not_secret":"not secret"}"#;
+ assert_eq!(got, exp);
+ }
// end
@@ -57,21 +67,21 @@ fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
#[test]
fn without_serialize() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
- use pii::{Secret, ZeroizableSecret};
- use serde::Serialize;
-
- #[derive(Clone, Debug, Serialize, PartialEq, Eq)]
+ #[cfg_attr(feature = "serde", derive(Serialize))]
+ #[derive(Clone, Debug, PartialEq, Eq)]
pub struct AccountNumber(String);
+ #[cfg(feature = "alloc")]
impl ZeroizableSecret for AccountNumber {
fn zeroize(&mut self) {
self.0.zeroize();
}
}
- #[derive(Clone, Debug, Serialize, PartialEq, Eq)]
+ #[cfg_attr(feature = "serde", derive(Serialize))]
+ #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Composite {
- #[serde(skip)]
+ #[cfg_attr(feature = "serde", serde(skip))]
secret_number: Secret<AccountNumber>,
not_secret: String,
}
@@ -88,14 +98,17 @@ fn without_serialize() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// format
let got = format!("{composite:?}");
- let exp = "Composite { secret_number: *** basic::without_serialize::AccountNumber ***, not_secret: \"not secret\" }";
+ let exp = r#"Composite { secret_number: *** basic::without_serialize::AccountNumber ***, not_secret: "not secret" }"#;
assert_eq!(got, exp);
// serialize
- let got = serde_json::to_string(&composite).unwrap();
- let exp = "{\"not_secret\":\"not secret\"}";
- assert_eq!(got, exp);
+ #[cfg(feature = "serde")]
+ {
+ let got = serde_json::to_string(&composite).unwrap();
+ let exp = r#"{"not_secret":"not secret"}"#;
+ assert_eq!(got, exp);
+ }
// end
@@ -104,10 +117,8 @@ fn without_serialize() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
#[test]
fn for_string() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
- use pii::Secret;
- use serde::Serialize;
-
- #[derive(Clone, Debug, Serialize, PartialEq, Eq)]
+ #[cfg_attr(feature = "serde", derive(Serialize))]
+ #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Composite {
secret_number: Secret<String>,
not_secret: String,
@@ -131,14 +142,17 @@ fn for_string() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let got = format!("{composite:?}");
let exp =
- "Composite { secret_number: *** alloc::string::String ***, not_secret: \"not secret\" }";
+ r#"Composite { secret_number: *** alloc::string::String ***, not_secret: "not secret" }"#;
assert_eq!(got, exp);
// serialize
- let got = serde_json::to_string(&composite).unwrap();
- let exp = "{\"secret_number\":\"abc\",\"not_secret\":\"not secret\"}";
- assert_eq!(got, exp);
+ #[cfg(feature = "serde")]
+ {
+ let got = serde_json::to_string(&composite).unwrap();
+ let exp = r#"{"secret_number":"abc","not_secret":"not secret"}"#;
+ assert_eq!(got, exp);
+ }
// end
|
test
|
add suitable feature gates for basic tests (#745)
|
ff6a0dd0b515778b64a3e28ef905154eee85ec78
|
2023-11-28 20:34:30
|
chikke srujan
|
fix(core): Replace euclid enum with RoutableConnectors enum (#2994)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index e4a317d74f4..2ca33b6910a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2339,6 +2339,7 @@ name = "euclid_wasm"
version = "0.1.0"
dependencies = [
"api_models",
+ "common_enums",
"currency_conversion",
"euclid",
"getrandom 0.2.10",
@@ -3306,6 +3307,7 @@ name = "kgraph_utils"
version = "0.1.0"
dependencies = [
"api_models",
+ "common_enums",
"criterion",
"euclid",
"masking",
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index e441b0e5879..e9945a726a9 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -106,6 +106,7 @@ impl ConnectorCommon for {{project-name | downcase | pascal_case}} {
message: response.message,
reason: response.reason,
attempt_status: None,
+ connector_transaction_id: None,
})
}
}
@@ -485,7 +486,7 @@ impl api::IncomingWebhook for {{project-name | downcase | pascal_case}} {
fn get_webhook_resource_object(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
- ) -> CustomResult<Box<dyn erased_serde::Serialize>, errors::ConnectorError> {
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index ffefaa2ad2c..535be4dfb15 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -147,104 +147,6 @@ impl Connector {
}
}
-#[derive(
- Clone,
- Copy,
- Debug,
- Eq,
- Hash,
- PartialEq,
- serde::Serialize,
- serde::Deserialize,
- strum::Display,
- strum::EnumString,
- strum::EnumIter,
- strum::EnumVariantNames,
-)]
-#[serde(rename_all = "snake_case")]
-#[strum(serialize_all = "snake_case")]
-pub enum RoutableConnectors {
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "phonypay")]
- #[strum(serialize = "phonypay")]
- DummyConnector1,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "fauxpay")]
- #[strum(serialize = "fauxpay")]
- DummyConnector2,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "pretendpay")]
- #[strum(serialize = "pretendpay")]
- DummyConnector3,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "stripe_test")]
- #[strum(serialize = "stripe_test")]
- DummyConnector4,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "adyen_test")]
- #[strum(serialize = "adyen_test")]
- DummyConnector5,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "checkout_test")]
- #[strum(serialize = "checkout_test")]
- DummyConnector6,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "paypal_test")]
- #[strum(serialize = "paypal_test")]
- DummyConnector7,
- Aci,
- Adyen,
- Airwallex,
- Authorizedotnet,
- Bankofamerica,
- Bitpay,
- Bambora,
- Bluesnap,
- Boku,
- Braintree,
- Cashtocode,
- Checkout,
- Coinbase,
- Cryptopay,
- Cybersource,
- Dlocal,
- Fiserv,
- Forte,
- Globalpay,
- Globepay,
- Gocardless,
- Helcim,
- Iatapay,
- Klarna,
- Mollie,
- Multisafepay,
- Nexinets,
- Nmi,
- Noon,
- Nuvei,
- // Opayo, added as template code for future usage
- Opennode,
- // Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage
- Payme,
- Paypal,
- Payu,
- Powertranz,
- Prophetpay,
- Rapyd,
- Shift4,
- Square,
- Stax,
- Stripe,
- Trustpay,
- // Tsys,
- Tsys,
- Volt,
- Wise,
- Worldline,
- Worldpay,
- Zen,
-}
-
#[cfg(feature = "payouts")]
#[derive(
Clone,
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 47a44ea7443..2236714da1d 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -4,7 +4,6 @@ use common_utils::errors::ParsingError;
use error_stack::IntoReport;
use euclid::{
dssa::types::EuclidAnalysable,
- enums as euclid_enums,
frontend::{
ast,
dir::{DirKeyKind, EuclidDirFilter},
@@ -287,71 +286,7 @@ impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
impl From<RoutableConnectorChoice> for ast::ConnectorChoice {
fn from(value: RoutableConnectorChoice) -> Self {
Self {
- connector: match value.connector {
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector1 => euclid_enums::Connector::DummyConnector1,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector2 => euclid_enums::Connector::DummyConnector2,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector3 => euclid_enums::Connector::DummyConnector3,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector4 => euclid_enums::Connector::DummyConnector4,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector5 => euclid_enums::Connector::DummyConnector5,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector6 => euclid_enums::Connector::DummyConnector6,
- #[cfg(feature = "dummy_connector")]
- RoutableConnectors::DummyConnector7 => euclid_enums::Connector::DummyConnector7,
- RoutableConnectors::Aci => euclid_enums::Connector::Aci,
- RoutableConnectors::Adyen => euclid_enums::Connector::Adyen,
- RoutableConnectors::Airwallex => euclid_enums::Connector::Airwallex,
- RoutableConnectors::Authorizedotnet => euclid_enums::Connector::Authorizedotnet,
- RoutableConnectors::Bambora => euclid_enums::Connector::Bambora,
- RoutableConnectors::Bankofamerica => euclid_enums::Connector::Bankofamerica,
- RoutableConnectors::Bitpay => euclid_enums::Connector::Bitpay,
- RoutableConnectors::Bluesnap => euclid_enums::Connector::Bluesnap,
- RoutableConnectors::Boku => euclid_enums::Connector::Boku,
- RoutableConnectors::Braintree => euclid_enums::Connector::Braintree,
- RoutableConnectors::Cashtocode => euclid_enums::Connector::Cashtocode,
- RoutableConnectors::Checkout => euclid_enums::Connector::Checkout,
- RoutableConnectors::Coinbase => euclid_enums::Connector::Coinbase,
- RoutableConnectors::Cryptopay => euclid_enums::Connector::Cryptopay,
- RoutableConnectors::Cybersource => euclid_enums::Connector::Cybersource,
- RoutableConnectors::Dlocal => euclid_enums::Connector::Dlocal,
- RoutableConnectors::Fiserv => euclid_enums::Connector::Fiserv,
- RoutableConnectors::Forte => euclid_enums::Connector::Forte,
- RoutableConnectors::Globalpay => euclid_enums::Connector::Globalpay,
- RoutableConnectors::Globepay => euclid_enums::Connector::Globepay,
- RoutableConnectors::Gocardless => euclid_enums::Connector::Gocardless,
- RoutableConnectors::Helcim => euclid_enums::Connector::Helcim,
- RoutableConnectors::Iatapay => euclid_enums::Connector::Iatapay,
- RoutableConnectors::Klarna => euclid_enums::Connector::Klarna,
- RoutableConnectors::Mollie => euclid_enums::Connector::Mollie,
- RoutableConnectors::Multisafepay => euclid_enums::Connector::Multisafepay,
- RoutableConnectors::Nexinets => euclid_enums::Connector::Nexinets,
- RoutableConnectors::Nmi => euclid_enums::Connector::Nmi,
- RoutableConnectors::Noon => euclid_enums::Connector::Noon,
- RoutableConnectors::Nuvei => euclid_enums::Connector::Nuvei,
- RoutableConnectors::Opennode => euclid_enums::Connector::Opennode,
- RoutableConnectors::Payme => euclid_enums::Connector::Payme,
- RoutableConnectors::Paypal => euclid_enums::Connector::Paypal,
- RoutableConnectors::Payu => euclid_enums::Connector::Payu,
- RoutableConnectors::Powertranz => euclid_enums::Connector::Powertranz,
- RoutableConnectors::Prophetpay => euclid_enums::Connector::Prophetpay,
- RoutableConnectors::Rapyd => euclid_enums::Connector::Rapyd,
- RoutableConnectors::Shift4 => euclid_enums::Connector::Shift4,
- RoutableConnectors::Square => euclid_enums::Connector::Square,
- RoutableConnectors::Stax => euclid_enums::Connector::Stax,
- RoutableConnectors::Stripe => euclid_enums::Connector::Stripe,
- RoutableConnectors::Trustpay => euclid_enums::Connector::Trustpay,
- RoutableConnectors::Tsys => euclid_enums::Connector::Tsys,
- RoutableConnectors::Volt => euclid_enums::Connector::Volt,
- RoutableConnectors::Wise => euclid_enums::Connector::Wise,
- RoutableConnectors::Worldline => euclid_enums::Connector::Worldline,
- RoutableConnectors::Worldpay => euclid_enums::Connector::Worldpay,
- RoutableConnectors::Zen => euclid_enums::Connector::Zen,
- },
-
+ connector: value.connector,
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: value.sub_label,
}
diff --git a/crates/common_enums/Cargo.toml b/crates/common_enums/Cargo.toml
index 88628825ca6..cd061970bff 100644
--- a/crates/common_enums/Cargo.toml
+++ b/crates/common_enums/Cargo.toml
@@ -7,6 +7,10 @@ rust-version.workspace = true
readme = "README.md"
license.workspace = true
+[features]
+default = ["dummy_connector"]
+dummy_connector = []
+
[dependencies]
diesel = { version = "2.1.0", features = ["postgres"] }
serde = { version = "1.0.160", features = ["derive"] }
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 063e35933c4..3f343965130 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -59,6 +59,105 @@ pub enum AttemptStatus {
DeviceDataCollectionPending,
}
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::Display,
+ strum::EnumString,
+ strum::EnumIter,
+ strum::EnumVariantNames,
+)]
+#[router_derive::diesel_enum(storage_type = "db_enum")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum RoutableConnectors {
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "phonypay")]
+ #[strum(serialize = "phonypay")]
+ DummyConnector1,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "fauxpay")]
+ #[strum(serialize = "fauxpay")]
+ DummyConnector2,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "pretendpay")]
+ #[strum(serialize = "pretendpay")]
+ DummyConnector3,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "stripe_test")]
+ #[strum(serialize = "stripe_test")]
+ DummyConnector4,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "adyen_test")]
+ #[strum(serialize = "adyen_test")]
+ DummyConnector5,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "checkout_test")]
+ #[strum(serialize = "checkout_test")]
+ DummyConnector6,
+ #[cfg(feature = "dummy_connector")]
+ #[serde(rename = "paypal_test")]
+ #[strum(serialize = "paypal_test")]
+ DummyConnector7,
+ Aci,
+ Adyen,
+ Airwallex,
+ Authorizedotnet,
+ Bankofamerica,
+ Bitpay,
+ Bambora,
+ Bluesnap,
+ Boku,
+ Braintree,
+ Cashtocode,
+ Checkout,
+ Coinbase,
+ Cryptopay,
+ Cybersource,
+ Dlocal,
+ Fiserv,
+ Forte,
+ Globalpay,
+ Globepay,
+ Gocardless,
+ Helcim,
+ Iatapay,
+ Klarna,
+ Mollie,
+ Multisafepay,
+ Nexinets,
+ Nmi,
+ Noon,
+ Nuvei,
+ // Opayo, added as template code for future usage
+ Opennode,
+ // Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage
+ Payme,
+ Paypal,
+ Payu,
+ Powertranz,
+ Prophetpay,
+ Rapyd,
+ Shift4,
+ Square,
+ Stax,
+ Stripe,
+ Trustpay,
+ // Tsys,
+ Tsys,
+ Volt,
+ Wise,
+ Worldline,
+ Worldpay,
+ Zen,
+}
+
impl AttemptStatus {
pub fn is_terminal_status(self) -> bool {
match self {
diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rs
index dc6d9f66a58..68e081c7aa9 100644
--- a/crates/euclid/src/enums.rs
+++ b/crates/euclid/src/enums.rs
@@ -1,8 +1,7 @@
pub use common_enums::{
AuthenticationType, CaptureMethod, CardNetwork, Country, Currency,
- FutureUsage as SetupFutureUsage, PaymentMethod, PaymentMethodType,
+ FutureUsage as SetupFutureUsage, PaymentMethod, PaymentMethodType, RoutableConnectors,
};
-use serde::{Deserialize, Serialize};
use strum::VariantNames;
pub trait CollectVariants {
@@ -24,6 +23,7 @@ macro_rules! collect_variants {
pub(crate) use collect_variants;
collect_variants!(PaymentMethod);
+collect_variants!(RoutableConnectors);
collect_variants!(PaymentType);
collect_variants!(MandateType);
collect_variants!(MandateAcceptanceType);
@@ -33,105 +33,8 @@ collect_variants!(AuthenticationType);
collect_variants!(CaptureMethod);
collect_variants!(Currency);
collect_variants!(Country);
-collect_variants!(Connector);
collect_variants!(SetupFutureUsage);
-#[derive(
- Debug,
- Copy,
- Clone,
- PartialEq,
- Eq,
- Hash,
- Serialize,
- Deserialize,
- strum::Display,
- strum::EnumVariantNames,
- strum::EnumIter,
- strum::EnumString,
- frunk::LabelledGeneric,
-)]
-#[serde(rename_all = "snake_case")]
-#[strum(serialize_all = "snake_case")]
-pub enum Connector {
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "phonypay")]
- #[strum(serialize = "phonypay")]
- DummyConnector1,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "fauxpay")]
- #[strum(serialize = "fauxpay")]
- DummyConnector2,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "pretendpay")]
- #[strum(serialize = "pretendpay")]
- DummyConnector3,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "stripe_test")]
- #[strum(serialize = "stripe_test")]
- DummyConnector4,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "adyen_test")]
- #[strum(serialize = "adyen_test")]
- DummyConnector5,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "checkout_test")]
- #[strum(serialize = "checkout_test")]
- DummyConnector6,
- #[cfg(feature = "dummy_connector")]
- #[serde(rename = "paypal_test")]
- #[strum(serialize = "paypal_test")]
- DummyConnector7,
- Aci,
- Adyen,
- Airwallex,
- Authorizedotnet,
- Bambora,
- Bankofamerica,
- Bitpay,
- Bluesnap,
- Boku,
- Braintree,
- Cashtocode,
- Checkout,
- Coinbase,
- Cryptopay,
- Cybersource,
- Dlocal,
- Fiserv,
- Forte,
- Globalpay,
- Globepay,
- Gocardless,
- Helcim,
- Iatapay,
- Klarna,
- Mollie,
- Multisafepay,
- Nexinets,
- Nmi,
- Noon,
- Nuvei,
- Opennode,
- Payme,
- Paypal,
- Payu,
- Powertranz,
- Prophetpay,
- Rapyd,
- Shift4,
- Square,
- Stax,
- Stripe,
- Trustpay,
- Tsys,
- Volt,
- Wise,
- Worldline,
- Worldpay,
- Zen,
-}
-
#[derive(
Clone,
Debug,
diff --git a/crates/euclid/src/frontend/ast.rs b/crates/euclid/src/frontend/ast.rs
index 3adb06ab187..0dad9b53c32 100644
--- a/crates/euclid/src/frontend/ast.rs
+++ b/crates/euclid/src/frontend/ast.rs
@@ -2,16 +2,14 @@ pub mod lowering;
#[cfg(feature = "ast_parser")]
pub mod parser;
+use common_enums::RoutableConnectors;
use serde::{Deserialize, Serialize};
-use crate::{
- enums::Connector,
- types::{DataType, Metadata},
-};
+use crate::types::{DataType, Metadata};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct ConnectorChoice {
- pub connector: Connector,
+ pub connector: RoutableConnectors,
#[cfg(not(feature = "connector_choice_mca_id"))]
pub sub_label: Option<String>,
}
diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs
index 7f2fc252d23..f8cef1f9295 100644
--- a/crates/euclid/src/frontend/dir.rs
+++ b/crates/euclid/src/frontend/dir.rs
@@ -13,7 +13,7 @@ macro_rules! dirval {
(Connector = $name:ident) => {
$crate::frontend::dir::DirValue::Connector(Box::new(
$crate::frontend::ast::ConnectorChoice {
- connector: $crate::frontend::dir::enums::Connector::$name,
+ connector: $crate::enums::RoutableConnectors::$name,
},
))
};
@@ -51,7 +51,7 @@ macro_rules! dirval {
(Connector = $name:ident) => {
$crate::frontend::dir::DirValue::Connector(Box::new(
$crate::frontend::ast::ConnectorChoice {
- connector: $crate::frontend::dir::enums::Connector::$name,
+ connector: $crate::enums::RoutableConnectors::$name,
sub_label: None,
},
))
@@ -60,7 +60,7 @@ macro_rules! dirval {
(Connector = ($name:ident, $sub_label:literal)) => {
$crate::frontend::dir::DirValue::Connector(Box::new(
$crate::frontend::ast::ConnectorChoice {
- connector: $crate::frontend::dir::enums::Connector::$name,
+ connector: $crate::enums::RoutableConnectors::$name,
sub_label: Some($sub_label.to_string()),
},
))
@@ -464,7 +464,7 @@ impl DirKeyKind {
.collect(),
),
Self::Connector => Some(
- enums::Connector::iter()
+ common_enums::RoutableConnectors::iter()
.map(|connector| {
DirValue::Connector(Box::new(ast::ConnectorChoice {
connector,
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index f049ad35328..0b71f916d03 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -2,9 +2,9 @@ use strum::VariantNames;
use crate::enums::collect_variants;
pub use crate::enums::{
- AuthenticationType, CaptureMethod, CardNetwork, Connector, Country, Country as BusinessCountry,
+ AuthenticationType, CaptureMethod, CardNetwork, Country, Country as BusinessCountry,
Country as BillingCountry, Currency as PaymentCurrency, MandateAcceptanceType, MandateType,
- PaymentMethod, PaymentType, SetupFutureUsage,
+ PaymentMethod, PaymentType, RoutableConnectors, SetupFutureUsage,
};
#[derive(
diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml
index 47e349847ef..8c96a7f67da 100644
--- a/crates/euclid_wasm/Cargo.toml
+++ b/crates/euclid_wasm/Cargo.toml
@@ -20,6 +20,7 @@ api_models = { version = "0.1.0", path = "../api_models", package = "api_models"
currency_conversion = { version = "0.1.0", path = "../currency_conversion" }
euclid = { path = "../euclid", features = [] }
kgraph_utils = { version = "0.1.0", path = "../kgraph_utils" }
+common_enums = { version = "0.1.0", path = "../common_enums" }
# Third party crates
getrandom = { version = "0.2.10", features = ["js"] }
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index 48d9ac0d82a..cab82f8ce41 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -7,6 +7,7 @@ use std::{
};
use api_models::{admin as admin_api, routing::ConnectorSelection};
+use common_enums::RoutableConnectors;
use currency_conversion::{
conversion::convert as convert_currency, types as currency_conversion_types,
};
@@ -17,7 +18,6 @@ use euclid::{
graph::{self, Memoization},
state_machine, truth,
},
- enums,
frontend::{
ast,
dir::{self, enums as dir_enums},
@@ -61,8 +61,8 @@ pub fn convert_forex_value(amount: i64, from_currency: JsValue, to_currency: JsV
.get()
.ok_or("Forex Data not seeded")
.err_to_js()?;
- let from_currency: enums::Currency = serde_wasm_bindgen::from_value(from_currency)?;
- let to_currency: enums::Currency = serde_wasm_bindgen::from_value(to_currency)?;
+ let from_currency: common_enums::Currency = serde_wasm_bindgen::from_value(from_currency)?;
+ let to_currency: common_enums::Currency = serde_wasm_bindgen::from_value(to_currency)?;
let converted_amount = convert_currency(forex_data, from_currency, to_currency, amount)
.map_err(|_| "conversion not possible for provided values")
.err_to_js()?;
@@ -80,7 +80,7 @@ pub fn seed_knowledge_graph(mcas: JsValue) -> JsResult {
.iter()
.map(|mca| {
Ok::<_, strum::ParseError>(ast::ConnectorChoice {
- connector: dir_enums::Connector::from_str(&mca.connector_name)?,
+ connector: RoutableConnectors::from_str(&mca.connector_name)?,
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: mca.business_sub_label.clone(),
})
@@ -183,7 +183,9 @@ pub fn run_program(program: JsValue, input: JsValue) -> JsResult {
#[wasm_bindgen(js_name = getAllConnectors)]
pub fn get_all_connectors() -> JsResult {
- Ok(serde_wasm_bindgen::to_value(enums::Connector::VARIANTS)?)
+ Ok(serde_wasm_bindgen::to_value(
+ common_enums::RoutableConnectors::VARIANTS,
+ )?)
}
#[wasm_bindgen(js_name = getAllKeys)]
diff --git a/crates/kgraph_utils/Cargo.toml b/crates/kgraph_utils/Cargo.toml
index cd0adf0bc8a..44a73dae4d7 100644
--- a/crates/kgraph_utils/Cargo.toml
+++ b/crates/kgraph_utils/Cargo.toml
@@ -11,6 +11,7 @@ connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connect
[dependencies]
api_models = { version = "0.1.0", path = "../api_models", package = "api_models" }
+common_enums = { version = "0.1.0", path = "../common_enums" }
euclid = { version = "0.1.0", path = "../euclid" }
masking = { version = "0.1.0", path = "../masking/" }
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index deea51bd880..0e224a8f3d9 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -5,10 +5,7 @@ use api_models::{
};
use euclid::{
dssa::graph::{self, DomainIdentifier},
- frontend::{
- ast,
- dir::{self, enums as dir_enums},
- },
+ frontend::{ast, dir},
types::{NumValue, NumValueRefinement},
};
@@ -277,7 +274,7 @@ fn compile_merchant_connector_graph(
builder: &mut graph::KnowledgeGraphBuilder<'_>,
mca: admin_api::MerchantConnectorResponse,
) -> Result<(), KgraphError> {
- let connector = dir_enums::Connector::from_str(&mca.connector_name)
+ let connector = common_enums::RoutableConnectors::from_str(&mca.connector_name)
.map_err(|_| KgraphError::InvalidConnectorName(mca.connector_name.clone()))?;
let mut agg_nodes: Vec<(graph::NodeId, graph::Relation)> = Vec::new();
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 8cfded8463e..db83dce487a 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -81,7 +81,7 @@ pub async fn payments_operation_core<F, Req, Op, FData, Ctx>(
req: Req,
call_connector_action: CallConnectorAction,
auth_flow: services::AuthFlow,
- eligible_connectors: Option<Vec<api_models::enums::RoutableConnectors>>,
+ eligible_connectors: Option<Vec<common_enums::RoutableConnectors>>,
header_payload: HeaderPayload,
) -> RouterResult<(
PaymentData<F>,
diff --git a/crates/router/src/core/payments/routing/transformers.rs b/crates/router/src/core/payments/routing/transformers.rs
index 5704f82f498..b273f18f3fd 100644
--- a/crates/router/src/core/payments/routing/transformers.rs
+++ b/crates/router/src/core/payments/routing/transformers.rs
@@ -1,15 +1,15 @@
-use api_models::{self, enums as api_enums, routing as routing_types};
+use api_models::{self, routing as routing_types};
use diesel_models::enums as storage_enums;
use euclid::{enums as dsl_enums, frontend::ast as dsl_ast};
-use crate::types::transformers::{ForeignFrom, ForeignInto};
+use crate::types::transformers::ForeignFrom;
impl ForeignFrom<routing_types::RoutableConnectorChoice> for dsl_ast::ConnectorChoice {
fn foreign_from(from: routing_types::RoutableConnectorChoice) -> Self {
Self {
// #[cfg(feature = "backwards_compatibility")]
// choice_kind: from.choice_kind.foreign_into(),
- connector: from.connector.foreign_into(),
+ connector: from.connector,
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: from.sub_label,
}
@@ -52,72 +52,3 @@ impl ForeignFrom<storage_enums::MandateDataType> for dsl_enums::MandateType {
}
}
}
-
-impl ForeignFrom<api_enums::RoutableConnectors> for dsl_enums::Connector {
- fn foreign_from(from: api_enums::RoutableConnectors) -> Self {
- match from {
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector1 => Self::DummyConnector1,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector2 => Self::DummyConnector2,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector3 => Self::DummyConnector3,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector4 => Self::DummyConnector4,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector5 => Self::DummyConnector5,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector6 => Self::DummyConnector6,
- #[cfg(feature = "dummy_connector")]
- api_enums::RoutableConnectors::DummyConnector7 => Self::DummyConnector7,
- api_enums::RoutableConnectors::Aci => Self::Aci,
- api_enums::RoutableConnectors::Adyen => Self::Adyen,
- api_enums::RoutableConnectors::Airwallex => Self::Airwallex,
- api_enums::RoutableConnectors::Authorizedotnet => Self::Authorizedotnet,
- api_enums::RoutableConnectors::Bambora => Self::Bambora,
- api_enums::RoutableConnectors::Bankofamerica => Self::Bankofamerica,
- api_enums::RoutableConnectors::Bitpay => Self::Bitpay,
- api_enums::RoutableConnectors::Bluesnap => Self::Bluesnap,
- api_enums::RoutableConnectors::Boku => Self::Boku,
- api_enums::RoutableConnectors::Braintree => Self::Braintree,
- api_enums::RoutableConnectors::Cashtocode => Self::Cashtocode,
- api_enums::RoutableConnectors::Checkout => Self::Checkout,
- api_enums::RoutableConnectors::Coinbase => Self::Coinbase,
- api_enums::RoutableConnectors::Cryptopay => Self::Cryptopay,
- api_enums::RoutableConnectors::Cybersource => Self::Cybersource,
- api_enums::RoutableConnectors::Dlocal => Self::Dlocal,
- api_enums::RoutableConnectors::Fiserv => Self::Fiserv,
- api_enums::RoutableConnectors::Forte => Self::Forte,
- api_enums::RoutableConnectors::Globalpay => Self::Globalpay,
- api_enums::RoutableConnectors::Globepay => Self::Globepay,
- api_enums::RoutableConnectors::Gocardless => Self::Gocardless,
- api_enums::RoutableConnectors::Helcim => Self::Helcim,
- api_enums::RoutableConnectors::Iatapay => Self::Iatapay,
- api_enums::RoutableConnectors::Klarna => Self::Klarna,
- api_enums::RoutableConnectors::Mollie => Self::Mollie,
- api_enums::RoutableConnectors::Multisafepay => Self::Multisafepay,
- api_enums::RoutableConnectors::Nexinets => Self::Nexinets,
- api_enums::RoutableConnectors::Nmi => Self::Nmi,
- api_enums::RoutableConnectors::Noon => Self::Noon,
- api_enums::RoutableConnectors::Nuvei => Self::Nuvei,
- api_enums::RoutableConnectors::Opennode => Self::Opennode,
- api_enums::RoutableConnectors::Payme => Self::Payme,
- api_enums::RoutableConnectors::Paypal => Self::Paypal,
- api_enums::RoutableConnectors::Payu => Self::Payu,
- api_enums::RoutableConnectors::Powertranz => Self::Powertranz,
- api_enums::RoutableConnectors::Prophetpay => Self::Prophetpay,
- api_enums::RoutableConnectors::Rapyd => Self::Rapyd,
- api_enums::RoutableConnectors::Shift4 => Self::Shift4,
- api_enums::RoutableConnectors::Square => Self::Square,
- api_enums::RoutableConnectors::Stax => Self::Stax,
- api_enums::RoutableConnectors::Stripe => Self::Stripe,
- api_enums::RoutableConnectors::Trustpay => Self::Trustpay,
- api_enums::RoutableConnectors::Tsys => Self::Tsys,
- api_enums::RoutableConnectors::Volt => Self::Volt,
- api_enums::RoutableConnectors::Wise => Self::Wise,
- api_enums::RoutableConnectors::Worldline => Self::Worldline,
- api_enums::RoutableConnectors::Worldpay => Self::Worldpay,
- api_enums::RoutableConnectors::Zen => Self::Zen,
- }
- }
-}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 5bd28db3c15..99096864a00 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -9,7 +9,6 @@ use common_utils::{
};
use diesel_models::enums as storage_enums;
use error_stack::{IntoReport, ResultExt};
-use euclid::enums as dsl_enums;
use masking::{ExposeInterface, PeekInterface};
use super::domain;
@@ -174,25 +173,11 @@ impl ForeignFrom<storage_enums::MandateDataType> for api_models::payments::Manda
}
}
-impl ForeignTryFrom<api_enums::Connector> for api_enums::RoutableConnectors {
+impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
type Error = error_stack::Report<common_utils::errors::ValidationError>;
fn foreign_try_from(from: api_enums::Connector) -> Result<Self, Self::Error> {
Ok(match from {
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector1 => Self::DummyConnector1,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector2 => Self::DummyConnector2,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector3 => Self::DummyConnector3,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector4 => Self::DummyConnector4,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector5 => Self::DummyConnector5,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector6 => Self::DummyConnector6,
- #[cfg(feature = "dummy_connector")]
- api_enums::Connector::DummyConnector7 => Self::DummyConnector7,
api_enums::Connector::Aci => Self::Aci,
api_enums::Connector::Adyen => Self::Adyen,
api_enums::Connector::Airwallex => Self::Airwallex,
@@ -253,76 +238,21 @@ impl ForeignTryFrom<api_enums::Connector> for api_enums::RoutableConnectors {
api_enums::Connector::Worldline => Self::Worldline,
api_enums::Connector::Worldpay => Self::Worldpay,
api_enums::Connector::Zen => Self::Zen,
- })
- }
-}
-
-impl ForeignFrom<dsl_enums::Connector> for api_enums::RoutableConnectors {
- fn foreign_from(from: dsl_enums::Connector) -> Self {
- match from {
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector1 => Self::DummyConnector1,
+ api_enums::Connector::DummyConnector1 => Self::DummyConnector1,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector2 => Self::DummyConnector2,
+ api_enums::Connector::DummyConnector2 => Self::DummyConnector2,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector3 => Self::DummyConnector3,
+ api_enums::Connector::DummyConnector3 => Self::DummyConnector3,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector4 => Self::DummyConnector4,
+ api_enums::Connector::DummyConnector4 => Self::DummyConnector4,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector5 => Self::DummyConnector5,
+ api_enums::Connector::DummyConnector5 => Self::DummyConnector5,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector6 => Self::DummyConnector6,
+ api_enums::Connector::DummyConnector6 => Self::DummyConnector6,
#[cfg(feature = "dummy_connector")]
- dsl_enums::Connector::DummyConnector7 => Self::DummyConnector7,
- dsl_enums::Connector::Aci => Self::Aci,
- dsl_enums::Connector::Adyen => Self::Adyen,
- dsl_enums::Connector::Airwallex => Self::Airwallex,
- dsl_enums::Connector::Authorizedotnet => Self::Authorizedotnet,
- dsl_enums::Connector::Bambora => Self::Bambora,
- dsl_enums::Connector::Bankofamerica => Self::Bankofamerica,
- dsl_enums::Connector::Bitpay => Self::Bitpay,
- dsl_enums::Connector::Bluesnap => Self::Bluesnap,
- dsl_enums::Connector::Boku => Self::Boku,
- dsl_enums::Connector::Braintree => Self::Braintree,
- dsl_enums::Connector::Cashtocode => Self::Cashtocode,
- dsl_enums::Connector::Checkout => Self::Checkout,
- dsl_enums::Connector::Coinbase => Self::Coinbase,
- dsl_enums::Connector::Cryptopay => Self::Cryptopay,
- dsl_enums::Connector::Cybersource => Self::Cybersource,
- dsl_enums::Connector::Dlocal => Self::Dlocal,
- dsl_enums::Connector::Fiserv => Self::Fiserv,
- dsl_enums::Connector::Forte => Self::Forte,
- dsl_enums::Connector::Globalpay => Self::Globalpay,
- dsl_enums::Connector::Globepay => Self::Globepay,
- dsl_enums::Connector::Gocardless => Self::Gocardless,
- dsl_enums::Connector::Helcim => Self::Helcim,
- dsl_enums::Connector::Iatapay => Self::Iatapay,
- dsl_enums::Connector::Klarna => Self::Klarna,
- dsl_enums::Connector::Mollie => Self::Mollie,
- dsl_enums::Connector::Multisafepay => Self::Multisafepay,
- dsl_enums::Connector::Nexinets => Self::Nexinets,
- dsl_enums::Connector::Nmi => Self::Nmi,
- dsl_enums::Connector::Noon => Self::Noon,
- dsl_enums::Connector::Nuvei => Self::Nuvei,
- dsl_enums::Connector::Opennode => Self::Opennode,
- dsl_enums::Connector::Payme => Self::Payme,
- dsl_enums::Connector::Paypal => Self::Paypal,
- dsl_enums::Connector::Payu => Self::Payu,
- dsl_enums::Connector::Powertranz => Self::Powertranz,
- dsl_enums::Connector::Prophetpay => Self::Prophetpay,
- dsl_enums::Connector::Rapyd => Self::Rapyd,
- dsl_enums::Connector::Shift4 => Self::Shift4,
- dsl_enums::Connector::Square => Self::Square,
- dsl_enums::Connector::Stax => Self::Stax,
- dsl_enums::Connector::Stripe => Self::Stripe,
- dsl_enums::Connector::Trustpay => Self::Trustpay,
- dsl_enums::Connector::Tsys => Self::Tsys,
- dsl_enums::Connector::Volt => Self::Volt,
- dsl_enums::Connector::Wise => Self::Wise,
- dsl_enums::Connector::Worldline => Self::Worldline,
- dsl_enums::Connector::Worldpay => Self::Worldpay,
- dsl_enums::Connector::Zen => Self::Zen,
- }
+ api_enums::Connector::DummyConnector7 => Self::DummyConnector7,
+ })
}
}
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 9a30fe9d757..7ed5e65151e 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -45,7 +45,7 @@ cd $SCRIPT/..
# Remove template files if already created for this connector
rm -rf $conn/$payment_gateway $conn/$payment_gateway.rs
-git checkout $conn.rs $src/types/api.rs $src/configs/settings.rs config/development.toml config/docker_compose.toml config/config.example.toml loadtest/config/development.toml crates/api_models/src/enums.rs crates/euclid/src/enums.rs crates/api_models/src/routing.rs $src/core/payments/flows.rs $src/core/admin.rs $src/core/payments/routing/transformers.rs $src/types/transformers.rs
+git checkout $conn.rs $src/types/api.rs $src/configs/settings.rs config/development.toml config/docker_compose.toml config/config.example.toml loadtest/config/development.toml crates/api_models/src/enums.rs crates/euclid/src/enums.rs crates/api_models/src/routing.rs $src/core/payments/flows.rs crates/common_enums/src/enums.rs $src/types/transformers.rs $src/core/admin.rs
# Add enum for this connector in required places
previous_connector=''
@@ -61,14 +61,12 @@ sed -r -i'' -e "s/\"$previous_connector\",/\"$previous_connector\",\n \"${pa
sed -i '' -e "s/\(pub enum Connector {\)/\1\n\t${payment_gateway_camelcase},/" crates/api_models/src/enums.rs
sed -i '' -e "s/\(pub enum Connector {\)/\1\n\t${payment_gateway_camelcase},/" crates/euclid/src/enums.rs
sed -i '' -e "s/\(match connector_name {\)/\1\n\t\tapi_enums::Connector::${payment_gateway_camelcase} => {${payment_gateway}::transformers::${payment_gateway_camelcase}AuthType::try_from(val)?;Ok(())}/" $src/core/admin.rs
-sed -i'' -e "s|$previous_connector_camelcase \(.*\)|$previous_connector_camelcase \1\n\t\t\tapi_enums::RoutableConnectors::${payment_gateway_camelcase} => Self::${payment_gateway_camelcase},|" $src/core/payments/routing/transformers.rs
-sed -i'' -e "s|dsl_enums::Connector::$previous_connector_camelcase \(.*\)|dsl_enums::Connector::$previous_connector_camelcase \1\n\t\t\tdsl_enums::Connector::${payment_gateway_camelcase} => Self::${payment_gateway_camelcase},|" $src/types/transformers.rs
-sed -i'' -e "s|api_enums::Connector::$previous_connector_camelcase \(.*\)|api_enums::Connector::$previous_connector_camelcase \1\n\t\t\tapi_enums::Connector::${payment_gateway_camelcase} => Self::${payment_gateway_camelcase},|" $src/types/transformers.rs
-sed -i'' -e "s/\(pub enum RoutableConnectors {\)/\1\n\t${payment_gateway_camelcase},/" crates/api_models/src/enums.rs
+sed -i'' -e "s/\(pub enum RoutableConnectors {\)/\1\n\t${payment_gateway_camelcase},/" crates/common_enums/src/enums.rs
+sed -i'' -e "s|$previous_connector_camelcase \(.*\)|$previous_connector_camelcase \1\n\t\t\tapi_enums::Connector::${payment_gateway_camelcase} => Self::${payment_gateway_camelcase},|" $src/types/transformers.rs
sed -i'' -e "s/^default_imp_for_\(.*\)/default_imp_for_\1\n\tconnector::${payment_gateway_camelcase},/" $src/core/payments/flows.rs
# Remove temporary files created in above step
-rm $conn.rs-e $src/types/api.rs-e $src/configs/settings.rs-e config/development.toml-e config/docker_compose.toml-e config/config.example.toml-e loadtest/config/development.toml-e crates/api_models/src/enums.rs-e crates/euclid/src/enums.rs-e crates/api_models/src/routing.rs-e $src/core/payments/flows.rs-e $src/core/admin.rs-e $src/core/payments/routing/transformers.rs-e $src/types/transformers.rs-e
+rm $conn.rs-e $src/types/api.rs-e $src/configs/settings.rs-e config/development.toml-e config/docker_compose.toml-e config/config.example.toml-e loadtest/config/development.toml-e crates/api_models/src/enums.rs-e crates/euclid/src/enums.rs-e crates/api_models/src/routing.rs-e $src/core/payments/flows.rs-e crates/common_enums/src/enums.rs-e $src/types/transformers.rs-e $src/core/admin.rs-e
cd $conn/
# Generate template files for the connector
|
fix
|
Replace euclid enum with RoutableConnectors enum (#2994)
|
0c9ba1e848c757cf3e0708f2ed4694259a5344aa
|
2024-04-30 15:14:47
|
Pa1NarK
|
refactor(cypress): read creds from env instead of hardcoding the path (#4430)
| false
|
diff --git a/cypress-tests/.gitignore b/cypress-tests/.gitignore
index 0954393e108..85a05e1a6a8 100644
--- a/cypress-tests/.gitignore
+++ b/cypress-tests/.gitignore
@@ -1,2 +1,2 @@
creds.json
-screenshots
\ No newline at end of file
+screenshots
diff --git a/cypress-tests/cypress.env.json b/cypress-tests/cypress.env.json
index 9e26dfeeb6e..0967ef424bc 100644
--- a/cypress-tests/cypress.env.json
+++ b/cypress-tests/cypress.env.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{}
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js
index 94700d1a1bb..4c16fef8df4 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js
@@ -1,5 +1,5 @@
-import merchantCreateBody from "../../fixtures/merchant-create-body.json";
import apiKeyCreateBody from "../../fixtures/create-api-key-body.json";
+import merchantCreateBody from "../../fixtures/merchant-create-body.json";
import State from "../../utils/State";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js
index 935d8d634d0..2f7e0ccaea2 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js
@@ -1,8 +1,8 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
-import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
+import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js
index 4b1f2d6e8c6..43cab5e189f 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js
@@ -1,7 +1,7 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js
index 5c0a09ec597..095ab5381d0 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js
@@ -1,9 +1,9 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
-import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
+import captureBody from "../../fixtures/capture-flow-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
+import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
-import captureBody from "../../fixtures/capture-flow-body.json";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js
index 7459a6cb83b..a3808b4db16 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js
@@ -1,8 +1,8 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
-import State from "../../utils/State";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import voidBody from "../../fixtures/void-payment-body.json";
+import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js
index 645af22313c..b0ee171ec25 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js
@@ -1,7 +1,7 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
index d3b1f467b2b..9449bf0d86f 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
@@ -1,12 +1,13 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
+import captureBody from "../../fixtures/capture-flow-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
-import captureBody from "../../fixtures/capture-flow-body.json";
-import refundBody from "../../fixtures/refund-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
+import refundBody from "../../fixtures/refund-flow-body.json";
+import listRefundCall from "../../fixtures/list-refund-call-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
@@ -89,32 +90,32 @@ describe("Card - Refund flow test", () => {
context("Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => {
it("create+confirm-payment-call-test", () => {
- console.log("confirm -> " + globalState.get("connectorId"));
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);
+ console.log("confirm -> " + globalState.get("connectorId"));
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
});
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.refundCallTest(refundBody, 6540, det, globalState);
});
-
+
});
context("Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => {
it("create+confirm-payment-call-test", () => {
- console.log("confirm -> " + globalState.get("connectorId"));
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);
+ console.log("confirm -> " + globalState.get("connectorId"));
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
});
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
@@ -131,7 +132,7 @@ describe("Card - Refund flow test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.syncRefundCallTest(det, globalState);
});
-
+
});
context("Card - Full Refund for fully captured No-3DS payment", () => {
@@ -223,7 +224,7 @@ describe("Card - Refund flow test", () => {
cy.syncRefundCallTest(det, globalState);
});
it("list-refund-call-test", () => {
- cy.listRefundCallTest(globalState);
+ cy.listRefundCallTest(listRefundCall, globalState);
});
});
@@ -276,37 +277,37 @@ describe("Card - Refund flow test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);
});
-
+
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
-
+
it("confirm-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
console.log("det -> " + det.card);
cy.confirmCallTest(confirmBody, det, true, globalState);
});
-
+
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
-
+
it("capture-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
console.log("det -> " + det.card);
cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);
});
-
+
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
-
+
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.refundCallTest(refundBody, 3000, det, globalState);
});
-
+
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.syncRefundCallTest(det, globalState);
@@ -333,10 +334,10 @@ describe("Card - Refund flow test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.refundCallTest(refundBody, 7000, det, globalState);
});
-
+
it("sync-refund-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.syncRefundCallTest(det, globalState);
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.syncRefundCallTest(det, globalState);
});
});
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js
index 8d35475f223..35f473d8a6d 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js
@@ -1,8 +1,8 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
-import refundBody from "../../fixtures/refund-flow-body.json"
+import createPaymentBody from "../../fixtures/create-payment-body.json";
+import refundBody from "../../fixtures/refund-flow-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js
index a3ad2a8f528..04e17795036 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js
@@ -1,8 +1,8 @@
import captureBody from "../../fixtures/capture-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
@@ -27,7 +27,7 @@ describe("Card - SingleUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "automatic", "new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState);
});
it("Confirm No 3DS MIT", () => {
@@ -41,7 +41,7 @@ describe("Card - SingleUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "manual", "new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState);
});
it("cit-capture-call-test", () => {
@@ -71,7 +71,7 @@ describe("Card - SingleUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody,6500, det, true, "automatic", "new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState);
});
it("cit-capture-call-test", () => {
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js
index 65939d1e44f..9990eeaadb5 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js
@@ -1,9 +1,8 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
import captureBody from "../../fixtures/capture-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
@@ -29,7 +28,7 @@ describe("Card - MultiUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic","new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState);
});
it("Confirm No 3DS MIT", () => {
@@ -46,7 +45,7 @@ describe("Card - MultiUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual","new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState);
});
it("cit-capture-call-test", () => {
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js
index 0ceb92d5ecb..fea2a94cbcc 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js
@@ -1,7 +1,6 @@
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import getConnectorDetails from "../ConnectorUtils/utils";
-import customerCreateBody from "../../fixtures/create-customer-body.json";
import State from "../../utils/State";
@@ -28,7 +27,7 @@ describe("Card - SingleUse Mandates flow test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];
console.log("det -> " + det.card);
- cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "automatic", "new_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState);
});
it("Confirm No 3DS MIT", () => {
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
index 744b730b58a..1aeb5199e73 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
@@ -1,129 +1,126 @@
-import createPaymentBody from "../../fixtures/create-payment-body.json";
+import captureBody from "../../fixtures/capture-flow-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import customerCreateBody from "../../fixtures/create-customer-body.json";
-import captureBody from "../../fixtures/capture-flow-body.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
-describe("Card - SaveCard payment flow test", () => {
+describe("Card - SaveCard payment flow test", () => {
- before("seed global state", () => {
-
- cy.task('getGlobalState').then((state) => {
- globalState = new State(state);
- console.log("seeding globalState -> " + JSON.stringify(globalState));
- })
- })
-
- after("flush global state", () => {
- console.log("flushing globalState -> "+ JSON.stringify(globalState));
- cy.task('setGlobalState', globalState.data);
+ before("seed global state", () => {
+
+ cy.task('getGlobalState').then((state) => {
+ globalState = new State(state);
+ console.log("seeding globalState -> " + JSON.stringify(globalState));
})
+ })
+
+ after("flush global state", () => {
+ console.log("flushing globalState -> " + JSON.stringify(globalState));
+ cy.task('setGlobalState', globalState.data);
+ })
+
+
+ context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => {
+ it("customer-create-call-test", () => {
+ cy.createCustomerCallTest(customerCreateBody, globalState);
+ });
+
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("retrieve-customerPM-call-test", () => {
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);
+ });
+
+ it("confirm-save-card-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.saveCardConfirmCallTest(confirmBody, det, globalState);
+ });
+
+ });
+
+ context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => {
+ it("customer-create-call-test", () => {
+ cy.createCustomerCallTest(customerCreateBody, globalState);
+ });
+
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("retrieve-customerPM-call-test", () => {
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);
+ });
+
+
+ it("confirm-save-card-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.saveCardConfirmCallTest(confirmBody, det, globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
+ });
+ });
+
+ context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => {
+ it("customer-create-call-test", () => {
+ cy.createCustomerCallTest(customerCreateBody, globalState);
+ });
+
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("retrieve-customerPM-call-test", () => {
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);
+ });
+
+
+ it("confirm-save-card-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
+ cy.saveCardConfirmCallTest(confirmBody, det, globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
+ cy.captureCallTest(captureBody, 5500, det.paymentSuccessfulStatus, globalState);
+ });
+ });
-
- context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => {
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);
- });
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "automatic", globalState);
- });
-
- it ("confirm-save-card-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(confirmBody,det,globalState);
- });
-
- });
-
- context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => {
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);
- });
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState);
- });
-
-
- it ("confirm-save-card-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(confirmBody,det,globalState);
- });
-
- it("capture-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
- });
-
-
-
- });
-
- context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => {
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);
- });
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState);
- });
-
-
- it ("confirm-save-card-payment-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(confirmBody,det,globalState);
- });
-
- it("capture-call-test", () => {
- let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
- cy.captureCallTest(captureBody, 5500, det.paymentSuccessfulStatus, globalState);
- });
- });
-
});
\ No newline at end of file
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js
index 41d6c3a7b1c..0208ca595ce 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js
@@ -1,8 +1,7 @@
-import captureBody from "../../fixtures/capture-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
-import getConnectorDetails from "../ConnectorUtils/utils";
import State from "../../utils/State";
+import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;
@@ -36,7 +35,7 @@ describe("Card - SingleUse Mandates flow test", () => {
it("Confirm No 3DS CIT", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];
- cy.citForMandatesCallTest(citConfirmBody,0, det, true, "automatic", "setup_mandate", globalState);
+ cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState);
});
it("Confirm No 3DS MIT", () => {
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
index a7526a80696..56ef464984d 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
@@ -23,7 +23,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"No3DS": {
@@ -33,7 +33,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"MandateSingleUse3DS": {
@@ -94,7 +94,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
index d868c325eaf..996122faa7e 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
@@ -23,7 +23,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"No3DS": {
@@ -33,7 +33,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"MandateSingleUse3DS": {
@@ -94,7 +94,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
@@ -109,5 +109,5 @@ export const connectorDetails = {
}
},
},
-
+
};
\ No newline at end of file
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
index fc81654ff01..c42ef5ba5a8 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
@@ -22,7 +22,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"No3DS": {
@@ -32,7 +32,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"MandateSingleUse3DS": {
@@ -93,7 +93,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
index bc27520e806..8daef2ffecf 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
@@ -22,7 +22,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"No3DS": {
@@ -32,7 +32,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"MandateSingleUse3DS": {
@@ -93,7 +93,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
index 248ba4cfcd1..e2e4d4e80f8 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
@@ -22,7 +22,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
@@ -33,7 +33,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
"MandateSingleUse3DS": {
@@ -94,7 +94,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "processing",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
index 6488d39f43c..5337c3eac69 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
@@ -21,7 +21,7 @@ export const connectorDetails = {
"currency": "USD",
"paymentSuccessfulStatus": "requires_customer_action",
"paymentSyncStatus": "processing",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
@@ -30,7 +30,7 @@ export const connectorDetails = {
"currency": "USD",
"paymentSuccessfulStatus": "processing",
"paymentSyncStatus": "processing",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session",
},
@@ -84,7 +84,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "processing",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
index bd4a73f33ac..2d8d5efa81b 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
@@ -25,7 +25,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session"
},
"No3DS": {
@@ -35,7 +35,7 @@ export const connectorDetails = {
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
- "customer_acceptance":null,
+ "customer_acceptance": null,
"setup_future_usage": "on_session"
},
"MandateSingleUse3DS": {
@@ -96,7 +96,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulTestCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
index c1c4155d102..f6d6a88ffbb 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
@@ -93,7 +93,7 @@ export const connectorDetails = {
},
"SaveCardUseNo3DS": {
"card": successfulNo3DSCardDetails,
- "currency":"USD",
+ "currency": "USD",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js
index b447f303995..c667c402c56 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js
@@ -7,8 +7,6 @@ import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";
-import globalState from "../../utils/State.js";
-
const connectorDetails = {
"adyen": adyenConnectorDetails,
"bankofamerica": bankOfAmericaConnectorDetails,
@@ -34,6 +32,6 @@ function getValueByKey(jsonObject, key) {
if (data && typeof data === 'object' && key in data) {
return data[key];
} else {
- return null;
+ return null;
}
}
\ No newline at end of file
diff --git a/cypress-tests/cypress/fixtures/capture-flow-body.json b/cypress-tests/cypress/fixtures/capture-flow-body.json
index cafda7261d4..a28e06c014a 100644
--- a/cypress-tests/cypress/fixtures/capture-flow-body.json
+++ b/cypress-tests/cypress/fixtures/capture-flow-body.json
@@ -2,4 +2,4 @@
"amount_to_capture": 100,
"statement_descriptor_name": "Joseph",
"statement_descriptor_suffix": "JS"
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.json
index 5222f4706fe..526d55e3fa8 100644
--- a/cypress-tests/cypress/fixtures/confirm-body.json
+++ b/cypress-tests/cypress/fixtures/confirm-body.json
@@ -19,10 +19,10 @@
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
- "ip_address": "127.0.0.1",
- "user_agent": "amet irure esse"
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
}
- },
+ },
"billing": {
"address": {
"state": "New York",
@@ -49,4 +49,4 @@
"java_enabled": true,
"java_script_enabled": true
}
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/create-api-key-body.json b/cypress-tests/cypress/fixtures/create-api-key-body.json
index 2f67633e171..1decb557802 100644
--- a/cypress-tests/cypress/fixtures/create-api-key-body.json
+++ b/cypress-tests/cypress/fixtures/create-api-key-body.json
@@ -2,4 +2,4 @@
"name": "API Key 1",
"description": null,
"expiration": "2069-09-23T01:02:03.000Z"
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.json
index ed52cd45616..1f3307b61f5 100644
--- a/cypress-tests/cypress/fixtures/create-confirm-body.json
+++ b/cypress-tests/cypress/fixtures/create-confirm-body.json
@@ -1,83 +1,82 @@
{
- "amount": 6540,
- "currency": "USD",
- "confirm": true,
-
- "capture_method": "automatic",
- "capture_on": "2022-09-10T10:11:12Z",
- "amount_to_capture": 6540,
- "customer_id": "john123",
- "email": "[email protected]",
- "name": "John Doe",
- "phone": "999999999",
- "phone_country_code": "+65",
- "description": "Its my first payment request",
- "authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
- "setup_future_usage": "on_session",
- "customer_acceptance": {
- "acceptance_type": "offline",
- "accepted_at": "1963-05-03T04:07:52.723Z",
- "online": {
- "ip_address": "127.0.0.1",
- "user_agent": "amet irure esse"
- }
- },
- "payment_method": "card",
- "payment_method_type": "debit",
- "payment_method_data": {
- "card": {
- "card_number": "4242424242424242",
- "card_exp_month": "01",
- "card_exp_year": "24",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "john123",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "01",
+ "card_exp_year": "24",
+ "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": "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"
- }
- },
- "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": 30,
- "screen_height": 1117,
- "screen_width": 1728,
- "time_zone": -330,
- "java_enabled": true,
- "java_script_enabled": 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"
+ }
+ },
+ "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"
}
-}
\ No newline at end of file
+ },
+ "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": 30,
+ "screen_height": 1117,
+ "screen_width": 1728,
+ "time_zone": -330,
+ "java_enabled": true,
+ "java_script_enabled": true
+ }
+}
diff --git a/cypress-tests/cypress/fixtures/create-connector-body.json b/cypress-tests/cypress/fixtures/create-connector-body.json
index 37646fbf94c..d3575c0b2cc 100644
--- a/cypress-tests/cypress/fixtures/create-connector-body.json
+++ b/cypress-tests/cypress/fixtures/create-connector-body.json
@@ -1,62 +1,62 @@
{
- "connector_type": "fiz_operations",
- "connector_name": "stripe",
- "business_country": "US",
- "business_label": "default",
- "connector_label": "first_stripe_connector",
- "connector_account_details": {
- "auth_type": "BodyKey",
- "api_key": "api-key",
- "key1": "value1"
- },
- "test_mode": true,
- "disabled": false,
- "payment_methods_enabled": [
+ "connector_type": "fiz_operations",
+ "connector_name": "stripe",
+ "business_country": "US",
+ "business_label": "default",
+ "connector_label": "first_stripe_connector",
+ "connector_account_details": {
+ "auth_type": "BodyKey",
+ "api_key": "api-key",
+ "key1": "value1"
+ },
+ "test_mode": true,
+ "disabled": false,
+ "payment_methods_enabled": [
+ {
+ "payment_method": "card",
+ "payment_method_types": [
{
- "payment_method": "card",
- "payment_method_types": [
- {
- "payment_method_type": "credit",
- "card_networks": [
- "AmericanExpress",
- "Discover",
- "Interac",
- "JCB",
- "Mastercard",
- "Visa",
- "DinersClub",
- "UnionPay",
- "RuPay"
- ],
- "minimum_amount": 0,
- "maximum_amount": 68607706,
- "recurring_enabled": false,
- "installment_payment_enabled": true
- },
- {
- "payment_method_type": "debit",
- "card_networks": [
- "AmericanExpress",
- "Discover",
- "Interac",
- "JCB",
- "Mastercard",
- "Visa",
- "DinersClub",
- "UnionPay",
- "RuPay"
- ],
- "minimum_amount": 0,
- "maximum_amount": 68607706,
- "recurring_enabled": false,
- "installment_payment_enabled": true
- }
- ]
+ "payment_method_type": "credit",
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
+ "minimum_amount": 0,
+ "maximum_amount": 68607706,
+ "recurring_enabled": false,
+ "installment_payment_enabled": true
+ },
+ {
+ "payment_method_type": "debit",
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
+ "minimum_amount": 0,
+ "maximum_amount": 68607706,
+ "recurring_enabled": false,
+ "installment_payment_enabled": true
}
- ],
- "metadata": {
- "city": "NY",
- "unit": "245",
- "endpoint_prefix": "AD"
+ ]
}
-}
\ No newline at end of file
+ ],
+ "metadata": {
+ "city": "NY",
+ "unit": "245",
+ "endpoint_prefix": "AD"
+ }
+}
diff --git a/cypress-tests/cypress/fixtures/create-customer-body.json b/cypress-tests/cypress/fixtures/create-customer-body.json
index 26c6bb9ec78..025e6bec35b 100644
--- a/cypress-tests/cypress/fixtures/create-customer-body.json
+++ b/cypress-tests/cypress/fixtures/create-customer-body.json
@@ -1,23 +1,23 @@
{
- "email": "[email protected]",
- "name": "John Doe",
- "phone": "999999999",
- "phone_country_code": "+65",
- "description": "First customer",
- "address": {
- "city": "Bangalore",
- "country": "IN",
- "line1": "Juspay router",
- "line2": "Koramangala",
- "line3": "Stallion",
- "state": "Karnataka",
- "zip": "560095",
- "first_name": "John",
- "last_name": "Doe"
- },
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
-}
\ No newline at end of file
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "First customer",
+ "address": {
+ "city": "Bangalore",
+ "country": "IN",
+ "line1": "Juspay router",
+ "line2": "Koramangala",
+ "line3": "Stallion",
+ "state": "Karnataka",
+ "zip": "560095",
+ "first_name": "John",
+ "last_name": "Doe"
+ },
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+}
diff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.json
index 1e297f5442f..e75aab9d00f 100644
--- a/cypress-tests/cypress/fixtures/create-mandate-cit.json
+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json
@@ -40,7 +40,7 @@
}
}
},
- "payment_type":"setup_mandate",
+ "payment_type": "setup_mandate",
"billing": {
"address": {
"line1": "1467",
@@ -87,4 +87,4 @@
"java_enabled": true,
"java_script_enabled": true
}
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/create-mandate-mit.json b/cypress-tests/cypress/fixtures/create-mandate-mit.json
index 779fd0b0254..9612eac3209 100644
--- a/cypress-tests/cypress/fixtures/create-mandate-mit.json
+++ b/cypress-tests/cypress/fixtures/create-mandate-mit.json
@@ -33,4 +33,4 @@
"java_enabled": true,
"java_script_enabled": true
}
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.json
index acd2160e8a8..8dd1ff9579d 100644
--- a/cypress-tests/cypress/fixtures/create-payment-body.json
+++ b/cypress-tests/cypress/fixtures/create-payment-body.json
@@ -4,7 +4,7 @@
"authentication_type": "three_ds",
"description": "Joseph First Crypto",
"email": "[email protected]",
- "setup_future_usage":"",
+ "setup_future_usage": "",
"connector_metadata": {
"noon": {
"order_category": "applepay"
@@ -17,4 +17,4 @@
},
"business_country": "US",
"business_label": "default"
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/list-refund-call-body.json b/cypress-tests/cypress/fixtures/list-refund-call-body.json
new file mode 100644
index 00000000000..9f6e3b6d9a3
--- /dev/null
+++ b/cypress-tests/cypress/fixtures/list-refund-call-body.json
@@ -0,0 +1,3 @@
+{
+ "offset": 0
+}
diff --git a/cypress-tests/cypress/fixtures/merchant-create-body.json b/cypress-tests/cypress/fixtures/merchant-create-body.json
index 00a28adbf0d..08ed0987425 100644
--- a/cypress-tests/cypress/fixtures/merchant-create-body.json
+++ b/cypress-tests/cypress/fixtures/merchant-create-body.json
@@ -41,4 +41,4 @@
"business": "default"
}
]
-}
\ No newline at end of file
+}
diff --git a/cypress-tests/cypress/fixtures/refund-flow-body.json b/cypress-tests/cypress/fixtures/refund-flow-body.json
index 4579d121a0c..f027042c5b8 100644
--- a/cypress-tests/cypress/fixtures/refund-flow-body.json
+++ b/cypress-tests/cypress/fixtures/refund-flow-body.json
@@ -1,11 +1,11 @@
{
- "payment_id": "payment_id",
- "amount": 100,
- "reason": "FRAUD",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
-}
\ No newline at end of file
+ "payment_id": "payment_id",
+ "amount": 100,
+ "reason": "FRAUD",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+}
diff --git a/cypress-tests/cypress/fixtures/save-card-confirm-body.json b/cypress-tests/cypress/fixtures/save-card-confirm-body.json
index 777e1b110bb..676e91871ff 100644
--- a/cypress-tests/cypress/fixtures/save-card-confirm-body.json
+++ b/cypress-tests/cypress/fixtures/save-card-confirm-body.json
@@ -1,6 +1,6 @@
{
- "client_secret": "{{client_secret}}",
- "payment_method": "card",
- "payment_token": "{{payment_token}}",
- "card_cvc": "card_cvc"
-}
\ No newline at end of file
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_token": "{{payment_token}}",
+ "card_cvc": "card_cvc"
+}
diff --git a/cypress-tests/cypress/fixtures/void-payment-body.json b/cypress-tests/cypress/fixtures/void-payment-body.json
index 29b5c8be3fa..471d90d6c48 100644
--- a/cypress-tests/cypress/fixtures/void-payment-body.json
+++ b/cypress-tests/cypress/fixtures/void-payment-body.json
@@ -1,3 +1,3 @@
{
- "cancellation_reason": "requested_by_customer"
-}
\ No newline at end of file
+ "cancellation_reason": "requested_by_customer"
+}
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 8a3ef5fa3ee..61ce6a0970d 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -26,12 +26,16 @@
// commands.js or your custom support file
import * as RequestBodyUtils from "../utils/RequestBodyUtils";
-import ConnectorAuthDetails from "../../../.github/secrets/creds.json";
-
+function logRequestId(xRequestId) {
+ if (xRequestId) {
+ cy.task('cli_log', "x-request-id -> " + xRequestId);
+ } else {
+ cy.task('cli_log', "x-request-id is not available in the response headers");
+ }
+}
Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState) => {
-
const randomMerchantId = RequestBodyUtils.generateRandomString();
RequestBodyUtils.setMerchantId(merchantCreateBody, randomMerchantId);
globalState.set("merchantId", randomMerchantId);
@@ -46,15 +50,9 @@ Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState)
},
body: merchantCreateBody,
}).then((response) => {
+ logRequestId(response.headers['x-request-id']);
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
// Handle the response as needed
- console.log(response.body);
globalState.set("publishableKey", response.body.publishable_key);
});
});
@@ -70,15 +68,9 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {
},
body: apiKeyCreateBody,
}).then((response) => {
+ logRequestId(response.headers['x-request-id']);
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
// Handle the response as needed
- console.log(response.body);
globalState.set("apiKey", response.body.api_key);
});
});
@@ -86,36 +78,30 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {
Cypress.Commands.add("createConnectorCallTest", (createConnectorBody, globalState) => {
const merchantId = globalState.get("merchantId");
createConnectorBody.connector_name = globalState.get("connectorId");
- const authDetails = getValueByKey(ConnectorAuthDetails, globalState.get("connectorId"));
- createConnectorBody.connector_account_details = authDetails;
- cy.request({
- method: "POST",
- url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`,
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "api-key": globalState.get("adminApiKey"),
- },
- body: createConnectorBody,
- failOnStatusCode: false
- }).then((response) => {
- // Handle the response as needed
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
-
- if (response.status === 200) {
- expect(globalState.get("connectorId")).to.equal(response.body.connector_name);
- }
- else {
- cy.task('cli_log', "response status ->> " + JSON.stringify(response.status));
- cy.task('cli_log', "res body ->> " + JSON.stringify(response.body));
- }
-
-
+ // readFile is used to read the contents of the file and it always returns a promise ([Object Object]) due to its asynchronous nature
+ // it is best to use then() to handle the response within the same block of code
+ cy.readFile(globalState.get("connectorAuthFilePath")).then((jsonContent) => {
+ const authDetails = getValueByKey(JSON.stringify(jsonContent), globalState.get("connectorId"));
+ createConnectorBody.connector_account_details = authDetails;
+ cy.request({
+ method: "POST",
+ url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`,
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "api-key": globalState.get("adminApiKey"),
+ },
+ body: createConnectorBody,
+ failOnStatusCode: false
+ }).then((response) => {
+ logRequestId(response.headers['x-request-id']);
+
+ if (response.status === 200) {
+ expect(globalState.get("connectorId")).to.equal(response.body.connector_name);
+ } else {
+ cy.task('cli_log', "response status -> " + JSON.stringify(response.status));
+ }
+ });
});
});
@@ -138,13 +124,8 @@ Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState)
},
body: customerCreateBody,
}).then((response) => {
+ logRequestId(response.headers['x-request-id']);
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
// Handle the response as needed
console.log(response);
@@ -159,7 +140,7 @@ Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_ty
request.currency = det.currency;
request.authentication_type = authentication_type;
request.capture_method = capture_method;
- request.setup_future_usage= det.setup_future_usage;
+ request.setup_future_usage = det.setup_future_usage;
request.customer_id = globalState.get("customerId");
globalState.set("paymentAmount", request.amount);
cy.request({
@@ -172,12 +153,8 @@ Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_ty
},
body: request,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("client_secret");
const clientSecret = response.body.client_secret;
@@ -203,12 +180,8 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {
"api-key": globalState.get("publishableKey"),
},
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
console.log(response);
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("redirect_url");
@@ -219,7 +192,6 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {
});
Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalState) => {
-
const paymentIntentID = globalState.get("paymentID");
confirmBody.payment_method_data.card = details.card;
confirmBody.confirm = confirm;
@@ -235,14 +207,9 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalSt
},
body: confirmBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
globalState.set("paymentID", paymentIntentID);
if (response.body.capture_method === "automatic") {
if (response.body.authentication_type === "three_ds") {
@@ -292,15 +259,10 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
},
body: createConfirmPaymentBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("status");
- console.log(response.body);
globalState.set("paymentAmount", createConfirmPaymentBody.amount);
globalState.set("paymentID", response.body.payment_id);
if (response.body.capture_method === "automatic") {
@@ -331,12 +293,12 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
});
// This is consequent saved card payment confirm call test(Using payment token)
-Cypress.Commands.add("saveCardConfirmCallTest", (confirmBody,det,globalState) => {
+Cypress.Commands.add("saveCardConfirmCallTest", (confirmBody, det, globalState) => {
const paymentIntentID = globalState.get("paymentID");
confirmBody.card_cvc = det.card.card_cvc;
confirmBody.payment_token = globalState.get("paymentToken");
confirmBody.client_secret = globalState.get("clientSecret");
- console.log("conf conn ->" + globalState.get("connectorId"));
+ console.log("configured connector ->" + globalState.get("connectorId"));
cy.request({
method: "POST",
url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`,
@@ -346,48 +308,42 @@ Cypress.Commands.add("saveCardConfirmCallTest", (confirmBody,det,globalState) =>
},
body: confirmBody,
})
- .then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
- expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
- globalState.set("paymentID", paymentIntentID);
- if (response.body.capture_method === "automatic") {
- if (response.body.authentication_type === "three_ds") {
- expect(response.body).to.have.property("next_action")
- .to.have.property("redirect_to_url");
- const nextActionUrl = response.body.next_action.redirect_to_url;
- } else if (response.body.authentication_type === "no_three_ds") {
- expect(response.body.status).to.equal(det.paymentSuccessfulStatus);
- expect(response.body.customer_id).to.equal(globalState.get("customerId"));
- } else {
- // Handle other authentication types as needed
- throw new Error(`Unsupported authentication type: ${authentication_type}`);
- }
- } else if (response.body.capture_method === "manual") {
- if (response.body.authentication_type === "three_ds") {
- expect(response.body).to.have.property("next_action")
- .to.have.property("redirect_to_url")
+ .then((response) => {
+ logRequestId(response.headers['x-request-id']);
+
+ expect(response.headers["content-type"]).to.include("application/json");
+ globalState.set("paymentID", paymentIntentID);
+ if (response.body.capture_method === "automatic") {
+ if (response.body.authentication_type === "three_ds") {
+ expect(response.body).to.have.property("next_action")
+ .to.have.property("redirect_to_url");
+ const nextActionUrl = response.body.next_action.redirect_to_url;
+ } else if (response.body.authentication_type === "no_three_ds") {
+ expect(response.body.status).to.equal(det.paymentSuccessfulStatus);
+ expect(response.body.customer_id).to.equal(globalState.get("customerId"));
+ } else {
+ // Handle other authentication types as needed
+ throw new Error(`Unsupported authentication type: ${authentication_type}`);
+ }
+ } else if (response.body.capture_method === "manual") {
+ if (response.body.authentication_type === "three_ds") {
+ expect(response.body).to.have.property("next_action")
+ .to.have.property("redirect_to_url")
+ }
+ else if (response.body.authentication_type === "no_three_ds") {
+ expect(response.body.status).to.equal("requires_capture");
+ expect(response.body.customer_id).to.equal(globalState.get("customerId"));
+ } else {
+ // Handle other authentication types as needed
+ throw new Error(`Unsupported authentication type: ${authentication_type}`);
+ }
}
- else if (response.body.authentication_type === "no_three_ds") {
- expect(response.body.status).to.equal("requires_capture");
- expect(response.body.customer_id).to.equal(globalState.get("customerId"));
- } else {
- // Handle other authentication types as needed
- throw new Error(`Unsupported authentication type: ${authentication_type}`);
+ else {
+ throw new Error(`Unsupported capture method: ${capture_method}`);
}
- }
- else {
- throw new Error(`Unsupported capture method: ${capture_method}`);
- }
- });
+ });
});
-
Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, paymentSuccessfulStatus, globalState) => {
const payment_id = globalState.get("paymentID");
requestBody.amount_to_capture = amount_to_capture;
@@ -401,27 +357,22 @@ Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, payment
},
body: requestBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body.payment_id).to.equal(payment_id);
- console.log(response.body);
if (amount_to_capture == amount && response.body.status == "succeeded") {
expect(response.body.amount).to.equal(amount_to_capture);
expect(response.body.amount_capturable).to.equal(0);
expect(response.body.amount_received).to.equal(amount);
expect(response.body.status).to.equal(paymentSuccessfulStatus);
- }else if (response.body.status=="processing") {
+ } else if (response.body.status == "processing") {
expect(response.body.amount).to.equal(amount);
expect(response.body.amount_capturable).to.equal(amount);
expect(response.body.amount_received).to.equal(0);
expect(response.body.status).to.equal(paymentSuccessfulStatus);
}
- else {
+ else {
expect(response.body.amount).to.equal(amount);
expect(response.body.amount_capturable).to.equal(0);
expect(response.body.amount_received).to.equal(amount_to_capture);
@@ -441,24 +392,19 @@ Cypress.Commands.add("voidCallTest", (requestBody, globalState) => {
},
body: requestBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body.payment_id).to.equal(payment_id);
expect(response.body.amount).to.equal(globalState.get("paymentAmount"));
// expect(response.body.amount_capturable).to.equal(0);
expect(response.body.amount_received).to.be.oneOf([0, null]);
expect(response.body.status).to.equal("cancelled");
- console.log(response.body);
});
});
Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {
- console.log("syncpaymentID------>" + globalState.get("paymentID"));
+ console.log("syncpaymentID ->" + globalState.get("paymentID"));
const payment_id = globalState.get("paymentID");
cy.request({
method: "GET",
@@ -468,14 +414,9 @@ Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {
"api-key": globalState.get("apiKey"),
},
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
expect(response.body.payment_id).to.equal(payment_id);
expect(response.body.amount).to.equal(globalState.get("paymentAmount"));
globalState.set("paymentID", response.body.payment_id);
@@ -496,14 +437,9 @@ Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalS
},
body: requestBody
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
globalState.set("refundId", response.body.refund_id);
expect(response.body.status).to.equal(det.refundStatus);
expect(response.body.amount).to.equal(refund_amount);
@@ -521,22 +457,16 @@ Cypress.Commands.add("syncRefundCallTest", (det, globalState) => {
"api-key": globalState.get("apiKey"),
},
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
expect(response.body.status).to.equal(det.refundSyncStatus);
});
});
-Cypress.Commands.add("citForMandatesCallTest", (requestBody,amount, details, confirm, capture_method, payment_type, globalState) => {
-
+Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, confirm, capture_method, payment_type, globalState) => {
requestBody.payment_method_data.card = details.card;
- requestBody.payment_type=payment_type;
+ requestBody.payment_type = payment_type;
requestBody.confirm = confirm;
requestBody.amount = amount;
requestBody.currency = details.currency;
@@ -553,15 +483,10 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody,amount, details, con
},
body: requestBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("mandate_id");
- console.log(response.body);
globalState.set("mandateId", response.body.mandate_id);
globalState.set("paymentID", response.body.payment_id);
@@ -610,15 +535,10 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
},
body: requestBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
globalState.set("paymentID", response.body.payment_id);
- console.log(response.body);
console.log("mit statusss-> " + response.body.status);
if (response.body.capture_method === "automatic") {
if (response.body.authentication_type === "three_ds") {
@@ -662,14 +582,10 @@ Cypress.Commands.add("listMandateCallTest", (globalState) => {
"api-key": globalState.get("apiKey"),
},
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
+
let i = 0;
for (i in response.body) {
if (response.body[i].mandate_id === globalState.get("mandateId")) {
@@ -690,14 +606,9 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {
},
failOnStatusCode: false
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
if (response.body.status === 200) {
expect(response.body.status).to.equal("revoked");
} else if (response.body.status === 400) {
@@ -706,8 +617,8 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {
});
});
-
Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => {
+ let connectorId = globalState.get("connectorId");
let expected_url = new URL(expected_redirection);
let redirection_url = new URL(globalState.get("nextActionUrl"));
cy.visit(redirection_url.href);
@@ -719,30 +630,30 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>
cy.get('input[type="password"]').type("password");
cy.get('#buttonSubmit').click();
})
- }
- else if (globalState.get("connectorId") === "cybersource" || globalState.get("connectorId") === "bankofamerica" ) {
+ }
+ else if (globalState.get("connectorId") === "cybersource" || globalState.get("connectorId") === "bankofamerica") {
cy.get('iframe')
.its('0.contentDocument.body')
.within((body) => {
cy.get('input[type="text"]').click().type("1234");
cy.get('input[value="SUBMIT"]').click();
- })
+ })
}
else if (globalState.get("connectorId") === "nmi" || globalState.get("connectorId") === "noon") {
- cy.get('iframe',{ timeout: 100000 })
+ cy.get('iframe', { timeout: 100000 })
.its('0.contentDocument.body')
.within((body) => {
- cy.get('iframe',{ timeout: 10000 })
+ cy.get('iframe', { timeout: 10000 })
.its('0.contentDocument.body')
.within((body) => {
- cy.get('form[name="cardholderInput"]',{ timeout: 10000 }).should('exist').then(form => {
- cy.get('input[name="challengeDataEntry"]').click().type("1234");
- cy.get('input[value="SUBMIT"]').click();
+ cy.get('form[name="cardholderInput"]', { timeout: 10000 }).should('exist').then(form => {
+ cy.get('input[name="challengeDataEntry"]').click().type("1234");
+ cy.get('input[value="SUBMIT"]').click();
+ })
})
})
- })
}
- else if (globalState.get("connectorId") === "stripe" ) {
+ else if (globalState.get("connectorId") === "stripe") {
cy.get('iframe')
.its('0.contentDocument.body')
.within((body) => {
@@ -752,35 +663,35 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>
cy.get('#test-source-authorize-3ds').click();
})
})
- }
- else if (globalState.get("connectorId") === "trustpay" ) {
- cy.get('form[name="challengeForm"]',{ timeout: 10000 }).should('exist').then(form => {
- cy.get('#outcomeSelect').select('Approve').should('have.value', 'Y')
- cy.get('button[type="submit"]').click();
- })
+ }
+ else if (globalState.get("connectorId") === "trustpay") {
+ cy.get('form[name="challengeForm"]', { timeout: 10000 }).should('exist').then(form => {
+ cy.get('#outcomeSelect').select('Approve').should('have.value', 'Y')
+ cy.get('button[type="submit"]').click();
+ })
}
-
+
else {
- // If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 30 seconds
- cy.wait(30000);
+ // If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 10 seconds
+ cy.wait(10000);
}
-
+
// Handling redirection
if (redirection_url.host.endsWith(expected_url.host)) {
// No CORS workaround needed
cy.window().its('location.origin').should('eq', expected_url.origin);
} else {
// Workaround for CORS to allow cross-origin iframe
- cy.origin(expected_url.origin, { args: { expected_url: expected_url.origin} }, ({expected_url}) => {
+ cy.origin(expected_url.origin, { args: { expected_url: expected_url.origin } }, ({ expected_url }) => {
cy.window().its('location.origin').should('eq', expected_url);
})
}
-
+
});
Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {
- console.log("customerID------>" + globalState.get("customerId"));
+ console.log("customerID ->" + globalState.get("customerId"));
const customerId = globalState.get("customerId");
cy.request({
method: "GET",
@@ -790,26 +701,21 @@ Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {
"api-key": globalState.get("apiKey"),
},
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
if (response.body.customer_payment_methods[0]?.payment_token) {
const paymentToken = response.body.customer_payment_methods[0].payment_token;
globalState.set("paymentToken", paymentToken); // Set paymentToken in globalState
expect(paymentToken).to.equal(globalState.get("paymentToken")); // Verify paymentToken
- }
+ }
else {
throw new Error(`Payment token not found`);
- }
+ }
});
});
-Cypress.Commands.add("listRefundCallTest", (globalState) => {
+Cypress.Commands.add("listRefundCallTest", (requestBody, globalState) => {
cy.request({
method: "POST",
url: `${globalState.get("baseUrl")}/refunds/list`,
@@ -817,17 +723,11 @@ Cypress.Commands.add("listRefundCallTest", (globalState) => {
"Content-Type": "application/json",
"api-key": globalState.get("apiKey"),
},
- body:{"offset":0}
+ body: requestBody,
}).then((response) => {
- const xRequestId = response.headers['x-request-id'];
- if (xRequestId) {
- cy.task('cli_log', "x-request-id ->> " + xRequestId);
- } else {
- cy.task('cli_log', "x-request-id is not available in the response headers");
- }
+ logRequestId(response.headers['x-request-id']);
+
expect(response.headers["content-type"]).to.include("application/json");
- console.log(response.body);
expect(response.body.data).to.be.an('array').and.not.empty;
-
- });
- });
\ No newline at end of file
+ });
+});
diff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.js
index 0e7290a13d9..9b1ef71ce0f 100644
--- a/cypress-tests/cypress/support/e2e.js
+++ b/cypress-tests/cypress/support/e2e.js
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import './commands'
+import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
\ No newline at end of file
diff --git a/cypress-tests/cypress/utils/State.js b/cypress-tests/cypress/utils/State.js
index 342c220a416..dae4963000f 100644
--- a/cypress-tests/cypress/utils/State.js
+++ b/cypress-tests/cypress/utils/State.js
@@ -5,6 +5,7 @@ class State {
this.data["connectorId"] = Cypress.env("CONNECTOR");
this.data["baseUrl"] = Cypress.env("BASEURL");
this.data["adminApiKey"] = Cypress.env("ADMINAPIKEY");
+ this.data["connectorAuthFilePath"] = Cypress.env("CONNECTOR_AUTH_FILE_PATH");
}
set(key, val) {
diff --git a/cypress-tests/package.json b/cypress-tests/package.json
index 62eab5e3803..fff8cd8b3f1 100644
--- a/cypress-tests/package.json
+++ b/cypress-tests/package.json
@@ -4,9 +4,9 @@
"description": "",
"main": "index.js",
"scripts": {
- "cypress":"npx cypress open",
+ "cypress": "npx cypress open",
"cypress-e2e": "npx cypress run --e2e",
- "cypress:ci":"npx cypress run --headless"
+ "cypress:ci": "npx cypress run --headless"
},
"author": "",
"license": "ISC"
diff --git a/cypress-tests/yarn.lock b/cypress-tests/yarn.lock
deleted file mode 100644
index fb57ccd13af..00000000000
--- a/cypress-tests/yarn.lock
+++ /dev/null
@@ -1,4 +0,0 @@
-# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
-# yarn lockfile v1
-
-
|
refactor
|
read creds from env instead of hardcoding the path (#4430)
|
c52dbd6fc21c9c16ebc8f2abed1d2979bc5a606b
|
2024-03-15 18:57:52
|
DEEPANSHU BANSAL
|
feat(connector): [BOA/CYB] Add support for payment status ACCEPTED and CANCELLED (#4107)
| false
|
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index 8e30e2b0475..b9a14321025 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -896,6 +896,8 @@ pub enum BankofamericaPaymentStatus {
ServerError,
PendingAuthentication,
PendingReview,
+ Accepted,
+ Cancelled,
//PartialAuthorized, not being consumed yet.
}
@@ -921,9 +923,9 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => {
Self::Charged
}
- BankofamericaPaymentStatus::Voided | BankofamericaPaymentStatus::Reversed => {
- Self::Voided
- }
+ BankofamericaPaymentStatus::Voided
+ | BankofamericaPaymentStatus::Reversed
+ | BankofamericaPaymentStatus::Cancelled => Self::Voided,
BankofamericaPaymentStatus::Failed
| BankofamericaPaymentStatus::Declined
| BankofamericaPaymentStatus::AuthorizedRiskDeclined
@@ -931,9 +933,9 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
| BankofamericaPaymentStatus::Rejected
| BankofamericaPaymentStatus::ServerError => Self::Failure,
BankofamericaPaymentStatus::PendingAuthentication => Self::AuthenticationPending,
- BankofamericaPaymentStatus::PendingReview | BankofamericaPaymentStatus::Challenge => {
- Self::Pending
- }
+ BankofamericaPaymentStatus::PendingReview
+ | BankofamericaPaymentStatus::Challenge
+ | BankofamericaPaymentStatus::Accepted => Self::Pending,
}
}
}
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index fb80c0a1c48..d9fab9a9025 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -1397,6 +1397,8 @@ pub enum CybersourcePaymentStatus {
ServerError,
PendingAuthentication,
PendingReview,
+ Accepted,
+ Cancelled,
//PartialAuthorized, not being consumed yet.
}
@@ -1430,7 +1432,9 @@ impl ForeignFrom<(CybersourcePaymentStatus, bool)> for enums::AttemptStatus {
CybersourcePaymentStatus::Succeeded | CybersourcePaymentStatus::Transmitted => {
Self::Charged
}
- CybersourcePaymentStatus::Voided | CybersourcePaymentStatus::Reversed => Self::Voided,
+ CybersourcePaymentStatus::Voided
+ | CybersourcePaymentStatus::Reversed
+ | CybersourcePaymentStatus::Cancelled => Self::Voided,
CybersourcePaymentStatus::Failed
| CybersourcePaymentStatus::Declined
| CybersourcePaymentStatus::AuthorizedRiskDeclined
@@ -1438,9 +1442,9 @@ impl ForeignFrom<(CybersourcePaymentStatus, bool)> for enums::AttemptStatus {
| CybersourcePaymentStatus::InvalidRequest
| CybersourcePaymentStatus::ServerError => Self::Failure,
CybersourcePaymentStatus::PendingAuthentication => Self::AuthenticationPending,
- CybersourcePaymentStatus::PendingReview | CybersourcePaymentStatus::Challenge => {
- Self::Pending
- }
+ CybersourcePaymentStatus::PendingReview
+ | CybersourcePaymentStatus::Challenge
+ | CybersourcePaymentStatus::Accepted => Self::Pending,
}
}
}
|
feat
|
[BOA/CYB] Add support for payment status ACCEPTED and CANCELLED (#4107)
|
783fa0b0dff1e157920d683a75fc579942cd9c06
|
2024-02-16 18:12:25
|
Sampras Lopes
|
fix(logging): fix missing fields in consolidated log line (#3684)
| false
|
diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs
index f1a3275ab21..2cab332a677 100644
--- a/crates/router/src/middleware.rs
+++ b/crates/router/src/middleware.rs
@@ -143,7 +143,7 @@ where
Box::pin(
async move {
let response = response_fut.await;
- logger::info!(golden_log_line = true);
+ router_env::tracing::Span::current().record("golden_log_line", true);
response
}
.instrument(
@@ -153,7 +153,8 @@ where
merchant_id = Empty,
connector_name = Empty,
payment_method = Empty,
- flow = "UNKNOWN"
+ flow = "UNKNOWN",
+ golden_log_line = Empty
)
.or_current(),
),
diff --git a/crates/router_env/src/logger/config.rs b/crates/router_env/src/logger/config.rs
index 664c0d508f5..09d285a8628 100644
--- a/crates/router_env/src/logger/config.rs
+++ b/crates/router_env/src/logger/config.rs
@@ -107,13 +107,15 @@ pub struct LogTelemetry {
/// Telemetry / tracing.
#[derive(Default, Debug, Deserialize, Clone, PartialEq, Eq)]
-#[serde(rename_all = "lowercase")]
+#[serde(rename_all = "snake_case")]
pub enum LogFormat {
/// Default pretty log format
Default,
/// JSON based structured logging
#[default]
Json,
+ /// JSON based structured logging with pretty print
+ PrettyJson,
}
impl Config {
diff --git a/crates/router_env/src/logger/formatter.rs b/crates/router_env/src/logger/formatter.rs
index 4fd94c22163..472b917e746 100644
--- a/crates/router_env/src/logger/formatter.rs
+++ b/crates/router_env/src/logger/formatter.rs
@@ -10,7 +10,7 @@ use std::{
use once_cell::sync::Lazy;
use serde::ser::{SerializeMap, Serializer};
-use serde_json::Value;
+use serde_json::{ser::Formatter, Value};
// use time::format_description::well_known::Rfc3339;
use time::format_description::well_known::Iso8601;
use tracing::{Event, Metadata, Subscriber};
@@ -121,9 +121,10 @@ impl fmt::Display for RecordType {
/// `FormattingLayer` relies on the `tracing_bunyan_formatter::JsonStorageLayer` which is storage of entries.
///
#[derive(Debug)]
-pub struct FormattingLayer<W>
+pub struct FormattingLayer<W, F>
where
W: for<'a> MakeWriter<'a> + 'static,
+ F: Formatter + Clone,
{
dst_writer: W,
pid: u32,
@@ -135,11 +136,13 @@ where
#[cfg(feature = "vergen")]
build: String,
default_fields: HashMap<String, Value>,
+ formatter: F,
}
-impl<W> FormattingLayer<W>
+impl<W, F> FormattingLayer<W, F>
where
W: for<'a> MakeWriter<'a> + 'static,
+ F: Formatter + Clone,
{
///
/// Constructor of `FormattingLayer`.
@@ -149,11 +152,11 @@ where
///
/// ## Example
/// ```rust
- /// let formatting_layer = router_env::FormattingLayer::new(router_env::service_name!(),std::io::stdout);
+ /// let formatting_layer = router_env::FormattingLayer::new(router_env::service_name!(),std::io::stdout, CompactFormatter);
/// ```
///
- pub fn new(service: &str, dst_writer: W) -> Self {
- Self::new_with_implicit_entries(service, dst_writer, HashMap::new())
+ pub fn new(service: &str, dst_writer: W, formatter: F) -> Self {
+ Self::new_with_implicit_entries(service, dst_writer, HashMap::new(), formatter)
}
/// Construct of `FormattingLayer with implicit default entries.
@@ -161,6 +164,7 @@ where
service: &str,
dst_writer: W,
default_fields: HashMap<String, Value>,
+ formatter: F,
) -> Self {
let pid = std::process::id();
let hostname = gethostname::gethostname().to_string_lossy().into_owned();
@@ -182,6 +186,7 @@ where
#[cfg(feature = "vergen")]
build,
default_fields,
+ formatter,
}
}
@@ -287,7 +292,6 @@ where
}
/// Serialize entries of span.
- #[cfg(feature = "log_active_span_json")]
fn span_serialize<S>(
&self,
span: &SpanRef<'_, S>,
@@ -297,7 +301,8 @@ where
S: Subscriber + for<'a> LookupSpan<'a>,
{
let mut buffer = Vec::new();
- let mut serializer = serde_json::Serializer::new(&mut buffer);
+ let mut serializer =
+ serde_json::Serializer::with_formatter(&mut buffer, self.formatter.clone());
let mut map_serializer = serializer.serialize_map(None)?;
let message = Self::span_message(span, ty);
@@ -324,7 +329,8 @@ where
S: Subscriber + for<'a> LookupSpan<'a>,
{
let mut buffer = Vec::new();
- let mut serializer = serde_json::Serializer::new(&mut buffer);
+ let mut serializer =
+ serde_json::Serializer::with_formatter(&mut buffer, self.formatter.clone());
let mut map_serializer = serializer.serialize_map(None)?;
let mut storage = Storage::default();
@@ -398,10 +404,11 @@ where
}
#[allow(clippy::expect_used)]
-impl<S, W> Layer<S> for FormattingLayer<W>
+impl<S, W, F> Layer<S> for FormattingLayer<W, F>
where
S: Subscriber + for<'a> LookupSpan<'a>,
W: for<'a> MakeWriter<'a> + 'static,
+ F: Formatter + Clone + 'static,
{
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
// Event could have no span.
@@ -421,6 +428,16 @@ where
}
}
+ #[cfg(not(feature = "log_active_span_json"))]
+ fn on_close(&self, id: tracing::Id, ctx: Context<'_, S>) {
+ let span = ctx.span(&id).expect("No span");
+ if span.parent().is_none() {
+ if let Ok(serialized) = self.span_serialize(&span, RecordType::ExitSpan) {
+ let _ = self.flush(serialized);
+ }
+ }
+ }
+
#[cfg(feature = "log_active_span_json")]
fn on_close(&self, id: tracing::Id, ctx: Context<'_, S>) {
let span = ctx.span(&id).expect("No span");
diff --git a/crates/router_env/src/logger/setup.rs b/crates/router_env/src/logger/setup.rs
index 992de3e747e..af77991e804 100644
--- a/crates/router_env/src/logger/setup.rs
+++ b/crates/router_env/src/logger/setup.rs
@@ -16,6 +16,7 @@ use opentelemetry::{
KeyValue,
};
use opentelemetry_otlp::{TonicExporterBuilder, WithExportConfig};
+use serde_json::ser::{CompactFormatter, PrettyFormatter};
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, EnvFilter, Layer};
@@ -69,7 +70,10 @@ pub fn setup(
);
println!("Using file logging filter: {file_filter}");
- Some(FormattingLayer::new(service_name, file_writer).with_filter(file_filter))
+ Some(
+ FormattingLayer::new(service_name, file_writer, CompactFormatter)
+ .with_filter(file_filter),
+ )
} else {
None
};
@@ -104,7 +108,15 @@ pub fn setup(
config::LogFormat::Json => {
error_stack::Report::set_color_mode(error_stack::fmt::ColorMode::None);
let logging_layer =
- FormattingLayer::new(service_name, console_writer).with_filter(console_filter);
+ FormattingLayer::new(service_name, console_writer, CompactFormatter)
+ .with_filter(console_filter);
+ subscriber.with(logging_layer).init();
+ }
+ config::LogFormat::PrettyJson => {
+ error_stack::Report::set_color_mode(error_stack::fmt::ColorMode::None);
+ let logging_layer =
+ FormattingLayer::new(service_name, console_writer, PrettyFormatter::new())
+ .with_filter(console_filter);
subscriber.with(logging_layer).init();
}
}
|
fix
|
fix missing fields in consolidated log line (#3684)
|
9e285720efba2f05485c62b837f778e74f897ce1
|
2024-08-28 13:01:59
|
Amisha Prabhat
|
fix(core): fix merchant connector account create for v2 (#5716)
| false
|
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index ea36f3e24f4..084ac8eacc7 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -4179,16 +4179,19 @@ impl BusinessProfileWrapper {
pub fn get_default_fallback_list_of_connector_under_profile(
&self,
) -> RouterResult<Vec<routing_types::RoutableConnectorChoice>> {
- use masking::ExposeOptionInterface;
- self.profile
- .default_fallback_routing
- .clone()
- .expose_option()
- .parse_value::<Vec<routing_types::RoutableConnectorChoice>>(
- "Vec<RoutableConnectorChoice>",
- )
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Merchant default config has invalid structure")
+ let fallback_connectors =
+ if let Some(default_fallback_routing) = self.profile.default_fallback_routing.clone() {
+ default_fallback_routing
+ .expose()
+ .parse_value::<Vec<routing_types::RoutableConnectorChoice>>(
+ "Vec<RoutableConnectorChoice>",
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Business Profile default config has invalid structure")?
+ } else {
+ Vec::new()
+ };
+ Ok(fallback_connectors)
}
pub fn get_default_routing_configs_from_profile(
&self,
|
fix
|
fix merchant connector account create for v2 (#5716)
|
3655c8de82dd25c08a13b6b88277a70ae184ce26
|
2022-12-13 19:23:19
|
kos-for-juspay
|
fix(router_derive): Use `#[automatically_derived]` for all derivations (#133)
| false
|
diff --git a/crates/router_derive/src/lib.rs b/crates/router_derive/src/lib.rs
index 7bb020f3c13..cba0ef30129 100644
--- a/crates/router_derive/src/lib.rs
+++ b/crates/router_derive/src/lib.rs
@@ -176,6 +176,7 @@ pub fn setter(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}
});
let output = quote::quote! {
+ #[automatically_derived]
impl #ident {
#(#build_methods)*
}
diff --git a/crates/router_derive/src/macros.rs b/crates/router_derive/src/macros.rs
index 8ef88d13c65..db3eb7fc9d8 100644
--- a/crates/router_derive/src/macros.rs
+++ b/crates/router_derive/src/macros.rs
@@ -18,6 +18,7 @@ pub(crate) fn debug_as_display_inner(ast: &DeriveInput) -> syn::Result<TokenStre
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
Ok(quote! {
+ #[automatically_derived]
impl #impl_generics ::core::fmt::Display for #name #ty_generics #where_clause {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::result::Result<(), ::core::fmt::Error> {
f.write_str(&format!("{:?}", self))
diff --git a/crates/router_derive/src/macros/api_error.rs b/crates/router_derive/src/macros/api_error.rs
index cdf14bbfdcc..56d59317cf4 100644
--- a/crates/router_derive/src/macros/api_error.rs
+++ b/crates/router_derive/src/macros/api_error.rs
@@ -47,8 +47,10 @@ pub(crate) fn api_error_derive_inner(ast: &DeriveInput) -> syn::Result<TokenStre
);
Ok(quote! {
+ #[automatically_derived]
impl #impl_generics std::error::Error for #name #ty_generics #where_clause {}
+ #[automatically_derived]
impl #impl_generics #name #ty_generics #where_clause {
#error_type_fn
#error_code_fn
@@ -226,6 +228,7 @@ fn implement_serialize(
});
}
quote! {
+ #[automatically_derived]
impl #impl_generics serde::Serialize for #enum_name #ty_generics #where_clause {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
diff --git a/crates/router_derive/src/macros/diesel.rs b/crates/router_derive/src/macros/diesel.rs
index 932d45b7f4d..b49b9ccc33c 100644
--- a/crates/router_derive/src/macros/diesel.rs
+++ b/crates/router_derive/src/macros/diesel.rs
@@ -20,6 +20,7 @@ pub(crate) fn diesel_enum_derive_inner(ast: &DeriveInput) -> syn::Result<TokenSt
#[diesel(postgres_type(name = #type_name))]
pub struct #struct_name;
+ #[automatically_derived]
impl #impl_generics ::diesel::serialize::ToSql<#struct_name, ::diesel::pg::Pg> for #name #ty_generics
#where_clause
{
@@ -31,6 +32,7 @@ pub(crate) fn diesel_enum_derive_inner(ast: &DeriveInput) -> syn::Result<TokenSt
}
}
+ #[automatically_derived]
impl #impl_generics ::diesel::deserialize::FromSql<#struct_name, ::diesel::pg::Pg> for #name #ty_generics
#where_clause
{
diff --git a/crates/router_derive/src/macros/operation.rs b/crates/router_derive/src/macros/operation.rs
index e234635aabc..798ee1525d2 100644
--- a/crates/router_derive/src/macros/operation.rs
+++ b/crates/router_derive/src/macros/operation.rs
@@ -50,6 +50,7 @@ impl Derives {
) -> TokenStream {
let req_type = Conversion::get_req_type(self);
quote! {
+ #[automatically_derived]
impl<F:Send+Clone> Operation<F,#req_type> for #struct_name {
#(#fns)*
}
@@ -63,6 +64,7 @@ impl Derives {
) -> TokenStream {
let req_type = Conversion::get_req_type(self);
quote! {
+ #[automatically_derived]
impl<F:Send+Clone> Operation<F,#req_type> for &#struct_name {
#(#ref_fns)*
}
|
fix
|
Use `#[automatically_derived]` for all derivations (#133)
|
bd19dad6165e86b23295a3a7e13a69743e5bd508
|
2022-12-15 20:24:10
|
Sampras Lopes
|
feat(router): add configuration support for actix workers (#156)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index b58e0763563..e9205501b5f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2734,6 +2734,7 @@ dependencies = [
"mimalloc",
"mime",
"nanoid",
+ "num_cpus",
"once_cell",
"rand",
"redis_interface",
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index a5b7c435d0b..32a45dde16a 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -48,7 +48,7 @@ locker_decryption_key2 = ""
host = "redis-queue"
port = 6379
cluster_enabled = true
-cluster_urls = ["bach-redis-queue-1:6379", "bach-redis-queue-2:6379", "bach-redis-queue-3:6379"]
+cluster_urls = ["redis-queue:6379"]
[connectors.aci]
base_url = "https://eu-test.oppwa.com/"
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 70ae5edc672..e2b27ca5e32 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -48,6 +48,7 @@ maud = { version = "0.24", features = ["actix-web"] }
mimalloc = { version = "0.1", optional = true }
mime = "0.3.16"
nanoid = "0.4.0"
+num_cpus = "1.14.0"
once_cell = "1.16.0"
rand = "0.8.5"
reqwest = { version = "0.11.12", features = ["json", "native-tls"] }
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 8a34bcdb130..55568caf25c 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -84,6 +84,7 @@ pub struct Proxy {
#[derive(Debug, Deserialize, Clone)]
pub struct Server {
pub port: u16,
+ pub workers: Option<usize>,
pub host: String,
pub request_body_limit: usize,
pub base_url: String,
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 6e87de86e27..21d3535fd68 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -133,6 +133,7 @@ pub async fn start_server(conf: Settings) -> BachResult<(Server, AppState)> {
let request_body_limit = server.request_body_limit;
let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit))
.bind((server.host.as_str(), server.port))?
+ .workers(server.workers.unwrap_or_else(num_cpus::get_physical))
.run();
Ok((server, app_state))
diff --git a/docker-compose.yml b/docker-compose.yml
index 085958c2111..89c4ab0422d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -25,7 +25,7 @@ services:
loki:
image: grafana/loki:latest
ports:
- - "3100:3100"
+ - "3100"
command: -config.file=/etc/loki/loki.yaml
networks:
- router_net
@@ -66,7 +66,7 @@ services:
pg:
image: postgres:14.5
ports:
- - "5432:5432"
+ - "5432"
networks:
- router_net
volumes:
|
feat
|
add configuration support for actix workers (#156)
|
c2aa0142ed5af0b5fcf21b35cb129addd92c6125
|
2023-08-29 20:10:04
|
Hrithikesh
|
feat(core): conditionally return captures list during payment sync. (#2033)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 1da8f9e3294..bc8cb0f4323 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2198,6 +2198,8 @@ pub struct PaymentsRetrieveRequest {
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
pub client_secret: Option<String>,
+ /// If enabled provides list of captures linked to latest attempt
+ pub expand_captures: Option<bool>,
/// If enabled provides list of attempts linked to payment intent
pub expand_attempts: Option<bool>,
}
@@ -2597,6 +2599,8 @@ pub struct PaymentRetrieveBody {
pub force_sync: Option<bool>,
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
pub client_secret: Option<String>,
+ /// If enabled provides list of captures linked to latest attempt
+ pub expand_captures: Option<bool>,
/// If enabled provides list of attempts linked to payment intent
pub expand_attempts: Option<bool>,
}
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index 21327174645..0efb44d9d71 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -81,6 +81,7 @@ pub async fn payment_intents_retrieve(
merchant_connector_details: None,
client_secret: query_payload.client_secret.clone(),
expand_attempts: None,
+ expand_captures: None,
};
let (auth_type, auth_flow) =
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 119f67148a6..a5d24c15810 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -85,6 +85,7 @@ pub async fn setup_intents_retrieve(
merchant_connector_details: None,
client_secret: query_payload.client_secret.clone(),
expand_attempts: None,
+ expand_captures: None,
};
let (auth_type, auth_flow) =
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f047715d817..e7784661d61 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -504,6 +504,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
}),
client_secret: None,
expand_attempts: None,
+ expand_captures: None,
};
payments_core::<api::PSync, api::PaymentsResponse, _, _, _>(
state,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 052afd0922f..6f9f4f470ed 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -274,7 +274,10 @@ async fn get_tracker_for_sync<
.attach_printable_lazy(|| {
format!("Error while retrieving capture list for, merchant_id: {}, payment_id: {payment_id_str}", merchant_account.merchant_id)
})?;
- Some(types::MultipleCaptureData::new_for_sync(captures)?)
+ Some(types::MultipleCaptureData::new_for_sync(
+ captures,
+ request.expand_captures,
+ )?)
} else {
None
};
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index fc77268e0a6..3a26b8ee656 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -203,6 +203,21 @@ where
connector_request_reference_id_config: &ConnectorRequestReferenceIdConfig,
connector_http_status_code: Option<u16>,
) -> RouterResponse<Self> {
+ let captures = payment_data
+ .multiple_capture_data
+ .and_then(|multiple_capture_data| {
+ multiple_capture_data
+ .expand_captures
+ .and_then(|should_expand| {
+ should_expand.then_some(
+ multiple_capture_data
+ .get_all_captures()
+ .into_iter()
+ .cloned()
+ .collect(),
+ )
+ })
+ });
payments_to_payments_response(
req,
payment_data.payment_attempt,
@@ -210,15 +225,7 @@ where
payment_data.refunds,
payment_data.disputes,
payment_data.attempts,
- payment_data
- .multiple_capture_data
- .map(|multiple_capture_data| {
- multiple_capture_data
- .get_all_captures()
- .into_iter()
- .cloned()
- .collect()
- }),
+ captures,
payment_data.payment_method_data,
customer,
auth_flow,
diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs
index 89f6e094d76..7157deffc11 100644
--- a/crates/router/src/core/payments/types.rs
+++ b/crates/router/src/core/payments/types.rs
@@ -12,13 +12,17 @@ pub struct MultipleCaptureData {
// key -> capture_id, value -> Capture
all_captures: HashMap<String, storage::Capture>,
latest_capture: storage::Capture,
+ pub expand_captures: Option<bool>,
_private: Private, // to restrict direct construction of MultipleCaptureData
}
#[derive(Clone, Debug)]
struct Private {}
impl MultipleCaptureData {
- pub fn new_for_sync(captures: Vec<storage::Capture>) -> RouterResult<Self> {
+ pub fn new_for_sync(
+ captures: Vec<storage::Capture>,
+ expand_captures: Option<bool>,
+ ) -> RouterResult<Self> {
let latest_capture = captures
.last()
.ok_or(errors::ApiErrorResponse::InternalServerError)
@@ -32,6 +36,7 @@ impl MultipleCaptureData {
.collect(),
latest_capture,
_private: Private {},
+ expand_captures,
};
Ok(multiple_capture_data)
}
@@ -48,6 +53,7 @@ impl MultipleCaptureData {
.collect(),
latest_capture: new_capture,
_private: Private {},
+ expand_captures: None,
}
}
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index f9d4d59afe8..b6baf10e913 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -58,6 +58,7 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
merchant_connector_details: None,
client_secret: None,
expand_attempts: None,
+ expand_captures: None,
},
services::AuthFlow::Merchant,
consume_or_trigger_flow,
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 32de056c1fc..d550cfe17a4 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -198,6 +198,7 @@ pub async fn payments_retrieve(
force_sync: json_payload.force_sync.unwrap_or(false),
client_secret: json_payload.client_secret.clone(),
expand_attempts: json_payload.expand_attempts,
+ expand_captures: json_payload.expand_captures,
..Default::default()
};
let (auth_type, auth_flow) =
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 85a2ad1dbda..15eecf072d1 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -8269,6 +8269,11 @@
"description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK",
"nullable": true
},
+ "expand_captures": {
+ "type": "boolean",
+ "description": "If enabled provides list of captures linked to latest attempt",
+ "nullable": true
+ },
"expand_attempts": {
"type": "boolean",
"description": "If enabled provides list of attempts linked to payment intent",
@@ -9447,6 +9452,11 @@
"description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK",
"nullable": true
},
+ "expand_captures": {
+ "type": "boolean",
+ "description": "If enabled provides list of captures linked to latest attempt",
+ "nullable": true
+ },
"expand_attempts": {
"type": "boolean",
"description": "If enabled provides list of attempts linked to payment intent",
|
feat
|
conditionally return captures list during payment sync. (#2033)
|
ec3b60e37c0b178c3e5e3fe79db88f83fd195722
|
2024-05-08 19:06:07
|
Hrithikesh
|
fix(core): drop three_dsserver_trans_id from authentication table (#4587)
| false
|
diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs
index 8840d287e54..ce2f02d087f 100644
--- a/crates/diesel_models/src/authentication.rs
+++ b/crates/diesel_models/src/authentication.rs
@@ -38,7 +38,6 @@ pub struct Authentication {
pub challenge_request: Option<String>,
pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>,
- pub three_ds_server_trans_id: Option<String>,
pub acs_signed_content: Option<String>,
pub profile_id: String,
pub payment_id: Option<String>,
@@ -83,7 +82,6 @@ pub struct AuthenticationNew {
pub challenge_request: Option<String>,
pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>,
- pub three_dsserver_trans_id: Option<String>,
pub acs_signed_content: Option<String>,
pub profile_id: String,
pub payment_id: Option<String>,
@@ -160,7 +158,6 @@ pub struct AuthenticationUpdateInternal {
pub challenge_request: Option<String>,
pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>,
- pub three_dsserver_trans_id: Option<String>,
pub acs_signed_content: Option<String>,
}
@@ -191,7 +188,6 @@ impl Default for AuthenticationUpdateInternal {
challenge_request: Default::default(),
acs_reference_number: Default::default(),
acs_trans_id: Default::default(),
- three_dsserver_trans_id: Default::default(),
acs_signed_content: Default::default(),
}
}
@@ -224,7 +220,6 @@ impl AuthenticationUpdateInternal {
challenge_request,
acs_reference_number,
acs_trans_id,
- three_dsserver_trans_id,
acs_signed_content,
} = self;
Authentication {
@@ -256,7 +251,6 @@ impl AuthenticationUpdateInternal {
challenge_request: challenge_request.or(source.challenge_request),
acs_reference_number: acs_reference_number.or(source.acs_reference_number),
acs_trans_id: acs_trans_id.or(source.acs_trans_id),
- three_ds_server_trans_id: three_dsserver_trans_id.or(source.three_ds_server_trans_id),
acs_signed_content: acs_signed_content.or(source.acs_signed_content),
..source
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 20296adb65c..0bea0402b51 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -108,7 +108,6 @@ diesel::table! {
challenge_request -> Nullable<Varchar>,
acs_reference_number -> Nullable<Varchar>,
acs_trans_id -> Nullable<Varchar>,
- three_dsserver_trans_id -> Nullable<Varchar>,
acs_signed_content -> Nullable<Varchar>,
#[max_length = 64]
profile_id -> Varchar,
diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs
index bece5459236..e29c8b10232 100644
--- a/crates/router/src/core/authentication/utils.rs
+++ b/crates/router/src/core/authentication/utils.rs
@@ -177,7 +177,6 @@ pub async fn create_new_authentication(
challenge_request: None,
acs_reference_number: None,
acs_trans_id: None,
- three_dsserver_trans_id: None,
acs_signed_content: None,
profile_id,
payment_id,
diff --git a/crates/router/src/db/authentication.rs b/crates/router/src/db/authentication.rs
index 0f4aef679c5..398af72f8bd 100644
--- a/crates/router/src/db/authentication.rs
+++ b/crates/router/src/db/authentication.rs
@@ -143,7 +143,6 @@ impl AuthenticationInterface for MockDb {
challenge_request: authentication.challenge_request,
acs_reference_number: authentication.acs_reference_number,
acs_trans_id: authentication.acs_trans_id,
- three_ds_server_trans_id: authentication.three_dsserver_trans_id,
acs_signed_content: authentication.acs_signed_content,
profile_id: authentication.profile_id,
payment_id: authentication.payment_id,
diff --git a/crates/router/src/types/api/authentication.rs b/crates/router/src/types/api/authentication.rs
index 92bcd1ae73b..3e4a494f658 100644
--- a/crates/router/src/types/api/authentication.rs
+++ b/crates/router/src/types/api/authentication.rs
@@ -50,7 +50,7 @@ impl TryFrom<storage::Authentication> for AuthenticationResponse {
challenge_request: authentication.challenge_request,
acs_reference_number: authentication.acs_reference_number,
acs_trans_id: authentication.acs_trans_id,
- three_dsserver_trans_id: authentication.three_ds_server_trans_id,
+ three_dsserver_trans_id: authentication.threeds_server_transaction_id,
acs_signed_content: authentication.acs_signed_content,
})
}
diff --git a/migrations/2024-05-08-111348_delete_unused_column_from_authentication/down.sql b/migrations/2024-05-08-111348_delete_unused_column_from_authentication/down.sql
new file mode 100644
index 00000000000..8459dd79c5a
--- /dev/null
+++ b/migrations/2024-05-08-111348_delete_unused_column_from_authentication/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE authentication ADD COLUMN three_dsserver_trans_id VARCHAR;
\ No newline at end of file
diff --git a/migrations/2024-05-08-111348_delete_unused_column_from_authentication/up.sql b/migrations/2024-05-08-111348_delete_unused_column_from_authentication/up.sql
new file mode 100644
index 00000000000..fdbe2332b32
--- /dev/null
+++ b/migrations/2024-05-08-111348_delete_unused_column_from_authentication/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE authentication DROP COLUMN three_dsserver_trans_id;
\ No newline at end of file
|
fix
|
drop three_dsserver_trans_id from authentication table (#4587)
|
98567569c1c61648eebf0ad7a1ab58bba967b427
|
2024-10-29 05:52:02
|
github-actions
|
chore(version): 2024.10.29.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 416b6cb7f08..cb6fcc8f40b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.10.29.0
+
+### Bug Fixes
+
+- **multitenancy:** Consistently use tenant nomenclature everywhere ([#6389](https://github.com/juspay/hyperswitch/pull/6389)) ([`aecd5ee`](https://github.com/juspay/hyperswitch/commit/aecd5eea3d2dce3ccdd4784f60d076b641104b67))
+
+**Full Changelog:** [`2024.10.28.2...2024.10.29.0`](https://github.com/juspay/hyperswitch/compare/2024.10.28.2...2024.10.29.0)
+
+- - -
+
## 2024.10.28.2
### Bug Fixes
|
chore
|
2024.10.29.0
|
89a1cd088591acc70abcc00ea863e0f108da45a6
|
2023-01-13 14:09:52
|
Sanchith Hegde
|
chore: drop `temp_card` table and all associated items (#366)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index d8e14809b27..7b93ff60696 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4598,9 +4598,9 @@ dependencies = [
[[package]]
name = "wiremock"
-version = "0.5.15"
+version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "249dc68542861d17eae4b4e5e8fb381c2f9e8f255a84f6771d5fdf8b6c03ce3c"
+checksum = "12316b50eb725e22b2f6b9c4cbede5b7b89984274d113a7440c86e5c3fc6f99b"
dependencies = [
"assert-json-diff",
"async-trait",
diff --git a/config/Development.toml b/config/Development.toml
index cd8a1d6bae7..c5b1911913f 100644
--- a/config/Development.toml
+++ b/config/Development.toml
@@ -28,9 +28,6 @@ pool_size = 5
[proxy]
-[keys]
-temp_card_key = "OJobAzAwOlibOhygIZOqOGideGUdEBeX" # 32 character long key
-
[locker]
host = ""
mock_locker = true
diff --git a/config/config.example.toml b/config/config.example.toml
index e03b67877b2..cabc652c91e 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -68,14 +68,10 @@ level = "DEBUG"
enabled = false # boolean [true or false]
sampling_rate = 0.1 # decimal rate between 0.0 - 1.0
-# This section provides configuration details for using AWS KMS to encrypt
-# data like payment method details being sent over a network.
-[keys]
-aws_key_id = "" # AWS Account Key ID
-aws_region = "" # AWS Account region
-temp_card_key = "OJobAzAwOlibOhygIZOqOGideGUdEBeX" # AWS KMS Key
-admin_api_key = "test_admin" #admin api key for merchant authentication
-jwt_secret= "secret" #secret jwt for merchant
+# This section provides some secret values.
+[secrets]
+admin_api_key = "test_admin" # admin API key for admin authentication
+jwt_secret = "secret" # JWT secret used for user authentication
# Locker settings contain details for accessing a card locker, a
# PCI Compliant storage entity which stores payment method information
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index b7e2b0d4e4b..0c026939849 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -28,10 +28,9 @@ pool_size = 5
# http_url = "http proxy URL"
# https_url = "https proxy URL"
-[keys]
-temp_card_key = "OJobAzAwOlibOhygIZOqOGideGUdEBeX" # 32 character long key
+[secrets]
admin_api_key = "test_admin"
-jwt_secret="secret"
+jwt_secret = "secret"
[locker]
host = ""
diff --git a/crates/router/src/configs/defaults.toml b/crates/router/src/configs/defaults.toml
index 62200dace25..fe24060d3c6 100644
--- a/crates/router/src/configs/defaults.toml
+++ b/crates/router/src/configs/defaults.toml
@@ -30,10 +30,9 @@ cluster_enabled = false
use_legacy_version = false
cluster_urls = []
-[keys]
-temp_card_key = "OJobAzAwOlibOhygIZOqOGideGUdEBeX" # 32 character long key
+[secrets]
admin_api_key = "test_admin"
-jwt_secret="secret"
+jwt_secret = "secret"
[locker]
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 080c545d337..474298ff074 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -39,7 +39,7 @@ pub struct Settings {
pub replica_database: Database,
pub redis: RedisSettings,
pub log: Log,
- pub keys: Keys, //remove this during refactoring
+ pub secrets: Secrets,
pub locker: Locker,
pub connectors: Connectors,
pub refund: Refund,
@@ -51,12 +51,7 @@ pub struct Settings {
}
#[derive(Debug, Deserialize, Clone)]
-pub struct Keys {
- #[cfg(feature = "kms")]
- pub aws_key_id: String,
- #[cfg(feature = "kms")]
- pub aws_region: String,
- pub temp_card_key: String,
+pub struct Secrets {
pub jwt_secret: String,
pub admin_api_key: String,
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 9302581c3ed..95642a771ff 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -5,7 +5,6 @@ use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
use crate::{
- configs::settings,
core::{
errors::{self, StorageErrorExt},
payment_methods::transformers as payment_methods,
@@ -19,7 +18,7 @@ use crate::{
storage::{self, enums},
transformers::ForeignInto,
},
- utils::{self, BytesExt, OptionExt, StringExt, ValueExt},
+ utils::{BytesExt, OptionExt, StringExt},
};
#[instrument(skip_all)]
@@ -789,34 +788,6 @@ impl BasiliskCardSupport {
}
}
-pub async fn get_card_info_value(
- keys: &settings::Keys,
- card_info: String,
-) -> errors::RouterResult<serde_json::Value> {
- let key = services::KeyHandler::get_encryption_key(keys)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
- let enc_card_info = services::encrypt(&card_info, key.as_bytes())
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
- utils::Encode::<Vec<u8>>::encode_to_value(&enc_card_info)
- .change_context(errors::CardVaultError::RequestEncodingFailed)
- .change_context(errors::ApiErrorResponse::InternalServerError)
-}
-
-pub async fn get_card_info_from_value(
- keys: &settings::Keys,
- card_info: serde_json::Value,
-) -> errors::RouterResult<String> {
- let key = services::KeyHandler::get_encryption_key(keys)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
- let card_info_val: Vec<u8> = card_info
- .parse_value("CardInfo")
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
- services::decrypt(card_info_val, key.as_bytes())
- .change_context(errors::ApiErrorResponse::InternalServerError)
-}
-
#[instrument(skip_all)]
pub async fn retrieve_payment_method(
state: &routes::AppState,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 559b6b1157c..411d6634041 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -942,36 +942,6 @@ impl Vault {
}
}
-#[instrument(skip_all)]
-pub async fn create_temp_card(
- state: &AppState,
- txn_id: &str,
- card: &api::CCard,
-) -> RouterResult<storage::TempCard> {
- let (card_info, temp_card);
- card_info = format!(
- "{}:::{}:::{}:::{}:::{}",
- card.card_number.peek(),
- card.card_exp_month.peek(),
- card.card_exp_year.peek(),
- card.card_holder_name.peek(),
- card.card_cvc.peek()
- );
-
- let card_info_val = cards::get_card_info_value(&state.conf.keys, card_info).await?;
- temp_card = storage::TempCardNew {
- card_info: Some(card_info_val),
- date_created: common_utils::date_time::now(),
- txn_id: Some(txn_id.to_string()),
- id: None,
- };
- state
- .store
- .insert_temp_card(temp_card)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
-}
-
#[instrument(skip_all)]
pub(crate) fn validate_capture_method(
capture_method: storage_enums::CaptureMethod,
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index 767fee28bc0..7e3594d00b4 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -15,7 +15,6 @@ pub mod process_tracker;
pub mod queue;
pub mod refund;
pub mod reverse_lookup;
-pub mod temp_card;
use std::sync::Arc;
@@ -39,7 +38,6 @@ pub trait StorageInterface:
+ mandate::MandateInterface
+ address::AddressInterface
+ configs::ConfigInterface
- + temp_card::TempCardInterface
+ customers::CustomerInterface
+ events::EventInterface
+ merchant_account::MerchantAccountInterface
@@ -76,7 +74,6 @@ pub struct MockDb {
payment_attempts: Arc<Mutex<Vec<storage::PaymentAttempt>>>,
payment_intents: Arc<Mutex<Vec<storage::PaymentIntent>>>,
customers: Arc<Mutex<Vec<storage::Customer>>>,
- temp_cards: Arc<Mutex<Vec<storage::TempCard>>>,
refunds: Arc<Mutex<Vec<storage::Refund>>>,
processes: Arc<Mutex<Vec<storage::ProcessTracker>>>,
connector_response: Arc<Mutex<Vec<storage::ConnectorResponse>>>,
@@ -91,7 +88,6 @@ impl MockDb {
payment_attempts: Default::default(),
payment_intents: Default::default(),
customers: Default::default(),
- temp_cards: Default::default(),
refunds: Default::default(),
processes: Default::default(),
connector_response: Default::default(),
diff --git a/crates/router/src/db/temp_card.rs b/crates/router/src/db/temp_card.rs
deleted file mode 100644
index 15b998d2836..00000000000
--- a/crates/router/src/db/temp_card.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-use error_stack::IntoReport;
-
-use super::{MockDb, Store};
-use crate::{
- connection::pg_connection,
- core::errors::{self, CustomResult},
- types::storage,
-};
-
-#[async_trait::async_trait]
-pub trait TempCardInterface {
- async fn find_tempcard_by_token(
- &self,
- token: &i32,
- ) -> CustomResult<storage::TempCard, errors::StorageError>;
-
- async fn insert_temp_card(
- &self,
- address: storage::TempCardNew,
- ) -> CustomResult<storage::TempCard, errors::StorageError>;
-
- async fn find_tempcard_by_transaction_id(
- &self,
- transaction_id: &str,
- ) -> CustomResult<Option<storage::TempCard>, errors::StorageError>;
-
- async fn insert_tempcard_with_token(
- &self,
- new: storage::TempCard,
- ) -> CustomResult<storage::TempCard, errors::StorageError>;
-}
-
-#[async_trait::async_trait]
-impl TempCardInterface for Store {
- async fn insert_temp_card(
- &self,
- address: storage::TempCardNew,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- address
- .insert(&conn)
- .await
- .map_err(Into::into)
- .into_report()
- }
-
- async fn find_tempcard_by_transaction_id(
- &self,
- transaction_id: &str,
- ) -> CustomResult<Option<storage::TempCard>, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- storage::TempCard::find_by_transaction_id(&conn, transaction_id)
- .await
- .map_err(Into::into)
- .into_report()
- }
-
- async fn insert_tempcard_with_token(
- &self,
- card: storage::TempCard,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- storage::TempCard::insert_with_token(card, &conn)
- .await
- .map_err(Into::into)
- .into_report()
- }
-
- async fn find_tempcard_by_token(
- &self,
- token: &i32,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- storage::TempCard::find_by_token(&conn, token)
- .await
- .map_err(Into::into)
- .into_report()
- }
-}
-
-#[async_trait::async_trait]
-impl TempCardInterface for MockDb {
- #[allow(clippy::panic)]
- async fn insert_temp_card(
- &self,
- insert: storage::TempCardNew,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- let mut cards = self.temp_cards.lock().await;
- let card = storage::TempCard {
- #[allow(clippy::as_conversions)]
- id: cards.len() as i32,
- date_created: insert.date_created,
- txn_id: insert.txn_id,
- card_info: insert.card_info,
- };
- cards.push(card.clone());
- Ok(card)
- }
-
- async fn find_tempcard_by_transaction_id(
- &self,
- _transaction_id: &str,
- ) -> CustomResult<Option<storage::TempCard>, errors::StorageError> {
- // [#172]: Implement function for `MockDb`
- Err(errors::StorageError::MockDbError)?
- }
-
- async fn insert_tempcard_with_token(
- &self,
- _card: storage::TempCard,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- // [#172]: Implement function for `MockDb`
- Err(errors::StorageError::MockDbError)?
- }
-
- async fn find_tempcard_by_token(
- &self,
- _token: &i32,
- ) -> CustomResult<storage::TempCard, errors::StorageError> {
- // [#172]: Implement function for `MockDb`
- Err(errors::StorageError::MockDbError)?
- }
-}
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index d02dc4f5c61..e62841a3031 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -55,7 +55,7 @@ impl AuthenticateAndFetch<()> for AdminApiAuth {
) -> RouterResult<()> {
let admin_api_key =
get_api_key(request_headers).change_context(errors::ApiErrorResponse::Unauthorized)?;
- if admin_api_key != state.conf.keys.admin_api_key {
+ if admin_api_key != state.conf.secrets.admin_api_key {
Err(report!(errors::ApiErrorResponse::Unauthorized)
.attach_printable("Admin Authentication Failure"))?;
}
@@ -231,7 +231,7 @@ pub fn decode_jwt<T>(token: &str, state: &AppState) -> RouterResult<T>
where
T: serde::de::DeserializeOwned,
{
- let secret = state.conf.keys.jwt_secret.as_bytes();
+ let secret = state.conf.secrets.jwt_secret.as_bytes();
let key = DecodingKey::from_secret(secret);
decode::<T>(token, &key, &Validation::new(Algorithm::HS256))
.map(|decoded| decoded.claims)
diff --git a/crates/router/src/services/encryption.rs b/crates/router/src/services/encryption.rs
index 3058b3ad2b5..0fe1d59eae4 100644
--- a/crates/router/src/services/encryption.rs
+++ b/crates/router/src/services/encryption.rs
@@ -6,7 +6,7 @@ use rand;
use ring::{aead::*, error::Unspecified};
use crate::{
- configs::settings::{Jwekey, Keys},
+ configs::settings::Jwekey,
core::errors::{self, CustomResult},
utils,
};
@@ -102,86 +102,11 @@ mod kms {
.attach_printable("Missing plaintext in response")),
}
}
-
- pub async fn get_encryption_key(
- keys: &Keys,
- ) -> CustomResult<String, errors::EncryptionError> {
- let kms_enc_key = keys.temp_card_key.to_string();
- let region = keys.aws_region.to_string();
- let key_id = keys.aws_key_id.clone();
- let region_provider = RegionProviderChain::first_try(Region::new(region));
- let shared_config = aws_config::from_env().region(region_provider).load().await;
- let client = Client::new(&shared_config);
- let data = consts::BASE64_ENGINE
- .decode(kms_enc_key)
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Error decoding from base64")?;
- let blob = Blob::new(data);
- let resp = client
- .decrypt()
- .key_id(key_id)
- .ciphertext_blob(blob)
- .send()
- .await
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Error decrypting kms encrypted data")?;
- match resp.plaintext() {
- Some(inner) => {
- let bytes = inner.as_ref().to_vec();
- let res = String::from_utf8(bytes)
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Could not convert to UTF-8")?;
- Ok(res)
- }
- None => Err(report!(errors::EncryptionError)
- .attach_printable("Missing plaintext in response")),
- }
- }
-
- pub async fn set_encryption_key(
- input: &str,
- keys: &Keys,
- ) -> CustomResult<String, errors::EncryptionError> {
- let region = keys.aws_region.to_string();
- let key_id = keys.aws_key_id.clone();
- let region_provider = RegionProviderChain::first_try(Region::new(region));
- let shared_config = aws_config::from_env().region(region_provider).load().await;
- let client = Client::new(&shared_config);
- let blob = Blob::new(input.as_bytes());
- let resp = client
- .encrypt()
- .key_id(key_id)
- .plaintext(blob)
- .send()
- .await
- .into_report()
- .change_context(errors::EncryptionError)
- .attach_printable("Error getting EncryptOutput")?;
- match resp.ciphertext_blob {
- Some(blob) => {
- let bytes = blob.as_ref();
- let encoded_res = consts::BASE64_ENGINE.encode(bytes);
- Ok(encoded_res)
- }
- None => {
- Err(report!(errors::EncryptionError)
- .attach_printable("Missing ciphertext blob"))
- }
- }
- }
}
}
#[cfg(not(feature = "kms"))]
impl KeyHandler {
- // Fetching KMS decrypted key
- pub async fn get_encryption_key(keys: &Keys) -> CustomResult<String, errors::EncryptionError> {
- Ok(keys.temp_card_key.clone())
- }
-
pub async fn get_kms_decrypted_key(
_aws_keys: &Jwekey,
key: String,
@@ -337,20 +262,6 @@ mod tests {
assert_eq!(dec_data, "Test_Encrypt".to_string());
}
- #[cfg(feature = "kms")]
- #[actix_rt::test]
- #[ignore]
- async fn test_kms() {
- let conf = settings::Settings::new().unwrap();
- let kms_encrypted = KeyHandler::get_encryption_key(&conf.keys)
- .await
- .expect("Error encode_kms");
- let kms_decrypted = KeyHandler::set_encryption_key(&kms_encrypted, &conf.keys)
- .await
- .expect("error decode_kms");
- assert_eq!("Testing KMS".to_string(), kms_decrypted)
- }
-
#[actix_rt::test]
async fn test_jwe() {
let conf = settings::Settings::new().unwrap();
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 43e84cb87dd..54471190778 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -17,7 +17,6 @@ pub mod reverse_lookup;
mod query;
pub mod refund;
-pub mod temp_card;
#[cfg(feature = "kv_store")]
pub mod kv;
@@ -26,5 +25,4 @@ pub use self::{
address::*, configs::*, connector_response::*, customers::*, events::*, locker_mock_up::*,
mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*,
payment_intent::*, payment_method::*, process_tracker::*, refund::*, reverse_lookup::*,
- temp_card::*,
};
diff --git a/crates/router/src/types/storage/temp_card.rs b/crates/router/src/types/storage/temp_card.rs
deleted file mode 100644
index fba5d4b5180..00000000000
--- a/crates/router/src/types/storage/temp_card.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub use storage_models::temp_card::{TempCard, TempCardNew};
diff --git a/crates/storage_models/src/lib.rs b/crates/storage_models/src/lib.rs
index 7ff7845843d..6a92b6df1e4 100644
--- a/crates/storage_models/src/lib.rs
+++ b/crates/storage_models/src/lib.rs
@@ -21,7 +21,6 @@ pub mod query;
pub mod refund;
pub mod reverse_lookup;
pub mod schema;
-pub mod temp_card;
use diesel_impl::{DieselArray, OptionalDieselArray};
diff --git a/crates/storage_models/src/query.rs b/crates/storage_models/src/query.rs
index 850f04ebf3b..379617571bd 100644
--- a/crates/storage_models/src/query.rs
+++ b/crates/storage_models/src/query.rs
@@ -14,4 +14,3 @@ pub mod payment_method;
pub mod process_tracker;
pub mod refund;
pub mod reverse_lookup;
-pub mod temp_card;
diff --git a/crates/storage_models/src/query/temp_card.rs b/crates/storage_models/src/query/temp_card.rs
deleted file mode 100644
index 4ebe39924c8..00000000000
--- a/crates/storage_models/src/query/temp_card.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use diesel::{associations::HasTable, ExpressionMethods};
-use router_env::{instrument, tracing};
-
-use super::generics;
-use crate::{
- schema::temp_card::dsl,
- temp_card::{TempCard, TempCardNew},
- PgPooledConn, StorageResult,
-};
-
-impl TempCardNew {
- #[instrument(skip(conn))]
- pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<TempCard> {
- generics::generic_insert(conn, self).await
- }
-}
-
-impl TempCard {
- #[instrument(skip(conn))]
- pub async fn insert_with_token(self, conn: &PgPooledConn) -> StorageResult<Self> {
- generics::generic_insert(conn, self).await
- }
-
- #[instrument(skip(conn))]
- pub async fn find_by_transaction_id(
- conn: &PgPooledConn,
- transaction_id: &str,
- ) -> StorageResult<Option<Self>> {
- generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
- conn,
- dsl::txn_id.eq(transaction_id.to_owned()),
- )
- .await
- }
-
- #[instrument(skip(conn))]
- pub async fn find_by_token(conn: &PgPooledConn, token: &i32) -> StorageResult<Self> {
- generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
- conn,
- dsl::id.eq(token.to_owned()),
- )
- .await
- }
-}
diff --git a/crates/storage_models/src/schema.rs b/crates/storage_models/src/schema.rs
index 22894bd0deb..612766e6cfd 100644
--- a/crates/storage_models/src/schema.rs
+++ b/crates/storage_models/src/schema.rs
@@ -344,18 +344,6 @@ diesel::table! {
}
}
-diesel::table! {
- use diesel::sql_types::*;
- use crate::enums::diesel_exports::*;
-
- temp_card (id) {
- id -> Int4,
- date_created -> Timestamp,
- txn_id -> Nullable<Varchar>,
- card_info -> Nullable<Json>,
- }
-}
-
diesel::allow_tables_to_appear_in_same_query!(
address,
configs,
@@ -372,5 +360,4 @@ diesel::allow_tables_to_appear_in_same_query!(
process_tracker,
refund,
reverse_lookup,
- temp_card,
);
diff --git a/crates/storage_models/src/temp_card.rs b/crates/storage_models/src/temp_card.rs
deleted file mode 100644
index 6b036ef8d9c..00000000000
--- a/crates/storage_models/src/temp_card.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use diesel::{Identifiable, Insertable, Queryable};
-use serde_json::Value;
-use time::PrimitiveDateTime;
-
-use crate::schema::temp_card;
-
-#[derive(Clone, Debug, router_derive::DebugAsDisplay, Queryable, Identifiable, Insertable)]
-#[diesel(table_name = temp_card)]
-pub struct TempCard {
- pub id: i32,
- pub date_created: PrimitiveDateTime,
- pub txn_id: Option<String>,
- pub card_info: Option<Value>,
-}
-
-#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
-#[diesel(table_name = temp_card)]
-pub struct TempCardNew {
- pub id: Option<i32>,
- pub card_info: Option<Value>,
- pub date_created: PrimitiveDateTime,
- pub txn_id: Option<String>,
-}
diff --git a/loadtest/config/Development.toml b/loadtest/config/Development.toml
index 3f1c09d5146..bc5043ca8c9 100644
--- a/loadtest/config/Development.toml
+++ b/loadtest/config/Development.toml
@@ -21,10 +21,9 @@ host = "0.0.0.0"
[redis]
host = "redis-queue"
-[keys]
-temp_card_key = "OJobAzAwOlibOhygIZOqOGideGUdEBeX" # 32 character long key
+[secrets]
admin_api_key = "test_admin"
-jwt_secret="secret"
+jwt_secret = "secret"
[locker]
host = ""
diff --git a/migrations/2023-01-12-140107_drop_temp_card/down.sql b/migrations/2023-01-12-140107_drop_temp_card/down.sql
new file mode 100644
index 00000000000..ca7082e4571
--- /dev/null
+++ b/migrations/2023-01-12-140107_drop_temp_card/down.sql
@@ -0,0 +1,8 @@
+CREATE TABLE temp_card (
+ id SERIAL PRIMARY KEY,
+ date_created TIMESTAMP NOT NULL,
+ txn_id VARCHAR(255),
+ card_info JSON
+);
+
+CREATE INDEX temp_card_txn_id_index ON temp_card (txn_id);
diff --git a/migrations/2023-01-12-140107_drop_temp_card/up.sql b/migrations/2023-01-12-140107_drop_temp_card/up.sql
new file mode 100644
index 00000000000..3984e9430e4
--- /dev/null
+++ b/migrations/2023-01-12-140107_drop_temp_card/up.sql
@@ -0,0 +1 @@
+DROP TABLE temp_card;
|
chore
|
drop `temp_card` table and all associated items (#366)
|
d2d33c55a9f57c3853dcc3dc1a3c07d7075baeec
|
2024-01-31 14:47:40
|
github-actions
|
chore(version): 2024.01.31.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 00cfdc5a015..122730e017c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,27 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.01.31.1
+
+### Features
+
+- **users:**
+ - Added blacklist for users ([#3469](https://github.com/juspay/hyperswitch/pull/3469)) ([`e331d2d`](https://github.com/juspay/hyperswitch/commit/e331d2d5569405b89052c6bb59f7e755523f6f15))
+ - Add `merchant_id` in `EmailToken` and change user status in reset password ([#3473](https://github.com/juspay/hyperswitch/pull/3473)) ([`db3d53f`](https://github.com/juspay/hyperswitch/commit/db3d53ff1d8b42d107fafe7a6efe7ec9f155d5a0))
+- Add deep health check for analytics ([#3438](https://github.com/juspay/hyperswitch/pull/3438)) ([`7597f3b`](https://github.com/juspay/hyperswitch/commit/7597f3b692124a762c3b212b604938be2d64175a))
+
+### Bug Fixes
+
+- **connector:** [Trustpay] add merchant_id in gpay session response for trustpay ([#3471](https://github.com/juspay/hyperswitch/pull/3471)) ([`20568dc`](https://github.com/juspay/hyperswitch/commit/20568dc976687b8b2bfba12ab2db8926cf1c14ed))
+
+### Miscellaneous Tasks
+
+- **postman:** Update Postman collection files ([`a4b9782`](https://github.com/juspay/hyperswitch/commit/a4b97828be103d601a5007f8e4274837faa6886f))
+
+**Full Changelog:** [`2024.01.31.0...2024.01.31.1`](https://github.com/juspay/hyperswitch/compare/2024.01.31.0...2024.01.31.1)
+
+- - -
+
## 2024.01.31.0
### Features
|
chore
|
2024.01.31.1
|
53b31638815afe7dbf946e24af06c997c5fb0232
|
2024-08-28 13:30:07
|
Apoorv Dixit
|
feat(user_roles): support switch for new hierarchy (#5692)
| false
|
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index 862c361d465..590179c052c 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -17,10 +17,10 @@ use crate::user::{
GetUserRoleDetailsRequest, GetUserRoleDetailsResponse, InviteUserRequest, ListUsersResponse,
ReInviteUserRequest, RecoveryCodes, ResetPasswordRequest, RotatePasswordRequest,
SendVerifyEmailRequest, SignInResponse, SignUpRequest, SignUpWithMerchantIdRequest,
- SsoSignInRequest, SwitchMerchantIdRequest, TokenOrPayloadResponse, TokenResponse,
- TwoFactorAuthStatusResponse, UpdateUserAccountDetailsRequest,
- UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantCreate,
- VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
+ SsoSignInRequest, SwitchMerchantRequest, SwitchOrganizationRequest, SwitchProfileRequest,
+ TokenOrPayloadResponse, TokenResponse, TwoFactorAuthStatusResponse,
+ UpdateUserAccountDetailsRequest, UpdateUserAuthenticationMethodRequest, UserFromEmailRequest,
+ UserMerchantCreate, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
};
impl ApiEventMetric for DashboardEntryResponse {
@@ -56,7 +56,9 @@ common_utils::impl_api_event_type!(
GetMetaDataResponse,
GetMetaDataRequest,
SetMetaDataRequest,
- SwitchMerchantIdRequest,
+ SwitchOrganizationRequest,
+ SwitchMerchantRequest,
+ SwitchProfileRequest,
CreateInternalUserRequest,
UserMerchantCreate,
ListUsersResponse,
diff --git a/crates/api_models/src/events/user_role.rs b/crates/api_models/src/events/user_role.rs
index 7e8eaf17e30..5b5da0ec50a 100644
--- a/crates/api_models/src/events/user_role.rs
+++ b/crates/api_models/src/events/user_role.rs
@@ -7,7 +7,7 @@ use crate::user_role::{
UpdateRoleRequest,
},
AcceptInvitationRequest, AuthorizationInfoResponse, DeleteUserRoleRequest,
- MerchantSelectRequest, TransferOrgOwnershipRequest, UpdateUserRoleRequest,
+ MerchantSelectRequest, UpdateUserRoleRequest,
};
common_utils::impl_api_event_type!(
@@ -20,7 +20,6 @@ common_utils::impl_api_event_type!(
MerchantSelectRequest,
AcceptInvitationRequest,
DeleteUserRoleRequest,
- TransferOrgOwnershipRequest,
CreateRoleRequest,
UpdateRoleRequest,
ListRolesResponse,
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index 1fdf47425e2..2547f082039 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -124,10 +124,20 @@ pub struct AcceptInviteFromEmailRequest {
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
-pub struct SwitchMerchantIdRequest {
+pub struct SwitchOrganizationRequest {
+ pub org_id: id_type::OrganizationId,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct SwitchMerchantRequest {
pub merchant_id: id_type::MerchantId,
}
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct SwitchProfileRequest {
+ pub profile_id: id_type::ProfileId,
+}
+
#[derive(serde::Deserialize, Debug, serde::Serialize)]
pub struct CreateInternalUserRequest {
pub name: Secret<String>,
diff --git a/crates/api_models/src/user_role.rs b/crates/api_models/src/user_role.rs
index 5319c81385a..c9f222cb7be 100644
--- a/crates/api_models/src/user_role.rs
+++ b/crates/api_models/src/user_role.rs
@@ -133,8 +133,3 @@ pub struct AcceptInvitationRequest {
pub struct DeleteUserRoleRequest {
pub email: pii::Email,
}
-
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
-pub struct TransferOrgOwnershipRequest {
- pub email: pii::Email,
-}
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index c3d0dbae04e..9510ddd632d 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -1320,12 +1320,12 @@ pub async fn create_internal_user(
pub async fn switch_merchant_id(
state: SessionState,
- request: user_api::SwitchMerchantIdRequest,
+ request: user_api::SwitchMerchantRequest,
user_from_token: auth::UserFromToken,
) -> UserResponse<user_api::DashboardEntryResponse> {
if user_from_token.merchant_id == request.merchant_id {
return Err(UserErrors::InvalidRoleOperationWithMessage(
- "User switching to same merchant id".to_string(),
+ "User switching to same merchant_id".to_string(),
)
.into());
}
@@ -1375,9 +1375,9 @@ pub async fn switch_merchant_id(
})?
.organization_id;
- let token = utils::user::generate_jwt_auth_token_with_custom_role_attributes(
+ let token = utils::user::generate_jwt_auth_token_with_attributes(
&state,
- &user,
+ user_from_token.user_id,
request.merchant_id.clone(),
org_id.clone(),
user_from_token.role_id.clone(),
@@ -1557,7 +1557,7 @@ pub async fn list_users_for_merchant_account(
.list_user_roles_by_merchant_id(&user_from_token.merchant_id, UserRoleVersion::V1)
.await
.change_context(UserErrors::InternalServerError)
- .attach_printable("No user roles for given merchant id")?
+ .attach_printable("No user roles for given merchant_id")?
.into_iter()
.map(|role| (role.user_id.clone(), role))
.collect();
@@ -1569,7 +1569,7 @@ pub async fn list_users_for_merchant_account(
.find_users_by_user_ids(user_ids)
.await
.change_context(UserErrors::InternalServerError)
- .attach_printable("No users for given merchant id")?;
+ .attach_printable("No users for given merchant_id")?;
let users_and_user_roles: Vec<_> = users
.into_iter()
@@ -2134,7 +2134,7 @@ pub async fn verify_recovery_code(
state: SessionState,
user_token: auth::UserIdFromAuth,
req: user_api::VerifyRecoveryCodeRequest,
-) -> UserResponse<user_api::TokenResponse> {
+) -> UserResponse<()> {
let user_from_db: domain::UserFromStorage = state
.global_store
.find_user_by_id(&user_token.user_id)
@@ -2760,3 +2760,442 @@ pub async fn list_profiles_for_user_in_org_and_merchant_account(
Ok(ApplicationResponse::Json(profiles))
}
+
+pub async fn switch_org_for_user(
+ state: SessionState,
+ request: user_api::SwitchOrganizationRequest,
+ user_from_token: auth::UserFromToken,
+) -> UserResponse<user_api::TokenResponse> {
+ if user_from_token.org_id == request.org_id {
+ return Err(UserErrors::InvalidRoleOperationWithMessage(
+ "User switching to same org".to_string(),
+ )
+ .into());
+ }
+
+ let key_manager_state = &(&state).into();
+ let role_info = roles::RoleInfo::from_role_id(
+ &state,
+ &user_from_token.role_id,
+ &user_from_token.merchant_id,
+ &user_from_token.org_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve role information")?;
+
+ if role_info.get_entity_type() == EntityType::Internal {
+ return Err(UserErrors::InvalidRoleOperationWithMessage(
+ "Org switching not allowed for Internal role".to_string(),
+ )
+ .into());
+ }
+
+ let user_role = state
+ .store
+ .list_user_roles(
+ &user_from_token.user_id,
+ Some(&request.org_id),
+ None,
+ None,
+ None,
+ None,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list user roles by user_id and org_id")?
+ .into_iter()
+ .find(|role| role.status == UserStatus::Active)
+ .ok_or(UserErrors::InvalidRoleOperationWithMessage(
+ "No user role found for the requested org_id".to_string(),
+ ))?
+ .to_owned();
+
+ let merchant_id = if let Some(merchant_id) = &user_role.merchant_id {
+ merchant_id.clone()
+ } else {
+ state
+ .store
+ .list_merchant_accounts_by_organization_id(
+ key_manager_state,
+ request.org_id.get_string_repr(),
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list merchant accounts by organization_id")?
+ .first()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("No merchant account found for the given organization_id")?
+ .get_id()
+ .clone()
+ };
+
+ let profile_id = if let Some(profile_id) = &user_role.profile_id {
+ profile_id.clone()
+ } else {
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &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")?;
+
+ state
+ .store
+ .list_business_profile_by_merchant_id(
+ key_manager_state,
+ &merchant_key_store,
+ &merchant_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list business profiles by merchant_id")?
+ .first()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("No business profile found for the merchant_id")?
+ .profile_id
+ .clone()
+ };
+
+ let token = utils::user::generate_jwt_auth_token_with_attributes(
+ &state,
+ user_from_token.user_id,
+ merchant_id.clone(),
+ request.org_id.clone(),
+ user_role.role_id.clone(),
+ Some(profile_id.clone()),
+ )
+ .await?;
+
+ utils::user_role::set_role_permissions_in_cache_by_role_id_merchant_id_org_id(
+ &state,
+ &user_role.role_id,
+ &merchant_id,
+ &request.org_id,
+ )
+ .await;
+
+ let response = user_api::TokenResponse {
+ token: token.clone(),
+ token_type: common_enums::TokenPurpose::UserInfo,
+ };
+
+ auth::cookies::set_cookie_response(response, token)
+}
+
+pub async fn switch_merchant_for_user_in_org(
+ state: SessionState,
+ request: user_api::SwitchMerchantRequest,
+ user_from_token: auth::UserFromToken,
+) -> UserResponse<user_api::TokenResponse> {
+ if user_from_token.merchant_id == request.merchant_id {
+ return Err(UserErrors::InvalidRoleOperationWithMessage(
+ "User switching to same merchant".to_string(),
+ )
+ .into());
+ }
+
+ let key_manager_state = &(&state).into();
+ let role_info = roles::RoleInfo::from_role_id(
+ &state,
+ &user_from_token.role_id,
+ &user_from_token.merchant_id,
+ &user_from_token.org_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve role information")?;
+
+ let (org_id, merchant_id, profile_id, role_id) = match role_info.get_entity_type() {
+ EntityType::Internal => {
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &request.merchant_id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(UserErrors::MerchantIdNotFound)?;
+
+ let merchant_account = state
+ .store
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &request.merchant_id,
+ &merchant_key_store,
+ )
+ .await
+ .to_not_found_response(UserErrors::MerchantIdNotFound)?;
+
+ let profile_id = state
+ .store
+ .list_business_profile_by_merchant_id(
+ key_manager_state,
+ &merchant_key_store,
+ &request.merchant_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list business profiles by merchant_id")?
+ .first()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("No business profile found for the given merchant_id")?
+ .profile_id
+ .clone();
+
+ (
+ merchant_account.organization_id,
+ request.merchant_id,
+ profile_id,
+ user_from_token.role_id.clone(),
+ )
+ }
+
+ EntityType::Organization => {
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &request.merchant_id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(UserErrors::MerchantIdNotFound)?;
+
+ let merchant_id = state
+ .store
+ .find_merchant_account_by_merchant_id(
+ key_manager_state,
+ &request.merchant_id,
+ &merchant_key_store,
+ )
+ .await
+ .change_context(UserErrors::MerchantIdNotFound)?
+ .organization_id
+ .eq(&user_from_token.org_id)
+ .then(|| request.merchant_id.clone())
+ .ok_or_else(|| {
+ UserErrors::InvalidRoleOperationWithMessage(
+ "No such merchant_id found for the user in the org".to_string(),
+ )
+ })?;
+
+ let profile_id = state
+ .store
+ .list_business_profile_by_merchant_id(
+ key_manager_state,
+ &merchant_key_store,
+ &merchant_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list business profiles by merchant_id")?
+ .first()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("No business profile found for the merchant_id")?
+ .profile_id
+ .clone();
+
+ (
+ user_from_token.org_id.clone(),
+ merchant_id,
+ profile_id,
+ user_from_token.role_id.clone(),
+ )
+ }
+
+ EntityType::Merchant | EntityType::Profile => {
+ let user_role = state
+ .store
+ .list_user_roles(
+ &user_from_token.user_id,
+ Some(&user_from_token.org_id),
+ Some(&request.merchant_id),
+ None,
+ None,
+ None,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable(
+ "Failed to list user roles for the given user_id, org_id and merchant_id",
+ )?
+ .into_iter()
+ .find(|role| role.status == UserStatus::Active)
+ .ok_or(UserErrors::InvalidRoleOperationWithMessage(
+ "No user role associated with the requested merchant_id".to_string(),
+ ))?
+ .to_owned();
+
+ let profile_id = if let Some(profile_id) = &user_role.profile_id {
+ profile_id.clone()
+ } else {
+ let merchant_key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &request.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")?;
+
+ state
+ .store
+ .list_business_profile_by_merchant_id(
+ key_manager_state,
+ &merchant_key_store,
+ &request.merchant_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list business profiles for the given merchant_id")?
+ .first()
+ .ok_or(UserErrors::InternalServerError)
+ .attach_printable("No business profile found for the given merchant_id")?
+ .profile_id
+ .clone()
+ };
+ (
+ user_from_token.org_id,
+ request.merchant_id,
+ profile_id,
+ user_role.role_id,
+ )
+ }
+ };
+
+ let token = utils::user::generate_jwt_auth_token_with_attributes(
+ &state,
+ user_from_token.user_id,
+ merchant_id.clone(),
+ org_id.clone(),
+ role_id.clone(),
+ Some(profile_id),
+ )
+ .await?;
+
+ utils::user_role::set_role_permissions_in_cache_by_role_id_merchant_id_org_id(
+ &state,
+ &role_id,
+ &merchant_id,
+ &org_id,
+ )
+ .await;
+
+ let response = user_api::TokenResponse {
+ token: token.clone(),
+ token_type: common_enums::TokenPurpose::UserInfo,
+ };
+
+ auth::cookies::set_cookie_response(response, token)
+}
+
+pub async fn switch_profile_for_user_in_org_and_merchant(
+ state: SessionState,
+ request: user_api::SwitchProfileRequest,
+ user_from_token: auth::UserFromToken,
+) -> UserResponse<user_api::TokenResponse> {
+ if user_from_token.profile_id == Some(request.profile_id.clone()) {
+ return Err(UserErrors::InvalidRoleOperationWithMessage(
+ "User switching to same profile".to_string(),
+ )
+ .into());
+ }
+
+ let key_manager_state = &(&state).into();
+ let role_info = roles::RoleInfo::from_role_id(
+ &state,
+ &user_from_token.role_id,
+ &user_from_token.merchant_id,
+ &user_from_token.org_id,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve role information")?;
+
+ let (profile_id, role_id) = match role_info.get_entity_type() {
+ EntityType::Internal | EntityType::Organization | EntityType::Merchant => {
+ 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
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to retrieve merchant key store by merchant_id")?;
+
+ let profile_id = state
+ .store
+ .find_business_profile_by_merchant_id_profile_id(
+ key_manager_state,
+ &merchant_key_store,
+ &user_from_token.merchant_id,
+ &request.profile_id,
+ )
+ .await
+ .change_context(UserErrors::InvalidRoleOperationWithMessage(
+ "No such profile found for the merchant".to_string(),
+ ))?
+ .profile_id;
+ (profile_id, user_from_token.role_id)
+ }
+
+ EntityType::Profile => {
+ let user_role = state
+ .store
+ .list_user_roles(
+ &user_from_token.user_id,
+ Some(&user_from_token.org_id),
+ Some(&user_from_token.merchant_id),
+ Some(&request.profile_id),
+ None,
+ None,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("Failed to list user roles for the given user_id, org_id, merchant_id and profile_id")?
+ .into_iter()
+ .find(|role| role.status == UserStatus::Active)
+ .ok_or(UserErrors::InvalidRoleOperationWithMessage(
+ "No user role associated with the profile".to_string(),
+ ))?
+ .to_owned();
+
+ (request.profile_id, user_role.role_id)
+ }
+ };
+
+ let token = utils::user::generate_jwt_auth_token_with_attributes(
+ &state,
+ user_from_token.user_id,
+ user_from_token.merchant_id.clone(),
+ user_from_token.org_id.clone(),
+ role_id.clone(),
+ Some(profile_id),
+ )
+ .await?;
+
+ utils::user_role::set_role_permissions_in_cache_by_role_id_merchant_id_org_id(
+ &state,
+ &role_id,
+ &user_from_token.merchant_id,
+ &user_from_token.org_id,
+ )
+ .await;
+
+ let response = user_api::TokenResponse {
+ token: token.clone(),
+ token_type: common_enums::TokenPurpose::UserInfo,
+ };
+
+ auth::cookies::set_cookie_response(response, token)
+}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 06971f381ad..97042485d6b 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1707,6 +1707,19 @@ impl User {
),
);
+ route = route.service(
+ web::scope("/switch")
+ .service(web::resource("/org").route(web::post().to(switch_org_for_user)))
+ .service(
+ web::resource("/merchant")
+ .route(web::post().to(switch_merchant_for_user_in_org)),
+ )
+ .service(
+ web::resource("/profile")
+ .route(web::post().to(switch_profile_for_user_in_org_and_merchant)),
+ ),
+ );
+
// Two factor auth routes
route = route.service(
web::scope("/2fa")
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index e08b477d29a..f64fab1f408 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -212,7 +212,10 @@ impl From<Flow> for ApiIdentifier {
| Flow::GetMultipleDashboardMetadata
| Flow::VerifyPaymentConnector
| Flow::InternalUserSignup
+ | Flow::SwitchOrg
| Flow::SwitchMerchant
+ | Flow::SwitchMerchantV2
+ | Flow::SwitchProfile
| Flow::UserMerchantAccountCreate
| Flow::GenerateSampleData
| Flow::DeleteSampleData
@@ -258,7 +261,6 @@ impl From<Flow> for ApiIdentifier {
| Flow::AcceptInvitation
| Flow::MerchantSelect
| Flow::DeleteUserRole
- | Flow::TransferOrgOwnership
| Flow::CreateRole
| Flow::UpdateRole
| Flow::UserFromEmail => Self::UserRole,
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 39ec3a24ff2..c52c5d1321c 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -240,7 +240,7 @@ pub async fn internal_user_signup(
pub async fn switch_merchant_id(
state: web::Data<AppState>,
http_req: HttpRequest,
- json_payload: web::Json<user_api::SwitchMerchantIdRequest>,
+ json_payload: web::Json<user_api::SwitchMerchantRequest>,
) -> HttpResponse {
let flow = Flow::SwitchMerchant;
Box::pin(api::server_wrap(
@@ -969,3 +969,59 @@ pub async fn list_profiles_for_user_in_org_and_merchant(
))
.await
}
+
+pub async fn switch_org_for_user(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<user_api::SwitchOrganizationRequest>,
+) -> HttpResponse {
+ let flow = Flow::SwitchOrg;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &http_req,
+ json_payload.into_inner(),
+ |state, user, req, _| user_core::switch_org_for_user(state, req, user),
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn switch_merchant_for_user_in_org(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<user_api::SwitchMerchantRequest>,
+) -> HttpResponse {
+ let flow = Flow::SwitchMerchantV2;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &http_req,
+ json_payload.into_inner(),
+ |state, user, req, _| user_core::switch_merchant_for_user_in_org(state, req, user),
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn switch_profile_for_user_in_org_and_merchant(
+ state: web::Data<AppState>,
+ http_req: HttpRequest,
+ json_payload: web::Json<user_api::SwitchProfileRequest>,
+) -> HttpResponse {
+ let flow = Flow::SwitchProfile;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &http_req,
+ json_payload.into_inner(),
+ |state, user, req, _| {
+ user_core::switch_profile_for_user_in_org_and_merchant(state, req, user)
+ },
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 30a0e1ca788..b2170e7294a 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -108,16 +108,16 @@ pub async fn generate_jwt_auth_token_without_profile(
Ok(Secret::new(token))
}
-pub async fn generate_jwt_auth_token_with_custom_role_attributes(
+pub async fn generate_jwt_auth_token_with_attributes(
state: &SessionState,
- user: &UserFromStorage,
+ user_id: String,
merchant_id: id_type::MerchantId,
org_id: id_type::OrganizationId,
role_id: String,
profile_id: Option<id_type::ProfileId>,
) -> UserResult<Secret<String>> {
let token = AuthToken::new_token(
- user.get_user_id().to_string(),
+ user_id,
merchant_id,
role_id,
&state.conf,
diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs
index 792a79c91eb..1791b5308b4 100644
--- a/crates/router/src/utils/user_role.rs
+++ b/crates/router/src/utils/user_role.rs
@@ -128,6 +128,18 @@ pub async fn set_role_permissions_in_cache_by_user_role(
.is_ok()
}
+pub async fn set_role_permissions_in_cache_by_role_id_merchant_id_org_id(
+ state: &SessionState,
+ role_id: &str,
+ merchant_id: &id_type::MerchantId,
+ org_id: &id_type::OrganizationId,
+) -> bool {
+ set_role_permissions_in_cache_if_required(state, role_id, merchant_id, org_id)
+ .await
+ .map_err(|e| logger::error!("Error setting permissions in cache {:?}", e))
+ .is_ok()
+}
+
pub async fn set_role_permissions_in_cache_if_required(
state: &SessionState,
role_id: &str,
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 4fbbfdf5518..88eec0f791a 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -352,8 +352,14 @@ pub enum Flow {
VerifyPaymentConnector,
/// Internal user signup
InternalUserSignup,
+ /// Switch org
+ SwitchOrg,
/// Switch merchant
SwitchMerchant,
+ /// Switch merchant v2
+ SwitchMerchantV2,
+ /// Switch profile
+ SwitchProfile,
/// Get permission info
GetAuthorizationInfo,
/// Get Roles info
@@ -366,8 +372,6 @@ pub enum Flow {
GetRoleFromToken,
/// Update user role
UpdateUserRole,
- /// Transfer organization ownership
- TransferOrgOwnership,
/// Create merchant account for user in a org
UserMerchantAccountCreate,
/// Generate Sample Data
|
feat
|
support switch for new hierarchy (#5692)
|
27ae437a88492bf5b17ad2fbf4a083891602c07a
|
2024-05-16 18:50:40
|
YongJoon Kim
|
refactor(cards,router): Remove duplicated card number interface (#4404)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index e045cf2c42d..dd7791ee2d2 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -361,7 +361,7 @@ impl From<CardDetailFromLocker> for payments::AdditionalCardInfo {
card_isin: item.card_isin,
card_extended_bin: item
.card_number
- .map(|card_number| card_number.get_card_extended_bin()),
+ .map(|card_number| card_number.get_extended_card_bin()),
card_exp_month: item.expiry_month,
card_exp_year: item.expiry_year,
card_holder_name: item.card_holder_name,
diff --git a/crates/cards/src/validate.rs b/crates/cards/src/validate.rs
index 08ad127047c..5a71aaa7863 100644
--- a/crates/cards/src/validate.rs
+++ b/crates/cards/src/validate.rs
@@ -24,7 +24,6 @@ impl CardNumber {
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>()
}
@@ -42,9 +41,6 @@ impl CardNumber {
.rev()
.collect::<String>()
}
- pub fn get_card_extended_bin(self) -> String {
- self.0.peek().chars().take(8).collect::<String>()
- }
}
impl FromStr for CardNumber {
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 1789c3c3fad..38acf574a7c 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3719,7 +3719,7 @@ pub async fn get_additional_payment_data(
let card_extended_bin = match enable_extended_bin {
Some(config) if config.config == "true" => {
- Some(card_data.card_number.clone().get_card_extended_bin())
+ Some(card_data.card_number.clone().get_extended_card_bin())
}
_ => None,
};
|
refactor
|
Remove duplicated card number interface (#4404)
|
64fa21eb4fb265e122f97aaae7445fabd571be23
|
2023-05-04 19:24:34
|
ItsMeShashank
|
refactor(router): nest the straight through algorithm column in payment attempt (#1040)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 321e402c34a..0935e38b2e4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2949,7 +2949,7 @@ dependencies = [
[[package]]
name = "opentelemetry"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"opentelemetry_api",
"opentelemetry_sdk",
@@ -2958,7 +2958,7 @@ dependencies = [
[[package]]
name = "opentelemetry-otlp"
version = "0.11.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"async-trait",
"futures",
@@ -2975,7 +2975,7 @@ dependencies = [
[[package]]
name = "opentelemetry-proto"
version = "0.1.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"futures",
"futures-util",
@@ -2987,7 +2987,7 @@ dependencies = [
[[package]]
name = "opentelemetry_api"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"fnv",
"futures-channel",
@@ -3002,7 +3002,7 @@ dependencies = [
[[package]]
name = "opentelemetry_sdk"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"async-trait",
"crossbeam-channel",
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 52524aea8c3..f943d536e12 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -263,6 +263,40 @@ pub enum RoutingAlgorithm {
Single(api_enums::RoutableConnectors),
}
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(
+ tag = "type",
+ content = "data",
+ rename_all = "snake_case",
+ from = "StraightThroughAlgorithmSerde",
+ into = "StraightThroughAlgorithmSerde"
+)]
+pub enum StraightThroughAlgorithm {
+ Single(api_enums::RoutableConnectors),
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum StraightThroughAlgorithmSerde {
+ Direct(StraightThroughAlgorithm),
+ Nested { algorithm: StraightThroughAlgorithm },
+}
+
+impl From<StraightThroughAlgorithmSerde> for StraightThroughAlgorithm {
+ fn from(value: StraightThroughAlgorithmSerde) -> Self {
+ match value {
+ StraightThroughAlgorithmSerde::Direct(algorithm) => algorithm,
+ StraightThroughAlgorithmSerde::Nested { algorithm } => algorithm,
+ }
+ }
+}
+
+impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
+ fn from(value: StraightThroughAlgorithm) -> Self {
+ Self::Nested { algorithm: value }
+ }
+}
+
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct PrimaryBusinessDetails {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index fbd8dba8ffd..a22f91ba215 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1079,8 +1079,8 @@ where
.attach_printable("Invalid straight through algorithm format in payment attempt")?,
};
- let request_straight_through: Option<api::RoutingAlgorithm> = request_straight_through
- .map(|val| val.parse_value("RoutingAlgorithm"))
+ let request_straight_through: Option<api::StraightThroughAlgorithm> = request_straight_through
+ .map(|val| val.parse_value("StraightThroughAlgorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid straight through routing rules format")?;
@@ -1108,7 +1108,7 @@ where
pub fn decide_connector(
state: &AppState,
merchant_account: &storage::MerchantAccount,
- request_straight_through: Option<api::RoutingAlgorithm>,
+ request_straight_through: Option<api::StraightThroughAlgorithm>,
routing_data: &mut storage::RoutingData,
) -> RouterResult<api::ConnectorCallType> {
if let Some(ref connector_name) = routing_data.routed_through {
@@ -1125,7 +1125,7 @@ pub fn decide_connector(
if let Some(routing_algorithm) = request_straight_through {
let connector_name = match &routing_algorithm {
- api::RoutingAlgorithm::Single(conn) => conn.to_string(),
+ api::StraightThroughAlgorithm::Single(conn) => conn.to_string(),
};
let connector_data = api::ConnectorData::get_connector_by_name(
@@ -1143,7 +1143,7 @@ pub fn decide_connector(
if let Some(ref routing_algorithm) = routing_data.algorithm {
let connector_name = match routing_algorithm {
- api::RoutingAlgorithm::Single(conn) => conn.to_string(),
+ api::StraightThroughAlgorithm::Single(conn) => conn.to_string(),
};
let connector_data = api::ConnectorData::get_connector_by_name(
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 9cfd4ea2145..0a49d01e1ae 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -2,8 +2,8 @@ pub use api_models::admin::{
MerchantAccountCreate, MerchantAccountDeleteResponse, MerchantAccountResponse,
MerchantAccountUpdate, MerchantConnectorCreate, MerchantConnectorDeleteResponse,
MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId, MerchantDetails,
- MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, ToggleKVRequest, ToggleKVResponse,
- WebhookDetails,
+ MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, StraightThroughAlgorithm, ToggleKVRequest,
+ ToggleKVResponse, WebhookDetails,
};
use common_utils::ext_traits::ValueExt;
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 6171bf6dded..bb14bbad818 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -5,7 +5,7 @@ pub use storage_models::payment_attempt::{
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RoutingData {
pub routed_through: Option<String>,
- pub algorithm: Option<api_models::admin::RoutingAlgorithm>,
+ pub algorithm: Option<api_models::admin::StraightThroughAlgorithm>,
}
#[cfg(feature = "kv_store")]
diff --git a/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/down.sql b/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/down.sql
new file mode 100644
index 00000000000..192e9514498
--- /dev/null
+++ b/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/down.sql
@@ -0,0 +1,7 @@
+-- This file should undo anything in `up.sql`
+UPDATE payment_attempt
+SET straight_through_algorithm = CASE WHEN straight_through_algorithm->>'algorithm' IS NULL THEN
+ NULL
+ELSE
+ straight_through_algorithm->'algorithm'
+END;
diff --git a/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/up.sql b/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/up.sql
new file mode 100644
index 00000000000..63683b59245
--- /dev/null
+++ b/migrations/2023-05-03-121025_nest_straight_through_col_in_payment_attempt/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+UPDATE payment_attempt
+SET straight_through_algorithm = jsonb_build_object('algorithm', straight_through_algorithm);
|
refactor
|
nest the straight through algorithm column in payment attempt (#1040)
|
2bee694d5bb7393c11817bbee26b459609f6dd8c
|
2024-07-26 15:41:27
|
DEEPANSHU BANSAL
|
feat(connector): [FISERV] Move connector to hyperswitch_connectors (#5441)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index c5eac1ef868..45556ef401e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3836,6 +3836,7 @@ version = "0.1.0"
dependencies = [
"api_models",
"async-trait",
+ "base64 0.22.0",
"cards",
"common_enums",
"common_utils",
@@ -3843,10 +3844,13 @@ dependencies = [
"hyperswitch_domain_models",
"hyperswitch_interfaces",
"masking",
+ "ring 0.17.8",
"router_env",
"serde",
"serde_json",
"strum 0.26.2",
+ "time",
+ "uuid",
]
[[package]]
diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml
index 0e620c6b9f0..30671d43bd9 100644
--- a/crates/hyperswitch_connectors/Cargo.toml
+++ b/crates/hyperswitch_connectors/Cargo.toml
@@ -11,10 +11,14 @@ payouts = ["hyperswitch_domain_models/payouts", "api_models/payouts", "hyperswit
[dependencies]
async-trait = "0.1.79"
+base64 = "0.22.0"
error-stack = "0.4.1"
+ring = "0.17.8"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115"
strum = { version = "0.26", features = ["derive"] }
+time = "0.3.35"
+uuid = { version = "1.8.0", features = ["v4"] }
# First party crates
api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] , default-features = false}
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index a2d78ede2b9..0481939feb4 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -1,2 +1,4 @@
+pub mod fiserv;
pub mod helcim;
-pub use self::helcim::Helcim;
+
+pub use self::{fiserv::Fiserv, helcim::Helcim};
diff --git a/crates/router/src/connector/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
similarity index 67%
rename from crates/router/src/connector/fiserv.rs
rename to crates/hyperswitch_connectors/src/connectors/fiserv.rs
index 75147fe780c..fc67cd2fde7 100644
--- a/crates/router/src/connector/fiserv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
@@ -3,34 +3,45 @@ pub mod transformers;
use std::fmt::Debug;
use base64::Engine;
-use common_utils::request::RequestContent;
-use diesel_models::enums;
+use common_enums::enums;
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+};
use error_stack::{report, ResultExt};
-use masking::{ExposeInterface, PeekInterface};
+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, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
+ configs::Connectors,
+ consts, errors,
+ events::connector_api_logs::ConnectorEvent,
+ types, webhooks,
+};
+use masking::{ExposeInterface, Mask, PeekInterface};
use ring::hmac;
use time::OffsetDateTime;
use transformers as fiserv;
use uuid::Uuid;
-use crate::{
- configs::settings,
- connector::utils as connector_utils,
- consts,
- core::errors::{self, CustomResult},
- events::connector_api_logs::ConnectorEvent,
- headers, logger,
- services::{
- self,
- api::ConnectorIntegration,
- request::{self, Mask},
- ConnectorValidation,
- },
- types::{
- self,
- api::{self, ConnectorCommon, ConnectorCommonExt},
- },
- utils::BytesExt,
-};
+use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Debug, Clone)]
pub struct Fiserv;
@@ -51,8 +62,8 @@ impl Fiserv {
let raw_signature = format!("{}{request_id}{timestamp}{payload}", api_key.peek());
let key = hmac::Key::new(hmac::HMAC_SHA256, api_secret.expose().as_bytes());
- let signature_value =
- consts::BASE64_ENGINE.encode(hmac::sign(&key, raw_signature.as_bytes()).as_ref());
+ let signature_value = common_utils::consts::BASE64_ENGINE
+ .encode(hmac::sign(&key, raw_signature.as_bytes()).as_ref());
Ok(signature_value)
}
}
@@ -63,9 +74,9 @@ where
{
fn build_headers(
&self,
- req: &types::RouterData<Flow, Request, Response>,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &RouterData<Flow, Request, Response>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let timestamp = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000;
let auth: fiserv::FiservAuthType =
fiserv::FiservAuthType::try_from(&req.connector_auth_type)?;
@@ -112,13 +123,13 @@ impl ConnectorCommon for Fiserv {
"application/json"
}
- fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.fiserv.base_url.as_ref()
}
fn get_auth_header(
&self,
- auth_type: &types::ConnectorAuthType,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = fiserv::FiservAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
@@ -130,7 +141,7 @@ impl ConnectorCommon for Fiserv {
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: fiserv::ErrorResponse = res
.response
.parse_struct("Fiserv ErrorResponse")
@@ -144,21 +155,19 @@ impl ConnectorCommon for Fiserv {
Ok(error
.or(details)
.and_then(|error_details| {
- error_details
- .first()
- .map(|first_error| types::ErrorResponse {
- code: first_error
- .code
- .to_owned()
- .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
- message: first_error.message.to_owned(),
- reason: first_error.field.to_owned(),
- status_code: res.status_code,
- attempt_status: None,
- connector_transaction_id: None,
- })
+ error_details.first().map(|first_error| ErrorResponse {
+ code: first_error
+ .code
+ .to_owned()
+ .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
+ message: first_error.message.to_owned(),
+ reason: first_error.field.to_owned(),
+ status_code: res.status_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
})
- .unwrap_or(types::ErrorResponse {
+ .unwrap_or(ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(),
message: consts::NO_ERROR_MESSAGE.to_string(),
reason: None,
@@ -179,7 +188,7 @@ impl ConnectorValidation for Fiserv {
match capture_method {
enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()),
enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
- connector_utils::construct_not_implemented_error_report(capture_method, self.id()),
+ utils::construct_not_implemented_error_report(capture_method, self.id()),
),
}
}
@@ -187,9 +196,7 @@ impl ConnectorValidation for Fiserv {
impl api::ConnectorAccessToken for Fiserv {}
-impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
- for Fiserv
-{
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Fiserv {
// Not Implemented (R)
}
@@ -197,12 +204,8 @@ impl api::Payment for Fiserv {}
impl api::PaymentToken for Fiserv {}
-impl
- ConnectorIntegration<
- api::PaymentMethodToken,
- types::PaymentMethodTokenizationData,
- types::PaymentsResponseData,
- > for Fiserv
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Fiserv
{
// Not Implemented (R)
}
@@ -210,22 +213,12 @@ impl
impl api::MandateSetup for Fiserv {}
#[allow(dead_code)]
-impl
- ConnectorIntegration<
- api::SetupMandate,
- types::SetupMandateRequestData,
- types::PaymentsResponseData,
- > for Fiserv
-{
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Fiserv {
fn build_request(
&self,
- _req: &types::RouterData<
- api::SetupMandate,
- types::SetupMandateRequestData,
- types::PaymentsResponseData,
- >,
- _connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
Err(
errors::ConnectorError::NotImplemented("Setup Mandate flow for Fiserv".to_string())
.into(),
@@ -236,14 +229,12 @@ impl
impl api::PaymentVoid for Fiserv {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
- for Fiserv
-{
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::PaymentsCancelRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -253,8 +244,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
fn get_url(
&self,
- _req: &types::PaymentsCancelRouterData,
- connectors: &settings::Connectors,
+ _req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
//The docs has this url wrong, cancels is the working endpoint
@@ -265,8 +256,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
fn get_request_body(
&self,
- req: &types::PaymentsCancelRouterData,
- _connectors: &settings::Connectors,
+ req: &PaymentsCancelRouterData,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = fiserv::FiservCancelRequest::try_from(req)?;
Ok(RequestContent::Json(Box::new(connector_req)))
@@ -274,12 +265,12 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
fn build_request(
&self,
- req: &types::PaymentsCancelRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
- services::RequestBuilder::new()
- .method(services::Method::Post)
+ RequestBuilder::new()
+ .method(Method::Post)
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
@@ -294,17 +285,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
fn handle_response(
&self,
- data: &types::PaymentsCancelRouterData,
+ data: &PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {
+ ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
let response: fiserv::FiservPaymentsResponse = res
.response
.parse_struct("Fiserv PaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -316,7 +307,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
@@ -324,14 +315,12 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
impl api::PaymentSync for Fiserv {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
- for Fiserv
-{
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::PaymentsSyncRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -341,8 +330,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
fn get_url(
&self,
- _req: &types::PaymentsSyncRouterData,
- connectors: &settings::Connectors,
+ _req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}ch/payments/v1/transaction-inquiry",
@@ -352,8 +341,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
fn get_request_body(
&self,
- req: &types::PaymentsSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = fiserv::FiservSyncRequest::try_from(req)?;
Ok(RequestContent::Json(Box::new(connector_req)))
@@ -361,12 +350,12 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
fn build_request(
&self,
- req: &types::PaymentsSyncRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
- services::RequestBuilder::new()
- .method(services::Method::Post)
+ RequestBuilder::new()
+ .method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
@@ -380,17 +369,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
fn handle_response(
&self,
- data: &types::PaymentsSyncRouterData,
+ data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: fiserv::FiservSyncResponse = res
.response
.parse_struct("Fiserv PaymentSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -402,20 +391,18 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl api::PaymentCapture for Fiserv {}
-impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
- for Fiserv
-{
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::PaymentsCaptureRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -425,8 +412,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
fn get_request_body(
&self,
- req: &types::PaymentsCaptureRouterData,
- _connectors: &settings::Connectors,
+ req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let router_obj = fiserv::FiservRouterData::try_from((
&self.get_currency_unit(),
@@ -440,12 +427,12 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
fn build_request(
&self,
- req: &types::PaymentsCaptureRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
- services::RequestBuilder::new()
- .method(services::Method::Post)
+ RequestBuilder::new()
+ .method(Method::Post)
.url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsCaptureType::get_headers(
@@ -461,10 +448,10 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
fn handle_response(
&self,
- data: &types::PaymentsCaptureRouterData,
+ data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: fiserv::FiservPaymentsResponse = res
.response
.parse_struct("Fiserv Payment Response")
@@ -473,7 +460,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -483,8 +470,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
fn get_url(
&self,
- _req: &types::PaymentsCaptureRouterData,
- connectors: &settings::Connectors,
+ _req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}ch/payments/v1/charges",
@@ -496,7 +483,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
@@ -504,21 +491,16 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
impl api::PaymentSession for Fiserv {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
- for Fiserv
-{
-}
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Fiserv {}
impl api::PaymentAuthorize for Fiserv {}
-impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
- for Fiserv
-{
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::PaymentsAuthorizeRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -528,8 +510,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_url(
&self,
- _req: &types::PaymentsAuthorizeRouterData,
- connectors: &settings::Connectors,
+ _req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}ch/payments/v1/charges",
@@ -539,8 +521,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_request_body(
&self,
- req: &types::PaymentsAuthorizeRouterData,
- _connectors: &settings::Connectors,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let router_obj = fiserv::FiservRouterData::try_from((
&self.get_currency_unit(),
@@ -554,12 +536,12 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn build_request(
&self,
- req: &types::PaymentsAuthorizeRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
- services::RequestBuilder::new()
- .method(services::Method::Post)
+ RequestBuilder::new()
+ .method(Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
@@ -578,17 +560,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn handle_response(
&self,
- data: &types::PaymentsAuthorizeRouterData,
+ data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: fiserv::FiservPaymentsResponse = res
.response
.parse_struct("Fiserv PaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -600,7 +582,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
@@ -610,12 +592,12 @@ impl api::RefundExecute for Fiserv {}
impl api::RefundSync for Fiserv {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Fiserv {
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::RefundsRouterData<api::Execute>,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ 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 {
@@ -623,8 +605,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
}
fn get_url(
&self,
- _req: &types::RefundsRouterData<api::Execute>,
- connectors: &settings::Connectors,
+ _req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}ch/payments/v1/refunds",
@@ -633,8 +615,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
}
fn get_request_body(
&self,
- req: &types::RefundsRouterData<api::Execute>,
- _connectors: &settings::Connectors,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let router_obj = fiserv::FiservRouterData::try_from((
&self.get_currency_unit(),
@@ -647,11 +629,11 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
}
fn build_request(
&self,
- req: &types::RefundsRouterData<api::Execute>,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
- let request = services::RequestBuilder::new()
- .method(services::Method::Post)
+ 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(
@@ -666,18 +648,18 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
fn handle_response(
&self,
- data: &types::RefundsRouterData<api::Execute>,
+ data: &RefundsRouterData<Execute>,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
- logger::debug!(target: "router::connector::fiserv", response=?res);
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ router_env::logger::debug!(target: "router::connector::fiserv", response=?res);
let response: fiserv::RefundResponse =
res.response
.parse_struct("fiserv RefundResponse")
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -688,18 +670,18 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
#[allow(dead_code)]
-impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Fiserv {
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Fiserv {
fn get_headers(
&self,
- req: &types::RefundSyncRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -709,8 +691,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
fn get_url(
&self,
- _req: &types::RefundSyncRouterData,
- connectors: &settings::Connectors,
+ _req: &RefundSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}ch/payments/v1/transaction-inquiry",
@@ -720,8 +702,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
fn get_request_body(
&self,
- req: &types::RefundSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &RefundSyncRouterData,
+ _connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = fiserv::FiservSyncRequest::try_from(req)?;
Ok(RequestContent::Json(Box::new(connector_req)))
@@ -729,12 +711,12 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
fn build_request(
&self,
- req: &types::RefundSyncRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
- services::RequestBuilder::new()
- .method(services::Method::Post)
+ RequestBuilder::new()
+ .method(Method::Post)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
@@ -748,11 +730,11 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
fn handle_response(
&self,
- data: &types::RefundSyncRouterData,
+ data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: types::Response,
- ) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
- logger::debug!(target: "router::connector::fiserv", response=?res);
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ router_env::logger::debug!(target: "router::connector::fiserv", response=?res);
let response: fiserv::FiservSyncResponse = res
.response
@@ -760,7 +742,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
+ RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -772,30 +754,30 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
&self,
res: types::Response,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
#[async_trait::async_trait]
-impl api::IncomingWebhook for Fiserv {
+impl webhooks::IncomingWebhook for Fiserv {
fn get_webhook_object_reference_id(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
fn get_webhook_event_type(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
- ) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Ok(api::IncomingWebhookEvent::EventNotSupported)
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
fn get_webhook_resource_object(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
similarity index 88%
rename from crates/router/src/connector/fiserv/transformers.rs
rename to crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
index 1a149c6af78..0ae59d4526e 100644
--- a/crates/router/src/connector/fiserv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
@@ -1,15 +1,24 @@
+use common_enums::enums;
use common_utils::{ext_traits::ValueExt, pii};
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_response_types::{PaymentsResponseData, RefundsResponseData},
+ types,
+};
+use hyperswitch_interfaces::{api, errors};
+use masking::Secret;
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::{
+ types::{RefundsResponseRouterData, ResponseRouterData},
+ utils::{
self, CardData as CardDataUtil, PaymentsCancelRequestData, PaymentsSyncRequestData,
- RouterData,
+ RouterData as _,
},
- core::errors,
- pii::Secret,
- types::{self, api, domain, storage::enums},
};
#[derive(Debug, Serialize)]
@@ -166,7 +175,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP
pos_condition_code: TransactionInteractionPosConditionCode::CardNotPresentEcom,
};
let source = match item.router_data.request.payment_method_data.clone() {
- domain::PaymentMethodData::Card(ref ccard) => {
+ PaymentMethodData::Card(ref ccard) => {
let card = CardData {
card_data: ccard.card_number.clone(),
expiration_month: ccard.card_exp_month.clone(),
@@ -175,21 +184,21 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP
};
Source::PaymentCard { card }
}
- domain::PaymentMethodData::Wallet(_)
- | domain::PaymentMethodData::PayLater(_)
- | domain::PaymentMethodData::BankRedirect(_)
- | domain::PaymentMethodData::BankDebit(_)
- | domain::PaymentMethodData::CardRedirect(_)
- | domain::PaymentMethodData::BankTransfer(_)
- | domain::PaymentMethodData::Crypto(_)
- | domain::PaymentMethodData::MandatePayment
- | domain::PaymentMethodData::Reward
- | domain::PaymentMethodData::RealTimePayment(_)
- | domain::PaymentMethodData::Upi(_)
- | domain::PaymentMethodData::Voucher(_)
- | domain::PaymentMethodData::GiftCard(_)
- | domain::PaymentMethodData::OpenBanking(_)
- | domain::PaymentMethodData::CardToken(_) => {
+ PaymentMethodData::Wallet(_)
+ | PaymentMethodData::PayLater(_)
+ | PaymentMethodData::BankRedirect(_)
+ | PaymentMethodData::BankDebit(_)
+ | PaymentMethodData::CardRedirect(_)
+ | PaymentMethodData::BankTransfer(_)
+ | PaymentMethodData::Crypto(_)
+ | PaymentMethodData::MandatePayment
+ | PaymentMethodData::Reward
+ | PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::Upi(_)
+ | PaymentMethodData::Voucher(_)
+ | PaymentMethodData::GiftCard(_)
+ | PaymentMethodData::OpenBanking(_)
+ | PaymentMethodData::CardToken(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("fiserv"),
))
@@ -211,10 +220,10 @@ pub struct FiservAuthType {
pub(super) api_secret: Secret<String>,
}
-impl TryFrom<&types::ConnectorAuthType> for FiservAuthType {
+impl TryFrom<&ConnectorAuthType> for FiservAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
- if let types::ConnectorAuthType::SignatureKey {
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ if let ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
@@ -348,20 +357,19 @@ pub struct TransactionProcessingDetails {
transaction_id: String,
}
-impl<F, T>
- TryFrom<types::ResponseRouterData<F, FiservPaymentsResponse, T, types::PaymentsResponseData>>
- for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F, T> TryFrom<ResponseRouterData<F, FiservPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::ResponseRouterData<F, FiservPaymentsResponse, T, types::PaymentsResponseData>,
+ item: ResponseRouterData<F, FiservPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let gateway_resp = item.response.gateway_response;
Ok(Self {
status: enums::AttemptStatus::from(gateway_resp.transaction_state),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
gateway_resp.transaction_processing_details.transaction_id,
),
redirection_data: None,
@@ -379,12 +387,12 @@ impl<F, T>
}
}
-impl<F, T> TryFrom<types::ResponseRouterData<F, FiservSyncResponse, T, types::PaymentsResponseData>>
- for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F, T> TryFrom<ResponseRouterData<F, FiservSyncResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::ResponseRouterData<F, FiservSyncResponse, T, types::PaymentsResponseData>,
+ item: ResponseRouterData<F, FiservSyncResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let gateway_resp = match item.response.sync_responses.first() {
Some(gateway_response) => gateway_response,
@@ -395,8 +403,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, FiservSyncResponse, T, types::Pa
status: enums::AttemptStatus::from(
gateway_resp.gateway_response.transaction_state.clone(),
),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
gateway_resp
.gateway_response
.transaction_processing_details
@@ -590,15 +598,15 @@ pub struct RefundResponse {
gateway_response: GatewayResponse,
}
-impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
- for types::RefundsRouterData<api::Execute>
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
+ for types::RefundsRouterData<Execute>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
- response: Ok(types::RefundsResponseData {
+ response: Ok(RefundsResponseData {
connector_refund_id: item
.response
.gateway_response
@@ -613,12 +621,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
}
}
-impl TryFrom<types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>>
- for types::RefundsRouterData<api::RSync>
+impl TryFrom<RefundsResponseRouterData<RSync, FiservSyncResponse>>
+ for types::RefundsRouterData<RSync>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>,
+ item: RefundsResponseRouterData<RSync, FiservSyncResponse>,
) -> Result<Self, Self::Error> {
let gateway_resp = item
.response
@@ -626,7 +634,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>>
.first()
.ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
Ok(Self {
- response: Ok(types::RefundsResponseData {
+ response: Ok(RefundsResponseData {
connector_refund_id: gateway_resp
.gateway_response
.transaction_processing_details
diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs
index 9f5285bd2e1..8a5a2ff543a 100644
--- a/crates/hyperswitch_connectors/src/constants.rs
+++ b/crates/hyperswitch_connectors/src/constants.rs
@@ -1,6 +1,9 @@
/// Header Constants
pub(crate) mod headers {
+ pub(crate) const API_KEY: &str = "API-KEY";
pub(crate) const API_TOKEN: &str = "Api-Token";
+ pub(crate) const AUTHORIZATION: &str = "Authorization";
pub(crate) const CONTENT_TYPE: &str = "Content-Type";
pub(crate) const IDEMPOTENCY_KEY: &str = "Idempotency-Key";
+ pub(crate) const TIMESTAMP: &str = "Timestamp";
}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 2273b8c31da..d8e2e121318 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -81,7 +81,7 @@ macro_rules! default_imp_for_authorize_session_token {
};
}
-default_imp_for_authorize_session_token!(connectors::Helcim);
+default_imp_for_authorize_session_token!(connectors::Fiserv, connectors::Helcim);
use crate::connectors;
macro_rules! default_imp_for_complete_authorize {
@@ -99,7 +99,7 @@ macro_rules! default_imp_for_complete_authorize {
};
}
-default_imp_for_complete_authorize!(connectors::Helcim);
+default_imp_for_complete_authorize!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_incremental_authorization {
($($path:ident::$connector:ident),*) => {
@@ -116,7 +116,7 @@ macro_rules! default_imp_for_incremental_authorization {
};
}
-default_imp_for_incremental_authorization!(connectors::Helcim);
+default_imp_for_incremental_authorization!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_create_customer {
($($path:ident::$connector:ident),*) => {
@@ -133,7 +133,7 @@ macro_rules! default_imp_for_create_customer {
};
}
-default_imp_for_create_customer!(connectors::Helcim);
+default_imp_for_create_customer!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_pre_processing_steps{
($($path:ident::$connector:ident),*)=> {
@@ -150,7 +150,7 @@ macro_rules! default_imp_for_pre_processing_steps{
};
}
-default_imp_for_pre_processing_steps!(connectors::Helcim);
+default_imp_for_pre_processing_steps!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_post_processing_steps{
($($path:ident::$connector:ident),*)=> {
@@ -167,7 +167,7 @@ macro_rules! default_imp_for_post_processing_steps{
};
}
-default_imp_for_post_processing_steps!(connectors::Helcim);
+default_imp_for_post_processing_steps!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_approve {
($($path:ident::$connector:ident),*) => {
@@ -184,7 +184,7 @@ macro_rules! default_imp_for_approve {
};
}
-default_imp_for_approve!(connectors::Helcim);
+default_imp_for_approve!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_reject {
($($path:ident::$connector:ident),*) => {
@@ -201,7 +201,7 @@ macro_rules! default_imp_for_reject {
};
}
-default_imp_for_reject!(connectors::Helcim);
+default_imp_for_reject!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_webhook_source_verification {
($($path:ident::$connector:ident),*) => {
@@ -218,7 +218,7 @@ macro_rules! default_imp_for_webhook_source_verification {
};
}
-default_imp_for_webhook_source_verification!(connectors::Helcim);
+default_imp_for_webhook_source_verification!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_accept_dispute {
($($path:ident::$connector:ident),*) => {
@@ -236,7 +236,7 @@ macro_rules! default_imp_for_accept_dispute {
};
}
-default_imp_for_accept_dispute!(connectors::Helcim);
+default_imp_for_accept_dispute!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_submit_evidence {
($($path:ident::$connector:ident),*) => {
@@ -253,7 +253,7 @@ macro_rules! default_imp_for_submit_evidence {
};
}
-default_imp_for_submit_evidence!(connectors::Helcim);
+default_imp_for_submit_evidence!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_defend_dispute {
($($path:ident::$connector:ident),*) => {
@@ -270,7 +270,7 @@ macro_rules! default_imp_for_defend_dispute {
};
}
-default_imp_for_defend_dispute!(connectors::Helcim);
+default_imp_for_defend_dispute!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_file_upload {
($($path:ident::$connector:ident),*) => {
@@ -296,7 +296,7 @@ macro_rules! default_imp_for_file_upload {
};
}
-default_imp_for_file_upload!(connectors::Helcim);
+default_imp_for_file_upload!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_create {
@@ -315,7 +315,7 @@ macro_rules! default_imp_for_payouts_create {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_create!(connectors::Helcim);
+default_imp_for_payouts_create!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_retrieve {
@@ -334,7 +334,7 @@ macro_rules! default_imp_for_payouts_retrieve {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_retrieve!(connectors::Helcim);
+default_imp_for_payouts_retrieve!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_eligibility {
@@ -353,7 +353,7 @@ macro_rules! default_imp_for_payouts_eligibility {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_eligibility!(connectors::Helcim);
+default_imp_for_payouts_eligibility!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_fulfill {
@@ -372,7 +372,7 @@ macro_rules! default_imp_for_payouts_fulfill {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_fulfill!(connectors::Helcim);
+default_imp_for_payouts_fulfill!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_cancel {
@@ -391,7 +391,7 @@ macro_rules! default_imp_for_payouts_cancel {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_cancel!(connectors::Helcim);
+default_imp_for_payouts_cancel!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_quote {
@@ -410,7 +410,7 @@ macro_rules! default_imp_for_payouts_quote {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_quote!(connectors::Helcim);
+default_imp_for_payouts_quote!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_recipient {
@@ -429,7 +429,7 @@ macro_rules! default_imp_for_payouts_recipient {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_recipient!(connectors::Helcim);
+default_imp_for_payouts_recipient!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_payouts_recipient_account {
@@ -448,7 +448,7 @@ macro_rules! default_imp_for_payouts_recipient_account {
}
#[cfg(feature = "payouts")]
-default_imp_for_payouts_recipient_account!(connectors::Helcim);
+default_imp_for_payouts_recipient_account!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_frm_sale {
@@ -467,7 +467,7 @@ macro_rules! default_imp_for_frm_sale {
}
#[cfg(feature = "frm")]
-default_imp_for_frm_sale!(connectors::Helcim);
+default_imp_for_frm_sale!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_frm_checkout {
@@ -486,7 +486,7 @@ macro_rules! default_imp_for_frm_checkout {
}
#[cfg(feature = "frm")]
-default_imp_for_frm_checkout!(connectors::Helcim);
+default_imp_for_frm_checkout!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_frm_transaction {
@@ -505,7 +505,7 @@ macro_rules! default_imp_for_frm_transaction {
}
#[cfg(feature = "frm")]
-default_imp_for_frm_transaction!(connectors::Helcim);
+default_imp_for_frm_transaction!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_frm_fulfillment {
@@ -524,7 +524,7 @@ macro_rules! default_imp_for_frm_fulfillment {
}
#[cfg(feature = "frm")]
-default_imp_for_frm_fulfillment!(connectors::Helcim);
+default_imp_for_frm_fulfillment!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_frm_record_return {
@@ -543,7 +543,7 @@ macro_rules! default_imp_for_frm_record_return {
}
#[cfg(feature = "frm")]
-default_imp_for_frm_record_return!(connectors::Helcim);
+default_imp_for_frm_record_return!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_revoking_mandates {
($($path:ident::$connector:ident),*) => {
@@ -559,4 +559,4 @@ macro_rules! default_imp_for_revoking_mandates {
};
}
-default_imp_for_revoking_mandates!(connectors::Helcim);
+default_imp_for_revoking_mandates!(connectors::Fiserv, connectors::Helcim);
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index df72d3d9c48..f420447fd74 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -180,7 +180,7 @@ macro_rules! default_imp_for_new_connector_integration_payment {
};
}
-default_imp_for_new_connector_integration_payment!(connectors::Helcim);
+default_imp_for_new_connector_integration_payment!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_new_connector_integration_refund {
($($path:ident::$connector:ident),*) => {
@@ -198,7 +198,7 @@ macro_rules! default_imp_for_new_connector_integration_refund {
};
}
-default_imp_for_new_connector_integration_refund!(connectors::Helcim);
+default_imp_for_new_connector_integration_refund!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_new_connector_integration_connector_access_token {
($($path:ident::$connector:ident),*) => {
@@ -211,7 +211,10 @@ macro_rules! default_imp_for_new_connector_integration_connector_access_token {
};
}
-default_imp_for_new_connector_integration_connector_access_token!(connectors::Helcim);
+default_imp_for_new_connector_integration_connector_access_token!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
macro_rules! default_imp_for_new_connector_integration_accept_dispute {
($($path:ident::$connector:ident),*) => {
@@ -230,7 +233,7 @@ macro_rules! default_imp_for_new_connector_integration_accept_dispute {
};
}
-default_imp_for_new_connector_integration_accept_dispute!(connectors::Helcim);
+default_imp_for_new_connector_integration_accept_dispute!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_new_connector_integration_submit_evidence {
($($path:ident::$connector:ident),*) => {
@@ -248,7 +251,7 @@ macro_rules! default_imp_for_new_connector_integration_submit_evidence {
};
}
-default_imp_for_new_connector_integration_submit_evidence!(connectors::Helcim);
+default_imp_for_new_connector_integration_submit_evidence!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_new_connector_integration_defend_dispute {
($($path:ident::$connector:ident),*) => {
@@ -266,7 +269,7 @@ macro_rules! default_imp_for_new_connector_integration_defend_dispute {
};
}
-default_imp_for_new_connector_integration_defend_dispute!(connectors::Helcim);
+default_imp_for_new_connector_integration_defend_dispute!(connectors::Fiserv, connectors::Helcim);
macro_rules! default_imp_for_new_connector_integration_file_upload {
($($path:ident::$connector:ident),*) => {
@@ -294,7 +297,7 @@ macro_rules! default_imp_for_new_connector_integration_file_upload {
};
}
-default_imp_for_new_connector_integration_file_upload!(connectors::Helcim);
+default_imp_for_new_connector_integration_file_upload!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_create {
@@ -314,7 +317,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_create {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_create!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_create!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_eligibility {
@@ -334,7 +337,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_eligibility {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_eligibility!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_eligibility!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_fulfill {
@@ -354,7 +360,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_fulfill {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_fulfill!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_fulfill!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_cancel {
@@ -374,7 +380,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_cancel {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_cancel!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_cancel!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_quote {
@@ -394,7 +400,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_quote {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_quote!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_quote!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_recipient {
@@ -414,7 +420,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_recipient {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_recipient!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_recipient!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_sync {
@@ -434,7 +443,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_sync {
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_sync!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_sync!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_recipient_account {
@@ -454,7 +463,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_recipient_account
}
#[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_recipient_account!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_recipient_account!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
macro_rules! default_imp_for_new_connector_integration_webhook_source_verification {
($($path:ident::$connector:ident),*) => {
@@ -472,7 +484,10 @@ macro_rules! default_imp_for_new_connector_integration_webhook_source_verificati
};
}
-default_imp_for_new_connector_integration_webhook_source_verification!(connectors::Helcim);
+default_imp_for_new_connector_integration_webhook_source_verification!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_new_connector_integration_frm_sale {
@@ -492,7 +507,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_sale {
}
#[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_sale!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_sale!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_new_connector_integration_frm_checkout {
@@ -512,7 +527,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_checkout {
}
#[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_checkout!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_checkout!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_new_connector_integration_frm_transaction {
@@ -532,7 +547,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_transaction {
}
#[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_transaction!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_transaction!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_new_connector_integration_frm_fulfillment {
@@ -552,7 +567,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_fulfillment {
}
#[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_fulfillment!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_fulfillment!(connectors::Fiserv, connectors::Helcim);
#[cfg(feature = "frm")]
macro_rules! default_imp_for_new_connector_integration_frm_record_return {
@@ -572,7 +587,10 @@ macro_rules! default_imp_for_new_connector_integration_frm_record_return {
}
#[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_record_return!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_record_return!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
macro_rules! default_imp_for_new_connector_integration_revoking_mandates {
($($path:ident::$connector:ident),*) => {
@@ -589,4 +607,7 @@ macro_rules! default_imp_for_new_connector_integration_revoking_mandates {
};
}
-default_imp_for_new_connector_integration_revoking_mandates!(connectors::Helcim);
+default_imp_for_new_connector_integration_revoking_mandates!(
+ connectors::Fiserv,
+ connectors::Helcim
+);
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 0b8ecac9b07..40f98b6efdb 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1,7 +1,7 @@
use api_models::payments::{self, Address, AddressDetails, OrderDetailsWithAmount, PhoneDetails};
use common_enums::{enums, enums::FutureUsage};
use common_utils::{
- errors::ReportSwitchExt,
+ errors::{CustomResult, ReportSwitchExt},
ext_traits::{OptionExt, ValueExt},
id_type,
pii::{self, Email, IpAddress},
@@ -12,11 +12,12 @@ use hyperswitch_domain_models::{
router_data::{PaymentMethodToken, RecurringMandatePaymentData},
router_request_types::{
AuthenticationData, BrowserInformation, PaymentsAuthorizeData, PaymentsCancelData,
- PaymentsCaptureData, RefundsData, SetupMandateRequestData,
+ PaymentsCaptureData, PaymentsSyncData, RefundsData, ResponseId, SetupMandateRequestData,
},
};
use hyperswitch_interfaces::{api, errors};
use masking::{ExposeInterface, PeekInterface, Secret};
+use serde::Serializer;
type Error = error_stack::Report<errors::ConnectorError>;
@@ -31,6 +32,27 @@ pub(crate) fn construct_not_supported_error_report(
.into()
}
+pub(crate) fn get_amount_as_string(
+ currency_unit: &api::CurrencyUnit,
+ amount: i64,
+ currency: enums::Currency,
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+ let amount = match currency_unit {
+ api::CurrencyUnit::Minor => amount.to_string(),
+ api::CurrencyUnit::Base => to_currency_base_unit(amount, currency)?,
+ };
+ Ok(amount)
+}
+
+pub(crate) fn to_currency_base_unit(
+ amount: i64,
+ currency: enums::Currency,
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+ currency
+ .to_currency_base_unit(amount)
+ .change_context(errors::ConnectorError::ParsingFailed)
+}
+
pub(crate) fn get_amount_as_f64(
currency_unit: &api::CurrencyUnit,
amount: i64,
@@ -54,6 +76,18 @@ pub(crate) fn to_currency_base_unit_asf64(
.change_context(errors::ConnectorError::ParsingFailed)
}
+pub(crate) fn to_connector_meta_from_secret<T>(
+ connector_meta: Option<Secret<serde_json::Value>>,
+) -> Result<T, Error>
+where
+ T: serde::de::DeserializeOwned,
+{
+ let connector_meta_secret =
+ connector_meta.ok_or_else(missing_field_err("connector_meta_data"))?;
+ let json = connector_meta_secret.expose();
+ json.parse_value(std::any::type_name::<T>()).switch()
+}
+
pub(crate) fn missing_field_err(
message: &'static str,
) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + '_> {
@@ -65,6 +99,24 @@ pub(crate) fn missing_field_err(
})
}
+pub(crate) fn construct_not_implemented_error_report(
+ capture_method: enums::CaptureMethod,
+ connector_name: &str,
+) -> error_stack::Report<errors::ConnectorError> {
+ errors::ConnectorError::NotImplemented(format!("{} for {}", capture_method, connector_name))
+ .into()
+}
+
+pub(crate) fn str_to_f32<S>(value: &str, serializer: S) -> Result<S::Ok, S::Error>
+where
+ S: Serializer,
+{
+ let float_value = value.parse::<f64>().map_err(|_| {
+ serde::ser::Error::custom("Invalid string, cannot be converted to float value")
+ })?;
+ serializer.serialize_f64(float_value)
+}
+
pub(crate) const SELECTED_PAYMENT_METHOD: &str = "Selected payment method";
pub(crate) fn get_unimplemented_payment_method_error_message(connector: &str) -> String {
@@ -943,6 +995,33 @@ impl PaymentsCaptureRequestData for PaymentsCaptureData {
}
}
+pub trait PaymentsSyncRequestData {
+ fn is_auto_capture(&self) -> Result<bool, Error>;
+ fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError>;
+}
+
+impl PaymentsSyncRequestData for PaymentsSyncData {
+ fn is_auto_capture(&self) -> Result<bool, Error> {
+ match self.capture_method {
+ Some(enums::CaptureMethod::Automatic) | None => Ok(true),
+ Some(enums::CaptureMethod::Manual) => Ok(false),
+ Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()),
+ }
+ }
+ fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError> {
+ match self.connector_transaction_id.clone() {
+ ResponseId::ConnectorTransactionId(txn_id) => Ok(txn_id),
+ _ => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "connector_transaction_id",
+ },
+ )
+ .attach_printable("Expected connector transaction ID not found")
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
+ }
+ }
+}
+
pub trait PaymentsCancelRequestData {
fn get_amount(&self) -> Result<i64, Error>;
fn get_currency(&self) -> Result<enums::Currency, Error>;
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 365b0ca87a6..a421c931203 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -21,7 +21,6 @@ pub mod dlocal;
#[cfg(feature = "dummy_connector")]
pub mod dummyconnector;
pub mod ebanx;
-pub mod fiserv;
pub mod forte;
pub mod globalpay;
pub mod globepay;
@@ -69,7 +68,7 @@ pub mod worldpay;
pub mod zen;
pub mod zsl;
-pub use hyperswitch_connectors::connectors::{helcim, helcim::Helcim};
+pub use hyperswitch_connectors::connectors::{fiserv, fiserv::Fiserv, helcim, helcim::Helcim};
#[cfg(feature = "dummy_connector")]
pub use self::dummyconnector::DummyConnector;
@@ -79,14 +78,14 @@ pub use self::{
bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap,
boku::Boku, braintree::Braintree, cashtocode::Cashtocode, checkout::Checkout,
coinbase::Coinbase, cryptopay::Cryptopay, cybersource::Cybersource, datatrans::Datatrans,
- dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte, globalpay::Globalpay,
- globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay,
- itaubank::Itaubank, klarna::Klarna, mifinity::Mifinity, mollie::Mollie,
- multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon,
- nuvei::Nuvei, opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone,
- paypal::Paypal, payu::Payu, placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz,
- prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4,
- signifyd::Signifyd, square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio,
- trustpay::Trustpay, tsys::Tsys, volt::Volt, wellsfargo::Wellsfargo, wise::Wise,
- worldline::Worldline, worldpay::Worldpay, zen::Zen, zsl::Zsl,
+ dlocal::Dlocal, ebanx::Ebanx, forte::Forte, globalpay::Globalpay, globepay::Globepay,
+ gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay, itaubank::Itaubank,
+ klarna::Klarna, mifinity::Mifinity, mollie::Mollie, multisafepay::Multisafepay,
+ netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon, nuvei::Nuvei, opayo::Opayo,
+ opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone, paypal::Paypal, payu::Payu,
+ placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, prophetpay::Prophetpay,
+ rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4, signifyd::Signifyd,
+ square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay,
+ tsys::Tsys, volt::Volt, wellsfargo::Wellsfargo, wise::Wise, worldline::Worldline,
+ worldpay::Worldpay, zen::Zen, 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 dbb50b18032..019020b0b52 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -655,7 +655,6 @@ default_imp_for_new_connector_integration_payment!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -741,7 +740,6 @@ default_imp_for_new_connector_integration_refund!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -822,7 +820,6 @@ default_imp_for_new_connector_integration_connector_access_token!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -925,7 +922,6 @@ default_imp_for_new_connector_integration_accept_dispute!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1010,7 +1006,6 @@ default_imp_for_new_connector_integration_defend_dispute!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1079,7 +1074,6 @@ default_imp_for_new_connector_integration_submit_evidence!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1175,7 +1169,6 @@ default_imp_for_new_connector_integration_file_upload!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1342,7 +1335,6 @@ default_imp_for_new_connector_integration_payouts_create!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1430,7 +1422,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1518,7 +1509,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1606,7 +1596,6 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1694,7 +1683,6 @@ default_imp_for_new_connector_integration_payouts_quote!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1782,7 +1770,6 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1870,7 +1857,6 @@ default_imp_for_new_connector_integration_payouts_sync!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1958,7 +1944,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2044,7 +2029,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2211,7 +2195,6 @@ default_imp_for_new_connector_integration_frm_sale!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2299,7 +2282,6 @@ default_imp_for_new_connector_integration_frm_checkout!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2387,7 +2369,6 @@ default_imp_for_new_connector_integration_frm_transaction!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2475,7 +2456,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2563,7 +2543,6 @@ default_imp_for_new_connector_integration_frm_record_return!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2648,7 +2627,6 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 32d739bcf9f..6756b9ff5dc 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -201,7 +201,6 @@ default_imp_for_complete_authorize!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globepay,
connector::Gocardless,
@@ -287,7 +286,6 @@ default_imp_for_webhook_source_verification!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -383,7 +381,6 @@ default_imp_for_create_customer!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -643,7 +640,6 @@ default_imp_for_accept_dispute!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -761,7 +757,6 @@ default_imp_for_file_upload!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -856,7 +851,6 @@ default_imp_for_submit_evidence!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -951,7 +945,6 @@ default_imp_for_defend_dispute!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Globepay,
connector::Forte,
connector::Globalpay,
@@ -1062,7 +1055,6 @@ default_imp_for_pre_processing_steps!(
connector::Ebanx,
connector::Iatapay,
connector::Itaubank,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1144,7 +1136,6 @@ default_imp_for_post_processing_steps!(
connector::Ebanx,
connector::Iatapay,
connector::Itaubank,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1303,7 +1294,6 @@ default_imp_for_payouts_create!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1398,7 +1388,6 @@ default_imp_for_payouts_retrieve!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1496,7 +1485,6 @@ default_imp_for_payouts_eligibility!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1589,7 +1577,6 @@ default_imp_for_payouts_fulfill!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1681,7 +1668,6 @@ default_imp_for_payouts_cancel!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1776,7 +1762,6 @@ default_imp_for_payouts_quote!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1872,7 +1857,6 @@ default_imp_for_payouts_recipient!(
connector::Coinbase,
connector::Datatrans,
connector::Dlocal,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -1971,7 +1955,6 @@ default_imp_for_payouts_recipient_account!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2067,7 +2050,6 @@ default_imp_for_approve!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2164,7 +2146,6 @@ default_imp_for_reject!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2343,7 +2324,6 @@ default_imp_for_frm_sale!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2440,7 +2420,6 @@ default_imp_for_frm_checkout!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2537,7 +2516,6 @@ default_imp_for_frm_transaction!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2634,7 +2612,6 @@ default_imp_for_frm_fulfillment!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2731,7 +2708,6 @@ default_imp_for_frm_record_return!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2825,7 +2801,6 @@ default_imp_for_incremental_authorization!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -2919,7 +2894,6 @@ default_imp_for_revoking_mandates!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
@@ -3166,7 +3140,6 @@ default_imp_for_authorize_session_token!(
connector::Datatrans,
connector::Dlocal,
connector::Ebanx,
- connector::Fiserv,
connector::Forte,
connector::Globalpay,
connector::Globepay,
|
feat
|
[FISERV] Move connector to hyperswitch_connectors (#5441)
|
80f3b1edaeae9a13ea291a0315f1be2686336914
|
2023-10-05 20:30:48
|
Prajjwal Kumar
|
refactor(router): renamed Verify flow to SetupMandate (#2455)
| false
|
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index d9aa340b1dc..6c311844c88 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -131,8 +131,8 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
impl
ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for {{project-name | downcase | pascal_case}}
{
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 4b25a0e54e0..b9da2f8e3ee 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -54,7 +54,7 @@ pub async fn setup_intents_create(
&req,
create_payment_req,
|state, auth, req| {
- payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
state,
auth.merchant_account,
auth.key_store,
@@ -178,7 +178,7 @@ pub async fn setup_intents_update(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
state,
auth.merchant_account,
auth.key_store,
@@ -244,7 +244,7 @@ pub async fn setup_intents_confirm(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Verify, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
state,
auth.merchant_account,
auth.key_store,
diff --git a/crates/router/src/connector/aci.rs b/crates/router/src/connector/aci.rs
index b5d23410ce5..0a6e0d8a609 100644
--- a/crates/router/src/connector/aci.rs
+++ b/crates/router/src/connector/aci.rs
@@ -122,12 +122,12 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Aci {}
+impl api::MandateSetup for Aci {}
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Aci
{
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 5089d86b803..8347e43757b 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -114,7 +114,7 @@ impl api::PaymentAuthorize for Adyen {}
impl api::PaymentSync for Adyen {}
impl api::PaymentVoid for Adyen {}
impl api::PaymentCapture for Adyen {}
-impl api::PreVerify for Adyen {}
+impl api::MandateSetup for Adyen {}
impl api::ConnectorAccessToken for Adyen {}
impl api::PaymentToken for Adyen {}
@@ -140,19 +140,19 @@ impl
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Adyen
{
fn get_headers(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
- types::PaymentsVerifyType::get_content_type(self)
+ types::SetupMandateType::get_content_type(self)
.to_string()
.into(),
)];
@@ -163,14 +163,14 @@ impl
fn get_url(
&self,
- _req: &types::VerifyRouterData,
+ _req: &types::SetupMandateRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!("{}{}", self.base_url(connectors), "v68/payments"))
}
fn get_request_body(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
let authorize_req = types::PaymentsAuthorizeRouterData::from((
req,
@@ -193,32 +193,34 @@ impl
}
fn build_request(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
- .url(&types::PaymentsVerifyType::get_url(self, req, connectors)?)
+ .url(&types::SetupMandateType::get_url(self, req, connectors)?)
.attach_default_headers()
- .headers(types::PaymentsVerifyType::get_headers(
- self, req, connectors,
- )?)
- .body(types::PaymentsVerifyType::get_request_body(self, req)?)
+ .headers(types::SetupMandateType::get_headers(self, req, connectors)?)
+ .body(types::SetupMandateType::get_request_body(self, req)?)
.build(),
))
}
fn handle_response(
&self,
- data: &types::VerifyRouterData,
+ data: &types::SetupMandateRouterData,
res: types::Response,
) -> CustomResult<
- types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
errors::ConnectorError,
>
where
- api::Verify: Clone,
- types::VerifyRequestData: Clone,
+ api::SetupMandate: Clone,
+ types::SetupMandateRequestData: Clone,
types::PaymentsResponseData: Clone,
{
let response: adyen::AdyenPaymentResponse = res
diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rs
index f7086cfb7ad..de1947d8181 100644
--- a/crates/router/src/connector/airwallex.rs
+++ b/crates/router/src/connector/airwallex.rs
@@ -110,9 +110,13 @@ impl ConnectorValidation for Airwallex {
impl api::Payment for Airwallex {}
impl api::PaymentsCompleteAuthorize for Airwallex {}
-impl api::PreVerify for Airwallex {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Airwallex
+impl api::MandateSetup for Airwallex {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Airwallex
{
}
diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs
index c40317ea376..3f5b0a22b2c 100644
--- a/crates/router/src/connector/authorizedotnet.rs
+++ b/crates/router/src/connector/authorizedotnet.rs
@@ -104,10 +104,14 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
// Not Implemented (R)
}
-impl api::PreVerify for Authorizedotnet {}
+impl api::MandateSetup for Authorizedotnet {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Authorizedotnet
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Authorizedotnet
{
// Issue: #173
}
diff --git a/crates/router/src/connector/bambora.rs b/crates/router/src/connector/bambora.rs
index a8ea787eaf4..b59645a4090 100644
--- a/crates/router/src/connector/bambora.rs
+++ b/crates/router/src/connector/bambora.rs
@@ -128,9 +128,13 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Bambora {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Bambora
+impl api::MandateSetup for Bambora {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Bambora
{
}
diff --git a/crates/router/src/connector/bitpay.rs b/crates/router/src/connector/bitpay.rs
index 471cab7199f..2dc634426f3 100644
--- a/crates/router/src/connector/bitpay.rs
+++ b/crates/router/src/connector/bitpay.rs
@@ -33,7 +33,7 @@ impl api::Payment for Bitpay {}
impl api::PaymentToken for Bitpay {}
impl api::PaymentSession for Bitpay {}
impl api::ConnectorAccessToken for Bitpay {}
-impl api::PreVerify for Bitpay {}
+impl api::MandateSetup for Bitpay {}
impl api::PaymentAuthorize for Bitpay {}
impl api::PaymentSync for Bitpay {}
impl api::PaymentCapture for Bitpay {}
@@ -133,8 +133,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Bitpay
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Bitpay
{
}
diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rs
index 7e7af935226..00901a55ba3 100644
--- a/crates/router/src/connector/bluesnap.rs
+++ b/crates/router/src/connector/bluesnap.rs
@@ -201,9 +201,13 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Bluesnap {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Bluesnap
+impl api::MandateSetup for Bluesnap {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Bluesnap
{
}
diff --git a/crates/router/src/connector/boku.rs b/crates/router/src/connector/boku.rs
index 65e962f5aa0..826d218cd56 100644
--- a/crates/router/src/connector/boku.rs
+++ b/crates/router/src/connector/boku.rs
@@ -37,7 +37,7 @@ pub struct Boku;
impl api::Payment for Boku {}
impl api::PaymentSession for Boku {}
impl api::ConnectorAccessToken for Boku {}
-impl api::PreVerify for Boku {}
+impl api::MandateSetup for Boku {}
impl api::PaymentAuthorize for Boku {}
impl api::PaymentSync for Boku {}
impl api::PaymentCapture for Boku {}
@@ -162,8 +162,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Boku
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Boku
{
}
diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs
index 1dddc876c14..6a641108283 100644
--- a/crates/router/src/connector/braintree.rs
+++ b/crates/router/src/connector/braintree.rs
@@ -375,11 +375,15 @@ impl
}
}
-impl api::PreVerify for Braintree {}
+impl api::MandateSetup for Braintree {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Braintree
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Braintree
{
// Not Implemented (R)
}
diff --git a/crates/router/src/connector/cashtocode.rs b/crates/router/src/connector/cashtocode.rs
index a185c6a653b..cf30c5f83e5 100644
--- a/crates/router/src/connector/cashtocode.rs
+++ b/crates/router/src/connector/cashtocode.rs
@@ -32,7 +32,7 @@ pub struct Cashtocode;
impl api::Payment for Cashtocode {}
impl api::PaymentSession for Cashtocode {}
impl api::ConnectorAccessToken for Cashtocode {}
-impl api::PreVerify for Cashtocode {}
+impl api::MandateSetup for Cashtocode {}
impl api::PaymentAuthorize for Cashtocode {}
impl api::PaymentSync for Cashtocode {}
impl api::PaymentCapture for Cashtocode {}
@@ -149,8 +149,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Cashtocode
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Cashtocode
{
}
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index 9e28adb57b7..b9d0e70a8cb 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -275,10 +275,14 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
// Not Implemented (R)
}
-impl api::PreVerify for Checkout {}
+impl api::MandateSetup for Checkout {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Checkout
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Checkout
{
// Issue: #173
}
diff --git a/crates/router/src/connector/coinbase.rs b/crates/router/src/connector/coinbase.rs
index 463a8e679a1..17d78750afa 100644
--- a/crates/router/src/connector/coinbase.rs
+++ b/crates/router/src/connector/coinbase.rs
@@ -34,7 +34,7 @@ impl api::Payment for Coinbase {}
impl api::PaymentToken for Coinbase {}
impl api::PaymentSession for Coinbase {}
impl api::ConnectorAccessToken for Coinbase {}
-impl api::PreVerify for Coinbase {}
+impl api::MandateSetup for Coinbase {}
impl api::PaymentAuthorize for Coinbase {}
impl api::PaymentSync for Coinbase {}
impl api::PaymentCapture for Coinbase {}
@@ -148,8 +148,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Coinbase
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Coinbase
{
}
diff --git a/crates/router/src/connector/cryptopay.rs b/crates/router/src/connector/cryptopay.rs
index 2387a9bf401..91e62f72e7e 100644
--- a/crates/router/src/connector/cryptopay.rs
+++ b/crates/router/src/connector/cryptopay.rs
@@ -39,7 +39,7 @@ pub struct Cryptopay;
impl api::Payment for Cryptopay {}
impl api::PaymentSession for Cryptopay {}
impl api::ConnectorAccessToken for Cryptopay {}
-impl api::PreVerify for Cryptopay {}
+impl api::MandateSetup for Cryptopay {}
impl api::PaymentAuthorize for Cryptopay {}
impl api::PaymentSync for Cryptopay {}
impl api::PaymentCapture for Cryptopay {}
@@ -183,8 +183,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Cryptopay
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Cryptopay
{
}
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index 26fd156abe8..11f76ec3313 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -226,7 +226,7 @@ impl api::PaymentAuthorize for Cybersource {}
impl api::PaymentSync for Cybersource {}
impl api::PaymentVoid for Cybersource {}
impl api::PaymentCapture for Cybersource {}
-impl api::PreVerify for Cybersource {}
+impl api::MandateSetup for Cybersource {}
impl api::ConnectorAccessToken for Cybersource {}
impl api::PaymentToken for Cybersource {}
@@ -240,8 +240,12 @@ impl
// Not Implemented (R)
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Cybersource
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Cybersource
{
}
diff --git a/crates/router/src/connector/dlocal.rs b/crates/router/src/connector/dlocal.rs
index 2e18030ff4f..90be2399ba0 100644
--- a/crates/router/src/connector/dlocal.rs
+++ b/crates/router/src/connector/dlocal.rs
@@ -37,7 +37,7 @@ impl api::Payment for Dlocal {}
impl api::PaymentToken for Dlocal {}
impl api::PaymentSession for Dlocal {}
impl api::ConnectorAccessToken for Dlocal {}
-impl api::PreVerify for Dlocal {}
+impl api::MandateSetup for Dlocal {}
impl api::PaymentAuthorize for Dlocal {}
impl api::PaymentSync for Dlocal {}
impl api::PaymentCapture for Dlocal {}
@@ -171,8 +171,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Dlocal
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Dlocal
{
}
diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rs
index 4c7fc6c4347..af87029a682 100644
--- a/crates/router/src/connector/dummyconnector.rs
+++ b/crates/router/src/connector/dummyconnector.rs
@@ -30,7 +30,7 @@ pub struct DummyConnector<const T: u8>;
impl<const T: u8> api::Payment for DummyConnector<T> {}
impl<const T: u8> api::PaymentSession for DummyConnector<T> {}
impl<const T: u8> api::ConnectorAccessToken for DummyConnector<T> {}
-impl<const T: u8> api::PreVerify for DummyConnector<T> {}
+impl<const T: u8> api::MandateSetup for DummyConnector<T> {}
impl<const T: u8> api::PaymentAuthorize for DummyConnector<T> {}
impl<const T: u8> api::PaymentSync for DummyConnector<T> {}
impl<const T: u8> api::PaymentCapture for DummyConnector<T> {}
@@ -144,8 +144,11 @@ impl<const T: u8>
}
impl<const T: u8>
- ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for DummyConnector<T>
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for DummyConnector<T>
{
}
diff --git a/crates/router/src/connector/fiserv.rs b/crates/router/src/connector/fiserv.rs
index 83bbf592f80..70f58ffe6eb 100644
--- a/crates/router/src/connector/fiserv.rs
+++ b/crates/router/src/connector/fiserv.rs
@@ -195,11 +195,15 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Fiserv {}
+impl api::MandateSetup for Fiserv {}
#[allow(dead_code)]
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Fiserv
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Fiserv
{
}
diff --git a/crates/router/src/connector/forte.rs b/crates/router/src/connector/forte.rs
index ecb63bcd752..6f20e93e8c8 100644
--- a/crates/router/src/connector/forte.rs
+++ b/crates/router/src/connector/forte.rs
@@ -36,7 +36,7 @@ pub struct Forte;
impl api::Payment for Forte {}
impl api::PaymentSession for Forte {}
impl api::ConnectorAccessToken for Forte {}
-impl api::PreVerify for Forte {}
+impl api::MandateSetup for Forte {}
impl api::PaymentAuthorize for Forte {}
impl api::PaymentSync for Forte {}
impl api::PaymentCapture for Forte {}
@@ -159,8 +159,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Forte
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Forte
{
}
diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rs
index 8d803913c4a..761d91ae013 100644
--- a/crates/router/src/connector/globalpay.rs
+++ b/crates/router/src/connector/globalpay.rs
@@ -331,9 +331,13 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Globalpay {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Globalpay
+impl api::MandateSetup for Globalpay {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Globalpay
{
}
diff --git a/crates/router/src/connector/globepay.rs b/crates/router/src/connector/globepay.rs
index e0bb9e1fd3f..c1bda593283 100644
--- a/crates/router/src/connector/globepay.rs
+++ b/crates/router/src/connector/globepay.rs
@@ -31,7 +31,7 @@ pub struct Globepay;
impl api::Payment for Globepay {}
impl api::PaymentSession for Globepay {}
impl api::ConnectorAccessToken for Globepay {}
-impl api::PreVerify for Globepay {}
+impl api::MandateSetup for Globepay {}
impl api::PaymentAuthorize for Globepay {}
impl api::PaymentSync for Globepay {}
impl api::PaymentCapture for Globepay {}
@@ -138,8 +138,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Globepay
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Globepay
{
}
diff --git a/crates/router/src/connector/gocardless.rs b/crates/router/src/connector/gocardless.rs
index 6692c869e0c..d2593df0325 100644
--- a/crates/router/src/connector/gocardless.rs
+++ b/crates/router/src/connector/gocardless.rs
@@ -32,7 +32,7 @@ pub struct Gocardless;
impl api::Payment for Gocardless {}
impl api::PaymentSession for Gocardless {}
impl api::ConnectorAccessToken for Gocardless {}
-impl api::PreVerify for Gocardless {}
+impl api::MandateSetup for Gocardless {}
impl api::PaymentAuthorize for Gocardless {}
impl api::PaymentSync for Gocardless {}
impl api::PaymentCapture for Gocardless {}
@@ -422,8 +422,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Gocardless
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Gocardless
{
}
diff --git a/crates/router/src/connector/helcim.rs b/crates/router/src/connector/helcim.rs
index e5444b53be0..a3cb5f7a22e 100644
--- a/crates/router/src/connector/helcim.rs
+++ b/crates/router/src/connector/helcim.rs
@@ -29,7 +29,7 @@ pub struct Helcim;
impl api::Payment for Helcim {}
impl api::PaymentSession for Helcim {}
impl api::ConnectorAccessToken for Helcim {}
-impl api::PreVerify for Helcim {}
+impl api::MandateSetup for Helcim {}
impl api::PaymentAuthorize for Helcim {}
impl api::PaymentSync for Helcim {}
impl api::PaymentCapture for Helcim {}
@@ -128,8 +128,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Helcim
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Helcim
{
}
diff --git a/crates/router/src/connector/iatapay.rs b/crates/router/src/connector/iatapay.rs
index f55ee22a23b..0106b708715 100644
--- a/crates/router/src/connector/iatapay.rs
+++ b/crates/router/src/connector/iatapay.rs
@@ -34,7 +34,7 @@ pub struct Iatapay;
impl api::Payment for Iatapay {}
impl api::PaymentSession for Iatapay {}
impl api::ConnectorAccessToken for Iatapay {}
-impl api::PreVerify for Iatapay {}
+impl api::MandateSetup for Iatapay {}
impl api::PaymentAuthorize for Iatapay {}
impl api::PaymentSync for Iatapay {}
impl api::PaymentCapture for Iatapay {}
@@ -235,8 +235,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
}
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Iatapay
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Iatapay
{
}
diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs
index 2611c062ebe..87f007cb3ac 100644
--- a/crates/router/src/connector/klarna.rs
+++ b/crates/router/src/connector/klarna.rs
@@ -207,12 +207,12 @@ impl
}
}
-impl api::PreVerify for Klarna {}
+impl api::MandateSetup for Klarna {}
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Klarna
{
diff --git a/crates/router/src/connector/mollie.rs b/crates/router/src/connector/mollie.rs
index 5759a4f8a0a..d0b2b635fce 100644
--- a/crates/router/src/connector/mollie.rs
+++ b/crates/router/src/connector/mollie.rs
@@ -33,7 +33,7 @@ pub struct Mollie;
impl api::Payment for Mollie {}
impl api::PaymentSession for Mollie {}
impl api::ConnectorAccessToken for Mollie {}
-impl api::PreVerify for Mollie {}
+impl api::MandateSetup for Mollie {}
impl api::PaymentToken for Mollie {}
impl api::PaymentAuthorize for Mollie {}
impl api::PaymentsCompleteAuthorize for Mollie {}
@@ -197,8 +197,12 @@ impl
}
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Mollie
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Mollie
{
}
diff --git a/crates/router/src/connector/multisafepay.rs b/crates/router/src/connector/multisafepay.rs
index 160a135b173..1629f2ab36d 100644
--- a/crates/router/src/connector/multisafepay.rs
+++ b/crates/router/src/connector/multisafepay.rs
@@ -115,9 +115,13 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Multisafepay {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Multisafepay
+impl api::MandateSetup for Multisafepay {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Multisafepay
{
}
diff --git a/crates/router/src/connector/nexinets.rs b/crates/router/src/connector/nexinets.rs
index f0a490cfbd1..30ae4ab25e5 100644
--- a/crates/router/src/connector/nexinets.rs
+++ b/crates/router/src/connector/nexinets.rs
@@ -33,7 +33,7 @@ pub struct Nexinets;
impl api::Payment for Nexinets {}
impl api::PaymentSession for Nexinets {}
impl api::ConnectorAccessToken for Nexinets {}
-impl api::PreVerify for Nexinets {}
+impl api::MandateSetup for Nexinets {}
impl api::PaymentAuthorize for Nexinets {}
impl api::PaymentSync for Nexinets {}
impl api::PaymentCapture for Nexinets {}
@@ -159,8 +159,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Nexinets
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Nexinets
{
}
diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rs
index d2834d99664..cdeb9c99d5e 100644
--- a/crates/router/src/connector/nmi.rs
+++ b/crates/router/src/connector/nmi.rs
@@ -27,7 +27,7 @@ pub struct Nmi;
impl api::Payment for Nmi {}
impl api::PaymentSession for Nmi {}
impl api::ConnectorAccessToken for Nmi {}
-impl api::PreVerify for Nmi {}
+impl api::MandateSetup for Nmi {}
impl api::PaymentAuthorize for Nmi {}
impl api::PaymentSync for Nmi {}
impl api::PaymentCapture for Nmi {}
@@ -113,12 +113,16 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Nmi
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Nmi
{
fn get_headers(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
@@ -126,7 +130,7 @@ impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::Payments
fn get_url(
&self,
- _req: &types::VerifyRouterData,
+ _req: &types::SetupMandateRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!("{}api/transact.php", self.base_url(connectors)))
@@ -134,7 +138,7 @@ impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::Payments
fn get_request_body(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
let connector_req = nmi::NmiPaymentsRequest::try_from(req)?;
let nmi_req = types::RequestBody::log_and_get_request_body(
@@ -147,26 +151,24 @@ impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::Payments
fn build_request(
&self,
- req: &types::VerifyRouterData,
+ req: &types::SetupMandateRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
- .url(&types::PaymentsVerifyType::get_url(self, req, connectors)?)
- .headers(types::PaymentsVerifyType::get_headers(
- self, req, connectors,
- )?)
- .body(types::PaymentsVerifyType::get_request_body(self, req)?)
+ .url(&types::SetupMandateType::get_url(self, req, connectors)?)
+ .headers(types::SetupMandateType::get_headers(self, req, connectors)?)
+ .body(types::SetupMandateType::get_request_body(self, req)?)
.build(),
))
}
fn handle_response(
&self,
- data: &types::VerifyRouterData,
+ data: &types::SetupMandateRouterData,
res: types::Response,
- ) -> CustomResult<types::VerifyRouterData, errors::ConnectorError> {
+ ) -> CustomResult<types::SetupMandateRouterData, errors::ConnectorError> {
let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
.into_report()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 13cf1426b90..a57ac4271d0 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -158,9 +158,9 @@ impl From<&api_models::payments::ApplePayWalletData> for PaymentMethod {
}
}
-impl TryFrom<&types::VerifyRouterData> for NmiPaymentsRequest {
+impl TryFrom<&types::SetupMandateRouterData> for NmiPaymentsRequest {
type Error = Error;
- fn try_from(item: &types::VerifyRouterData) -> Result<Self, Self::Error> {
+ fn try_from(item: &types::SetupMandateRouterData) -> Result<Self, Self::Error> {
let auth_type: NmiAuthType = (&item.connector_auth_type).try_into()?;
let payment_method = PaymentMethod::try_from(&item.request.payment_method_data)?;
Ok(Self {
@@ -314,13 +314,18 @@ pub struct StandardResponse {
impl<T>
TryFrom<
- types::ResponseRouterData<api::Verify, StandardResponse, T, types::PaymentsResponseData>,
- > for types::RouterData<api::Verify, T, types::PaymentsResponseData>
+ types::ResponseRouterData<
+ api::SetupMandate,
+ StandardResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<api::SetupMandate, T, types::PaymentsResponseData>
{
type Error = Error;
fn try_from(
item: types::ResponseRouterData<
- api::Verify,
+ api::SetupMandate,
StandardResponse,
T,
types::PaymentsResponseData,
diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rs
index 8b7c984083c..bf1ab53453e 100644
--- a/crates/router/src/connector/noon.rs
+++ b/crates/router/src/connector/noon.rs
@@ -38,7 +38,7 @@ pub struct Noon;
impl api::Payment for Noon {}
impl api::PaymentSession for Noon {}
impl api::ConnectorAccessToken for Noon {}
-impl api::PreVerify for Noon {}
+impl api::MandateSetup for Noon {}
impl api::PaymentAuthorize for Noon {}
impl api::PaymentSync for Noon {}
impl api::PaymentCapture for Noon {}
@@ -167,8 +167,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Noon
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Noon
{
}
diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rs
index b2bcb39c5ea..52388c849ad 100644
--- a/crates/router/src/connector/nuvei.rs
+++ b/crates/router/src/connector/nuvei.rs
@@ -98,7 +98,7 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Nuvei {}
+impl api::MandateSetup for Nuvei {}
impl api::PaymentVoid for Nuvei {}
impl api::PaymentSync for Nuvei {}
impl api::PaymentCapture for Nuvei {}
@@ -110,8 +110,12 @@ impl api::RefundSync for Nuvei {}
impl api::PaymentsCompleteAuthorize for Nuvei {}
impl api::ConnectorAccessToken for Nuvei {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Nuvei
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Nuvei
{
}
diff --git a/crates/router/src/connector/opayo.rs b/crates/router/src/connector/opayo.rs
index c64cfe7ea0c..89e16416d27 100644
--- a/crates/router/src/connector/opayo.rs
+++ b/crates/router/src/connector/opayo.rs
@@ -31,7 +31,7 @@ pub struct Opayo;
impl api::Payment for Opayo {}
impl api::PaymentSession for Opayo {}
impl api::ConnectorAccessToken for Opayo {}
-impl api::PreVerify for Opayo {}
+impl api::MandateSetup for Opayo {}
impl api::PaymentAuthorize for Opayo {}
impl api::PaymentSync for Opayo {}
impl api::PaymentCapture for Opayo {}
@@ -137,8 +137,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Opayo
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Opayo
{
}
diff --git a/crates/router/src/connector/opennode.rs b/crates/router/src/connector/opennode.rs
index 2a997e0adb0..df2b2170d02 100644
--- a/crates/router/src/connector/opennode.rs
+++ b/crates/router/src/connector/opennode.rs
@@ -33,7 +33,7 @@ impl api::PaymentSession for Opennode {}
impl api::PaymentToken for Opennode {}
impl api::ConnectorAccessToken for Opennode {}
-impl api::PreVerify for Opennode {}
+impl api::MandateSetup for Opennode {}
impl api::PaymentAuthorize for Opennode {}
impl api::PaymentSync for Opennode {}
impl api::PaymentCapture for Opennode {}
@@ -133,8 +133,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Opennode
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Opennode
{
}
diff --git a/crates/router/src/connector/payeezy.rs b/crates/router/src/connector/payeezy.rs
index 6baa01f087e..da712605437 100644
--- a/crates/router/src/connector/payeezy.rs
+++ b/crates/router/src/connector/payeezy.rs
@@ -140,9 +140,13 @@ impl ConnectorValidation for Payeezy {
impl api::Payment for Payeezy {}
-impl api::PreVerify for Payeezy {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Payeezy
+impl api::MandateSetup for Payeezy {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Payeezy
{
}
diff --git a/crates/router/src/connector/payme.rs b/crates/router/src/connector/payme.rs
index beb0b7c83ef..f3af084a97d 100644
--- a/crates/router/src/connector/payme.rs
+++ b/crates/router/src/connector/payme.rs
@@ -33,7 +33,7 @@ impl api::Payment for Payme {}
impl api::PaymentSession for Payme {}
impl api::PaymentsCompleteAuthorize for Payme {}
impl api::ConnectorAccessToken for Payme {}
-impl api::PreVerify for Payme {}
+impl api::MandateSetup for Payme {}
impl api::PaymentAuthorize for Payme {}
impl api::PaymentSync for Payme {}
impl api::PaymentCapture for Payme {}
@@ -326,8 +326,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Payme
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Payme
{
}
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index 4aa50bb2d67..b82223f3acc 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -41,7 +41,7 @@ impl api::Payment for Paypal {}
impl api::PaymentSession for Paypal {}
impl api::PaymentToken for Paypal {}
impl api::ConnectorAccessToken for Paypal {}
-impl api::PreVerify for Paypal {}
+impl api::MandateSetup for Paypal {}
impl api::PaymentAuthorize for Paypal {}
impl api::PaymentsCompleteAuthorize for Paypal {}
impl api::PaymentSync for Paypal {}
@@ -316,8 +316,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
}
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Paypal
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Paypal
{
}
diff --git a/crates/router/src/connector/payu.rs b/crates/router/src/connector/payu.rs
index dd78c214ee6..6433735f7c5 100644
--- a/crates/router/src/connector/payu.rs
+++ b/crates/router/src/connector/payu.rs
@@ -117,9 +117,13 @@ impl ConnectorValidation for Payu {
impl api::Payment for Payu {}
-impl api::PreVerify for Payu {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Payu
+impl api::MandateSetup for Payu {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Payu
{
}
diff --git a/crates/router/src/connector/powertranz.rs b/crates/router/src/connector/powertranz.rs
index 32303dc073d..bcbe2113f61 100644
--- a/crates/router/src/connector/powertranz.rs
+++ b/crates/router/src/connector/powertranz.rs
@@ -36,7 +36,7 @@ pub struct Powertranz;
impl api::Payment for Powertranz {}
impl api::PaymentSession for Powertranz {}
impl api::ConnectorAccessToken for Powertranz {}
-impl api::PreVerify for Powertranz {}
+impl api::MandateSetup for Powertranz {}
impl api::PaymentAuthorize for Powertranz {}
impl api::PaymentsCompleteAuthorize for Powertranz {}
impl api::PaymentSync for Powertranz {}
@@ -149,8 +149,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Powertranz
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Powertranz
{
}
diff --git a/crates/router/src/connector/rapyd.rs b/crates/router/src/connector/rapyd.rs
index d0a5259157d..04748edd234 100644
--- a/crates/router/src/connector/rapyd.rs
+++ b/crates/router/src/connector/rapyd.rs
@@ -255,11 +255,11 @@ impl
impl api::Payment for Rapyd {}
-impl api::PreVerify for Rapyd {}
+impl api::MandateSetup for Rapyd {}
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Rapyd
{
diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rs
index ae777b28600..a17546711f1 100644
--- a/crates/router/src/connector/shift4.rs
+++ b/crates/router/src/connector/shift4.rs
@@ -148,9 +148,13 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
// Not Implemented (R)
}
-impl api::PreVerify for Shift4 {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Shift4
+impl api::MandateSetup for Shift4 {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Shift4
{
}
diff --git a/crates/router/src/connector/square.rs b/crates/router/src/connector/square.rs
index 6ef1b6a29c7..aedd2f93dad 100644
--- a/crates/router/src/connector/square.rs
+++ b/crates/router/src/connector/square.rs
@@ -37,7 +37,7 @@ pub struct Square;
impl api::Payment for Square {}
impl api::PaymentSession for Square {}
impl api::ConnectorAccessToken for Square {}
-impl api::PreVerify for Square {}
+impl api::MandateSetup for Square {}
impl api::PaymentAuthorize for Square {}
impl api::PaymentSync for Square {}
impl api::PaymentCapture for Square {}
@@ -153,8 +153,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Square
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Square
{
}
diff --git a/crates/router/src/connector/stax.rs b/crates/router/src/connector/stax.rs
index 52287639071..82a4c7ff323 100644
--- a/crates/router/src/connector/stax.rs
+++ b/crates/router/src/connector/stax.rs
@@ -34,7 +34,7 @@ pub struct Stax;
impl api::Payment for Stax {}
impl api::PaymentSession for Stax {}
impl api::ConnectorAccessToken for Stax {}
-impl api::PreVerify for Stax {}
+impl api::MandateSetup for Stax {}
impl api::PaymentAuthorize for Stax {}
impl api::PaymentSync for Stax {}
impl api::PaymentCapture for Stax {}
@@ -311,8 +311,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Stax
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Stax
{
}
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 5e31a89bed5..cc1e3be81d4 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -453,7 +453,7 @@ impl
}
}
-impl api::PreVerify for Stripe {}
+impl api::MandateSetup for Stripe {}
impl
services::ConnectorIntegration<
@@ -965,20 +965,24 @@ impl
}
type Verify = dyn services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
>;
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Stripe
{
fn get_headers(
&self,
- req: &types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ req: &types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
@@ -997,8 +1001,8 @@ impl
fn get_url(
&self,
_req: &types::RouterData<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
>,
connectors: &settings::Connectors,
@@ -1012,7 +1016,11 @@ impl
fn get_request_body(
&self,
- req: &types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ req: &types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
let req = stripe::SetupIntentRequest::try_from(req)?;
let stripe_req = types::RequestBody::log_and_get_request_body(
@@ -1025,7 +1033,11 @@ impl
fn build_request(
&self,
- req: &types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ req: &types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
@@ -1042,18 +1054,22 @@ impl
fn handle_response(
&self,
data: &types::RouterData<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
>,
res: types::Response,
) -> CustomResult<
- types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,
+ types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
errors::ConnectorError,
>
where
- api::Verify: Clone,
- types::VerifyRequestData: Clone,
+ api::SetupMandate: Clone,
+ types::SetupMandateRequestData: Clone,
types::PaymentsResponseData: Clone,
{
let response: stripe::SetupIntentResponse = res
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 57a7935f030..a3711a5497c 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1929,9 +1929,9 @@ fn get_payment_method_type_for_saved_payment_method_payment(
}
}
-impl TryFrom<&types::VerifyRouterData> for SetupIntentRequest {
+impl TryFrom<&types::SetupMandateRouterData> for SetupIntentRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::VerifyRouterData) -> Result<Self, Self::Error> {
+ fn try_from(item: &types::SetupMandateRouterData) -> Result<Self, Self::Error> {
let metadata_order_id = item.connector_request_reference_id.clone();
let metadata_txn_id = format!("{}_{}_{}", item.merchant_id, item.payment_id, "1");
let metadata_txn_uuid = Uuid::new_v4().to_string();
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index bfecc563c5e..3d4f0a14a99 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -164,9 +164,13 @@ impl
// Not Implemented (R)
}
-impl api::PreVerify for Trustpay {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Trustpay
+impl api::MandateSetup for Trustpay {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Trustpay
{
}
diff --git a/crates/router/src/connector/tsys.rs b/crates/router/src/connector/tsys.rs
index b7e4f5aece2..869aa535636 100644
--- a/crates/router/src/connector/tsys.rs
+++ b/crates/router/src/connector/tsys.rs
@@ -30,7 +30,7 @@ pub struct Tsys;
impl api::Payment for Tsys {}
impl api::PaymentSession for Tsys {}
impl api::ConnectorAccessToken for Tsys {}
-impl api::PreVerify for Tsys {}
+impl api::MandateSetup for Tsys {}
impl api::PaymentAuthorize for Tsys {}
impl api::PaymentSync for Tsys {}
impl api::PaymentCapture for Tsys {}
@@ -105,8 +105,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Tsys
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Tsys
{
}
diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rs
index e64e95ed90e..9616533a455 100644
--- a/crates/router/src/connector/wise.rs
+++ b/crates/router/src/connector/wise.rs
@@ -119,7 +119,7 @@ impl api::PaymentAuthorize for Wise {}
impl api::PaymentSync for Wise {}
impl api::PaymentVoid for Wise {}
impl api::PaymentCapture for Wise {}
-impl api::PreVerify for Wise {}
+impl api::MandateSetup for Wise {}
impl api::ConnectorAccessToken for Wise {}
impl api::PaymentToken for Wise {}
impl ConnectorValidation for Wise {}
@@ -144,8 +144,8 @@ impl
impl
services::ConnectorIntegration<
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> for Wise
{
diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rs
index ed9acec34c9..2dddb2ed9e2 100644
--- a/crates/router/src/connector/worldline.rs
+++ b/crates/router/src/connector/worldline.rs
@@ -162,9 +162,13 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
impl api::Payment for Worldline {}
-impl api::PreVerify for Worldline {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Worldline
+impl api::MandateSetup for Worldline {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Worldline
{
}
diff --git a/crates/router/src/connector/worldpay.rs b/crates/router/src/connector/worldpay.rs
index 20185cf81ab..53e26f749fc 100644
--- a/crates/router/src/connector/worldpay.rs
+++ b/crates/router/src/connector/worldpay.rs
@@ -111,9 +111,13 @@ impl ConnectorValidation for Worldpay {
impl api::Payment for Worldpay {}
-impl api::PreVerify for Worldpay {}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Worldpay
+impl api::MandateSetup for Worldpay {}
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Worldpay
{
}
diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rs
index a284352bf42..11b3b7076dd 100644
--- a/crates/router/src/connector/zen.rs
+++ b/crates/router/src/connector/zen.rs
@@ -36,7 +36,7 @@ pub struct Zen;
impl api::Payment for Zen {}
impl api::PaymentSession for Zen {}
impl api::ConnectorAccessToken for Zen {}
-impl api::PreVerify for Zen {}
+impl api::MandateSetup for Zen {}
impl api::PaymentAuthorize for Zen {}
impl api::PaymentSync for Zen {}
impl api::PaymentCapture for Zen {}
@@ -161,8 +161,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
{
}
-impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for Zen
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Zen
{
}
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index e63471e0134..8a86be2036b 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -118,7 +118,7 @@ pub trait ConnectorErrorExt<T> {
#[track_caller]
fn to_payment_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse>;
#[track_caller]
- fn to_verify_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse>;
+ fn to_setup_mandate_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse>;
#[track_caller]
fn to_dispute_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse>;
#[cfg(feature = "payouts")]
@@ -211,7 +211,7 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
})
}
- fn to_verify_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse> {
+ fn to_setup_mandate_failed_response(self) -> error_stack::Result<T, errors::ApiErrorResponse> {
self.map_err(|err| {
let error = err.current_context();
let data = match error {
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index e7c19ac2a69..b8919dab30a 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -6,7 +6,7 @@ pub mod complete_authorize_flow;
pub mod psync_flow;
pub mod reject_flow;
pub mod session_flow;
-pub mod verify_flow;
+pub mod setup_mandate_flow;
use async_trait::async_trait;
diff --git a/crates/router/src/core/payments/flows/verify_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
similarity index 84%
rename from crates/router/src/core/payments/flows/verify_flow.rs
rename to crates/router/src/core/payments/flows/setup_mandate_flow.rs
index 1ecf2199b80..756600ce2e7 100644
--- a/crates/router/src/core/payments/flows/verify_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -15,8 +15,12 @@ use crate::{
};
#[async_trait]
-impl ConstructFlowSpecificData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
- for PaymentData<api::Verify>
+impl
+ ConstructFlowSpecificData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for PaymentData<api::SetupMandate>
{
async fn construct_router_data<'a>(
&self,
@@ -26,8 +30,11 @@ impl ConstructFlowSpecificData<api::Verify, types::VerifyRequestData, types::Pay
key_store: &domain::MerchantKeyStore,
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
- ) -> RouterResult<types::VerifyRouterData> {
- transformers::construct_payment_router_data::<api::Verify, types::VerifyRequestData>(
+ ) -> RouterResult<types::SetupMandateRouterData> {
+ transformers::construct_payment_router_data::<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ >(
state,
self.clone(),
connector_id,
@@ -41,7 +48,7 @@ impl ConstructFlowSpecificData<api::Verify, types::VerifyRequestData, types::Pay
}
#[async_trait]
-impl Feature<api::Verify, types::VerifyRequestData> for types::VerifyRouterData {
+impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::SetupMandateRouterData {
async fn decide_flows<'a>(
self,
state: &AppState,
@@ -54,8 +61,8 @@ impl Feature<api::Verify, types::VerifyRequestData> for types::VerifyRouterData
) -> RouterResult<Self> {
let connector_integration: services::BoxedConnectorIntegration<
'_,
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> = connector.connector.get_connector_integration();
let resp = services::execute_connector_processing_step(
@@ -66,7 +73,7 @@ impl Feature<api::Verify, types::VerifyRequestData> for types::VerifyRouterData
connector_request,
)
.await
- .to_verify_failed_response()?;
+ .to_setup_mandate_failed_response()?;
let pm_id = tokenization::save_payment_method(
state,
@@ -132,8 +139,8 @@ impl Feature<api::Verify, types::VerifyRequestData> for types::VerifyRouterData
payments::CallConnectorAction::Trigger => {
let connector_integration: services::BoxedConnectorIntegration<
'_,
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> = connector.connector.get_connector_integration();
@@ -149,9 +156,9 @@ impl Feature<api::Verify, types::VerifyRequestData> for types::VerifyRouterData
}
}
-impl TryFrom<types::VerifyRequestData> for types::ConnectorCustomerData {
+impl TryFrom<types::SetupMandateRequestData> for types::ConnectorCustomerData {
type Error = error_stack::Report<errors::ApiErrorResponse>;
- fn try_from(data: types::VerifyRequestData) -> Result<Self, Self::Error> {
+ fn try_from(data: types::SetupMandateRequestData) -> Result<Self, Self::Error> {
Ok(Self {
email: data.email,
description: None,
@@ -163,7 +170,7 @@ impl TryFrom<types::VerifyRequestData> for types::ConnectorCustomerData {
}
#[allow(clippy::too_many_arguments)]
-impl types::VerifyRouterData {
+impl types::SetupMandateRouterData {
pub async fn decide_flow<'a, 'b>(
&'b self,
state: &'a AppState,
@@ -178,8 +185,8 @@ impl types::VerifyRouterData {
Some(true) => {
let connector_integration: services::BoxedConnectorIntegration<
'_,
- api::Verify,
- types::VerifyRequestData,
+ api::SetupMandate,
+ types::SetupMandateRequestData,
types::PaymentsResponseData,
> = connector.connector.get_connector_integration();
let resp = services::execute_connector_processing_step(
@@ -190,7 +197,7 @@ impl types::VerifyRouterData {
None,
)
.await
- .to_verify_failed_response()?;
+ .to_setup_mandate_failed_response()?;
let payment_method_type = self.request.payment_method_type;
let pm_id = tokenization::save_payment_method(
@@ -211,7 +218,7 @@ impl types::VerifyRouterData {
}
}
-impl mandate::MandateBehaviour for types::VerifyRequestData {
+impl mandate::MandateBehaviour for types::SetupMandateRequestData {
fn get_amount(&self) -> i64 {
0
}
@@ -237,10 +244,10 @@ impl mandate::MandateBehaviour for types::VerifyRequestData {
}
}
-impl TryFrom<types::VerifyRequestData> for types::PaymentMethodTokenizationData {
+impl TryFrom<types::SetupMandateRequestData> for types::PaymentMethodTokenizationData {
type Error = error_stack::Report<errors::ApiErrorResponse>;
- fn try_from(data: types::VerifyRequestData) -> Result<Self, Self::Error> {
+ fn try_from(data: types::SetupMandateRequestData) -> Result<Self, Self::Error> {
Ok(Self {
payment_method_data: data.payment_method_data,
browser_info: None,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 328319c3912..d3cb4f818f0 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -32,7 +32,7 @@ use crate::{
#[derive(Debug, Clone, Copy, router_derive::PaymentOperation)]
#[operation(
ops = "post_tracker",
- flow = "syncdata,authorizedata,canceldata,capturedata,completeauthorizedata,approvedata,rejectdata,verifydata,sessiondata"
+ flow = "syncdata,authorizedata,canceldata,capturedata,completeauthorizedata,approvedata,rejectdata,setupmandatedata,sessiondata"
)]
pub struct PaymentResponse;
@@ -230,13 +230,19 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsRejectData> f
}
#[async_trait]
-impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::VerifyRequestData> for PaymentResponse {
+impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestData>
+ for PaymentResponse
+{
async fn update_tracker<'b>(
&'b self,
db: &dyn StorageInterface,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
- router_data: types::RouterData<F, types::VerifyRequestData, types::PaymentsResponseData>,
+ router_data: types::RouterData<
+ F,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<PaymentData<F>>
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 96c8a8a2cb5..a8069b4d4a6 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1160,7 +1160,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD
}
}
-impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::VerifyRequestData {
+impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequestData {
type Error = error_stack::Report<errors::ApiErrorResponse>;
fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index bd58d55191e..db27929be3a 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -860,7 +860,10 @@ where
+ Clone
+ std::fmt::Debug
+ payments::operations::Operation<api_types::Authorize, api_models::payments::PaymentsRequest>
- + payments::operations::Operation<api_types::Verify, api_models::payments::PaymentsRequest>,
+ + payments::operations::Operation<
+ api_types::SetupMandate,
+ api_models::payments::PaymentsRequest,
+ >,
{
// TODO: Change for making it possible for the flow to be inferred internally or through validation layer
// This is a temporary fix.
@@ -868,8 +871,10 @@ where
// the operation are flow agnostic, and the flow is only required in the post_update_tracker
// Thus the flow can be generated just before calling the connector instead of explicitly passing it here.
- match req.amount.as_ref() {
- Some(api_types::Amount::Value(_)) | None => payments::payments_core::<
+ match req.payment_type {
+ api_models::enums::PaymentType::Normal
+ | api_models::enums::PaymentType::RecurringMandate
+ | api_models::enums::PaymentType::NewMandate => payments::payments_core::<
api_types::Authorize,
payment_types::PaymentsResponse,
_,
@@ -886,9 +891,14 @@ where
header_payload,
)
.await,
-
- Some(api_types::Amount::Zero) => {
- payments::payments_core::<api_types::Verify, payment_types::PaymentsResponse, _, _, _>(
+ api_models::enums::PaymentType::SetupMandate => {
+ payments::payments_core::<
+ api_types::SetupMandate,
+ payment_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ >(
state,
merchant_account,
key_store,
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 13ad129f4ac..3b1becb25e1 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -101,8 +101,11 @@ pub type RefundsResponseRouterData<F, R> =
pub type PaymentsAuthorizeType =
dyn services::ConnectorIntegration<api::Authorize, PaymentsAuthorizeData, PaymentsResponseData>;
-pub type PaymentsVerifyType =
- dyn services::ConnectorIntegration<api::Verify, VerifyRequestData, PaymentsResponseData>;
+pub type SetupMandateType = dyn services::ConnectorIntegration<
+ api::SetupMandate,
+ SetupMandateRequestData,
+ PaymentsResponseData,
+>;
pub type PaymentsPreProcessingType = dyn services::ConnectorIntegration<
api::PreProcessing,
PaymentsPreProcessingData,
@@ -204,7 +207,8 @@ pub type DefendDisputeType = dyn services::ConnectorIntegration<
DefendDisputeResponse,
>;
-pub type VerifyRouterData = RouterData<api::Verify, VerifyRequestData, PaymentsResponseData>;
+pub type SetupMandateRouterData =
+ RouterData<api::SetupMandate, SetupMandateRequestData, PaymentsResponseData>;
pub type AcceptDisputeRouterData =
RouterData<api::Accept, AcceptDisputeRequestData, AcceptDisputeResponse>;
@@ -510,7 +514,7 @@ pub struct PaymentsSessionData {
}
#[derive(Debug, Clone)]
-pub struct VerifyRequestData {
+pub struct SetupMandateRequestData {
pub currency: storage_enums::Currency,
pub payment_method_data: payments::PaymentMethodData,
pub amount: Option<i64>,
@@ -557,7 +561,7 @@ impl Capturable for CompleteAuthorizeData {
Some(self.amount)
}
}
-impl Capturable for VerifyRequestData {}
+impl Capturable for SetupMandateRequestData {}
impl Capturable for PaymentsCancelData {}
impl Capturable for PaymentsApproveData {}
impl Capturable for PaymentsRejectData {}
@@ -1014,7 +1018,7 @@ pub trait Tokenizable {
fn set_session_token(&mut self, token: Option<String>);
}
-impl Tokenizable for VerifyRequestData {
+impl Tokenizable for SetupMandateRequestData {
fn get_pm_data(&self) -> RouterResult<payments::PaymentMethodData> {
Ok(self.payment_method_data.clone())
}
@@ -1039,8 +1043,8 @@ impl Tokenizable for CompleteAuthorizeData {
fn set_session_token(&mut self, _token: Option<String>) {}
}
-impl From<&VerifyRouterData> for PaymentsAuthorizeData {
- fn from(data: &VerifyRouterData) -> Self {
+impl From<&SetupMandateRouterData> for PaymentsAuthorizeData {
+ fn from(data: &SetupMandateRouterData) -> Self {
Self {
currency: data.request.currency,
payment_method_data: data.request.payment_method_data.clone(),
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index eecaac6ced6..b00a7f0cbda 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -76,7 +76,7 @@ pub struct PaymentMethodToken;
pub struct CreateConnectorCustomer;
#[derive(Debug, Clone)]
-pub struct Verify;
+pub struct SetupMandate;
#[derive(Debug, Clone)]
pub struct PreProcessing;
@@ -159,8 +159,8 @@ pub trait PaymentSession:
{
}
-pub trait PreVerify:
- api::ConnectorIntegration<Verify, types::VerifyRequestData, types::PaymentsResponseData>
+pub trait MandateSetup:
+ api::ConnectorIntegration<SetupMandate, types::SetupMandateRequestData, types::PaymentsResponseData>
{
}
@@ -210,7 +210,7 @@ pub trait Payment:
+ PaymentVoid
+ PaymentApprove
+ PaymentReject
- + PreVerify
+ + MandateSetup
+ PaymentSession
+ PaymentToken
+ PaymentsPreProcessing
diff --git a/crates/router_derive/src/macros/operation.rs b/crates/router_derive/src/macros/operation.rs
index c6504f1d9c4..cf71370a293 100644
--- a/crates/router_derive/src/macros/operation.rs
+++ b/crates/router_derive/src/macros/operation.rs
@@ -20,7 +20,7 @@ enum Derives {
Capturedata,
CompleteAuthorizeData,
Rejectdata,
- VerifyData,
+ SetupMandateData,
Start,
Verify,
Session,
@@ -44,7 +44,7 @@ impl From<String> for Derives {
"rejectdata" => Self::Rejectdata,
"start" => Self::Start,
"verify" => Self::Verify,
- "verifydata" => Self::VerifyData,
+ "setupmandatedata" => Self::SetupMandateData,
"session" => Self::Session,
"sessiondata" => Self::SessionData,
_ => Self::Authorize,
@@ -126,7 +126,9 @@ impl Conversion {
}
Derives::Start => syn::Ident::new("PaymentsStartRequest", Span::call_site()),
Derives::Verify => syn::Ident::new("VerifyRequest", Span::call_site()),
- Derives::VerifyData => syn::Ident::new("VerifyRequestData", Span::call_site()),
+ Derives::SetupMandateData => {
+ syn::Ident::new("SetupMandateRequestData", Span::call_site())
+ }
Derives::Session => syn::Ident::new("PaymentsSessionRequest", Span::call_site()),
Derives::SessionData => syn::Ident::new("PaymentsSessionData", Span::call_site()),
}
@@ -336,7 +338,7 @@ pub fn operation_derive_inner(input: DeriveInput) -> syn::Result<proc_macro::Tok
UpdateTracker,
}};
use #current_crate::types::{
- VerifyRequestData,
+ SetupMandateRequestData,
PaymentsSyncData,
PaymentsCaptureData,
PaymentsCancelData,
|
refactor
|
renamed Verify flow to SetupMandate (#2455)
|
de9e0feac0e002a022356233e8f0b62500ce75ed
|
2023-09-06 19:47:20
|
DEEPANSHU BANSAL
|
fix(connector): [STAX] Incoming amount will be processed in higher unit (#2091)
| false
|
diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs
index d4a9aebeceb..e36f66abb71 100644
--- a/crates/router/src/connector/stax/transformers.rs
+++ b/crates/router/src/connector/stax/transformers.rs
@@ -1,10 +1,12 @@
use common_utils::pii::Email;
-use error_stack::IntoReport;
+use error_stack::{IntoReport, ResultExt};
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::{missing_field_err, CardData, PaymentsAuthorizeRequestData, RouterData},
+ connector::utils::{
+ self, missing_field_err, CardData, PaymentsAuthorizeRequestData, RouterData,
+ },
core::errors,
types::{self, api, storage::enums},
};
@@ -17,7 +19,7 @@ pub struct StaxPaymentsRequestMetaData {
#[derive(Debug, Serialize)]
pub struct StaxPaymentsRequest {
payment_method_id: Secret<String>,
- total: i64,
+ total: f64,
is_refundable: bool,
pre_auth: bool,
meta: StaxPaymentsRequestMetaData,
@@ -32,12 +34,14 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for StaxPaymentsRequest {
connector: "Stax",
})?
}
+ let total = utils::to_currency_base_unit_asf64(item.request.amount, item.request.currency)?;
+
match item.request.payment_method_data.clone() {
api::PaymentMethodData::Card(_) => {
let pre_auth = !item.request.is_auto_capture()?;
Ok(Self {
meta: StaxPaymentsRequestMetaData { tax: 0 },
- total: item.request.amount,
+ total,
is_refundable: true,
pre_auth,
payment_method_id: Secret::new(item.get_payment_method_token()?),
@@ -49,7 +53,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for StaxPaymentsRequest {
let pre_auth = !item.request.is_auto_capture()?;
Ok(Self {
meta: StaxPaymentsRequestMetaData { tax: 0 },
- total: item.request.amount,
+ total,
is_refundable: true,
pre_auth,
payment_method_id: Secret::new(item.get_payment_method_token()?),
@@ -322,13 +326,16 @@ impl<F, T>
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StaxCaptureRequest {
- total: Option<i64>,
+ total: Option<f64>,
}
impl TryFrom<&types::PaymentsCaptureRouterData> for StaxCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
- let total = item.request.amount_to_capture;
+ let total = utils::to_currency_base_unit_asf64(
+ item.request.amount_to_capture,
+ item.request.currency,
+ )?;
Ok(Self { total: Some(total) })
}
}
@@ -337,14 +344,17 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for StaxCaptureRequest {
// Type definition for RefundRequest
#[derive(Debug, Serialize)]
pub struct StaxRefundRequest {
- pub total: i64,
+ pub total: f64,
}
impl<F> TryFrom<&types::RefundsRouterData<F>> for StaxRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
- total: item.request.refund_amount,
+ total: utils::to_currency_base_unit_asf64(
+ item.request.refund_amount,
+ item.request.currency,
+ )?,
})
}
}
@@ -354,7 +364,7 @@ pub struct ChildTransactionsInResponse {
id: String,
success: bool,
created_at: String,
- total: i64,
+ total: f64,
}
#[derive(Debug, Deserialize)]
pub struct RefundResponse {
@@ -370,11 +380,16 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
fn try_from(
item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
+ let refund_amount = utils::to_currency_base_unit_asf64(
+ item.data.request.refund_amount,
+ item.data.request.currency,
+ )
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let filtered_txn: Vec<&ChildTransactionsInResponse> = item
.response
.child_transactions
.iter()
- .filter(|txn| txn.total == item.data.request.refund_amount)
+ .filter(|txn| txn.total == refund_amount)
.collect();
let mut refund_txn = filtered_txn
diff --git a/crates/router/tests/connectors/stax.rs b/crates/router/tests/connectors/stax.rs
index c4eb2c51321..72c1d89da09 100644
--- a/crates/router/tests/connectors/stax.rs
+++ b/crates/router/tests/connectors/stax.rs
@@ -625,7 +625,7 @@ async fn should_fail_for_refund_amount_higher_than_payment_amount() {
.unwrap();
assert_eq!(
response.response.unwrap_err().reason,
- Some(r#"{"total":["The total may not be greater than 100."]}"#.to_string()),
+ Some(r#"{"total":["The total may not be greater than 1."]}"#.to_string()),
);
}
|
fix
|
[STAX] Incoming amount will be processed in higher unit (#2091)
|
5048d248e59b8ecaf8585ffd5134953cf62e74ef
|
2023-10-03 14:57:34
|
Narayan Bhat
|
feat(webhooks): webhooks effect tracker (#2260)
| false
|
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index 94274344abf..a1cafee1f8d 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -5,7 +5,7 @@ use utoipa::ToSchema;
use crate::{disputes, enums as api_enums, payments, refunds};
-#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Copy)]
#[serde(rename_all = "snake_case")]
pub enum IncomingWebhookEvent {
PaymentIntentFailure,
@@ -39,6 +39,26 @@ pub enum WebhookFlow {
BankTransfer,
}
+#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
+/// This enum tells about the affect a webhook had on an object
+pub enum WebhookResponseTracker {
+ Payment {
+ payment_id: String,
+ status: common_enums::IntentStatus,
+ },
+ Refund {
+ payment_id: String,
+ refund_id: String,
+ status: common_enums::RefundStatus,
+ },
+ Dispute {
+ dispute_id: String,
+ payment_id: String,
+ status: common_enums::DisputeStatus,
+ },
+ NoEffect,
+}
+
impl From<IncomingWebhookEvent> for WebhookFlow {
fn from(evt: IncomingWebhookEvent) -> Self {
match evt {
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index c365e3e6bf5..6a33c97e391 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -3,7 +3,7 @@ pub mod utils;
use std::str::FromStr;
-use api_models::payments::HeaderPayload;
+use api_models::{payments::HeaderPayload, webhooks::WebhookResponseTracker};
use common_utils::errors::ReportSwitchExt;
use error_stack::{report, IntoReport, ResultExt};
use masking::ExposeInterface;
@@ -40,7 +40,7 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
key_store: domain::MerchantKeyStore,
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
-) -> CustomResult<(), errors::ApiErrorResponse> {
+) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let consume_or_trigger_flow = if source_verified {
payments::CallConnectorAction::HandleResponse(webhook_details.resource_object)
} else {
@@ -111,9 +111,12 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
metrics::WEBHOOK_PAYMENT_NOT_FOUND.add(
&metrics::CONTEXT,
1,
- &[add_attributes("merchant_id", merchant_account.merchant_id)],
+ &[add_attributes(
+ "merchant_id",
+ merchant_account.merchant_id.clone(),
+ )],
);
- return Ok(());
+ return Ok(WebhookResponseTracker::NoEffect);
}
error @ Err(_) => error?,
}
@@ -134,6 +137,8 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
.change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
.attach_printable("payment id not received from payments core")?;
+ let status = payments_response.status;
+
let event_type: Option<enums::EventType> = payments_response.status.foreign_into();
// If event is NOT an UnsupportedEvent, trigger Outgoing Webhook
@@ -144,20 +149,22 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
outgoing_event_type,
enums::EventClass::Payments,
None,
- payment_id,
+ payment_id.clone(),
enums::EventObjectType::PaymentDetails,
api::OutgoingWebhookContent::PaymentDetails(payments_response),
)
.await?;
- }
+ };
+
+ let response = WebhookResponseTracker::Payment { payment_id, status };
+
+ Ok(response)
}
_ => Err(errors::ApiErrorResponse::WebhookProcessingFailure)
.into_report()
.attach_printable("received non-json response from payments core")?,
}
-
- Ok(())
}
#[instrument(skip_all)]
@@ -169,7 +176,7 @@ pub async fn refunds_incoming_webhook_flow<W: types::OutgoingWebhookType>(
connector_name: &str,
source_verified: bool,
event_type: api_models::webhooks::IncomingWebhookEvent,
-) -> CustomResult<(), errors::ApiErrorResponse> {
+) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let db = &*state.store;
//find refund by connector refund id
let refund = match webhook_details.object_reference_id {
@@ -246,7 +253,8 @@ pub async fn refunds_incoming_webhook_flow<W: types::OutgoingWebhookType>(
// If event is NOT an UnsupportedEvent, trigger Outgoing Webhook
if let Some(outgoing_event_type) = event_type {
- let refund_response: api_models::refunds::RefundResponse = updated_refund.foreign_into();
+ let refund_response: api_models::refunds::RefundResponse =
+ updated_refund.clone().foreign_into();
create_event_and_trigger_outgoing_webhook::<W>(
state,
merchant_account,
@@ -260,7 +268,11 @@ pub async fn refunds_incoming_webhook_flow<W: types::OutgoingWebhookType>(
.await?;
}
- Ok(())
+ Ok(WebhookResponseTracker::Refund {
+ payment_id: updated_refund.payment_id,
+ refund_id: updated_refund.refund_id,
+ status: updated_refund.refund_status,
+ })
}
pub async fn get_payment_attempt_from_object_reference_id(
@@ -386,7 +398,7 @@ pub async fn disputes_incoming_webhook_flow<W: types::OutgoingWebhookType>(
connector: &(dyn api::Connector + Sync),
request_details: &api::IncomingWebhookRequestDetails<'_>,
event_type: api_models::webhooks::IncomingWebhookEvent,
-) -> CustomResult<(), errors::ApiErrorResponse> {
+) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
metrics::INCOMING_DISPUTE_WEBHOOK_METRIC.add(&metrics::CONTEXT, 1, &[]);
if source_verified {
let db = &*state.store;
@@ -411,7 +423,7 @@ pub async fn disputes_incoming_webhook_flow<W: types::OutgoingWebhookType>(
dispute_details,
&merchant_account.merchant_id,
&payment_attempt,
- event_type.clone(),
+ event_type,
connector.id(),
)
.await?;
@@ -424,13 +436,17 @@ pub async fn disputes_incoming_webhook_flow<W: types::OutgoingWebhookType>(
event_type,
enums::EventClass::Disputes,
None,
- dispute_object.dispute_id,
+ dispute_object.dispute_id.clone(),
enums::EventObjectType::DisputeDetails,
api::OutgoingWebhookContent::DisputeDetails(disputes_response),
)
.await?;
metrics::INCOMING_DISPUTE_WEBHOOK_MERCHANT_NOTIFIED_METRIC.add(&metrics::CONTEXT, 1, &[]);
- Ok(())
+ Ok(WebhookResponseTracker::Dispute {
+ dispute_id: dispute_object.dispute_id,
+ payment_id: dispute_object.payment_id,
+ status: dispute_object.dispute_status,
+ })
} else {
metrics::INCOMING_DISPUTE_WEBHOOK_SIGNATURE_FAILURE_METRIC.add(&metrics::CONTEXT, 1, &[]);
Err(errors::ApiErrorResponse::WebhookAuthenticationFailed).into_report()
@@ -443,7 +459,7 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType>(
key_store: domain::MerchantKeyStore,
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
-) -> CustomResult<(), errors::ApiErrorResponse> {
+) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let response = if source_verified {
let payment_attempt = get_payment_attempt_from_object_reference_id(
&state,
@@ -486,6 +502,7 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType>(
.attach_printable("did not receive payment id from payments core response")?;
let event_type: Option<enums::EventType> = payments_response.status.foreign_into();
+ let status = payments_response.status;
// If event is NOT an UnsupportedEvent, trigger Outgoing Webhook
if let Some(outgoing_event_type) = event_type {
@@ -495,20 +512,20 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType>(
outgoing_event_type,
enums::EventClass::Payments,
None,
- payment_id,
+ payment_id.clone(),
enums::EventObjectType::PaymentDetails,
api::OutgoingWebhookContent::PaymentDetails(payments_response),
)
.await?;
}
+
+ Ok(WebhookResponseTracker::Payment { payment_id, status })
}
_ => Err(errors::ApiErrorResponse::WebhookProcessingFailure)
.into_report()
.attach_printable("received non-json response from payments core")?,
}
-
- Ok(())
}
#[allow(clippy::too_many_arguments)]
@@ -729,6 +746,27 @@ pub async fn trigger_webhook_to_merchant<W: types::OutgoingWebhookType>(
Ok(())
}
+pub async fn webhooks_wrapper<W: types::OutgoingWebhookType>(
+ state: AppState,
+ req: &actix_web::HttpRequest,
+ merchant_account: domain::MerchantAccount,
+ key_store: domain::MerchantKeyStore,
+ connector_name_or_mca_id: &str,
+ body: actix_web::web::Bytes,
+) -> RouterResponse<serde_json::Value> {
+ let (application_response, _webhooks_response_tracker) = webhooks_core::<W>(
+ state,
+ req,
+ merchant_account,
+ key_store,
+ connector_name_or_mca_id,
+ body,
+ )
+ .await?;
+
+ Ok(application_response)
+}
+
#[instrument(skip_all)]
pub async fn webhooks_core<W: types::OutgoingWebhookType>(
state: AppState,
@@ -737,7 +775,10 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
key_store: domain::MerchantKeyStore,
connector_name_or_mca_id: &str,
body: actix_web::web::Bytes,
-) -> RouterResponse<serde_json::Value> {
+) -> errors::RouterResult<(
+ services::ApplicationResponse<serde_json::Value>,
+ WebhookResponseTracker,
+)> {
metrics::WEBHOOK_INCOMING_COUNT.add(
&metrics::CONTEXT,
1,
@@ -754,8 +795,11 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
body: &body,
};
+ // Fetch the merchant connector account to get the webhooks source secret
+ // `webhooks source secret` is a secret shared between the merchant and connector
+ // This is used for source verification and webhooks integrity
let (merchant_connector_account, connector) = fetch_mca_and_connector(
- state.clone(),
+ &state,
&merchant_account,
connector_name_or_mca_id,
&key_store,
@@ -810,10 +854,12 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
],
);
- return connector
+ let response = connector
.get_webhook_api_response(&request_details)
.switch()
- .attach_printable("Failed while early return in case of event type parsing");
+ .attach_printable("Failed while early return in case of event type parsing")?;
+
+ return Ok((response, WebhookResponseTracker::NoEffect));
}
};
@@ -829,7 +875,9 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
logger::info!(event_type=?event_type);
let flow_type: api::WebhookFlow = event_type.to_owned().into();
- if process_webhook_further && !matches!(flow_type, api::WebhookFlow::ReturnResponse) {
+ let webhook_effect = if process_webhook_further
+ && !matches!(flow_type, api::WebhookFlow::ReturnResponse)
+ {
let object_ref_id = connector
.get_webhook_object_reference_id(&request_details)
.switch()
@@ -962,7 +1010,7 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
.await
.attach_printable("Incoming bank-transfer webhook flow failed")?,
- api::WebhookFlow::ReturnResponse => {}
+ api::WebhookFlow::ReturnResponse => WebhookResponseTracker::NoEffect,
_ => Err(errors::ApiErrorResponse::InternalServerError)
.into_report()
@@ -977,14 +1025,15 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
merchant_account.merchant_id.clone(),
)],
);
- }
+ WebhookResponseTracker::NoEffect
+ };
let response = connector
.get_webhook_api_response(&request_details)
.switch()
.attach_printable("Could not get incoming webhook api response from connector")?;
- Ok(response)
+ Ok((response, webhook_effect))
}
#[inline]
@@ -1026,7 +1075,7 @@ pub async fn get_payment_id(
}
async fn fetch_mca_and_connector(
- state: AppState,
+ state: &AppState,
merchant_account: &domain::MerchantAccount,
connector_name_or_mca_id: &str,
key_store: &domain::MerchantKeyStore,
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index 33fa9291670..05aafd872e3 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -29,6 +29,9 @@ const IRRELEVANT_ATTEMPT_ID_IN_SOURCE_VERIFICATION_FLOW: &str =
const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_SOURCE_VERIFICATION_FLOW: &str =
"irrelevant_connector_request_reference_id_in_source_verification_flow";
+/// Check whether the merchant has configured to process the webhook `event` for the `connector`
+/// First check for the key "whconf_{merchant_id}_{connector_id}" in redis,
+/// if not found, fetch from configs table in database, if not found use default
pub async fn lookup_webhook_event(
db: &dyn StorageInterface,
connector_id: &str,
diff --git a/crates/router/src/routes/webhooks.rs b/crates/router/src/routes/webhooks.rs
index fa28e3fa7fb..0bbc6add436 100644
--- a/crates/router/src/routes/webhooks.rs
+++ b/crates/router/src/routes/webhooks.rs
@@ -26,8 +26,8 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
&req,
body,
|state, auth, body| {
- webhooks::webhooks_core::<W>(
- state,
+ webhooks::webhooks_wrapper::<W>(
+ state.to_owned(),
&req,
auth.merchant_account,
auth.key_store,
|
feat
|
webhooks effect tracker (#2260)
|
ea1888677df7de60a248184389d7be30ae21fc59
|
2025-02-05 19:07:08
|
Debarshi Gupta
|
refactor(connector): [AUTHORIZEDOTNET] Add metadata information to connector request (#7011)
| false
|
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index d2b212e3ea0..8e0af603a3d 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1,3 +1,5 @@
+use std::collections::BTreeMap;
+
use common_utils::{
errors::CustomResult,
ext_traits::{Encode, ValueExt},
@@ -6,6 +8,7 @@ use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret};
use rand::distributions::{Alphanumeric, DistString};
use serde::{Deserialize, Serialize};
+use serde_json::Value;
use crate::{
connector::utils::{
@@ -143,12 +146,27 @@ struct TransactionRequest {
#[serde(skip_serializing_if = "Option::is_none")]
bill_to: Option<BillTo>,
#[serde(skip_serializing_if = "Option::is_none")]
+ user_fields: Option<UserFields>,
+ #[serde(skip_serializing_if = "Option::is_none")]
processing_options: Option<ProcessingOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
subsequent_auth_information: Option<SubsequentAuthInformation>,
authorization_indicator_type: Option<AuthorizationIndicator>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UserFields {
+ user_field: Vec<UserField>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UserField {
+ name: String,
+ value: String,
+}
+
#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
enum ProfileDetails {
@@ -299,6 +317,25 @@ pub enum ValidationMode {
LiveMode,
}
+impl ForeignTryFrom<Value> for Vec<UserField> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn foreign_try_from(metadata: Value) -> Result<Self, Self::Error> {
+ let hashmap: BTreeMap<String, Value> = serde_json::from_str(&metadata.to_string())
+ .change_context(errors::ConnectorError::RequestEncodingFailedWithReason(
+ "Failed to serialize request metadata".to_owned(),
+ ))
+ .attach_printable("")?;
+ let mut vector: Self = Self::new();
+ for (key, value) in hashmap {
+ vector.push(UserField {
+ name: key,
+ value: value.to_string(),
+ });
+ }
+ Ok(vector)
+ }
+}
+
impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::SetupMandateRouterData) -> Result<Self, Self::Error> {
@@ -622,6 +659,12 @@ impl
zip: address.zip.clone(),
country: address.country,
}),
+ user_fields: match item.router_data.request.metadata.clone() {
+ Some(metadata) => Some(UserFields {
+ user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+ }),
+ None => None,
+ },
processing_options: Some(ProcessingOptions {
is_subsequent_auth: true,
}),
@@ -675,6 +718,12 @@ impl
},
customer: None,
bill_to: None,
+ user_fields: match item.router_data.request.metadata.clone() {
+ Some(metadata) => Some(UserFields {
+ user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+ }),
+ None => None,
+ },
processing_options: Some(ProcessingOptions {
is_subsequent_auth: true,
}),
@@ -764,6 +813,12 @@ impl
zip: address.zip.clone(),
country: address.country,
}),
+ user_fields: match item.router_data.request.metadata.clone() {
+ Some(metadata) => Some(UserFields {
+ user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+ }),
+ None => None,
+ },
processing_options: None,
subsequent_auth_information: None,
authorization_indicator_type: match item.router_data.request.capture_method {
@@ -815,6 +870,12 @@ impl
zip: address.zip.clone(),
country: address.country,
}),
+ user_fields: match item.router_data.request.metadata.clone() {
+ Some(metadata) => Some(UserFields {
+ user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+ }),
+ None => None,
+ },
processing_options: None,
subsequent_auth_information: None,
authorization_indicator_type: match item.router_data.request.capture_method {
|
refactor
|
[AUTHORIZEDOTNET] Add metadata information to connector request (#7011)
|
53b5551df7e7a04bb26532591180608542c33c3a
|
2024-08-05 16:44:23
|
Mani Chandra
|
refactor(auth): Pass `profile_id` from the auth to core functions (#5520)
| false
|
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index 3eed0591dba..a6670414f6f 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -43,7 +43,9 @@ pub async fn retrieve_dispute(
state,
&req,
dispute_id,
- |state, auth, req, _| disputes::retrieve_dispute(state, auth.merchant_account, None, req),
+ |state, auth, req, _| {
+ disputes::retrieve_dispute(state, auth.merchant_account, auth.profile_id, req)
+ },
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::DisputeRead),
@@ -133,7 +135,13 @@ pub async fn accept_dispute(
&req,
dispute_id,
|state, auth, req, _| {
- disputes::accept_dispute(state, auth.merchant_account, None, auth.key_store, req)
+ disputes::accept_dispute(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -170,7 +178,13 @@ pub async fn submit_dispute_evidence(
&req,
json_payload.into_inner(),
|state, auth, req, _| {
- disputes::submit_evidence(state, auth.merchant_account, None, auth.key_store, req)
+ disputes::submit_evidence(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -215,7 +229,13 @@ pub async fn attach_dispute_evidence(
&req,
attach_evidence_request,
|state, auth, req, _| {
- disputes::attach_evidence(state, auth.merchant_account, None, auth.key_store, req)
+ disputes::attach_evidence(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -258,7 +278,7 @@ pub async fn retrieve_dispute_evidence(
&req,
dispute_id,
|state, auth, req, _| {
- disputes::retrieve_dispute_evidence(state, auth.merchant_account, None, req)
+ disputes::retrieve_dispute_evidence(state, auth.merchant_account, auth.profile_id, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 58d331d0fe3..e226f3f07ab 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -200,7 +200,7 @@ pub async fn payments_start(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::operations::PaymentStart,
req,
@@ -276,7 +276,7 @@ pub async fn payments_retrieve(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentStatus,
req,
@@ -350,7 +350,7 @@ pub async fn payments_retrieve_with_gateway_creds(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentStatus,
req,
@@ -558,7 +558,7 @@ pub async fn payments_capture(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentCapture,
payload,
@@ -628,7 +628,7 @@ pub async fn payments_connector_session(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentSession,
payload,
@@ -861,7 +861,7 @@ pub async fn payments_complete_authorize(
state.clone(),
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::operations::payment_complete_authorize::CompleteAuthorize,
payment_confirm_req.clone(),
@@ -921,7 +921,7 @@ pub async fn payments_cancel(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentCancel,
req,
@@ -1088,7 +1088,7 @@ pub async fn payments_approve(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentApprove,
payment_types::PaymentsCaptureRequest {
@@ -1143,7 +1143,7 @@ pub async fn payments_reject(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentReject,
payment_types::PaymentsCancelRequest {
@@ -1295,7 +1295,7 @@ pub async fn payments_incremental_authorization(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
payments::PaymentIncrementalAuthorization,
req,
diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs
index 18ba815551e..02e67e66c81 100644
--- a/crates/router/src/routes/payouts.rs
+++ b/crates/router/src/routes/payouts.rs
@@ -80,7 +80,13 @@ pub async fn payouts_retrieve(
&req,
payout_retrieve_request,
|state, auth, req, _| {
- payouts_retrieve_core(state, auth.merchant_account, None, auth.key_store, req)
+ payouts_retrieve_core(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index e0b1e0786ff..2a0d619e38b 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -37,7 +37,13 @@ pub async fn refunds_create(
&req,
json_payload.into_inner(),
|state, auth, req, _| {
- refund_create_core(state, auth.merchant_account, None, auth.key_store, req)
+ refund_create_core(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -94,7 +100,7 @@ pub async fn refunds_retrieve(
refund_response_wrapper(
state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
refund_request,
refund_retrieve_core,
@@ -146,7 +152,7 @@ pub async fn refunds_retrieve_with_body(
refund_response_wrapper(
state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
req,
refund_retrieve_core,
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 0b2066fdb13..a82306fd133 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -57,7 +57,7 @@ pub struct AuthenticationData {
pub profile_id: Option<String>,
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct AuthenticationDataWithMultipleProfiles {
pub merchant_account: domain::MerchantAccount,
pub key_store: domain::MerchantKeyStore,
@@ -251,6 +251,12 @@ impl AuthInfo for AuthenticationData {
}
}
+impl AuthInfo for AuthenticationDataWithMultipleProfiles {
+ fn get_merchant_id(&self) -> Option<&id_type::MerchantId> {
+ Some(self.merchant_account.get_id())
+ }
+}
+
#[async_trait]
pub trait AuthenticateAndFetch<T, A>
where
@@ -968,6 +974,65 @@ where
}
}
+#[async_trait]
+impl<A> AuthenticateAndFetch<AuthenticationData, A> for JWTAuthMerchantFromRoute
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<(AuthenticationData, AuthenticationType)> {
+ let payload = parse_jwt_payload::<A, AuthToken>(request_headers, state).await?;
+ if payload.check_in_blacklist(state).await? {
+ return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
+ }
+
+ if payload.merchant_id != self.merchant_id {
+ return Err(report!(errors::ApiErrorResponse::InvalidJwtToken));
+ }
+
+ let permissions = authorization::get_permissions(state, &payload).await?;
+ authorization::check_authorization(&self.required_permission, &permissions)?;
+ let key_manager_state = &(&state.session_state()).into();
+ let key_store = state
+ .store()
+ .get_merchant_key_store_by_merchant_id(
+ key_manager_state,
+ &payload.merchant_id,
+ &state.store().get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
+ .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,
+ &payload.merchant_id,
+ &key_store,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
+ .attach_printable("Failed to fetch merchant account for the merchant id")?;
+
+ let auth = AuthenticationData {
+ merchant_account: merchant,
+ key_store,
+ profile_id: payload.profile_id,
+ };
+ Ok((
+ auth.clone(),
+ AuthenticationType::MerchantJwt {
+ merchant_id: auth.merchant_account.get_id().clone(),
+ user_id: Some(payload.user_id),
+ },
+ ))
+ }
+}
+
pub struct JWTAuthMerchantOrProfileFromRoute {
pub merchant_id_or_profile_id: String,
pub required_permission: Permission,
@@ -1074,7 +1139,7 @@ where
&state.store().get_master_key().to_vec().into(),
)
.await
- .change_context(errors::ApiErrorResponse::InvalidJwtToken)
+ .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
.attach_printable("Failed to fetch merchant key store for the merchant id")?;
let merchant = state
@@ -1085,7 +1150,8 @@ where
&key_store,
)
.await
- .change_context(errors::ApiErrorResponse::InvalidJwtToken)?;
+ .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
+ .attach_printable("Failed to fetch merchant account for the merchant id")?;
let auth = AuthenticationData {
merchant_account: merchant,
@@ -1096,7 +1162,7 @@ where
auth.clone(),
AuthenticationType::MerchantJwt {
merchant_id: auth.merchant_account.get_id().clone(),
- user_id: None,
+ user_id: Some(payload.user_id),
},
))
}
|
refactor
|
Pass `profile_id` from the auth to core functions (#5520)
|
0e9966a54d87f55b0f5c54e4dccb80742674fe26
|
2025-02-03 19:22:14
|
Pa1NarK
|
chore: bump cypress to `v14.0.0` (#7102)
| false
|
diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js
index 913663c509e..dce9048339e 100644
--- a/cypress-tests/cypress.config.js
+++ b/cypress-tests/cypress.config.js
@@ -30,14 +30,27 @@ export default defineConfig({
},
});
on("after:spec", (spec, results) => {
- if (results && results.video) {
- // Do we have failures for any retry attempts?
- const failures = results.tests.some((test) =>
+ // Clean up resources after each spec
+ if (
+ results &&
+ results.video &&
+ !results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed")
- );
- if (!failures) {
- // delete the video if the spec passed and no tests retried
- fs.unlinkSync(results.video);
+ )
+ ) {
+ // Only try to delete if the video file exists
+ try {
+ if (fs.existsSync(results.video)) {
+ fs.unlinkSync(results.video);
+ }
+ } catch (error) {
+ // Log the error but don't fail the test
+ // eslint-disable-next-line no-console
+ console.warn(
+ `Warning: Could not delete video file: ${results.video}`
+ );
+ // eslint-disable-next-line no-console
+ console.warn(error);
}
}
});
@@ -45,6 +58,9 @@ export default defineConfig({
},
experimentalRunAllSpecs: true,
+ specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
+ supportFile: "cypress/support/e2e.js",
+
reporter: "cypress-mochawesome-reporter",
reporterOptions: {
reportDir: `cypress/reports/${connectorId}`,
@@ -55,12 +71,13 @@ export default defineConfig({
inlineAssets: true,
saveJson: true,
},
+ defaultCommandTimeout: 10000,
+ pageLoadTimeout: 20000,
+ responseTimeout: 30000,
+ screenshotsFolder: screenshotsFolderName,
+ video: true,
+ videoCompression: 32,
+ videosFolder: `cypress/videos/${connectorId}`,
+ chromeWebSecurity: false,
},
- chromeWebSecurity: false,
- defaultCommandTimeout: 10000,
- pageLoadTimeout: 20000,
- responseTimeout: 30000,
- screenshotsFolder: screenshotsFolderName,
- video: true,
- videoCompression: 32,
});
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
index 8ad218953dd..e8cdd97e7a7 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
@@ -163,7 +163,9 @@ export const connectorDetails = {
},
},
Void: {
- Request: {},
+ Request: {
+ cancellation_reason: "user_cancel",
+ },
Response: {
status: 200,
body: {
@@ -172,16 +174,13 @@ export const connectorDetails = {
},
},
VoidAfterConfirm: {
- Request: {},
+ Request: {
+ cancellation_reason: "user_cancel",
+ },
Response: {
- status: 400,
+ status: 200,
body: {
- error: {
- code: "IR_16",
- message:
- "You cannot cancel this payment because it has status processing",
- type: "invalid_request",
- },
+ status: "processing",
},
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index d4d3c30fe27..b73bbf18dcc 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -23,7 +23,7 @@ const successfulThreeDSTestCardDetails = {
const failedNo3DSCardDetails = {
card_number: "4000000000000002",
card_exp_month: "01",
- card_exp_year: "25",
+ card_exp_year: "35",
card_holder_name: "joseph Doe",
card_cvc: "123",
};
@@ -123,7 +123,7 @@ const requiredFields = {
export const connectorDetails = {
multi_credential_config: {
- specName: ["connectorAgnostic"],
+ specName: ["connectorAgnosticNTID"],
value: "connector_2",
},
card_pm: {
@@ -144,7 +144,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Configs: {
CONNECTOR_CREDENTIAL: {
- specName: ["connectorAgnostic"],
+ specName: ["connectorAgnosticNTID"],
value: "connector_2",
},
},
@@ -564,7 +564,7 @@ export const connectorDetails = {
MITAutoCapture: getCustomExchange({
Configs: {
CONNECTOR_CREDENTIAL: {
- specName: ["connectorAgnostic"],
+ specName: ["connectorAgnosticNTID"],
value: "connector_2",
},
},
@@ -701,7 +701,7 @@ export const connectorDetails = {
SaveCardUseNo3DSAutoCaptureOffSession: {
Configs: {
CONNECTOR_CREDENTIAL: {
- specName: ["connectorAgnostic"],
+ specName: ["connectorAgnosticNTID"],
value: "connector_2",
},
},
@@ -754,7 +754,7 @@ export const connectorDetails = {
SaveCardConfirmAutoCaptureOffSession: {
Configs: {
CONNECTOR_CREDENTIAL: {
- specName: ["connectorAgnostic"],
+ specName: ["connectorAgnosticNTID"],
value: "connector_2",
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index c35e5950b73..5a9baa32d73 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -4,10 +4,8 @@ import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";
import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";
import { connectorDetails as checkoutConnectorDetails } from "./Checkout.js";
-import {
- connectorDetails as CommonConnectorDetails,
- updateDefaultStatusCode,
-} from "./Commons.js";
+import { connectorDetails as CommonConnectorDetails } from "./Commons.js";
+import { updateDefaultStatusCode } from "./Modifiers.js";
import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js";
import { connectorDetails as datatransConnectorDetails } from "./Datatrans.js";
import { connectorDetails as elavonConnectorDetails } from "./Elavon.js";
@@ -227,12 +225,10 @@ function getConnectorConfig(
const mcaConfig = getConnectorDetails(globalState.get("connectorId"));
return {
- config: {
- CONNECTOR_CREDENTIAL:
- multipleConnector?.nextConnector && multipleConnectors?.status
- ? multipleConnector
- : mcaConfig?.multi_credential_config || multipleConnector,
- },
+ CONNECTOR_CREDENTIAL:
+ multipleConnector?.nextConnector && multipleConnectors?.status
+ ? multipleConnector
+ : mcaConfig?.multi_credential_config || multipleConnector,
multipleConnectors,
};
}
@@ -243,13 +239,12 @@ export function createBusinessProfile(
globalState,
multipleConnector = { nextConnector: false }
) {
- const { config, multipleConnectors } = getConnectorConfig(
- globalState,
- multipleConnector
- );
+ const config = getConnectorConfig(globalState, multipleConnector);
const { profilePrefix } = execConfig(config);
- if (shouldProceedWithOperation(multipleConnector, multipleConnectors)) {
+ if (
+ shouldProceedWithOperation(multipleConnector, config.multipleConnectors)
+ ) {
cy.createBusinessProfileTest(
createBusinessProfileBody,
globalState,
@@ -266,13 +261,12 @@ export function createMerchantConnectorAccount(
paymentMethodsEnabled,
multipleConnector = { nextConnector: false }
) {
- const { config, multipleConnectors } = getConnectorConfig(
- globalState,
- multipleConnector
- );
+ const config = getConnectorConfig(globalState, multipleConnector);
const { profilePrefix, merchantConnectorPrefix } = execConfig(config);
- if (shouldProceedWithOperation(multipleConnector, multipleConnectors)) {
+ if (
+ shouldProceedWithOperation(multipleConnector, config.multipleConnectors)
+ ) {
cy.createConnectorCallTest(
paymentType,
createMerchantConnectorAccountBody,
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 60691899f7c..45be7043116 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -620,7 +620,6 @@ Cypress.Commands.add(
);
if (stateUpdate) {
- // cy.task("setGlobalState", stateUpdate);
globalState.set(
"MULTIPLE_CONNECTORS",
stateUpdate.MULTIPLE_CONNECTORS
@@ -2202,13 +2201,19 @@ Cypress.Commands.add(
);
Cypress.Commands.add("voidCallTest", (requestBody, data, globalState) => {
- const { Configs: configs = {}, Response: resData } = data || {};
+ const {
+ Configs: configs = {},
+ Response: resData,
+ Request: reqData,
+ } = data || {};
const configInfo = execConfig(validateConfig(configs));
const payment_id = globalState.get("paymentID");
const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);
requestBody.profile_id = profile_id;
+ requestBody.cancellation_reason =
+ reqData?.cancellation_reason ?? requestBody.cancellation_reason;
cy.request({
method: "POST",
diff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.js
index eab7b99b629..1ec43cd03b6 100644
--- a/cypress-tests/cypress/support/e2e.js
+++ b/cypress-tests/cypress/support/e2e.js
@@ -16,12 +16,22 @@
// Import commands.js using ES2015 syntax:
import "cypress-mochawesome-reporter/register";
import "./commands";
+import "./redirectionHandler";
+
+Cypress.on("window:before:load", (win) => {
+ // Add security headers
+ win.headers = {
+ "Content-Security-Policy": "default-src 'self'",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "DENY",
+ };
+});
// Add error handling for dynamic imports
Cypress.on("uncaught:exception", (err, runnable) => {
// Log the error details
// eslint-disable-next-line no-console
- console.log(
+ console.error(
`Error: ${err.message}\nError occurred in: ${runnable.title}\nStack trace: ${err.stack}`
);
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index cc9c180b35e..d840aab9e48 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -3,23 +3,38 @@
import jsQR from "jsqr";
// Define constants for wait times
-const TIMEOUT = 20000; // 20 seconds
-const WAIT_TIME = 10000; // 10 seconds
+const CONSTANTS = {
+ TIMEOUT: 20000, // 20 seconds
+ WAIT_TIME: 10000, // 10 seconds
+ ERROR_PATTERNS: [
+ /4\d{2}/,
+ /5\d{2}/,
+ /error/i,
+ /invalid request/i,
+ /server error/i,
+ ],
+ VALID_TERMINAL_STATUSES: [
+ "failed",
+ "processing",
+ "requires_capture",
+ "succeeded",
+ ],
+};
export function handleRedirection(
- redirection_type,
+ redirectionType,
urls,
connectorId,
- payment_method_type,
- handler_metadata
+ paymentMethodType,
+ handlerMetadata
) {
- switch (redirection_type) {
+ switch (redirectionType) {
case "bank_redirect":
bankRedirectRedirection(
urls.redirection_url,
urls.expected_url,
connectorId,
- payment_method_type
+ paymentMethodType
);
break;
case "bank_transfer":
@@ -27,8 +42,8 @@ export function handleRedirection(
urls.redirection_url,
urls.expected_url,
connectorId,
- payment_method_type,
- handler_metadata.next_action_type
+ paymentMethodType,
+ handlerMetadata.next_action_type
);
break;
case "three_ds":
@@ -39,309 +54,358 @@ export function handleRedirection(
urls.redirection_url,
urls.expected_url,
connectorId,
- payment_method_type
+ paymentMethodType
);
break;
default:
- throw new Error(`Redirection known: ${redirection_type}`);
+ throw new Error(`Unknown redirection type: ${redirectionType}`);
}
}
function bankTransferRedirection(
- redirection_url,
- expected_url,
+ redirectionUrl,
+ expectedUrl,
connectorId,
- payment_method_type,
- next_action_type
+ paymentMethodType,
+ nextActionType
) {
- switch (next_action_type) {
+ switch (nextActionType) {
case "qr_code_url":
- cy.request(redirection_url.href).then((response) => {
+ cy.request(redirectionUrl.href).then((response) => {
switch (connectorId) {
case "adyen":
- switch (payment_method_type) {
+ switch (paymentMethodType) {
case "pix":
expect(response.status).to.eq(200);
- fetchAndParseQRCode(redirection_url.href).then((qrCodeData) => {
+ fetchAndParseQRCode(redirectionUrl.href).then((qrCodeData) => {
expect(qrCodeData).to.eq("TestQRCodeEMVToken");
});
break;
default:
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
// expected_redirection can be used here to handle other payment methods
}
break;
default:
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
}
});
break;
case "image_data_url":
switch (connectorId) {
case "itaubank":
- switch (payment_method_type) {
+ switch (paymentMethodType) {
case "pix":
- fetchAndParseImageData(redirection_url).then((qrCodeData) => {
+ fetchAndParseImageData(redirectionUrl).then((qrCodeData) => {
expect(qrCodeData).to.contains("itau.com.br/pix/qr/v2"); // image data contains the following value
});
break;
default:
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
}
break;
default:
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
}
break;
default:
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
}
}
function bankRedirectRedirection(
- redirection_url,
- expected_url,
+ redirectionUrl,
+ expectedUrl,
connectorId,
- payment_method_type
+ paymentMethodType
) {
let verifyUrl = false;
- cy.visit(redirection_url.href);
-
- switch (connectorId) {
- case "adyen":
- switch (payment_method_type) {
- case "eps":
- cy.get("h1").should("contain.text", "Acquirer Simulator");
- cy.get('[value="authorised"]').click();
- cy.url().should("include", "status=succeeded");
- cy.wait(5000);
- break;
- case "ideal":
- cy.get(":nth-child(4) > td > p").should(
- "contain.text",
- "Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)"
- );
- cy.get(".btnLink").click();
- cy.url().should("include", "status=succeeded");
- cy.wait(5000);
- break;
- case "giropay":
- cy.get(
- ".rds-cookies-overlay__allow-all-cookies-btn > .rds-button"
- ).click();
- cy.wait(5000);
- cy.get(".normal-3").should(
- "contain.text",
- "Bank suchen ‑ mit giropay zahlen."
- );
- cy.get("#bankSearch").type("giropay TestBank{enter}");
- cy.get(".normal-2 > div").click();
- cy.get('[data-testid="customerIban"]').type("DE48499999601234567890");
- cy.get('[data-testid="customerIdentification"]').type("9123456789");
- cy.get(":nth-child(3) > .rds-button").click();
- cy.get('[data-testid="onlineBankingPin"]').type("1234");
- cy.get(".rds-button--primary").click();
- cy.get(":nth-child(5) > .rds-radio-input-group__label").click();
- cy.get(".rds-button--primary").click();
- cy.get('[data-testid="photoTan"]').type("123456");
- cy.get(".rds-button--primary").click();
- cy.wait(5000);
- cy.url().should("include", "status=succeeded");
- cy.wait(5000);
- break;
- case "sofort":
- cy.get(".modal-overlay.modal-shown.in", { timeout: TIMEOUT }).then(
- ($modal) => {
- // If modal is found, handle it
- if ($modal.length > 0) {
- cy.get("button.cookie-modal-deny-all.button-tertiary")
- .should("be.visible")
- .should("contain", "Reject All")
- .click({ multiple: true });
- cy.get("div#TopBanks.top-banks-multistep")
- .should("contain", "Demo Bank")
- .as("btn")
- .click();
- cy.get("@btn").click();
- } else {
- cy.get("input.phone").type("9123456789");
- cy.get("#button.onContinue")
- .should("contain", "Continue")
- .click();
- }
- }
- );
- break;
- case "trustly":
- break;
- default:
- throw new Error(
- `Unsupported payment method type: ${payment_method_type}`
- );
- }
- verifyUrl = true;
- break;
- case "paypal":
- switch (payment_method_type) {
- case "eps":
- cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
- break;
- case "ideal":
- cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
- break;
- case "giropay":
- cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
- break;
- default:
- throw new Error(
- `Unsupported payment method type: ${payment_method_type}`
- );
- }
- verifyUrl = true;
- break;
- case "stripe":
- switch (payment_method_type) {
- case "eps":
- cy.get('a[name="success"]').click();
- break;
- case "ideal":
- cy.get('a[name="success"]').click();
- break;
- case "giropay":
- cy.get('a[name="success"]').click();
- break;
- case "sofort":
- cy.get('a[name="success"]').click();
- break;
- case "przelewy24":
- cy.get('a[name="success"]').click();
- break;
- default:
- throw new Error(
- `Unsupported payment method type: ${payment_method_type}`
- );
- }
- verifyUrl = true;
- break;
- case "trustpay":
- switch (payment_method_type) {
- case "eps":
- cy.get("#bankname").type(
- "Allgemeine Sparkasse Oberösterreich Bank AG (ASPKAT2LXXX / 20320)"
- );
- cy.get("#selectionSubmit").click();
- cy.get("#user")
- .should("be.visible")
- .should("be.enabled")
- .focus()
- .type("Verfügernummer");
- cy.get("input#submitButton.btn.btn-primary").click();
- break;
- case "ideal":
- cy.contains("button", "Select your bank").click();
- cy.get(
- 'button[data-testid="bank-item"][id="bank-item-INGBNL2A"]'
- ).click();
+
+ cy.visit(redirectionUrl.href);
+ waitForRedirect(redirectionUrl.href);
+
+ handleFlow(
+ redirectionUrl,
+ expectedUrl,
+ connectorId,
+ ({ connectorId, paymentMethodType, constants }) => {
+ switch (connectorId) {
+ case "adyen":
+ switch (paymentMethodType) {
+ case "eps":
+ cy.get("h1").should("contain.text", "Acquirer Simulator");
+ cy.get('[value="authorised"]').click();
+ break;
+ case "ideal":
+ cy.get(":nth-child(4) > td > p").should(
+ "contain.text",
+ "Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)"
+ );
+ cy.get(".btnLink").click();
+ cy.url().should("include", "status=succeeded");
+ cy.wait(5000);
+ break;
+ case "giropay":
+ cy.get(
+ ".rds-cookies-overlay__allow-all-cookies-btn > .rds-button"
+ ).click();
+ cy.wait(5000);
+ cy.get(".normal-3").should(
+ "contain.text",
+ "Bank suchen ‑ mit giropay zahlen."
+ );
+ cy.get("#bankSearch").type("giropay TestBank{enter}");
+ cy.get(".normal-2 > div").click();
+ cy.get('[data-testid="customerIban"]').type(
+ "DE48499999601234567890"
+ );
+ cy.get('[data-testid="customerIdentification"]').type(
+ "9123456789"
+ );
+ cy.get(":nth-child(3) > .rds-button").click();
+ cy.get('[data-testid="onlineBankingPin"]').type("1234");
+ cy.get(".rds-button--primary").click();
+ cy.get(":nth-child(5) > .rds-radio-input-group__label").click();
+ cy.get(".rds-button--primary").click();
+ cy.get('[data-testid="photoTan"]').type("123456");
+ cy.get(".rds-button--primary").click();
+ cy.wait(5000);
+ cy.url().should("include", "status=succeeded");
+ cy.wait(5000);
+ break;
+ case "sofort":
+ cy.get(".modal-overlay.modal-shown.in", {
+ timeout: constants.TIMEOUT,
+ }).then(($modal) => {
+ // If modal is found, handle it
+ if ($modal.length > 0) {
+ cy.get("button.cookie-modal-deny-all.button-tertiary")
+ .should("be.visible")
+ .should("contain", "Reject All")
+ .click({ multiple: true });
+ cy.get("div#TopBanks.top-banks-multistep")
+ .should("contain", "Demo Bank")
+ .as("btn")
+ .click();
+ cy.get("@btn").click();
+ } else {
+ cy.get("input.phone").type("9123456789");
+ cy.get("#button.onContinue")
+ .should("contain", "Continue")
+ .click();
+ }
+ });
+ break;
+ default:
+ throw new Error(
+ `Unsupported payment method type: ${paymentMethodType}`
+ );
+ }
+ verifyUrl = true;
break;
- case "giropay":
- cy.get("._transactionId__header__iXVd_").should(
- "contain.text",
- "Bank suchen ‑ mit giropay zahlen."
- );
- cy.get(".BankSearch_searchInput__uX_9l").type(
- "Volksbank Hildesheim{enter}"
- );
- cy.get(".BankSearch_searchIcon__EcVO7").click();
- cy.get(".BankSearch_bankWrapper__R5fUK").click();
- cy.get("._transactionId__primaryButton__nCa0r").click();
- cy.get(".normal-3").should("contain.text", "Kontoauswahl");
+ case "paypal":
+ if (["eps", "ideal", "giropay"].includes(paymentMethodType)) {
+ cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
+ verifyUrl = true;
+ } else {
+ throw new Error(
+ `Unsupported payment method type: ${paymentMethodType}`
+ );
+ }
+ verifyUrl = true;
break;
- case "sofort":
+ case "stripe":
+ if (
+ ["eps", "ideal", "giropay", "sofort", "przelewy24"].includes(
+ paymentMethodType
+ )
+ ) {
+ cy.get('a[name="success"]').click();
+ verifyUrl = true;
+ } else {
+ throw new Error(
+ `Unsupported payment method type: ${paymentMethodType}`
+ );
+ }
+ verifyUrl = true;
break;
- case "trustly":
+ case "trustpay":
+ switch (paymentMethodType) {
+ case "eps":
+ cy.get("#bankname").type(
+ "Allgemeine Sparkasse Oberösterreich Bank AG (ASPKAT2LXXX / 20320)"
+ );
+ cy.get("#selectionSubmit").click();
+ cy.get("#user")
+ .should("be.visible")
+ .should("be.enabled")
+ .focus()
+ .type("Verfügernummer");
+ cy.get("input#submitButton.btn.btn-primary").click();
+ break;
+ case "ideal":
+ cy.contains("button", "Select your bank").click();
+ cy.get(
+ 'button[data-testid="bank-item"][id="bank-item-INGBNL2A"]'
+ ).click();
+ break;
+ case "giropay":
+ cy.get("._transactionId__header__iXVd_").should(
+ "contain.text",
+ "Bank suchen ‑ mit giropay zahlen."
+ );
+ cy.get(".BankSearch_searchInput__uX_9l").type(
+ "Volksbank Hildesheim{enter}"
+ );
+ cy.get(".BankSearch_searchIcon__EcVO7").click();
+ cy.get(".BankSearch_bankWrapper__R5fUK").click();
+ cy.get("._transactionId__primaryButton__nCa0r").click();
+ cy.get(".normal-3").should("contain.text", "Kontoauswahl");
+ break;
+ default:
+ throw new Error(
+ `Unsupported payment method type: ${paymentMethodType}`
+ );
+ }
+ verifyUrl = false;
break;
default:
- throw new Error(
- `Unsupported payment method type: ${payment_method_type}`
- );
+ throw new Error(`Unsupported connector: ${connectorId}`);
}
- verifyUrl = false;
- break;
- default:
- throw new Error(`Unsupported connector: ${connectorId}`);
- }
+ },
+ { paymentMethodType }
+ );
cy.then(() => {
- verifyReturnUrl(redirection_url, expected_url, verifyUrl);
+ verifyReturnUrl(redirectionUrl, expectedUrl, verifyUrl);
});
}
-function threeDsRedirection(redirection_url, expected_url, connectorId) {
- cy.visit(redirection_url.href);
-
- switch (connectorId) {
- case "adyen":
- cy.get("iframe")
- .its("0.contentDocument.body")
- .within(() => {
- cy.get('input[type="password"]').click();
- cy.get('input[type="password"]').type("password");
- cy.get("#buttonSubmit").click();
- });
- break;
+function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {
+ cy.visit(redirectionUrl.href);
+ waitForRedirect(redirectionUrl.href);
- case "bankofamerica":
- case "wellsfargo":
- cy.get("iframe", { timeout: TIMEOUT })
- .should("be.visible")
- .its("0.contentDocument.body")
- .should("not.be.empty")
- .within(() => {
- cy.get(
- 'input[type="text"], input[type="password"], input[name="challengeDataEntry"]',
- { timeout: TIMEOUT }
- )
- .should("be.visible")
- .should("be.enabled")
- .click()
- .type("1234");
+ handleFlow(
+ redirectionUrl,
+ expectedUrl,
+ connectorId,
+ ({ connectorId, constants, expectedUrl }) => {
+ switch (connectorId) {
+ case "adyen":
+ cy.get("iframe")
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get('input[type="password"]').click();
+ cy.get('input[type="password"]').type("password");
+ cy.get("#buttonSubmit").click();
+ });
+ break;
- cy.get('input[value="SUBMIT"], button[type="submit"]', {
- timeout: TIMEOUT,
- })
+ case "bankofamerica":
+ case "wellsfargo":
+ cy.get("iframe", { timeout: constants.TIMEOUT })
.should("be.visible")
- .click();
- });
- break;
+ .its("0.contentDocument.body")
+ .should("not.be.empty")
+ .within(() => {
+ cy.get(
+ 'input[type="text"], input[type="password"], input[name="challengeDataEntry"]',
+ { timeout: constants.TIMEOUT }
+ )
+ .should("be.visible")
+ .should("be.enabled")
+ .click()
+ .type("1234");
+
+ cy.get('input[value="SUBMIT"], button[type="submit"]', {
+ timeout: constants.TIMEOUT,
+ })
+ .should("be.visible")
+ .click();
+ });
+ break;
- case "cybersource":
- cy.url({ timeout: TIMEOUT }).should("include", expected_url.origin);
- break;
+ case "cybersource":
+ cy.url({ timeout: constants.TIMEOUT }).should("include", expectedUrl);
+ break;
+
+ case "checkout":
+ cy.get("iframe", { timeout: constants.TIMEOUT })
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get('form[id="form"]', { timeout: constants.WAIT_TIME })
+ .should("exist")
+ .then(() => {
+ cy.get('input[id="password"]').click();
+ cy.get('input[id="password"]').type("Checkout1!");
+ cy.get("#txtButton").click();
+ });
+ });
+ break;
- case "checkout":
- cy.get("iframe", { timeout: TIMEOUT })
- .its("0.contentDocument.body")
- .within(() => {
- cy.get('form[id="form"]', { timeout: WAIT_TIME })
+ case "nmi":
+ case "noon":
+ case "xendit":
+ cy.get("iframe", { timeout: constants.TIMEOUT })
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get("iframe", { timeout: constants.TIMEOUT })
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get('form[name="cardholderInput"]', {
+ timeout: constants.TIMEOUT,
+ })
+ .should("exist")
+ .then(() => {
+ cy.get('input[name="challengeDataEntry"]')
+ .click()
+ .type("1234");
+ cy.get('input[value="SUBMIT"]').click();
+ });
+ });
+ });
+ break;
+
+ case "novalnet":
+ cy.get("form", { timeout: constants.WAIT_TIME })
.should("exist")
.then(() => {
- cy.get('input[id="password"]').click();
- cy.get('input[id="password"]').type("Checkout1!");
- cy.get("#txtButton").click();
+ cy.get('input[id="submit"]').click();
});
- });
- break;
+ break;
+
+ case "stripe":
+ cy.get("iframe", { timeout: constants.TIMEOUT })
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get("iframe")
+ .its("0.contentDocument.body")
+ .within(() => {
+ cy.get("#test-source-authorize-3ds").click();
+ });
+ });
+ break;
+
+ case "trustpay":
+ cy.get('form[name="challengeForm"]', {
+ timeout: constants.WAIT_TIME,
+ })
+ .should("exist")
+ .then(() => {
+ cy.get("#outcomeSelect")
+ .select("Approve")
+ .should("have.value", "Y");
+ cy.get('button[type="submit"]').click();
+ });
+ break;
- case "nmi":
- case "noon":
- case "xendit":
- cy.get("iframe", { timeout: TIMEOUT })
- .its("0.contentDocument.body")
- .within(() => {
- cy.get("iframe", { timeout: TIMEOUT })
+ case "worldpay":
+ cy.get("iframe", { timeout: constants.WAIT_TIME })
.its("0.contentDocument.body")
.within(() => {
- cy.get('form[name="cardholderInput"]', { timeout: TIMEOUT })
+ cy.get('form[name="cardholderInput"]', {
+ timeout: constants.WAIT_TIME,
+ })
.should("exist")
.then(() => {
cy.get('input[name="challengeDataEntry"]')
@@ -350,91 +414,50 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) {
cy.get('input[value="SUBMIT"]').click();
});
});
- });
- break;
-
- case "novalnet":
- cy.get("form", { timeout: WAIT_TIME })
- .should("exist")
- .then(() => {
- cy.get('input[id="submit"]').click();
- });
- break;
-
- case "stripe":
- cy.get("iframe", { timeout: TIMEOUT })
- .its("0.contentDocument.body")
- .within(() => {
- cy.get("iframe")
- .its("0.contentDocument.body")
- .within(() => {
- cy.get("#test-source-authorize-3ds").click();
- });
- });
- break;
-
- case "trustpay":
- cy.get('form[name="challengeForm"]', { timeout: WAIT_TIME })
- .should("exist")
- .then(() => {
- cy.get("#outcomeSelect").select("Approve").should("have.value", "Y");
- cy.get('button[type="submit"]').click();
- });
- break;
+ break;
- case "worldpay":
- cy.get("iframe", { timeout: WAIT_TIME })
- .its("0.contentDocument.body")
- .within(() => {
- cy.get('form[name="cardholderInput"]', { timeout: WAIT_TIME })
+ case "fiuu":
+ cy.get('form[id="cc_form"]', { timeout: constants.TIMEOUT })
.should("exist")
.then(() => {
- cy.get('input[name="challengeDataEntry"]').click().type("1234");
- cy.get('input[value="SUBMIT"]').click();
- });
- });
- break;
-
- case "fiuu":
- cy.get('form[id="cc_form"]', { timeout: TIMEOUT })
- .should("exist")
- .then(() => {
- cy.get('button.pay-btn[name="pay"]').click();
- cy.get("div.otp")
- .invoke("text")
- .then((otpText) => {
- const otp = otpText.match(/\d+/)[0];
- cy.get("input#otp-input").should("not.be.disabled").type(otp);
- cy.get("button.pay-btn").click();
+ cy.get('button.pay-btn[name="pay"]').click();
+ cy.get("div.otp")
+ .invoke("text")
+ .then((otpText) => {
+ const otp = otpText.match(/\d+/)[0];
+ cy.get("input#otp-input").should("not.be.disabled").type(otp);
+ cy.get("button.pay-btn").click();
+ });
});
- });
- break;
+ break;
- default:
- cy.wait(WAIT_TIME);
- }
+ default:
+ cy.wait(constants.WAIT_TIME);
+ }
+ }
+ );
// Verify return URL after handling the specific connector
- verifyReturnUrl(redirection_url, expected_url, true);
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
}
function upiRedirection(
- redirection_url,
- expected_url,
+ redirectionUrl,
+ expectedUrl,
connectorId,
- payment_method_type
+ paymentMethodType
) {
let verifyUrl = false;
if (connectorId === "iatapay") {
- switch (payment_method_type) {
+ switch (paymentMethodType) {
case "upi_collect":
- cy.visit(redirection_url.href);
- cy.wait(TIMEOUT).then(() => {
+ cy.visit(redirectionUrl.href);
+ cy.wait(CONSTANTS.TIMEOUT).then(() => {
verifyUrl = true;
});
break;
case "upi_intent":
- cy.request(redirection_url.href).then((response) => {
+ cy.request(redirectionUrl.href).then((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.have.property("iataPaymentId");
expect(response.body).to.have.property("status", "INITIATED");
@@ -446,99 +469,95 @@ function upiRedirection(
break;
default:
throw new Error(
- `Unsupported payment method type: ${payment_method_type}`
+ `Unsupported payment method type: ${paymentMethodType}`
);
}
} else {
- // If connectorId is not iatapay, wait for 10 seconds
- cy.wait(WAIT_TIME);
+ // For other connectors, nothing to do
+ return;
}
cy.then(() => {
- verifyReturnUrl(redirection_url, expected_url, verifyUrl);
+ verifyReturnUrl(redirectionUrl, expectedUrl, verifyUrl);
});
}
-function verifyReturnUrl(redirection_url, expected_url, forward_flow) {
- if (!forward_flow) return;
-
- try {
- if (redirection_url.host.endsWith(expected_url.host)) {
- cy.wait(WAIT_TIME / 2);
-
- cy.window()
- .its("location")
- .then((location) => {
- // Check page state before taking screenshots
- cy.document().then((doc) => {
- // For blank page
- cy.wrap(doc.body.innerText.trim()).then((text) => {
- if (text === "") {
- cy.wrap(text).should("eq", "");
- cy.screenshot("blank-page-error");
- }
- });
+function verifyReturnUrl(redirectionUrl, expectedUrl, forwardFlow) {
+ if (!forwardFlow) return;
- // For error pages
- const errorPatterns = [
- /4\d{2}/,
- /5\d{2}/,
- /error/i,
- /invalid request/i,
- /server error/i,
- ];
-
- const pageText = doc.body.innerText.toLowerCase();
- cy.wrap(pageText).then((text) => {
- if (errorPatterns.some((pattern) => pattern.test(text))) {
- cy.wrap(text).should((content) => {
- expect(errorPatterns.some((pattern) => pattern.test(content)))
- .to.be.true;
- });
- cy.screenshot(`error-page-${Date.now()}`);
- }
- });
- });
+ cy.location("host", { timeout: CONSTANTS.TIMEOUT }).should((currentHost) => {
+ expect(currentHost).to.equal(expectedUrl.host);
+ });
- const url_params = new URLSearchParams(location.search);
- const payment_status = url_params.get("status");
+ cy.url().then((url) => {
+ cy.origin(
+ new URL(url).origin,
+ {
+ args: {
+ redirectionUrl: redirectionUrl.origin,
+ expectedUrl: expectedUrl.origin,
+ constants: CONSTANTS,
+ },
+ },
+ ({ redirectionUrl, expectedUrl, constants }) => {
+ try {
+ const redirectionHost = new URL(redirectionUrl).host;
+ const expectedHost = new URL(expectedUrl).host;
+ if (redirectionHost.endsWith(expectedHost)) {
+ cy.wait(constants.WAIT_TIME / 2);
+
+ cy.window()
+ .its("location")
+ .then((location) => {
+ // Check page state before taking screenshots
+ cy.document().then((doc) => {
+ const pageText = doc.body.innerText.toLowerCase();
+ if (!pageText) {
+ // eslint-disable-next-line cypress/assertion-before-screenshot
+ cy.screenshot("blank-page-error");
+ } else if (
+ constants.ERROR_PATTERNS.some((pattern) =>
+ pattern.test(pageText)
+ )
+ ) {
+ // eslint-disable-next-line cypress/assertion-before-screenshot
+ cy.screenshot(`error-page-${Date.now()}`);
+ }
+ });
- if (
- payment_status !== "failed" &&
- payment_status !== "processing" &&
- payment_status !== "requires_capture" &&
- payment_status !== "succeeded"
- ) {
- cy.wrap(payment_status).should("exist");
- cy.screenshot(`failed-payment-${payment_status}`);
- throw new Error(
- `Redirection failed with payment status: ${payment_status}`
- );
+ const urlParams = new URLSearchParams(location.search);
+ const paymentStatus = urlParams.get("status");
+
+ if (
+ !constants.VALID_TERMINAL_STATUSES.includes(paymentStatus)
+ ) {
+ // eslint-disable-next-line cypress/assertion-before-screenshot
+ cy.screenshot(`failed-payment-${paymentStatus}`);
+ throw new Error(
+ `Redirection failed with payment status: ${paymentStatus}`
+ );
+ }
+ });
+ } else {
+ cy.window().its("location.origin").should("eq", expectedUrl);
+
+ Cypress.on("uncaught:exception", (err, runnable) => {
+ // Log the error details
+ // eslint-disable-next-line no-console
+ console.error(
+ `Error: ${err.message}\nOccurred in: ${runnable.title}\nStack: ${err.stack}`
+ );
+
+ // Return false to prevent the error from failing the test
+ return false;
+ });
}
- });
- } else {
- cy.origin(
- expected_url.origin,
- { args: { expected_url: expected_url.origin } },
- ({ expected_url }) => {
- cy.window().its("location.origin").should("eq", expected_url);
-
- Cypress.on("uncaught:exception", (err, runnable) => {
- // Log the error details
- // eslint-disable-next-line no-console
- console.log(
- `Error: ${err.message}\nError occurred in: ${runnable.title}\nStack trace: ${err.stack}`
- );
- // Return false to prevent the error from failing the test
- return false;
- });
+ } catch (error) {
+ throw new Error(`Redirection verification failed: ${error}`);
}
- );
- }
- } catch (error) {
- cy.error("Redirection verification failed:", error);
- throw error;
- }
+ }
+ );
+ });
}
async function fetchAndParseQRCode(url) {
@@ -548,12 +567,17 @@ async function fetchAndParseQRCode(url) {
}
const blob = await response.blob();
const reader = new FileReader();
- return await new Promise((resolve, reject) => {
+
+ return new Promise((resolve, reject) => {
reader.onload = () => {
- const base64Image = reader.result.split(",")[1]; // Remove data URI prefix
+ // Use the entire data URI from reader.result
+ const dataUrl = reader.result;
+
+ // Create a new Image, assigning its src to the full data URI
const image = new Image();
- image.src = base64Image;
+ image.src = dataUrl;
+ // Once the image loads, draw it to a canvas and let jsQR decode it
image.onload = () => {
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
@@ -574,8 +598,14 @@ async function fetchAndParseQRCode(url) {
reject(new Error("Failed to decode QR code"));
}
};
- image.onerror = reject; // Handle image loading errors
+
+ // If the image fails to load at all, reject the promise
+ image.onerror = (err) => {
+ reject(new Error("Image failed to load: " + err?.message || err));
+ };
};
+
+ // Read the blob as a data URL (this includes the data:image/png;base64 prefix)
reader.readAsDataURL(blob);
});
}
@@ -608,3 +638,69 @@ async function fetchAndParseImageData(url) {
image.onerror = reject; // Handle image loading errors
});
}
+
+function waitForRedirect(redirectionUrl) {
+ const originalHost = new URL(redirectionUrl).host;
+
+ cy.location("host", { timeout: CONSTANTS.TIMEOUT }).should((currentHost) => {
+ const hostChanged = currentHost !== originalHost;
+ const iframeExists = Cypress.$("iframe")
+ .toArray()
+ .some((iframeEl) => {
+ try {
+ const iframeHost = new URL(iframeEl.src).host;
+ return iframeHost && iframeHost !== originalHost;
+ } catch {
+ return false;
+ }
+ });
+
+ // The assertion will pass if either the host changed or an iframe with a foreign host exists.
+ expect(
+ hostChanged || iframeExists,
+ "Host changed or an iframe with foreign host exist"
+ ).to.be.true;
+ });
+}
+
+function handleFlow(
+ redirectionUrl,
+ expectedUrl,
+ connectorId,
+ callback,
+ options = {}
+) {
+ const originalHost = new URL(redirectionUrl.href).host;
+ cy.location("host", { timeout: CONSTANTS.TIMEOUT }).then((currentHost) => {
+ if (currentHost !== originalHost) {
+ // Regular redirection flow - host changed, use cy.origin()
+ cy.url().then((currentUrl) => {
+ cy.origin(
+ new URL(currentUrl).origin,
+ {
+ args: {
+ connectorId,
+ constants: CONSTANTS,
+ expectedUrl: expectedUrl.origin,
+ ...options, // optional params like paymentMethodType
+ },
+ },
+ callback
+ );
+ });
+ } else {
+ // Embedded flow - host unchanged, use cy.get("iframe")
+ cy.get("iframe", { timeout: CONSTANTS.TIMEOUT })
+ .should("be.visible")
+ .should("exist");
+
+ // Execute callback within the iframe context
+ callback({
+ connectorId,
+ constants: CONSTANTS,
+ expectedUrl: expectedUrl.origin,
+ ...options, // optional params like paymentMethodType
+ });
+ }
+ });
+}
diff --git a/cypress-tests/cypress/utils/featureFlags.js b/cypress-tests/cypress/utils/featureFlags.js
index 6d8599820f7..728016ebbb5 100644
--- a/cypress-tests/cypress/utils/featureFlags.js
+++ b/cypress-tests/cypress/utils/featureFlags.js
@@ -149,29 +149,41 @@ function matchesSpecName(specName) {
);
}
-export function determineConnectorConfig(connectorConfig) {
- // Case 1: Multiple connectors configuration
- if (
- connectorConfig?.nextConnector &&
- connectorConfig?.multipleConnectors?.status
- ) {
- return "connector_2";
- }
+export function determineConnectorConfig(config) {
+ const connectorCredential = config?.CONNECTOR_CREDENTIAL;
+ const multipleConnectors = config?.multipleConnectors;
- // Case 2: Invalid or null configuration
- if (!connectorConfig || connectorConfig.value === "null") {
+ // If CONNECTOR_CREDENTIAL doesn't exist or value is null, return default
+ if (!connectorCredential || connectorCredential.value === null) {
return DEFAULT_CONNECTOR;
}
- const { specName, value } = connectorConfig;
+ // Handle nextConnector cases
+ if (
+ Object.prototype.hasOwnProperty.call(connectorCredential, "nextConnector")
+ ) {
+ if (connectorCredential.nextConnector === true) {
+ // Check multipleConnectors conditions if available
+ if (
+ multipleConnectors?.status === true &&
+ multipleConnectors?.count > 1
+ ) {
+ return "connector_2";
+ }
+ return DEFAULT_CONNECTOR;
+ }
+ return DEFAULT_CONNECTOR;
+ }
- // Case 3: No spec name matching needed
- if (!specName) {
- return value;
+ // Handle specName cases
+ if (Object.prototype.hasOwnProperty.call(connectorCredential, "specName")) {
+ return matchesSpecName(connectorCredential.specName)
+ ? connectorCredential.value
+ : DEFAULT_CONNECTOR;
}
- // Case 4: Match spec name and return appropriate connector
- return matchesSpecName(specName) ? value : DEFAULT_CONNECTOR;
+ // Return value if it's the only property
+ return connectorCredential.value;
}
export function execConfig(configs) {
@@ -179,7 +191,7 @@ export function execConfig(configs) {
cy.wait(configs.DELAY.TIMEOUT);
}
- const connectorType = determineConnectorConfig(configs?.CONNECTOR_CREDENTIAL);
+ const connectorType = determineConnectorConfig(configs);
const { profileId, connectorId } = getProfileAndConnectorId(connectorType);
return {
diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json
index 57aef9f3b3e..abb5bd3cec5 100644
--- a/cypress-tests/package-lock.json
+++ b/cypress-tests/package-lock.json
@@ -9,10 +9,10 @@
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
- "@eslint/js": "^9.18.0",
- "cypress": "^13.17.0",
+ "@eslint/js": "^9.19.0",
+ "cypress": "^14.0.0",
"cypress-mochawesome-reporter": "^3.8.2",
- "eslint": "^9.18.0",
+ "eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-prettier": "^5.2.3",
@@ -191,9 +191,9 @@
}
},
"node_modules/@eslint/js": {
- "version": "9.18.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz",
- "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==",
+ "version": "9.19.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz",
+ "integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -1023,9 +1023,9 @@
}
},
"node_modules/cypress": {
- "version": "13.17.0",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.17.0.tgz",
- "integrity": "sha512-5xWkaPurwkIljojFidhw8lFScyxhtiFHl/i/3zov+1Z5CmY4t9tjIdvSXfu82Y3w7wt0uR9KkucbhkVvJZLQSA==",
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-14.0.0.tgz",
+ "integrity": "sha512-kEGqQr23so5IpKeg/dp6GVi7RlHx1NmW66o2a2Q4wk9gRaAblLZQSiZJuDI8UMC4LlG5OJ7Q6joAiqTrfRNbTw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@@ -1078,7 +1078,7 @@
"cypress": "bin/cypress"
},
"engines": {
- "node": "^16.0.0 || ^18.0.0 || >=20.0.0"
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
}
},
"node_modules/cypress-mochawesome-reporter": {
@@ -1335,9 +1335,9 @@
}
},
"node_modules/eslint": {
- "version": "9.18.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz",
- "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==",
+ "version": "9.19.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.19.0.tgz",
+ "integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1346,7 +1346,7 @@
"@eslint/config-array": "^0.19.0",
"@eslint/core": "^0.10.0",
"@eslint/eslintrc": "^3.2.0",
- "@eslint/js": "9.18.0",
+ "@eslint/js": "9.19.0",
"@eslint/plugin-kit": "^0.2.5",
"@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1",
diff --git a/cypress-tests/package.json b/cypress-tests/package.json
index a2e0a961e8f..b3701ce8fc7 100644
--- a/cypress-tests/package.json
+++ b/cypress-tests/package.json
@@ -20,10 +20,10 @@
"author": "Hyperswitch",
"license": "ISC",
"devDependencies": {
- "@eslint/js": "^9.18.0",
- "cypress": "^13.17.0",
+ "@eslint/js": "^9.19.0",
+ "cypress": "^14.0.0",
"cypress-mochawesome-reporter": "^3.8.2",
- "eslint": "^9.18.0",
+ "eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-prettier": "^5.2.3",
|
chore
|
bump cypress to `v14.0.0` (#7102)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.